bug-coreutils
[Top][All Lists]
Advanced

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

Re: Bug#367691: coreutils: behaviour of du -x[LDP] differs from that of


From: Justin Pryzby
Subject: Re: Bug#367691: coreutils: behaviour of du -x[LDP] differs from that of du -[LDP]x
Date: Fri, 19 May 2006 10:34:17 -0400
User-agent: Mutt/1.5.11+cvs20060403

On Fri, May 19, 2006 at 04:05:29PM +0200, Jim Meyering wrote:
> Justin Pryzby <address@hidden> wrote:
> 
> > Package: coreutils
> > Version: 5.94-1
> > Severity: normal
> >
> > I was reading du.c, and saw this:
> ...
> > A patch (assuming I understand the intended state of things) would
> > look something like:
> >
> >           bit_flags|= FTS_COMFOLLOW;
> > [...]
> >           bit_flags = FTS_LOGICAL;
> >           bit_flags&=~FTS_PHYSICAL;
> > [...]
> >           bit_flags|=FTS_PHYSICAL;
> >           bit_flags&=~FTS_LOGICAL;
> >
> > This also avoids clearing FTS_TIGHT_CYCLE_CHECK, which I'm guessing is
> > not intentional?
> 
> You're right.
> Thanks for spotting that.
> 
> Here's the change I've checked in for 6.0 -- note that clearing
I don't think this is right.

> Index: src/du.c
> ===================================================================
> RCS file: /fetish/cu/src/du.c,v
> retrieving revision 1.224
> retrieving revision 1.225
> diff -u -p -u -r1.224 -r1.225
> --- src/du.c  4 Nov 2005 10:08:51 -0000       1.224
> +++ src/du.c  19 May 2006 12:36:18 -0000      1.225
> @@ -1,5 +1,5 @@
>  /* du -- summarize disk usage
> -   Copyright (C) 1988-1991, 1995-2005 Free Software Foundation, Inc.
> +   Copyright (C) 1988-1991, 1995-2006 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
> @@ -681,7 +681,11 @@ main (int argc, char **argv)
>    struct Tokens tok;
>  
>    /* Bit flags that control how fts works.  */
> -  int bit_flags = FTS_PHYSICAL | FTS_TIGHT_CYCLE_CHECK;
> +  int bit_flags = FTS_TIGHT_CYCLE_CHECK;
> +
> +  /* Select one of the three FTS_ options that control if/when
> +     to follow a symlink.  */
> +  int symlink_deref_bit = FTS_PHYSICAL;
>  
>    /* If true, display only a total for each argument. */
>    bool opt_summarize_only = false;
> @@ -803,15 +807,15 @@ main (int argc, char **argv)
>         break;
>  
>       case 'D': /* This will eventually be 'H' (-H), too.  */
> -       bit_flags = FTS_COMFOLLOW;
> +       symlink_deref_bit = FTS_COMFOLLOW;
>         break;

Quoting the manpage:
|    There are a number of options, at least one of which (either FTS_LOGICAL
|    or FTS_PHYSICAL) must be specified.  The options are selected by or'ing
|    the following values:

so this will supposedly cause du to fail if -D is given.  I just wrote
a small test for this, and it appears to be false that (exactly?) one
of FTS_{LOGICAL,PHYSICAL} must be set.  The fts_{open,children,close}
all succeed.  I'm going to bug manpages about this (and some other
things).

In any case, it is my understanding that FTS_COMFOLLOW is really an
independent option, and so should be handled as an bit_flag.

Justin




reply via email to

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