Subject: df: text formatting issues when kernel uses devfs
Date: Mon, 26 Jul 2004 13:23:38 -0400 (EDT)
Subject: df: text formatting issues when kernel uses devfs
Package: coreutils
Version: 5.0.91-2
Severity: normal
Unlike the command ps which will adjust its text formatting for the width
of the terminal, and will not truncate or otherwise add extra linefeeds to
its output if stdout is directed to a pipe or file, df always formats the
text for an 80 column terminal regardless of actual terminal width or if
stdout is a pipe or a file.
The linefeed after the device name breaks perl and shell scripts that
parse df's output. df should never attempt to split lines if it's
outputing to a pipe or a file. Even if the terminal is wide enough to
display the data in one line, the extra linefeed is still inserted
regardless. The text formatting should be changed to be more
concise when dealing with kernels that use devfs.
Sample Ugly Output:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/ide/host0/bus1/target0/lun0/part3
14259064 11277248 2836952 80% /
tmpfs 128404 0 128404 0% /dev/shm
/dev/ide/host0/bus1/target0/lun0/part1
29737 1776 27347 7% /boot
/dev/ide/host0/bus0/target0/lun0/part3
79723696 32051984 43684784 43% /video
With more space efficient text formatting, the output will almost fit an
80 column display.
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/ide/host0/bus1/target0/lun0/part3 14259064 11277248 2836952 80% /
tmpfs 128404 0 128404 0% /dev/shm
/dev/ide/host0/bus1/target0/lun0/part1 29737 1776 27347 7% /boot
/dev/ide/host0/bus0/target0/lun0/part3 79723696 32051984 43684784 43% /video
df -h is even uglier.
Filesystem Size Used Avail Use% Mounted on
/dev/ide/host0/bus1/target0/lun0/part3
14G 11G 2.8G 80% /
tmpfs 126M 0 126M 0% /dev/shm
/dev/ide/host0/bus1/target0/lun0/part1
30M 1.8M 27M 7% /boot
/dev/ide/host0/bus0/target0/lun0/part3
77G 31G 42G 43% /video
With some reformatting it WILL fit an 80 column display properly!
Filesystem Size Used Avail Use% Mounted on
/dev/ide/host0/bus1/target0/lun0/part3 14G 11G 2.8G 80% /
tmpfs 126M 0 126M 0% /dev/shm
/dev/ide/host0/bus1/target0/lun0/part1 30M 1.8M 27M 7% /boot
/dev/ide/host0/bus0/target0/lun0/part3 77G 31G 42G 43% /video
-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux athlon-xp 2.4.26 #1 Sat Jul 24 11:22:24 EDT 2004 i686
Locale: LANG=en_US, LC_CTYPE=en_US
Versions of packages coreutils depends on:
ii libacl1 2.2.23-1 Access control list shared library
ii libattr1 2.4.16-1 Extended attribute shared library
ii libc6 2.3.2.ds1-13 GNU C Library: Shared libraries an
---
Eric Yagerlener
retitle 261552 df: breaks lines even when output is not a tty
thanks
Hi
This has nothing to do with devfs, devfs only happens to produce
quite long device names, but it breaks regardless of why the
lines get so long.
ciao, 2ri
--
Help securing email, spread GPG, clearsign all mail. http://www.gnupg.org
.
Following the First World War, Austrian journalist Karl Wiegand made an
interesting observation. "How are nations ruled and led into war?" he asked.
"Politicians lie to journalists and then believe those lies when they see them
in print." This may seem cynical, but it was true then, and it is true today.
-- http://www.disinfopedia.org/wiki.phtml?title=Weapons_of_mass_deception
This may help you:
`-P'
`--portability'
Use the POSIX output format. This is like the default format
except for the following:
1. The information about each filesystem is always printed on
exactly one line; a mount device is never put on a line by
itself. This means that if the mount device name is more
than 20 characters long (e.g., for some network mounts), the
columns are misaligned.
2. The labels in the header output line are changed to conform
to POSIX.
$ df --portability
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/hda7 11191604 7108748 3514348 67% /
/dev/hda6 10082852 7811056 1759608 82% /mnt/hda6
/dev/hda3 490496 14350 450820 4% /mnt/hda3
tmpfs 257336 16 257320 1% /dev/shm
jdsklfjsaklffjdsjfkldsjfkldsjfkldjslfkdsj 257336 0 257336 0% /mnt/x
$ df --version
df (coreutils) 5.2.1
--
Thomas Hood
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.