Bug in import(...) on Windows?

Steven Schveighoffer schveiguy at gmail.com
Wed Sep 2 20:23:15 UTC 2020

On 9/2/20 1:47 PM, Adam D. Ruppe wrote:
> On Wednesday, 2 September 2020 at 17:39:04 UTC, Andrey Zherikov wrote:
>> Is this a bug in dmd?
> I think it is an old bug filed (I can't find it though) about 
> inconsistent platform behavior but it is allowed by spec for the 
> compiler to reject any path components.
> import("") is supposed to just give a filename, no directory path.
> See: https://dlang.org/spec/expression.html#import_expressions
> "Implementations may restrict the file name in order to avoid directory 
> traversal security vulnerabilities. A possible restriction might be to 
> disallow any path components in the file name."

Is this the problem though? It works on DMD Linux, which shares the same 
front end.

What I'm wondering is if it needs to be ./file instead of .\file. Can 
you hard code that and see if it works?

FYI, I know vibe diet templates DEPEND on this behavior, and I'd be 
surprised if it doesn't work at all on Windows.


More information about the Digitalmars-d-learn mailing list