[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: |
Thu, 19 Dec 2013 10:37:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
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