Red Hat Bugzilla – Bug 56831
ls -l columns misformatted for files with 9-digit size
Last modified: 2007-04-18 12:38:28 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)
Description of problem:
If a file's size is 9 digits or longer (100MB or larger), the output
of "ls -l" will format columns incorrectly. The "file size" column
doesn't have large enough width preallocated.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create a file with size 100000000 bytes or larger.
2. Put it into a directory with other smaller files.
3. /bin/ls -l
Actual Results: Look at the line for file "ccc". It's pushed one column
to the right.
-rw------- 1 dbarrett dbarrett 246977 Jun 1 15:18 aaa
-r--r--r-- 1 dbarrett dbarrett 97621364 Nov 26 23:44 bbb
-r--r--r-- 1 dbarrett dbarrett 124582824 Nov 27 16:52 ccc
-rw-r--r-- 1 dbarrett dbarrett 227553 Apr 12 2001 ddd
Expected Results: All columns should be correctly aligned.
$ rpm -qf /bin/ls
"Fixing" this isn't possible without slowing down things a lot (ls would have to
either stat every file in the directory twice - once to find the largest file to
determine the correct alignment, then again to find the actual ls output or to
stat all files and keep the results in memory).
Especially with recursive directory listings, "fixing" this either way would be
a bad idea.