[Bug 1767] New: Inconsistend wildcard expansion in 'ls *'

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Wed May 5 23:13:04 EST 2010


https://bugzilla.mindrot.org/show_bug.cgi?id=1767

           Summary: Inconsistend wildcard expansion in 'ls *'
           Product: Portable OpenSSH
           Version: 5.5p1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: sftp
        AssignedTo: unassigned-bugs at mindrot.org
        ReportedBy: gtrenin at gmail.com


They way wilcard expansion is done in 'ls *' depends on the number of
files in the current directory.
If there are two or more files/subdirs in the current directory, 'ls *'
produces the list of current directory (this is ok).
But if there is only one subdirectory in the current directory, 'ls *'
also  produces the list of files in this subdirectory.
This is inconsistent approach to my mind.

Steps to reproduce:

$ touch file1 file2
$ sftp user at host
Connected to host.
Changing to: /home/user/
sftp> mkdir test
sftp> cd test 
sftp> mkdir dir1
sftp> mkdir dir2
sftp> put file* dir1
Uploading file1 to /home/user/test/dir1/file1
Uploading file2 to /home/user/test/dir1/file2
sftp> ls -1 *
dir1/
dir2/

Note the result of the above command. Assume this is a correct
behaviour. Now we'll remove dir2 and see how 'ls -1 *' output changes.
I expect to see only 'dir1/' in the output.

sftp> rmdir dir2
sftp> ls -1 *
dir1/file1
dir1/file2
sftp> 

We can see that the output is quite different from our expectations.
It showed 'dir1/file1  dir1/file2' instead of 'dir1/'.

This bug appeared in somewhere around OpenSSH_4.2p1, maybe a little bit
earlier. It is still present in OpenSSH_5.5p1-snap20100505.

This bug does NOT present in OpenSSH_3.8.1p1.

-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list