Red Hat Bugzilla – Bug 240298
ls -x broken
Last modified: 2007-11-30 17:12:04 EST
Description of problem:
If you do ls -x, the first item in the list will be replaced by a random other
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Open a terminal
2. Enter 'ls -x'
3. Observe that the first item in the list is wrong
flowers:[~]$ /bin/ls -x
spoof Desktop lj mark.ppm music note old personal photos projects
spoof sysadmin temp toybox work
bin lj music old photos spoof temp work
Desktop mark.ppm note personal projects sysadmin toybox
Thanks for the report.
This was fixed upstream, but is not in a stable release:
ls -x DIR would sometimes output the wrong string in place of the
first entry. [introduced in coreutils-6.8]
Here's the upstream fix:
Created attachment 154815 [details]
Yeah, that's the one. Does the upstream fix work when there is nothing to
list? It looks like sorted_file would be some random pointer in that case.
FWIW this is the fix I came up with (based on what's in F7, not upstream).
Good point: that patch is a little fragile. However, it does appear to work
even in that case, since when there are no entries to list, cwd_n_used is 0, in
which case print_horizontal cannot be called. But if you find a way to make ls
misbehave, please let me know.
Ah, that would explain it.
*** Bug 242197 has been marked as a duplicate of this bug. ***
coreutils-6.9-3.fc7 has been pushed to the Fedora 7 testing repository. If problems still persist, please make note of it in this bug report.
coreutils-6.9-3.fc7 has been pushed to the Fedora 7 stable repository. If problems still persist, please make note of it in this bug report.