Issue 14349 - String imports with subpaths don't work on Windows
Summary: String imports with subpaths don't work on Windows
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Windows
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-27 16:59 UTC by Vladimir Panteleev
Modified: 2020-03-21 03:56 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2015-03-27 16:59:04 UTC
echo "pragma(msg, import(\"a/b.txt\"));" > test.d
mkdir a
echo aoeu > a/b.txt
dmd -o- -J. test.d

Works on Linux. On Windows, complains:

test.d(1): Error: file "a/b.txt" cannot be found or not in a path specified with -J
test.d(1):        while evaluating pragma(msg, import("a/b.txt"))
Comment 1 Alex Parrill 2015-03-30 14:34:00 UTC
Looks like FileName::safeSearchPath in filename.c disallows forward slash on Windows. Fixing this should just involve removing it from the blacklist, though there may be security consequences.

Side note: the 'More info' link on safeSearchPath to www.securecoding.cert.org leads to a 404 page.
Comment 2 Atila Neves 2015-06-11 07:54:36 UTC
It's not just forward slash that doesn't work: passing in a backwards one or obtaining one via std.path.buildPath still doesn't work.
Comment 3 Tanel Tagaväli 2016-01-07 17:31:47 UTC
Update after DDMD:

This line is the root cause:
https://github.com/D-Programming-Language/dmd/blob/6e787376b89789aef8038ed1f177e94ef7f8bbf0/src/root/filename.d#L480
Comment 6 Andrej Mitrovic 2016-05-06 21:32:23 UTC
(In reply to Adam D. Ruppe from comment #5)
> https://github.com/D-Programming-Language/dmd/pull/5337

This issue is solved now with 5337 merged right? Should be closed.
Comment 7 Vladimir Panteleev 2016-05-06 22:46:41 UTC
Yes. Adam did not format his commit message correctly.