Skip to content

cp -afL fails with 'cp: -r not specified; omitting directory <dir-name>' #13207

Description

@suivue

If we use -L option with cp -af it fails to copy with error,

cp: -r not specified; omitting directory <dir-name>

However, if we use only cp -af it works.

sv@resolute-vm:~/Public/uu-cp$ ls
test
sv@resolute-vm:~/Public/uu-cp$ alias uu-cp
alias uu-cp='/usr/lib/cargo/bin/coreutils/cp'
sv@resolute-vm:~/Public/uu-cp$ uu-cp -af test test1
sv@resolute-vm:~/Public/uu-cp$ tree
.
├── test
│   ├── f1
│   │   ├── file1.txt
│   │   └── t1
│   ├── f2
│   │   ├── file2.txt
│   │   └── t2
│   ├── f3
│   │   ├── file3.txt
│   │   └── lmw-lintian -> /home/sv/lmw-lintian
│   └── test.py
└── test1
    ├── f1
    │   ├── file1.txt
    │   └── t1
    ├── f2
    │   ├── file2.txt
    │   └── t2
    ├── f3
    │   ├── file3.txt
    │   └── lmw-lintian -> /home/sv/lmw-lintian
    └── test.py

13 directories, 10 files
sv@resolute-vm:~/Public/uu-cp$ uu-cp -afL test test2
cp: -r not specified; omitting directory 'test'

There is no issue if we use GNU version of cp.

sv@resolute-vm:~/Public/uu-cp$ ls -l /usr/bin/cp
lrwxrwxrwx 1 root root 5 Mar 30 22:20 /usr/bin/cp -> gnucp
sv@resolute-vm:~/Public/uu-cp$ cp -afL test test2
sv@resolute-vm:~/Public/uu-cp$ echo $?
0

I am on Ubuntu-MATE 26.04 with coreutils-from-uutils version 0.0.0~ubuntu25, where core components like cp are still symlink to their gnu counterparts. The issue was noticed in 0.0.0~ubuntu27 where the uutils components replaced their corresponding gnu counterparts.

sv@resolute-vm:~/Public/uu-cp$ uu-cp --version
cp (uutils coreutils) 0.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions