This is an archive of the discontinued LLVM Phabricator instance.

[Windows] Don't try to wildcard expand paths starting with \\?\
ClosedPublic

Authored by mstorsjo on May 30 2022, 1:22 PM.

Details

Summary

Paths that start with \\?\ are absolute paths, and aren't expected
to be used with wildcard expressions.

Previously, the ? at the start of the path triggered the condition
for a potential wildcard, which caused the path to be split and
reassembled. In builds with LLVM_WINDOWS_PREFER_FORWARD_SLASH=ON,
this caused a path like e.g. \\?\D:\tmp\hello.cpp to be reassembled
into \\?\D:\tmp/hello.cpp which isn't a valid path (as such
absolute paths must use backslashes consistently).

This fixes https://github.com/mstorsjo/llvm-mingw/issues/280.

I'm not sure if there's any straightforward way to add a test
for this case, unfortunately.

Diff Detail

Event Timeline

mstorsjo created this revision.May 30 2022, 1:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2022, 1:22 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
mstorsjo requested review of this revision.May 30 2022, 1:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2022, 1:22 PM
mati865 accepted this revision.May 30 2022, 1:39 PM
mati865 added a subscriber: mati865.

Confirmed today it solves the problem.

This revision is now accepted and ready to land.May 30 2022, 1:39 PM
hans accepted this revision.May 31 2022, 8:24 AM

lgtm

llvm/lib/Support/Windows/Process.inc
162

Adding "Paths that start with \\?\ are absolute paths, and aren't expected to be used with wildcard expressions." to the comment would be good.

This revision was landed with ongoing or failed builds.Jun 1 2022, 1:26 AM
This revision was automatically updated to reflect the committed changes.