Skip to content

Absolute UNC paths in #include lines don't get added as dependencies #2717

Open
@bdbaddog

Description

@bdbaddog

This issue was originally created at: 2010-11-19 11:41:39.
This issue was reported by: garyo.

garyo said at 2010-11-19 11:41:39

Ran across this testing something else. Here's a test case:

SConstruct:

hdr_on_share = "//servername/sharename/dir/foo.h"
with open(hdr_on_share, "w") as h:
    f.write("/* test */\n")
with open("foo.c", "w") as f:
    f.write("""\
#include "%s"
""" % hdr_on_share)
Program("foo.c")

Make hdr_on_share be an existing filename with a UNC path (//). This should print True and build foo.exe correctly. And if you modify foo.h, it should rebuild. But that doesn't work today. If you run it with scons --tree=prune, you won't see the hdr_on_share (or anything it includes) in the dependency list.

The reason is in src/engine/SCons/Node/FS.py, in find_file() or actually the filedir_lookup() recursive helper function. That tries to recurse up to the root and then back down looking for existing paths, but that doesn't work with UNC paths. The path //servername doesn't exist as such, so filedir_lookup() returns None and so does find_file(), which means the dependency gets ignored (and it doesn't get scanned).

I'm not sure how to fix this; filedir_lookup could just check whether things exist on disk, but it looks like it's written to try to avoid that, using FS calls instead, but those don't understand UNC at a deep enough level for that to work.

Overall this is minor because who would really put a hardcoded UNC path in a #include line, but I thought it should be noted.

garyo said at 2011-04-02 16:03:47

Still happening in latest SCons, after recent UNC improvements.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions