"install -D" race condition

Bug #2152495 reported by Daniel J Blueman
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
rust-coreutils
New
Unknown
coreutils-from (Ubuntu)
Won't Fix
Undecided
Unassigned
rust-coreutils (Ubuntu)
Triaged
High
Unassigned

Bug Description

When "install -D dir" is invoked from a parallel make session, there is a race condition where one thread successfully creates "dir"; when the remaining threads get mkdir("dir")=EEXIST, the command exits with an error, aborting the parallel make job.

This race does not exist in GNU coreutils, where EEXIST does not trigger an error.

One example where this is a problem is during kernel builds:

$ make -j12 bindeb-pkg
...
install: cannot create directory 'debian/linux-image-7.1.0-rc3+/usr/lib/linux-image-7.1.0-rc3+/qcom'
make[6]: *** [scripts/Makefile.dtbinst:23: debian/linux-image-7.1.0-rc3+/usr/lib/linux-image-7.1.0-rc3+/qcom/sar2130p-qar2130p.dtb] Error 1
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [Makefile:1617: dtbs_install] Error 2
make[4]: *** [Makefile:2272: run-command] Error 2
make[3]: *** [debian/rules:67: binary-image] Error 2

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: coreutils-from-uutils 0.0.0~ubuntu25
Uname: Linux 7.1.0-rc3+ aarch64
ApportVersion: 2.34.0-0ubuntu2
Architecture: arm64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Wed May 13 18:15:07 2026
InstallationDate: Installed on 2026-04-24 (19 days ago)
InstallationMedia: Ubuntu 26.04 "Resolute Raccoon" - Release arm64 (20260423.1)
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.UTF-8
 PATH=(custom, no user)
 SHELL=/usr/bin/fish
 TERM=xterm-ghostty
 XDG_RUNTIME_DIR=<set>
SourcePackage: coreutils-from
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Daniel J Blueman (watchmaker) wrote :
Revision history for this message
Daniel Tang (daniel-z-tg) wrote :

```console
$ install -D dir
install: missing destination file operand after 'dir'
Try 'install --help' for more information.
```

Your command is incomplete. Please minimize the Makefile into a Bash script so that other people can test this.

Changed in coreutils-from (Ubuntu):
status: New → Incomplete
Revision history for this message
Daniel J Blueman (watchmaker) wrote :

With a minimal reproducer:
```bash
d=$(mktemp -d); :>$d/s; for i in $(seq 10); do for k in $(seq 32); do install -D $d/s $d/o$i/q/f$k & done; done; wait
```
we see eg "install: cannot create directory '/tmp/tmp.CB8euXaXaR/o10/q'". With GNU coreutils, EEXIST is ignored by design, thus this race does not occur.

Thanks,
  Daniel

Changed in coreutils-from (Ubuntu):
status: Incomplete → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in coreutils-from (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel Tang (daniel-z-tg) wrote :
Simon Johnsson (bamf0)
Changed in coreutils-from (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → High
status: Triaged → Won't Fix
Changed in rust-coreutils (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in coreutils-from (Ubuntu):
importance: High → Undecided
Changed in rust-coreutils:
status: Unknown → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.