[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7157: df should default to -P if output is not a tty

From: Alain Knaff
Subject: bug#7157: df should default to -P if output is not a tty
Date: Mon, 04 Oct 2010 11:44:15 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b2 Thunderbird/3.1.3


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
                      66688656  47463424  15782956  76% /
/dev/cciss/c0d0p1       197546     19124    168223  11% /boot
tmpfs                   517468        12    517456   1% /dev/shm



reply via email to

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