You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
It's not possible to run the ls command inside directories that contain characters "[]" #9232
When attempting to list files inside a directory which name contain characters [ and ], nushell fails to display the file list.
How to reproduce
I'm building the main branch at 18th May, but the behaviour is also reproducible on the Arch Linux nushell package (version 0.80.0):
cargo r
mkdir "[test]"cd"[test]"
ls # this will work as the folder is empty
touch file
ls # this will fail
Error:
× No matches found for*
╭─[entry #5:1:1]
1 │ ls
· ─┬
· ╰── Pattern, file or folder not found
╰────
help: no matches found
Expected behavior
nushell should list the files present in the folder, no matter what characters are present in the folder's name.
I probably broke this when I updated the nu-glob crate a while back. I'm guessing nushell is getting confused because you have a directory named with glob syntax like /some/path/[test] so when you try to do a ls, it's like you're doing ls /some/path/[test]. I'm not sure what the solution should be but I'd hate to remove [] from nu-glob just so people can have directories named with brackets.
now that i think about it. this may be why we vendored rust's glob crate way back when. but unfortunately it limits how we can use globs. it would be nice to have a fix for this so we can use brackets in folder paths and still allow our ls to work. maybe there's some way to escape brackets in the code?
Activity
fdncred commentedon May 18, 2023
I probably broke this when I updated the nu-glob crate a while back. I'm guessing nushell is getting confused because you have a directory named with glob syntax like
/some/path/[test]so when you try to do a ls, it's like you're doingls /some/path/[test]. I'm not sure what the solution should be but I'd hate to remove[]from nu-glob just so people can have directories named with brackets.bobhy commentedon May 20, 2023
Candidate, most entertaining bug of the month!
As a workaround, you can get a list of files in this directory via Nu
globitself!fdncred commentedon May 20, 2023
now that i think about it. this may be why we vendored rust's glob crate way back when. but unfortunately it limits how we can use globs. it would be nice to have a fix for this so we can use brackets in folder paths and still allow our ls to work. maybe there's some way to escape brackets in the code?
baehyunsol commentedon Jun 5, 2023
I found a bug similar to this one, so I'm writting a comment instead of opening a new issue.
touch "[]"andtouch `[]`works, butrm "[]"andrm `[]`don't.fdncred commentedon Jun 5, 2023
agreed, brackets cause issues. hopefully #9307 will fix it when it lands.
fdncred commentedon Jun 12, 2023
If you're interested in a fix for this, could you please test #9416 and let me know how it goes?
allow paths to have brackets (#9416)