Skip to content

install -D loses some files to EEXIST #12355

@danielzgtg

Description

@danielzgtg

Downstream: https://bugs.launchpad.net/ubuntu/+source/coreutils-from/+bug/2152495 . Tested with 7ea1211 and rust-coreutils=0.8.0-0ubuntu3.

Some files do not reach the destination folder if their parent directories cannot be created due to EEXIST. gnuinstall does not have this problem.

d=$(mktemp -d)
>$d/s
for i in {1..10}; do
  for k in {1..32}; do
    ~/CLionProjects/without_the_change/target/release/coreutils install -D $d/s $d/o$i/q/f$k &
  done
done
wait
fd . $d | wc -l

Replace the command with gnuinstall and the problem never occurs.

Expected behavior

There should be 341 files and no error message.

Actual behavior

I frequently only get 339 files. 2 files went missing. Console has:

[...]
install: cannot create directory '/tmp/tmp.dObRncyKbV/o8/q'
[...]
[225]   Exit 1                     ~/CLionProjects/without_the_change/target/release/coreutils install -D $d/s $d/o$i/q/f$k
[...]

Note that this is a race condition, and I have seen another wrong 340, as well as the correct 341 sometimes.

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