Glob handling of paths with # is different than elsewhere
In most cases, SCons handles paths that start with # alone the same as those that start with #/, leading the documentation to claim the slash is optional. However, in patterns supplied to the Glob function, it appears not to be optional: paths that begin with just # seem not to match. A very simple example:
file_a = File('a_noexist.c')
file_b = File('b_noexist.c')
noslash_files = Glob("#*.c", strings=True)
print(f"Top-rel-path: {noslash_files}")
slash_files = Glob("#/*.c", strings=True)
print(f"Top-rel-path: {slash_files}")
$ scons -Q
Top-rel-path: []
Top-rel-path: ['./a_noexist.c', './b_noexist.c']
scons: `.' is up to date.
$
It may be this can just be handled in documentation - tell Glob users to use the slash. Still, it seemed worth recording because it surprised me.
And... I think this may be because the code start right out doing a split:
dirname, basename = os.path.split(pathname)
and there's no special-case handling for a basename that starts with #
There's a trivial fix for this, the question is whether it should be fixed, or if this is intentional behavior? Update - not as trivial as I thought, misses one situation. Sigh.