Skip to content

Filename is missing from rm errors #9004

Closed

Description

@presidento

Describe the bug

This is not so helpful:

〉rm --recursive --force --verbose *

Error:
  × Could not delete because: Permission denied (os error 13)
   ╭─[entry #54:1:1]
 1 │ rm --recursive --force --verbose *
   · ─┬
   ·  ╰── Permission denied (os error 13)
   ╰────


Error:
  × Could not delete because: Permission denied (os error 13)
   ╭─[entry #54:1:1]
 1 │ rm --recursive --force --verbose *
   · ─┬
   ·  ╰── Permission denied (os error 13)
   ╰────


Error:
  × Could not delete because: Permission denied (os error 13)
   ╭─[entry #54:1:1]
 1 │ rm --recursive --force --verbose *
   · ─┬
   ·  ╰── Permission denied (os error 13)
   ╰────


Error:
  × Could not delete because: Permission denied (os error 13)
   ╭─[entry #54:1:1]
 1 │ rm --recursive --force --verbose *
   · ─┬
   ·  ╰── Permission denied (os error 13)
   ╰────


Error:
  × Could not delete because: Permission denied (os error 13)
   ╭─[entry #54:1:1]
 1 │ rm --recursive --force --verbose *
   · ─┬
   ·  ╰── Permission denied (os error 13)
   ╰────


Error:
  × Could not delete because: Permission denied (os error 13)
   ╭─[entry #54:1:1]
 1 │ rm --recursive --force --verbose *
   · ─┬
   ·  ╰── Permission denied (os error 13)
   ╰────


Error:
  × Could not delete because: Permission denied (os error 13)
   ╭─[entry #54:1:1]
 1 │ rm --recursive --force --verbose *
   · ─┬
   ·  ╰── Permission denied (os error 13)
   ╰────

How to reproduce

Create some files which the current user cannot delete, then try to delete all of them.

Expected behavior

I expected nu to display the name or the full path of the non-deletable file in the error message.

Screenshots

No response

Configuration

key value
version 0.79.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.68.2 (9eb3afe9e 2023-03-27) (built from a source tarball)
cargo_version cargo 1.68.1 (6feb7c9cf 2023-03-26)
build_time 2023-04-25 20:06:17 +00:00
build_rust_channel release
features default, zip
installed_plugins

Additional context

No response

Activity

  1. added
    good first issue
    A:error-unhelpful
    on Apr 26, 2023
  2. juanPabloMiceli commented on Apr 27, 2023

    @juanPabloMiceli
    Contributor
    Error:
      × Could not delete <path/to/file/from/cwd>: Permission denied (os error 13)
       ╭─[entry #54:1:1]
     1 │ rm --recursive --force --verbose *
       · ─┬
       ·  ╰── Permission denied (os error 13)
       ╰────
    

    Do we know what the '[entry #54:1:1]' is?

    I think the error could look like:

    Error:
      × Remove not possible
       ╭─[entry #54:1:1]
     1 │ rm --recursive --force --verbose <relative/path/1>
       ·                                  ────────┬────────
       ·                                          ╰── Failed to remove file: Permission denied (os error 13)
       ╰────
      × Remove not possible
       ╭─[entry #54:1:1]
     1 │ rm --recursive --force --verbose <relative/path/2>
       ·                                  ────────┬────────
       ·                                          ╰── Failed to remove file: Permission denied (os error 13)
       ╰────
    
  3. juanPabloMiceli commented on Apr 27, 2023

    @juanPabloMiceli
    Contributor

    There is also this ShellError enum RemoveNotPossible we are not using. Maybe we should replace this GenericError with the RemoveNotPossible one.

  4. juanPabloMiceli commented on Apr 28, 2023

    @juanPabloMiceli
    Contributor

    I am struggling with getting the span of the targets after replacing "" with each file in the folder. Are they computed somewhere already? Or do I need to compute them by hand? Because the only span I am being able to find in the scope is the one for the original target (for example: /home/user/folder/)

  5. michaeljohnalbers commented on May 6, 2023

    @michaeljohnalbers
    Contributor

    @juanPabloMiceli I took a stab at the fix on #9120. I left the command (and related span) unaltered as that is what the user entered. Presumably they can the actual error wasn't specifically on a glob pattern but on an actual file, which of course is not included in the error message.

  6. added this to the v0.82.0 milestone on Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:error-unhelpfulgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions