Public bug reported: rm -f should not write a diagnostic or modify the exit status on nonexistent operads.
However, currently, uutils' rm -f ENOENTs and subsequently fails if the target vanishes *during* the call (before its unlink). [Note: rm -f works perfectly fine under normal circumstances with nonexistent files. It is specifically the race condition of multiple copies which has this problem.] This has already caused (at least) one FTBFS in Stonking, namely freedombox, which does parallel builds that clean up the same side effect file with rm -f (see: https://code.launchpad.net/~graysonwolf/ubuntu/+source/freedombox/+git/freedombox/+merge/507265) Reproducer script attached (also tests GNU coreutils as a control), outputs for R and S: === uutils 'rm -f' concurrent-removal race reproducer === host : Linux 7.0.0-22-generic x86_64 distro: Ubuntu 26.04 LTS params: WORKERS=8 ITERS=2000 (one shared file, parallel create+rm) uutils rm under test : coreutils rm [rm (uutils coreutils) 0.8.0] sanity: 'rm -f <absent path>' exit=0 (expected 0 -- non-concurrent -f is fine) [1] uutils trial ... workers exiting non-zero ......................... 8 / 8 'cannot remove ... No such file or directory' ... 2014 sample diagnostic: rmrmrm: : : cannot remove '/tmp/uurm-repro.tuxl0y/shared.scratch'cannot remove '/tmp/uurm-repro.tuxl0y/shared.scratch': cannot remove '/tmp/uurm-repro.tuxl0y/shared.scratch': No such file or directory: No such file or directory [2] GNU control : gnurm [rm (GNU coreutils) 9.7] workers exiting non-zero ......................... 0 / 8 'cannot remove' diagnostics ..................... 0 (expected 0 / 0 -- GNU rm -f suppresses ENOENT under the same race) ---------------------------------------------------------------------- RESULT: BUG REPRODUCED uutils 'rm -f' emitted ENOENT diagnostics and/or exited non-zero when a concurrent process removed the shared file between uutils' existence check and its own unlink(). === uutils 'rm -f' concurrent-removal race reproducer === host : Linux 7.0.0-22-generic x86_64 distro: Ubuntu Stonking Stingray (development branch) params: WORKERS=8 ITERS=2000 (one shared file, parallel create+rm) uutils rm under test : coreutils rm [rm (uutils coreutils) 0.8.0] sanity: 'rm -f <absent path>' exit=0 (expected 0 -- non-concurrent -f is fine) [1] uutils trial ... workers exiting non-zero ......................... 8 / 8 'cannot remove ... No such file or directory' ... 1746 sample diagnostic: rmrmrmrmrm: : : : : cannot remove '/tmp/uurm-repro.D9Yg6p/shared.scratch'cannot remove '/tmp/uurm-repro.D9Yg6p/shared.scratch'cannot remove '/tmp/uurm-repro.D9Yg6p/shared.scratch'cannot remove '/tmp/uurm-repro.D9Yg6p/shared.scratch'cannot remove '/tmp/uurm-repro.D9Yg6p/shared.scratch': : : : : No such file or directoryNo such file or directoryNo such file or directoryNo such file or directoryNo such file or directory [2] GNU control : gnurm [rm (GNU coreutils) 9.7] workers exiting non-zero ......................... 0 / 8 'cannot remove' diagnostics ..................... 0 (expected 0 / 0 -- GNU rm -f suppresses ENOENT under the same race) ---------------------------------------------------------------------- RESULT: BUG REPRODUCED uutils 'rm -f' emitted ENOENT diagnostics and/or exited non-zero when a concurrent process removed the shared file between uutils' existence check and its own unlink(). ** Affects: rust-coreutils (Ubuntu) Importance: Undecided Status: New ** Affects: rust-coreutils (Ubuntu Resolute) Importance: Undecided Status: New ** Affects: rust-coreutils (Ubuntu Stonking) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2158331 Title: rm: race condition in concurrent rm -f calls on the same file To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2158331/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
