Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 240298 - ls -x broken
ls -x broken
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
: 242197 (view as bug list)
Depends On:
Blocks: F7Update
  Show dependency treegraph
Reported: 2007-05-16 08:33 EDT by Gary Benson
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version: 6.9-3.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-06-26 23:53:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Better fix? (1.07 KB, patch)
2007-05-16 08:57 EDT, Gary Benson
no flags Details | Diff

  None (edit)
Description Gary Benson 2007-05-16 08:33:02 EDT
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):

How reproducible:

Steps to Reproduce:
1. Open a terminal
2. Enter 'ls -x'
3. Observe that the first item in the list is wrong
Actual results:
flowers:[~]$ /bin/ls -x
spoof  Desktop   lj    mark.ppm  music  note  old  personal  photos  projects
spoof  sysadmin  temp  toybox    work

Expected results:
flowers:[~]$ /bin/ls
bin      lj        music  old       photos    spoof     temp    work
Desktop  mark.ppm  note   personal  projects  sysadmin  toybox
Comment 1 Jim Meyering 2007-05-16 08:41:00 EDT
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:

Comment 2 Gary Benson 2007-05-16 08:57:47 EDT
Created attachment 154815 [details]
Better fix?

Yeah, that's the one.  Does the upstream fix work when there is nothing to
list? It looks like sorted_file[0] 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).
Comment 3 Jim Meyering 2007-05-16 09:26:27 EDT
Hi Gary,
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.
Comment 4 Gary Benson 2007-05-16 09:49:10 EDT
Ah, that would explain it.
Comment 5 Tim Waugh 2007-06-04 13:08:11 EDT
*** Bug 242197 has been marked as a duplicate of this bug. ***
Comment 6 Fedora Update System 2007-06-13 17:03:29 EDT
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.
Comment 7 Fedora Update System 2007-06-26 23:53:05 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.