bug-coreutils
[Top][All Lists]
Advanced

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

df: text formatting issues when linux kernel uses devfs


From: Eric Yagerlener
Subject: df: text formatting issues when linux kernel uses devfs
Date: Mon, 26 Jul 2004 15:28:09 -0400 (EDT)


Package: coreutils
Version: 5.2.1
Severity: normal

Unlike the command ls which will adjusts its text formatting for the width of the terminal and will switch its out output to a more programmer friendly format if stdout is directed to a pipe or file, df always formats the text for an 80 column terminal regardless of the 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, df is oblivous to this fact and inserts the extra linefeed regardless. The default text formatting also should be changed to look more compact when dealing with long device names.

Sample ugly looking output of df

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!

df -hP looks much better, won't break shell scripts and is what I've got df aliased to for now as a workaround, but still there are some errors/uglyness in the formatting.

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   33G   41G  45% /video

Some of the beauty of the text formatting found in "ls" needs to find its way over to df.

Thank you for your time and effort!


-- 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




reply via email to

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