[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm -r fails on some systems

From: Jim Meyering
Subject: Re: rm -r fails on some systems
Date: Wed, 22 Jan 2003 00:19:01 +0100

Michael van Elst <address@hidden> wrote:
> the rm tool in GNU core utils 4.5.4 may fail to recursively remove directories
> on systems that support DIRENT_D_TYPE.
> On such systems the d_type may be set to DT_UNKNOWN for filesystems that
> do not support directory entry types and which require an explicit call
> to lstat(). In particular this happens on FreeBSD for NFS mounted volumes.
> In this case rm fails to see subdirectories it should traverse and tries
> to unlink() them.

Thank you for the very nice report and patch!
I've made essentially the same change:

Index: src/remove.c
RCS file: /fetish/cu/src/remove.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -p -u -r1.76 -r1.77
--- src/remove.c        20 Jan 2003 15:43:03 -0000      1.76
+++ src/remove.c        21 Jan 2003 18:49:49 -0000      1.77
@@ -695,7 +695,7 @@ remove_entry (Dirstack_state const *ds,
   if (is_dir == T_UNKNOWN)
-      if (dp)
+      if (dp && dp->d_type != DT_UNKNOWN)
        is_dir = DT_IS_DIR (dp) ? T_YES : T_NO;
 # endif

reply via email to

[Prev in Thread] Current Thread [Next in Thread]