[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: `du` check for directory loop avoidance
From:       Bernhard Voelker <mail () bernhard-voelker ! de>
Date:       2014-03-12 13:15:36
Message-ID: 53205DF8.8080605 () bernhard-voelker ! de
[Download RAW message or body]

[please don't top-post here]

On 01/13/2014 01:37 AM, Terry Bowling wrote:
> On 12/19/2013 04:37 AM, Bernhard Voelker wrote:
> > On 12/18/2013 07:41 PM, Pádraig Brady wrote:
> > > I need to look into this some more,
> > > but we should at least reword the warning to something more generic
> > BTW: the diagnostic in du(1) has been improved in 8.20 by commit
> > 
> > http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=cf7e1b5b
> > 
> > but chcon, chmod, chown, chgrp, rm, and mv are affected, too:
> > 
> > $ git grep emit_cycle_warning | cat
> > src/chcon.c:          emit_cycle_warning (file_full_name);
> > src/chmod.c:          emit_cycle_warning (file_full_name);
> > src/chown-core.c:          emit_cycle_warning (file_full_name);
> > src/du.c:                emit_cycle_warning (file);
> > src/remove.c:      emit_cycle_warning (ent->fts_path);
> > src/system.h:#define emit_cycle_warning(file_name)    \
> > 
> > e.g.
> > 
> > $ mount -t tmpfs tmpfs /mnt
> > 
> > $ mkdir /mnt/mnt
> > 
> > $ mount --bind /mnt /mnt/mnt
> > 
> > $ du /mnt
> > du: mount point ‘/mnt/mnt’ already traversed
> > 0    /mnt
> > 
> > $ chown -R root  /mnt
> > chown: WARNING: Circular directory structure.
> > This almost certainly means that you have a corrupted file system.
> > NOTIFY YOUR SYSTEM MANAGER.
> > The following directory is part of the cycle:
> > ‘/mnt/mnt’
> > 
> > Just for the record, non-FTS ls(1) uses a different diagnostic:
> > 
> > $ ls -R /mnt
> > /mnt:
> > mnt
> > ls: /mnt/mnt: not listing already-listed directory
> > 
> > It seems that there is still room for improvement.
> > 
> > Have a nice day,
> > Berny
 >
 > Hello all,
 >
 > After discussing further in RH BZ 1045086 \
(http://rhn.redhat.com/errata/RHSA-2013-1652.htmlincludes), we I would like to \
discuss the following options with upstream for consistency.  >
 > 1.  Ensure the new warning for du is upstream:  "mount point %s already traversed"

Already done with the above mentioned commit (cf7e1b5b).

 > 2. Ensure the other commands are using the same message for consistency (chcon, \
chmod, chown-core, remove)  >
 > 3. Evaluate if a separate exit code for this condition is appropriate. This would \
allow for slightly easier scripting to check for this condition and rule out any \
concerns that the warning message  > might change in the future.
 >
 > 4. Evaluate find, ls  - does it make sense for these to be consistent as well?
 >
 > After discussing here, I will likely submit a BZ for #2 in against RHEL.  And if \
all agree, I can submit a BZ for #3 and/or #4 as well.  >
 > Thanks to all in advance for discussing this and helping us work this out.  I know \
it's a tedious topic.  I will also document this behavior for RHEL & Fedora to \
provide a final document to direct all  > future inquiries so that we can quit \
discussing it in the future!  > -Terry

I'd only go with #2, and probably look at ls(1).
I think it's not worth adding a new exit code (#3).
And find(1) is out of scope here - it's in findutils
(though it's probably worth looking).

I'll try to come up with a patch for #2 in the next days.

Have a nice day,
Berny


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic