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

Unable to remove file with tabulation symbol in its name #12816

Closed
basilefff opened this issue May 9, 2024 · 4 comments · May be fixed by #12567
Closed

Unable to remove file with tabulation symbol in its name #12816

basilefff opened this issue May 9, 2024 · 4 comments · May be fixed by #12567
Labels
🐛 bug Something isn't working file-system Related to commands and core nushell behavior around the file system

Comments

@basilefff
Copy link

Describe the bug

When trying to delete files containing tabulation symbol in them, I encountered a very unexpected error.

Also, I did try with freshly compiled version from main, with the same error happening.

How to reproduce

  1. touch "c\td.txt"
  2. rm "c\td.txt"

Alternatively, after first step use auto completion, and even when closed by quotation marks (which by default it isn't) it shows the same error message.

Expected behavior

Be able to delete file with tabulation symbol in filename

Screenshots

screenshot

Configuration

key value
version 0.91.0
branch makepkg
commit_hash 3016d7a
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.76.0 (07dca489a 2024-02-04) (Arch Linux rust 1:1.76.0-1)
cargo_version cargo 1.76.0
build_time 2024-03-06 05:55:14 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, extra, sqlite, trash, which, zip
installed_plugins

Additional context

I am pretty sure that the problem is in this code in file nushell/crates/nu-command/src/filesystem/rm.rs at line 160

        let corrected_path = Spanned {
            item: match path.item {
                NuGlob::DoNotExpand(s) => {
                    NuGlob::DoNotExpand(nu_utils::strip_ansi_string_unlikely(s))
                }
                NuGlob::Expand(s) => NuGlob::Expand(nu_utils::strip_ansi_string_unlikely(s)),
            },
            span: path.span,
        };

Function nu_utils::strip_ansi_string_unlikely strips tabs and I am not sure why it is here

@basilefff basilefff added the needs-triage An issue that hasn't had any proper look label May 9, 2024
@fdncred
Copy link
Collaborator

fdncred commented May 9, 2024

I believe double quotes interpret escapes like \t. Have you tried with single quotes?

@sholderbach
Copy link
Member

@basilefff You are correct that the underlying ansi stripping logic removes also most of the ASCII control chars and not explicitly printables (including \t)
This will be fixed by #12567

See the related issue #6315 and the (flawed) motivation that find was inconvenient to use with the fs commands (#6220)

I should finish up my reimplementation of find that does highlighting without modifying the actual data and uses metadata instead.

@sholderbach sholderbach linked a pull request May 9, 2024 that will close this issue
@sholderbach sholderbach added 🐛 bug Something isn't working file-system Related to commands and core nushell behavior around the file system and removed needs-triage An issue that hasn't had any proper look labels May 9, 2024
@basilefff
Copy link
Author

@basilefff You are correct that the underlying ansi stripping logic removes also most of the ASCII control chars and not explicitly printables (including \t) This will be fixed by #12567

Oh, I guess I should have searched the issues more. I guess I shall close this one as a duplicate.

@basilefff basilefff closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2024
@sholderbach
Copy link
Member

That's a hard one to find if you are not 100% sure what to search for.

Thanks for reporting it and already drilling down on the underlying problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working file-system Related to commands and core nushell behavior around the file system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants