coreutils
[Top][All Lists]
Advanced

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

Re: `du` check for directory loop avoidance


From: Bernhard Voelker
Subject: Re: `du` check for directory loop avoidance
Date: Wed, 12 Mar 2014 14:15:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

[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



reply via email to

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