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

Bug: spaceful path handling #20

Open
rhn opened this issue Oct 24, 2023 · 2 comments
Open

Bug: spaceful path handling #20

rhn opened this issue Oct 24, 2023 · 2 comments

Comments

@rhn
Copy link

rhn commented Oct 24, 2023

$ ls /mnt/space/games/Cryostasis\ 2.0.0.13\ [GOG]/
No qualifying paths, (possibly due to permission errors): ['/mnt/space/games/Cryostasis 2.0.0.13 [GOG]/']

Meanwhile, bash can list it just fine.

Getting the path through tab-completion does not escape the spaces, either.

@geophile
Copy link
Owner

I know about the tab completion issue, I'm tracking that as a bug.

The other problem is new and more subtle. It looks like the problem is related to the brackets, not the spaces. Here's what I'm seeing:

M 0.18.3 jao@loon /tmp/t$ touch a\ b
M 0.18.3 jao@loon /tmp/t$ touch \ c\ d
M 0.18.3 jao@loon /tmp/t$ touch \[xyz\]
M 0.18.3 jao@loon /tmp/t$ ls a*
-rw-rw-r--   jao    jao           0   2023 Oct 24 17:06:46   a b
M 0.18.3 jao@loon /tmp/t$ ls a\ b
-rw-rw-r--   jao    jao           0   2023 Oct 24 17:06:46   a b
M 0.18.3 jao@loon /tmp/t$ ls \ c*
-rw-rw-r--   jao    jao           0   2023 Oct 24 17:06:52    c d
M 0.18.3 jao@loon /tmp/t$ ls \ c\ d
-rw-rw-r--   jao    jao           0   2023 Oct 24 17:06:52    c d
M 0.18.3 jao@loon /tmp/t$ ls \[*
-rw-rw-r--   jao    jao           0   2023 Oct 24 17:07:00   [xyz]
M 0.18.3 jao@loon /tmp/t$ ls *\]
-rw-rw-r--   jao    jao           0   2023 Oct 24 17:07:00   [xyz]
M 0.18.3 jao@loon /tmp/t$ ls \[xyz\]
No qualifying paths, (possibly due to permission errors): ['[xyz]']

I'll now tracking this as a bug.

@geophile
Copy link
Owner

I see. Marcel is interpreting ...[GOG], and [xyz] as glob expressions.

I'm not saying that bash is wrong, but it is surprising to me. Look at this:

jao@loon:/tmp/t$ touch [xyz] x y z
jao@loon:/tmp/t$ ls
 x  '[xyz]'   y   z
jao@loon:/tmp/t$ ls [xyz]
x  y  z
jao@loon:/tmp/t$ rm x y
jao@loon:/tmp/t$ ls [xyz]
z
jao@loon:/tmp/t$ rm z
jao@loon:/tmp/t$ ls [xyz]
'[xyz]'

bash interprets [xyz] as a glob expression if that interpretation yields any files. Otherwise (after x, y, and z are gone), it interprets [xyz] literally.

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

2 participants