Skip to content

Unhelpful error messages from mv and cp #15920

Open

Description

@Natureshadow

I today had the honour of using uutils-coreutils in an Ubuntu training. Contrary to the claim in the README, I experienced that both cp and mv offer less helpful error messages than GNU coreutils.

I suspect there are more examples of such behaviour, where very nuanced error messages were replaced by unhelpful, generic messages.

mv

uutils:

nutzer@nik-g-1:~/rechteuebung$ ls -ld file1 dir2
d-w------- 2 nutzer nutzer 4096 Oct 27 12:47 dir2
---------- 1 nutzer nutzer    7 Oct 27 12:32 file1
nutzer@nik-g-1:~/rechteuebung$ mv file1 dir2
mv: cannot move 'file1' to 'dir2/file1': Permission denied

GNU:

nik@makadamia ~/ru> ls -ld file1 dir2
d-w------- 1 nik nik 0 Oct 27 14:02 dir2
---------- 1 nik nik 0 Oct 27 14:02 file1
nik@makadamia ~/ru> mv file1 dir2
mv: cannot stat 'dir2/file1': Permission denied

Here, GNU coreutils tells exactly what it tries to do. It can be researched to find out that stat means it wants to look at the target file's inode, which requires the x privilege.

cp

uutils:

nutzer@nik-g-1:~/rechteuebung$ ls -ld file1 dir2
d-wx------ 2 nutzer nutzer 4096 Oct 27 12:47 dir2
---------- 1 nutzer nutzer    7 Oct 27 12:32 file1
nutzer@nik-g-1:~/rechteuebung$ cp file1 dir2
cp: 'file1' -> 'dir2/file1': Permission denied

GNU:

nik@makadamia ~/ru> ls -ld file1 dir2
d-wx------ 1 nik nik 0 Oct 27 14:02 dir2
---------- 1 nik nik 0 Oct 27 14:02 file1
nik@makadamia ~/ru> cp file1 dir2
cp: cannot open 'file1' for reading: Permission denied

Same here: GNU cp tells exactly what it tries to do, and what to correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions