Your message dated Sun, 13 Nov 2005 13:14:26 -0500
with message-id <[EMAIL PROTECTED]>
and subject line exclude option for du
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 11 Jun 2005 17:59:14 +0000
>From [EMAIL PROTECTED] Sat Jun 11 10:59:13 2005
Return-path: <[EMAIL PROTECTED]>
Received: from (judas.localdomain) [83.213.35.240] 
        by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
        id 1DhAGH-0006Js-00; Sat, 11 Jun 2005 10:59:13 -0700
Received: by judas.localdomain (Postfix, from userid 1000)
        id CBF28D813E; Sat, 11 Jun 2005 19:58:41 +0200 (CEST)
Content-Type: multipart/mixed; boundary="===============1159100264=="
MIME-Version: 1.0
From: txemi <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: coreutils: patch to add path exclude option to du
X-Mailer: reportbug 3.12
Date: Sat, 11 Jun 2005 19:58:41 +0200
Message-Id: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_PACKAGE 
        autolearn=no version=2.60-bugs.debian.org_2005_01_02
X-Spam-Level: 

This is a multi-part MIME message sent by reportbug.

--===============1159100264==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: coreutils
Version: 5.2.1-2
Severity: wishlist
Tags: patch

I send a patch to add path exclude option to du.
I think it could be useful to more people.

MOTIVATION:

I use xdiskusage to view disk space usage.
xdiskusage uses du to calculate file and dir sizes.
When I want to make a backup of my system I use this tool to inspect where is 
my disk space going and how much it would size.
I got some big dirs that I want to exclude from reports (media files, backup 
files...) because make more diffult to view how much disk space uses the real 
data.
I could no use the --exclude option because it exclude files by basename, and 
not by path.
So I made this patch.

txemi.


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11-1-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages coreutils depends on:
ii  libacl1                     2.2.29-1.0.1 Access control list shared library
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an

-- no debconf information

--===============1159100264==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="du.c.diff"

--- du.c.orig   2005-06-11 19:41:53.000000000 +0200
+++ du.c        2005-06-11 19:41:53.000000000 +0200
@@ -108,6 +108,7 @@
 
 /* File name patterns to exclude.  */
 static struct exclude *exclude;
+static struct exclude *exclude_path;
 
 /* Grand total size of all args, in bytes. */
 static uintmax_t tot_size = 0;
@@ -126,7 +127,8 @@
   APPARENT_SIZE_OPTION = CHAR_MAX + 1,
   EXCLUDE_OPTION,
   HUMAN_SI_OPTION,
-  MAX_DEPTH_OPTION
+  MAX_DEPTH_OPTION,
+  EXCLUDE_PATH_OPTION
 };
 
 static struct option const long_options[] =
@@ -139,6 +141,7 @@
   {"dereference", no_argument, NULL, 'L'},
   {"dereference-args", no_argument, NULL, 'D'},
   {"exclude", required_argument, 0, EXCLUDE_OPTION},
+  {"exclude-path", required_argument, 0, EXCLUDE_PATH_OPTION},
   {"exclude-from", required_argument, 0, 'X'},
   {"human-readable", no_argument, NULL, 'h'},
   {"si", no_argument, 0, HUMAN_SI_OPTION},
@@ -202,6 +205,7 @@
   -x, --one-file-system  skip directories on different filesystems\n\
   -X FILE, --exclude-from=FILE  Exclude files that match any pattern in 
FILE.\n\
       --exclude=PATTERN Exclude files that match PATTERN.\n\
+      --exclude-path=PATTERN Exclude file paths that match PATTERN.\n\
       --max-depth=N     print the total for a directory (or file, with 
--all)\n\
                           only if it is N or fewer levels below the command\n\
                           line argument;  --max-depth=0 is the same as\n\
@@ -331,7 +335,8 @@
   int skip;
 
   /* If necessary, set FTS_SKIP before returning.  */
-  skip = excluded_filename (exclude, ent->fts_name);
+  skip = excluded_filename (exclude, ent->fts_name)
+       ||excluded_filename (exclude_path, ent->fts_path);
   if (skip)
     fts_set (fts, ent, FTS_SKIP);
 
@@ -517,6 +522,7 @@
       process_file (fts, ent);
     }
 
+
   /* Ignore failure, since the only way it can do so is in failing to
      return to the original directory, and since we're about to exit,
      that doesn't matter.  */
@@ -555,6 +561,7 @@
   atexit (close_stdout);
 
   exclude = new_exclude ();
+  exclude_path = new_exclude ();
 
   human_output_opts = human_options (getenv ("DU_BLOCK_SIZE"), false,
                                     &output_block_size);
@@ -681,6 +688,10 @@
          add_exclude (exclude, optarg, EXCLUDE_WILDCARDS);
          break;
 
+       case EXCLUDE_PATH_OPTION:
+         add_exclude (exclude_path, optarg, EXCLUDE_WILDCARDS);
+         break;
+
        case_GETOPT_HELP_CHAR;
 
        case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);

--===============1159100264==--

---------------------------------------
Received: (at 313076-done) by bugs.debian.org; 13 Nov 2005 18:14:30 +0000
>From [EMAIL PROTECTED] Sun Nov 13 10:14:30 2005
Return-path: <[EMAIL PROTECTED]>
Received: from vms040pub.verizon.net ([206.46.252.40])
        by spohr.debian.org with esmtp (Exim 4.50)
        id 1EbMN4-0004yu-EI
        for [EMAIL PROTECTED]; Sun, 13 Nov 2005 10:14:30 -0800
Received: from osgiliath.mathom.us ([70.108.64.202])
 by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep
 9 2005)) with ESMTPA id <[EMAIL PROTECTED]> for
 [EMAIL PROTECTED]; Sun, 13 Nov 2005 12:14:27 -0600 (CST)
Received: from localhost (localhost [127.0.0.1])
        by osgiliath.mathom.us (Postfix) with ESMTP id 974A76031E0      for
 <[EMAIL PROTECTED]>; Sun, 13 Nov 2005 13:14:26 -0500 (EST)
Received: from osgiliath.mathom.us ([127.0.0.1])
        by localhost (osgiliath [127.0.0.1]) (amavisd-new, port 10024)
        with LMTP id 19682-04 for <[EMAIL PROTECTED]>; Sun,
 13 Nov 2005 13:14:26 -0500 (EST)
Received: by osgiliath.mathom.us (Postfix, from userid 1000)
        id 582BC60049B; Sun, 13 Nov 2005 13:14:26 -0500 (EST)
Date: Sun, 13 Nov 2005 13:14:26 -0500
From: Michael Stone <[EMAIL PROTECTED]>
Subject: exclude option for du
To: [EMAIL PROTECTED]
Message-id: <[EMAIL PROTECTED]>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii; format=flowed
Content-disposition: inline
X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C  84 52 84 C5 EE DF 7C 88
X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mathom.us
User-Agent: Mutt/1.5.11
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
        (1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-2.0 required=4.0 tests=BAYES_01 autolearn=no 
        version=2.60-bugs.debian.org_2005_01_02

As noted, there is a way to exclude things from du currently. Rather
than complicating du with additional layers of file selection, I suggest
using find + -print0 to select the desired files, and du --files0-from=-
to calculate their usage. The find command already has a rich language
for selecting & excluding files based on a variety of criteria.

Mike Stone


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to