GNU bug report logs - #7157
df should default to -P if output is not a tty

Previous Next

Package: coreutils;

Reported by: Alain Knaff <alain <at> knaff.lu>

Date: Mon, 4 Oct 2010 12:47:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 7157 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Alain Knaff <alain <at> knaff.lu>
Cc: 7157 <at> debbugs.gnu.org
Subject: Re: bug#7157: df should default to -P if output is not a tty
Date: Mon, 04 Oct 2010 08:30:16 -0600
On 10/04/2010 03:44 AM, Alain Knaff wrote:
> There is an option to prevent this behavior (-P), but apparently the
> logwatch authors were not aware of it. Understandably, I might say,
> because if their test cases happen to only have disks with short names,
> they'll never stumble upon this.

Thanks for the report.  However, I'm reluctant to make the change, on 
the grounds that df -P is documented by POSIX:

http://www.opengroup.org/onlinepubs/9699919799/utilities/df.html

Anyone that wants portable output MUST use -P, because POSIX explicitly 
implies that not using -P leads to implementation-defined formatting, 
which is therefore not machine-parseable.

Furthermore, GNU Coding Standards strongly discourage making behavior 
dependent on whether stdout is a tty.  Yes, some actions, like ls 
behavior, are mandated by POSIX, and some actions, like --color=auto 
only make sense with a tty check, but we should not be adding new 
exceptions without good cause.

One thing that might be possible, however, is to improve df output to 
adjust column alignment if $COLUMNS is not set (or is set to something 
large), so as to avoid breaking lines in the case where the output is 
usable in a long-line context.  But this still doesn't help the case 
that logwatch should have been using -P in the first place.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




This bug report was last modified 14 years and 66 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.