`install -D file /file` fails and loses the file when the destination's parent is /

Open Beginner friendly
#13,232 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
cli

Research direction

Start at the install command's handling of the -D option and reproduce the issue with install -D -m755 file /file. Verify that the source remains available, /file is created, and its mode is 0755, matching GNU install behavior.

Written by the indexing model from the issue text.

Description

U - install

When the destination of install -D is a single-component absolute path (i.e. its parent directory is the filesystem root /), install fails with a chmod error and does not produce the destination file. GNU coreutils handles this correctly.

Steps to reproduce

ubuntu@resolute-racoon:~$ ls
folder file
ubuntu@resolute-racoon:~$ install -D -m755 file /file
install: No such file or directory
ubuntu@resolute-racoon:~$ ls
folder

the file disappears and is not to be found even in /file.

Environmnet

ubuntu 26.04
install (uutils coreutils) 0.8.0

Expected behavior

Per the GNU install(1) documentation for -D:

-D — create all leading components of DEST except the last, then copy SOURCE to DEST

For DEST = /file, the only leading component except the last is /, which already exists. install should simply copy file to /file and set mode 0755.

Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/coreutils

All issues in uutils/coreutils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.