asar icon indicating copy to clipboard operation
asar copied to clipboard

`includeonce` breaks on some equivalent paths

Open Underrout opened this issue 1 year ago • 2 comments

To quote the manual:

The includeonce command places an include guard on the file that is currently being assembled. This prevents it from being assembled again in the same pass.

This is currently not actually true, from what I've seen in 1.81 as well as current versions of 1.9 and 2.0.

While includeonce works fine for something like

incsrc "shared.asm"
incsrc "shared.asm"

it takes very little to break it, something like this is already good enough (in some cases):

incsrc "shared.asm"
incsrc "../shared_code/shared.asm"

The same effect can also be seen when referring to the same file with an absolute and relative path.

As it turns, this problem also seems to appear and disappear depending on the current working directory, so I assume this might also be tied to #253.

Solution: Normalize paths or check them for actual equivalence. Workaround: Use manual include guards: if defined("guard")), etc.

Underrout avatar Aug 31 '23 17:08 Underrout