Martin Storsjö via llvm-dev
2021-Oct-15 20:52 UTC
[llvm-dev] RFC: Support for preferring paths with forward slashes on Windows
On Fri, 15 Oct 2021, Michael Kruse wrote:> I also noticed is that the paths printed by clang -v or -### are > escaping the backslashes and put them into quotes, i.e. > "C:\\path\\to\\clang.exe" -cc1 "..\\special'^`character .c" > Interestingly, it still works copy&pasting it to the Windows command > line [2], but cmd.exe's escape character is ^ and PowerShell's is the > backtick `. What would the correct output be?I wasn't aware that cmd.exe had an escape char per se (other than ^ for line continuations?). The fact that such slashes are printed double is, iirc, an intentional quirk, so that the command lines are copypasteable in a variety of contexts: cmd.exe don't need them doubled (but tolerates them), bash unescapes them so it also can execute them. This is actually one downside of using forward slashes, as cmd.exe wouldn't be able to execute such a command straight out (only the slash direction of the command executable itself matters though). // Martin
Reid Kleckner via llvm-dev
2021-Oct-18 21:03 UTC
[llvm-dev] RFC: Support for preferring paths with forward slashes on Windows
Thanks for working on this! I think this mode is a long time coming. On Fri, Oct 15, 2021 at 1:53 PM Martin Storsjö via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On Fri, 15 Oct 2021, Michael Kruse wrote: > > > I also noticed is that the paths printed by clang -v or -### are > > escaping the backslashes and put them into quotes, i.e. > > "C:\\path\\to\\clang.exe" -cc1 "..\\special'^`character .c" > > Interestingly, it still works copy&pasting it to the Windows command > > line [2], but cmd.exe's escape character is ^ and PowerShell's is the > > backtick `. What would the correct output be? > > I wasn't aware that cmd.exe had an escape char per se (other than ^ for > line continuations?). > > The fact that such slashes are printed double is, iirc, an intentional > quirk, so that the command lines are copypasteable in a variety of > contexts: cmd.exe don't need them doubled (but tolerates them), bash > unescapes them so it also can execute them. >Yep, I was going to say that.> This is actually one downside of using forward slashes, as cmd.exe > wouldn't be able to execute such a command straight out (only the slash > direction of the command executable itself matters though). >I think as long as the user has a way to choose between the styles, they've got what they need to unblock themselves. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211018/1b8ec2c6/attachment.html>