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

ls doesn't work inside folders with some characters in the name #12902

Open
MaxGrekhov opened this issue May 18, 2024 · 6 comments
Open

ls doesn't work inside folders with some characters in the name #12902

MaxGrekhov opened this issue May 18, 2024 · 6 comments
Labels
needs-triage An issue that hasn't had any proper look

Comments

@MaxGrekhov
Copy link

Describe the bug

ls doesn't work inside folders with some characters in the name

How to reproduce

  1. create a folder abc[a
  2. go to the folder
  3. create a file inside it
  4. ls *
  5. get an error

Expected behavior

list file

Screenshots

Screenshot from 2024-05-18 03-13-14

Configuration

~/Downloads/test/ab[c> version | transpose key value | to md --pretty 05/18/2024 03:11:55 AM

key value
version 0.93.0
major 0
minor 93
patch 0
branch
commit_hash 3b220e0
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.77.2 (25ef9e3d8 2024-04-09)
rust_channel 1.77.2-x86_64-unknown-linux-gnu
cargo_version cargo 1.77.2 (e52e36006 2024-03-26)
build_time 2024-04-30 23:06:38 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, sqlite, static-link-openssl, system-clipboard, trash, which
installed_plugins

Additional context

Text version of screenshot

max@max-ubuntu:~/Downloads/test$ mkdir abc
max@max-ubuntu:~/Downloads/test$ mkdir ab[c
max@max-ubuntu:~/Downloads/test$ touch ./abc/a
max@max-ubuntu:~/Downloads/test$ touch ./ab\[c/a
max@max-ubuntu:~/Downloads/test$ nu
~/Downloads/test> ls **/*                                                                                                                                                                                                                          05/18/2024 03:10:53 AM
╭───┬────────┬──────┬─────────┬────────────────╮
│ # │  name  │ type │  size   │    modified    │
├───┼────────┼──────┼─────────┼────────────────┤
│ 0 │ ab[c   │ dir  │ 4.0 KiB │ 17 seconds ago │
│ 1 │ ab[c/a │ file │     0 B │ 17 seconds ago │
│ 2 │ abc    │ dir  │ 4.0 KiB │ 25 seconds ago │
│ 3 │ abc/a  │ file │     0 B │ 25 seconds ago │
╰───┴────────┴──────┴─────────┴────────────────╯
~/Downloads/test> cd ./abc                                                                                                                                                                                                                         05/18/2024 03:11:00 AM
~/Downloads/test/abc> ls *                                                                                                                                                                                                                         05/18/2024 03:11:17 AM
╭───┬──────┬──────┬──────┬────────────────╮
│ # │ name │ type │ size │    modified    │
├───┼──────┼──────┼──────┼────────────────┤
│ 0 │ a    │ file │  0 B │ 45 seconds ago │
╰───┴──────┴──────┴──────┴────────────────╯
~/Downloads/test/abc> cd '../ab[c/'                                                                                                                                                                                                                05/18/2024 03:11:20 AM
~/Downloads/test/ab[c> ls *                                                                                                                                                                                                                        05/18/2024 03:11:40 AM
Error:   × Error extracting glob pattern
   ╭─[entry #5:1:1]
 1 │ ls *
   · ─┬
   ·  ╰── Pattern syntax error near position 27: invalid range pattern
   ╰────


~/Downloads/test/ab[c> ls **/*                                                                                                                                                                                                                   1 05/18/2024 03:11:43 AM
Error:   × Error extracting glob pattern
   ╭─[entry #6:1:1]
 1 │ ls **/*
   · ─┬
   ·  ╰── Pattern syntax error near position 27: invalid range pattern
   ╰────


~/Downloads/test/ab[c> ls                                                                                                                                                                                                                        1 05/18/2024 03:11:53 AM
╭───┬──────┬──────┬──────┬──────────────╮
│ # │ name │ type │ size │   modified   │
├───┼──────┼──────┼──────┼──────────────┤
│ 0 │ a    │ file │  0 B │ a minute ago │
╰───┴──────┴──────┴──────┴──────────────╯
@MaxGrekhov MaxGrekhov added the needs-triage An issue that hasn't had any proper look label May 18, 2024
@lpnh
Copy link
Contributor

lpnh commented May 18, 2024

Yep, I can confirm that. The good news is that it seems to have already been fixed in the main branch, so if you can build Nu from source, that should resolve this issue.

@MaxGrekhov
Copy link
Author

TLDR: I'm not a Rust developer and can't help you with that. With all due respect, I'm frustrated. I downloaded this package, tried the first command and folder, and faced this error. I spent three hours trying to understand why I was so stupid, and it didn't work. It's one of the crucial commands that can be in a shell. It just doesn't fit in my mind How incoming input can affect the call of the function and parameters. It looks like a leaking of execution control to input data, which is a security issue. I would suggest reconsidering some architectural decisions.

@NotTheDr01ds
Copy link
Contributor

NotTheDr01ds commented May 19, 2024

Looks like a duplicate of #12429 which was closed with #12625. Reading through the root issue, I don't see any security concerns there. Sorry to hear you ran into this on your try. Globbing, path handling, strings->path, etc. are areas that have seen a lot of recent changes, and I'm expecting (as a user) that it's still not finalized.

@MaxGrekhov
Copy link
Author

MaxGrekhov commented May 20, 2024

I won't insist on anything because I don't know. I like the idea behind this project. However, from a high-level review, it's less popular than the fish shell, so the base of people who would report issues should be smaller. Still, there are three times more issues. Maybe you could prioritize the stabilization instead of the new features.
I hope the project will make it through, and I'll give it another chance later. Thank you for your time.

@NotTheDr01ds
Copy link
Contributor

NotTheDr01ds commented May 20, 2024

I've used Fish for many years, and it's a great shell. While I've recently switched to Nushell as my daily-driver, I can certainly understand that you want to use a more stable shell. For me, the advantages of Nushell now outweigh its disadvantages, but that will differ for each individual's needs.

However, I do think that "total issues" is a poor comparison between the two shells, for multiple reasons. I don't think anyone would disagree that there are more issues with Nu at the moment than with Fish. That's pretty much expected when:

  • The first Fish stable release was more than 10 years ago, with more than 8 years of development prior to that. From "first commits", Fish is almost four times older than Nushell.
  • The maintainers of Nushell are clear that it is still pre-release. There are still fixes and features (IMHO, as a user) that will certainly be needed to get to 1.0. If it were to follow the Fish development cycle, it would still have another 3 years to go before it hits 1.0. I'm not saying that's going to be the case - I think Nushell's development so far (and to come) has been far more rapid than that of early Fish.

And Nushell is, arguably, a far more ambitious project:

  • Nushell has 443 built-in commands (help commands | length), over a dozen different data formats, a plugin system (even more data formats and commands), a standard library (yet again, even more formats and commands), and an advanced type system
  • Fish has 61 built-in commands (builtin --names | wc -l)

Finally, I'm not sure how to truly gauge "popularity" of the two shells. It's interesting to note that Nushell has 30k stars on GitHub compared to Fish's 25k, but that could simply be due to Nushell being in active development, so more people gravitate to the GitHub site than with Fish.

Side-note: While GitHub has me listed as a "contributor", I'm not a Rust developer either. I've just fixed a few help topics, docs, and scripts. I'm pretty much just an end-user like you.

@arnfaldur
Copy link

As per the discussion, the issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage An issue that hasn't had any proper look
Projects
None yet
Development

No branches or pull requests

4 participants