Thank you for the report!
Here's a patch:

        Fix the bug that would make `du /' omit the `/' on the last line.
        E.g., `du --exclude='[^/]*' -x /' would print only "4\t\n" for me.
        * ftw.c (ftw_dir): Don't clobber the leading `/'.
        Reported by Chris Lesniewski as http://bugs.debian.org/200542.

Index: lib/ftw.c
===================================================================
RCS file: /fetish/cu/lib/ftw.c,v
retrieving revision 1.28
diff -u -p -u -r1.28 ftw.c
--- lib/ftw.c   12 May 2003 14:51:02 -0000      1.28
+++ lib/ftw.c   9 Jul 2003 09:48:17 -0000
@@ -605,8 +605,9 @@ ftw_dir (struct ftw_data *data, struct F
       __set_errno (save_err);
     }
 
-  /* Prepare the return, revert the `struct FTW' information.  */
-  data->dirbuf[data->ftw.base - 1] = '\0';
+  /* Prepare the return, revert the `struct FTW' information.
+     If ftw.base is 1, be careful to preserve the `/'.  */
+  data->dirbuf[data->ftw.base == 1 ? 1 : data->ftw.base - 1] = '\0';
   --data->ftw.level;
   data->ftw.base = previous_base;
 



_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to