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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pádraig Brady <P <at> draigBrady.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#7157: closed (df should default to -P if output is not a tty)
Date: Thu, 24 Mar 2011 00:15:04 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 24 Mar 2011 00:11:40 +0000
with message-id <4D8A8C3C.10403 <at> draigBrady.com>
and subject line df no longer wraps lines
has caused the GNU bug report #7157,
regarding df should default to -P if output is not a tty
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
7157: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7157
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alain Knaff <alain <at> knaff.lu>
To: bug-coreutils <at> gnu.org
Subject: df should default to -P if output is not a tty
Date: Mon, 04 Oct 2010 11:44:15 +0200
Hello,

We just had a case where an overfull disk went unnoticed by logwatch.

The reason turned out to be its long device name (/dev/mapper
/VolGroup00-LogVol00), which caused df to break the line, messing up
the column count. Indeed, logwatch looks for the use% in the fifth
field, but due to this line breaking, the use% for this disk ended up
in the _fourth_ field of the next line instead.

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.

So, in the name of the "principle of least surprise" wouldn't it be
possible to make -P the default if the output is not a tty (and add an
additional flag for those rare cases where this line-breaking behavior
is actually wanted on non-tty's)

Other utilities, such as Debian's dpkg -l, also default to this
behavior (trimming lines to window width if output is a tty, and not
trimming it if output is not a tty). Same thing for ls (column output
on a tty, one file-name per line on non-tty)

The problem was observed on version coreutils-8.4-8.fc13.i686:

# df | cat
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      66688656  47463424  15782956  76% /
/dev/cciss/c0d0p1       197546     19124    168223  11% /boot
tmpfs                   517468        12    517456   1% /dev/shm

Thanks,

Alain


[Message part 3 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: 7157-done <at> debbugs.gnu.org, 6511-done <at> debbugs.gnu.org
Subject: df no longer wraps lines
Date: Thu, 24 Mar 2011 00:11:40 +0000
Since I've just changed df to no longer split
entries with long device names over two lines
(since it now aligns columns consistently),
I'm closing these.

cheers,
Pádraig


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.