[PATCH] D92558: [llvm-rc] Handle driveless absolute windows paths when loading external files

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 05:06:31 PST 2020


mstorsjo added a subscriber: rnk.
mstorsjo added a comment.

In D92558#2431144 <https://reviews.llvm.org/D92558#2431144>, @thakis wrote:

> If you're fine with this randomly breaking one day when someone changes path handling, I think this is fine as is. It is difficult to test.

Actually, testing should be fairly straightforward with a diff like this:

  diff --git a/llvm/test/tools/llvm-rc/absolute.test b/llvm/test/tools/llvm-rc/absolute.test
  index 95aff3e42440..fd8b2d68d41e 100644
  --- a/llvm/test/tools/llvm-rc/absolute.test 
  +++ b/llvm/test/tools/llvm-rc/absolute.test
  @@ -1,3 +1,7 @@ 
   ; RUN: touch %t.manifest
   ; RUN: echo "1 24 \"%t.manifest\"" > %t.rc
   ; RUN: llvm-rc -- %t.rc
  +;; On Windows, try stripping out the drive name from the absolute path,
  +;; and make sure the path still is found.
  +; RUN: cat %t.rc | sed 's/"[a-zA-Z]:/"/' > %t2.rc
  +; RUN: llvm-rc -- %t2.rc

But can we rely on tools like sed being available on windows test setups? (I faintly remember someone summarizing what tools we can rely on being available somewhere - @rnk?) I guess it also should be possible to do that replacement with some sort of shell expansion, like `ABS="%t"; ROOTLESS="${ABS#*:\\}"; echo "1 24 \"$ROOTLESS\"" > %t2.rc`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92558/new/

https://reviews.llvm.org/D92558



More information about the llvm-commits mailing list