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: Eric Blake
Subject: Re: `du` check for directory loop avoidance
Date: Wed, 18 Dec 2013 13:05:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 12/18/2013 12:29 PM, Jeff Kirkpatrick wrote:
> I would argue the message is only informational, or at most a warning,
> not an error, so the non-zero rule should not apply.

If the message is not an error, then: a) it must clearly state that it
is a warning, and b) it must have a way to be silenced, preferably by a
command line option, and c) setting POSIXLY_CORRECT in the environment
must silence the warning by default.  Otherwise, it is an error, and
non-zero status is correct.

> 
> My main concern is with scripts. This case is 100% normal and expected
> on every system that runs named chrooted, and potentially any other
> process that is run chrooted as well. Thus any script that calls du and
> wants to be robust will not be able to easily distinguish this
> completely normal and expected case from a true error case.

Then the CORRECT approach is to set different non-zero status levels;
use status 1 for this being the only message issued, and status 2 or
greater for any other, more serious error.  Scripts that care can then
check $?, and scripts that don't care about the distinction, but which
DO want to handle it as an error, can merely check for non-zero status.
 Just because it might be normal in some chroot environments doesn't
mean it is not an error in other environments.

> At the very least it should give a documented unique
> exit code to distinguish this case from true errors.

Yes, that may be the ideal solution.

> We will likely be opening another RFE within Red Hat Bugzilla on this.

And Red Hat will probably point you right back here, as they are
reluctant to diverge from upstream with no good reason.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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