-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Description
If the current directory of a process is deleted and the process runs the Rust cp command it will fail with:
/usr/lib/cargo/bin/coreutils/cp: failed to get current directory No such file or directory (os error 2)
The GNU version of cp does not have this issue.
(This is on Kubuntu 25.10.)
As a result, some automated build processes (which arrive at this situation) now fail to run.
You can see the error by using this simple shell script:
#!/bin/sh
#
echo Rust core-utils
cd $HOME
mkdir -p cu-test-base
touch cu-test-base/file1 cu-test-base/file2
mkdir -p cu-test
cd cu-test
rm -rf $HOME/cu-test
/usr/lib/cargo/bin/coreutils/cp -r $HOME/cu-test-base $HOME/cu-test
ls $HOME/cu-test
#####################
echo GNU core-utils
cd $HOME
mkdir -p cu-test-base
touch cu-test-base/file1 cu-test-base/file2
mkdir -p cu-test
cd cu-test
rm -rf $HOME/cu-test
/usr/bin/gnucp -r $HOME/cu-test-base $HOME/cu-test
ls $HOME/cu-test
The Rust version runs a series of statx() calls (3 in succession for each entry) then calls getcwd() and fails.
It has no reason to be calling getcwd().
[Originally reported at https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2130465]