Skip to content

include_once needs to normalize paths before checking if they're the same #3358

Description

@sauclovian-g

Suppose you have these files:

a/a.saw
b/b.saw
c/c.saw

and suppose both b.saw and c.saw do include_once "../a/a.saw", and c.saw also includes b.saw.

Then from the perspective of c.saw the path of a.saw is ../a/a.saw, but from the perspective of b.saw the path is ../b/../a/a.saw, because we try to make includes relative to where they're included from. But include_once just looks at the path strings, and they're different, so this doesn't work as intended.

This does, however, seem like a reasonable thing to do and to want include_once to work for, so I guess we do need it to normalize paths for comparison... much as normalizing paths is annoying and generally wrong. (That or we could check the system-level file identity... but I'm not sure how you do that from Haskell or whether it's workable in Windows.)

@qsctr

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    easyIssues that are expected to be easy to resolve and might therefore be good for new contributorsneeds testIssues for which we should add a regression testsubsystem: saw-scriptIssues related to the SAWScript language and/or its interpretation and executiontype: bugIssues reporting bugs or unexpected/unwanted behaviorusabilityAn issue that impedes efficient understanding and use

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions