bug-coreutils
[Top][All Lists]
Advanced

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

Re: du and exclution of directories.


From: Jim Meyering
Subject: Re: du and exclution of directories.
Date: Wed, 05 Jan 2005 08:57:47 +0100

Robert Lindgren <address@hidden> wrote:
> From what I understand it's not possible to exclude a directory path
> with the du command, this would be very nice to have.
>
> mkdir -p 1/1 2/2 3/3
> echo "count me" > 1/1/file1
> echo "count me" > 2/2/file2
> echo "exclude me" > 3/3/file3
>
> du
> 4       ./1/1
> 4       ./1
> 4       ./2/2
> 4       ./2
> 4       ./3/3
> 4       ./3
> 12      .
>
> Excludes everything names 3.
> du --exclude="3"
> 4       ./1/1
> 4       ./1
> 4       ./2/2
> 4       ./2
> 8       .
>
> This is what I want to do, just exclude the path 3/3
> du --exclude="3/3"
> 4       ./1/1
> 4       ./1
> 4       ./2/2
> 4       ./2
> 4       ./3/3
> 4       ./3
> 12      .

Thank you for reporting that.
It was a bug.
Here's the fix:

2005-01-05  Jim Meyering  <address@hidden>

        * Version 5.3.0.

        * src/du.c (process_file): Evaluate exclusion rules against
        the entire file name, not just the last component.
        Reported by Robert Lindgren.
        * tests/du/exclude: Test for this.

Index: src/du.c
===================================================================
RCS file: /fetish/cu/src/du.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -p -u -r1.199 -r1.200
--- src/du.c    21 Sep 2004 22:09:52 -0000      1.199
+++ src/du.c    5 Jan 2005 07:47:45 -0000       1.200
@@ -1,5 +1,5 @@
 /* du -- summarize disk usage
-   Copyright (C) 1988-1991, 1995-2004 Free Software Foundation, Inc.
+   Copyright (C) 1988-1991, 1995-2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -336,7 +336,7 @@ process_file (FTS *fts, FTSENT *ent)
   bool skip;
 
   /* If necessary, set FTS_SKIP before returning.  */
-  skip = excluded_filename (exclude, ent->fts_name);
+  skip = excluded_filename (exclude, ent->fts_path);
   if (skip)
     fts_set (fts, ent, FTS_SKIP);
 




reply via email to

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