Self-registration is disabled due to spam issue (mail [email protected] or [email protected] to create an account)
Bug 3392205 - -I doesn't work as expected if a trailing slash is missing
Summary: -I doesn't work as expected if a trailing slash is missing
Status: CLOSED FIXED
Alias: None
Product: NASM
Classification: Unclassified
Component: Assembler (show other bugs)
Version: 2.09.xx
Hardware: PC Windows
: Medium normal
Assignee: Cyrill Gorcunov
URL:
Depends on:
Blocks:
 
Reported: 2012-01-30 11:13 PST by Cédric OCHS
Modified: 2018-10-18 23:46 PDT (History)
3 users (show)

Obtained from: Other (please explain)
Generated by: ---
Bug category:
Breaks existing code: ---


Attachments
Fix nasm_catfile (patch) (1.16 KB, patch)
2018-10-18 14:25 PDT, night199uk
Details | Diff
Make the preprocessor use nasm_catfile (1.65 KB, patch)
2018-10-18 14:25 PDT, night199uk
Details | Diff
Make the preprocessor use nasm_catfile (1.64 KB, patch)
2018-10-18 14:43 PDT, night199uk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cédric OCHS 2012-01-30 11:13:05 PST
I'm using : NASM version 2.09.10 compiled on Jul 15 2011

When using :

nasm -ID:\Neolinks\xvid\src -f win64 -o CMakeFiles\xvidcore.dir\src\bitstream\x86_asm\cbp_mmx.asm.obj D:\Neolinks\xvid\src\bitstream\x86_asm\cbp_mmx.asm

I got this error message :

D:\Neolinks\xvid\src\bitstream\x86_asm\cbp_mmx.asm:32: fatal: unable to open include file `nasm.inc'

nasm.inc is present in D:\Neolinks\xvid\src directory specified by -I option.

Now if I type (with a backslash after D:\Neolinks\xvid\src):

nasm -ID:\Neolinks\xvid\src\ -f win64 -o CMakeFiles\xvidcore.dir\src\bitstream\x86_asm\cbp_mmx.asm.obj D:\Neolinks\xvid\src\bitstream\x86_asm\cbp_mmx.asm

It works fine.

Please could you make a path without a trailing slash or backslash will be working too ?

Thanks a lot !
Comment 1 night199uk 2018-10-18 09:07:47 PDT
Would anyone have a chance to take a look at this one please? It is a real pain when working with NASM and cmake. Currently cmake are saying the onus is on nasm to fix this.
https://gitlab.kitware.com/cmake/cmake/issues/12919
Comment 2 Cyrill Gorcunov 2018-10-18 09:13:17 PDT
I'll take a look once time permit.
Comment 3 night199uk 2018-10-18 09:14:16 PDT
Really really appreciate your time, thanks!
Comment 4 Cédric OCHS 2018-10-18 09:18:13 PDT
Yes, thank you so much :)
Comment 5 night199uk 2018-10-18 14:25:15 PDT
Created attachment 411679 [details]
Fix nasm_catfile (patch)

See patch description inside patch.
Comment 6 night199uk 2018-10-18 14:25:50 PDT
Created attachment 411680 [details]
Make the preprocessor use nasm_catfile

See description in patch.
Comment 7 night199uk 2018-10-18 14:26:50 PDT
Patches attached that fix this bug. There is a nasty bug in nasm_catfile today that renders this function useless, that needs to be fixed first. Then you can apply 0002 which will fix the include behaviour using nasm_catfile.

I don't know how to PR on this repo, so I'll just leave the patches here.
Comment 8 Cyrill Gorcunov 2018-10-18 14:34:06 PDT
Hopefully I'll deal with patches tomorrow. But there is a one important question -- can't some of other tool rely on lack of ending slash in the path so that if we start ending lines with a backslash '\' they might see two back slashes after the patching. May not it cause backward compatibility problem? The unix like systems are fine to have double slashes in paths (they simply ignore them) but I've no clue about windows machines.
Comment 9 night199uk 2018-10-18 14:36:41 PDT
nasm_catfile seems written for exactly that purpose and detects duplicate slashes (and won't append if it already has a terminating slash). It had a massive bug that rendered it effective (not sure where else it was being used), but once that's fixed it works great and doesn't duplicate slashes - so existing systems relying on the current behaviour should work fine.
Comment 10 night199uk 2018-10-18 14:43:27 PDT
Created attachment 411681 [details]
Make the preprocessor use nasm_catfile

411680 had a minor bug (I had fixed and forgot to regenerate the patch). Here is the fixed one.
Comment 11 Cyrill Gorcunov 2018-10-18 15:07:43 PDT
Great! I don't see obvious problems with the patches, so I pushed them out in 2.14.xx branch. Commits are

fdb1a1b15130d858d51916cca7e09a2566c4b69f
e1bd3bc7b497d58efc1c7a5c56dbc591d5be880f


The snapshot should be built soon so please give it a shot.
Comment 12 Cédric OCHS 2018-10-18 23:46:23 PDT
Thanks a lot night199uk and Cyrill :)