-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pathes in depfiles are not correctly escaped #6570
Comments
Assigned to @pborsutzki as they have a PR out for this already. It'd be good to double check what Clang does with this as well. |
For a trivial example on Windows clang: #include "test.h"
#include "test space.h" The output in the dep file is:
That escapes the space, but not the other slashes. We should match that behavior in DXC, but not escape all the slashes. |
Running the above example through DXC produces:
Looks like we're generating |
Thanks for your investigation. About clang, I am not sure how correct its output is. I tried this on a Linux using clang 15.0.7 with a file named
I am trying to use make as a validation tool here, as depfiles should contain suitable rules for make. So in this, make finds the target files
Which looks about correct to me. This probably is a bit different on Windows, where In the end, after digging through some makefile documentation I found that using "windows drive letters" (e.g. This conclusion makes this issue/PR currently a non-issue for me - but maybe not for you, as you still might be interested in a fix for the uncovered problems. So feel free to close this or tell me if you want me to reshape the PR in any direction. |
Description
When generating a depfile through any of the
-M*
switches, the generated output does not contain escaped pathes. Due to the depfile format (output: input0 input1 ...
) this can lead to ambiguities in tools that parse these files like the Ninja build system.Steps to Reproduce
-M*
switch while specifying an absolute path to the source file, e.g.dxc -T cs_6_0 -M e:\foo.hlsl
.e:\foo.hlsl: e:\foo.hlsl
Actual Behavior
DXC returns this result:
e:\foo.hlsl: e:\foo.hlsl
This result is ambiguous due to the additional colons
:
. To me, the format of depfiles does not seem to be clearly specified (it seems to be specified "like makefiles"). But other tools (e.g. Ninja build, Slang) avoid the ambiguity by escaping/expecting escaped pathes in depfiles. So a correct output in my opinion would be this:e\:\\foo.hlsl: e\:\\foo.hlsl
More problems can occur when using other problematic characters for makefiles like whitespace,
#
,$
,\
,[
and]
.Environment
The text was updated successfully, but these errors were encountered: