Hi Jim, > You mean you've found *another* problem with GNU rm? > Is so, please provide details.
The second bug is harder to reproduce. I have a big tar file with hard links in it. $ tar tvf cross-hppa.tar | grep ' link ' hrwxr-xr-x bruno/user 0 2002-06-02 01:20:05 cross/hppa-linux-tools/hppa-linux/bin/nm link to cross/hppa-linux-tools/bin/hppa-linux-nm hrwxr-xr-x bruno/user 0 2002-06-02 01:20:06 cross/hppa-linux-tools/hppa-linux/bin/strip link to cross/hppa-linux-tools/bin/hppa-linux-strip hrwxr-xr-x bruno/user 0 2002-06-02 01:20:02 cross/hppa-linux-tools/hppa-linux/bin/ar link to cross/hppa-linux-tools/bin/hppa-linux-ar hrwxr-xr-x bruno/user 0 2002-06-02 01:20:03 cross/hppa-linux-tools/hppa-linux/bin/ranlib link to cross/hppa-linux-tools/bin/hppa-linux-ranlib hrwxr-xr-x bruno/user 0 2002-06-02 01:20:11 cross/hppa-linux-tools/hppa-linux/bin/as link to cross/hppa-linux-tools/bin/hppa-linux-as hrwxr-xr-x bruno/user 0 2002-06-02 01:20:13 cross/hppa-linux-tools/hppa-linux/bin/ld link to cross/hppa-linux-tools/bin/hppa-linux-ld I unpack it on a HFS+ volume: $ tar xvf cross-hppa.tar Then I unmount the volume on the MacOS X machine and mount it again. (Alternatively, it appears that waiting a few hours has the same effect.) Then I try to remove the tree from a Linux machine, via a NFS mount: $ uname -a Linux linuix 2.4.21-99-default #1 Wed Sep 24 13:30:51 UTC 2003 i686 GNU/Linux $ rm -r cross rm: cannot remove directory `cross/hppa-linux/bin': Directory not empty ... [After 15 more attempts, to empty the directories that can be emptied:] $ rm -r cross rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ar': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-as': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ld': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-nm': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ranlib': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-strip': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ar': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/as': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ld': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/nm': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ranlib': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/strip': Input/output error $ ls -li cross/hppa-linux-tools/bin/hppa-linux-ar cross/hppa-linux-tools/hppa-linux/bin/ar 909286 -rwxr-xr-x 2 502 99 219395 Jun 2 2002 cross/hppa-linux-tools/bin/hppa-linux-ar 909286 -rwxr-xr-x 2 502 99 219395 Jun 2 2002 cross/hppa-linux-tools/hppa-linux/bin/ar $ rm cross/hppa-linux-tools/bin/hppa-linux-ar rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ar': Input/output error $ rm cross/hppa-linux-tools/hppa-linux/bin/ar rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ar': Input/output error $ mv cross/hppa-linux-tools/bin/hppa-linux-ar cross/junk $ rm cross/hppa-linux-tools/hppa-linux/bin/ar rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ar': Input/output error $ rm cross/junk $ rm cross/hppa-linux-tools/hppa-linux/bin/ar $ rm cross/hppa-linux-tools/bin/hppa-linux-as rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-as': Input/output error $ mv cross/hppa-linux-tools/bin/hppa-linux-as cross/hppa-linux-tools/bin/hppa-linux-ast $ rm cross/hppa-linux-tools/bin/hppa-linux-ast $ rm cross/hppa-linux-tools/hppa-linux/bin/as As you can see, the problem is with hardlinked files, even if they are in different directories. Attempting to remove them gives an I/O error. But moving or renaming one of the hard links somehow "unblocks" it, and it can then be removed. The strange thing is that if I try to remove the hardlinked files directly on HFS+, or through an SMB mount, after mounting the volume (but without having attempted removals through NFS), there is no problem. But if after mounting the volume with the hardlinked files, I use rm on the NFS mount: $ rm -r cross rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ar': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-as': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ld': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-nm': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ranlib': Input/output error rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-strip': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ar': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/as': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ld': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/nm': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ranlib': Input/output error rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/strip': Input/output error _then_ I also get errors on the SMB mount: $ rm -r cross rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ar': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-as': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ld': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-nm': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ranlib': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-strip': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ar': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/as': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ld': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/nm': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ranlib': Bad file descriptor rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/strip': Bad file descriptor and natively on HFS+: $ rm -r cross rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ar': Invalid argument rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-as': Invalid argument rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ld': Invalid argument rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-nm': Invalid argument rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-ranlib': Invalid argument rm: cannot remove `cross/hppa-linux-tools/bin/hppa-linux-strip': Invalid argument rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ar': Invalid argument rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/as': Invalid argument rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ld': Invalid argument rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/nm': Invalid argument rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/ranlib': Invalid argument rm: cannot remove `cross/hppa-linux-tools/hppa-linux/bin/strip': Invalid argument So for GNU rm it means the following heuristics: If an unlink() fails with EIO or EBADF or EINVAL, and the file has st_nlink > 1, try to rename the file and then unlink it. Bruno