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 #14 received at 7157 <at> debbugs.gnu.org (full text, mbox):

From: Alain Knaff <alain <at> knaff.lu>
To: Eric Blake <eblake <at> redhat.com>
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 17:10:47 +0200
On 04/10/10 17:06, Eric Blake wrote:
> [please keep the list in the loop]
> 
> On 10/04/2010 08:54 AM, Alain Knaff wrote:
>>> One thing that might be possible, however, is to improve df output to
>>> adjust column alignment if $COLUMNS
>>
>> Rather than using $COLUMNS (which is not set by all shells...), it might
>> be preferable to do an ioctl(1, TIOCGWINSZ, ...) instead. Indeed, the
>> ioctl returns the window size as it is now (even if it has been resized).
>> That is what ls does, in any case.
> 
> Yep, for consistency among coreutils, the ioctl approach is definitely best.

... and interestingly enough, the ioctl has the "advantage" of telling
us whether the output is indeed a tty or not (it fails with EINVAL if it
is not). AFAIU, this is how ls does the trick of finding out whether
stdout is a tty or not. In a way, a non-tty could be considered
equivalent to an infinetly wide window.

> 
>>
>>> 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.
>>>
>>
>> Agreed. I now also reported the problem to Kirk Bauer from logwatch.
> 
> Glad to hear it.
> 

Regards,

Alain




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.