Skip to content
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

Use backslash instead of forward slash #10

Open
alesimula opened this issue Sep 13, 2021 · 4 comments
Open

Use backslash instead of forward slash #10

alesimula opened this issue Sep 13, 2021 · 4 comments

Comments

@alesimula
Copy link

alesimula commented Sep 13, 2021

Windows uses backslashes for paths, but running such command

ls "C:\Program Files\"

would not work as it expects a forward slash; this makes msls a bit frustrating to use with autocomplete, there should be an option to use backslashes as path separators

@aklietz
Copy link
Contributor

aklietz commented Sep 13, 2021

When you hit tab it autocompletes as
ls "C:\Program Files" and works fine.

@aklietz
Copy link
Contributor

aklietz commented Sep 13, 2021

Oh I see. The problem is PowerShell not cmd. Thanks for the bug report.

@alesimula
Copy link
Author

alesimula commented Sep 13, 2021

@aklietz I was too quick to send a report though; here is the actual problem: both ls "C:\Program Files" and ls "C:/Program Files" commands appear to work, but when adding a slash at the end, only ls "C:/Program Files/" works while ls "C:\Program Files\" fails

It does work in paths that don't require double quotes though, even with a final backslash

@rivy
Copy link
Collaborator

rivy commented Oct 5, 2021

@alesimula , this is a bug in PowerShell tab completion; see PowerShell/PowerShell#7400. The usual command line parsing code for windows CLI EXEs interprets a \" as a literal double-quote (even within a double-quoted string), so PowerShell should never end an expansion with \" (but it does).

There's some background in the comment I made for a quoting issue within hyperfine. Unfortunately, it's complicated, and it's an on-going problem in lots of spaces.

For now, it looks like the problem is "fixed" for PowerShell versions of v6.0+. Although I wouldn't bet on a complete/final solution yet... command line processing and handoff is still a big work-in-progress for them (see PowerShell/PowerShell#1995 (comment) and PowerShell/PowerShell#15143).

The only way to "fix" this within msls would be to completely take over parsing the command line from the startup code. That can and is done for some programs which need specialized command line processing. But, here, it seems like overkill and a recipe for more bugs with minimal upside.

$0.02

ref: David Deley ~ "How Command Line Parameters Are Parsed" @@ https://archive.is/LTgTs
ref: sharkdp/hyperfine#296 (comment)
ref: PowerShell/PowerShell#1995
ref: PowerShell/PowerShell#4358
ref: PowerShell/PowerShell#7400
ref: PowerShell/PowerShell#4965

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants