Bug 1792 - Unable to "ls" within a directory with special characters "[" or "]"
Summary: Unable to "ls" within a directory with special characters "[" or "]"
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: 5.5p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_7
  Show dependency treegraph
 
Reported: 2010-07-10 07:42 AEST by sftpbug
Modified: 2011-01-24 12:34 AEDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sftpbug 2010-07-10 07:42:10 AEST
Unable to "ls" within a directory with special characters "[" or "]"

Issue appears as follows once connected to remote SFTP server:
sftp> pwd
Remote working directory: /foo
sftp> ls
directory [one]
sftp> cd directory\ [one]
sftp> pwd
Remote working directory: /foo/directory [one]
sftp> ls
Can't ls: "/foo/directory [one]" not found

However, the client is freely able to list the directory contents when outside the directory that contains the special characters: "[" and/or "]" 
sftp> ls "/foo/directory [one]" 
Successful.
Comment 1 Darren Tucker 2010-07-19 13:55:53 AEST
What platform is this?  I can't reproduce the problem on either OpenBSD or Fedora.

$ cd /tmp
$ mkdir directory\ [one]
$ cd directory\ \[one\]/
$ touch bar
$ sftp localhost
Connected to localhost.
sftp> cd /tmp/directory\ [one]/
sftp> pwd
Remote working directory: /tmp/directory [one]
sftp> ls
bar  
sftp> 

A couple of things you can try:

./configure --with-cflags=-DBROKEN_REALPATH

./configure --with-cflags=-DBROKEN_GLOB

and see if either of these makes the problem go away.
Comment 2 sftpbug 2010-07-22 10:16:44 AEST
OS-X Snow Leopard 10.6.4

SSH Version Info:
OpenSSH_5.5p1, OpenSSL 0.9.8l 5 Nov 2009

Issue persists with re-compiling using ./configure flags.

(In reply to comment #1)
> What platform is this?  I can't reproduce the problem on either OpenBSD
> or Fedora.
> 
> $ cd /tmp
> $ mkdir directory\ [one]
> $ cd directory\ \[one\]/
> $ touch bar
> $ sftp localhost
> Connected to localhost.
> sftp> cd /tmp/directory\ [one]/
> sftp> pwd
> Remote working directory: /tmp/directory [one]
> sftp> ls
> bar  
> sftp> 
> 
> A couple of things you can try:
> 
> ./configure --with-cflags=-DBROKEN_REALPATH
> 
> ./configure --with-cflags=-DBROKEN_GLOB
> 
> and see if either of these makes the problem go away.
Comment 3 Darren Tucker 2010-07-22 15:38:39 AEST
(In reply to comment #2)
> OS-X Snow Leopard 10.6.4

OK, I can reproduce it with 5.5p1, but I think it's since been fixed (bug #1655).

Please try a snapshot http://www.mindrot.org/openssh_snap/
Comment 4 Damien Miller 2010-11-05 10:55:07 AEDT
I can't elicit this in -current.
Comment 5 Damien Miller 2011-01-24 12:34:03 AEDT
Move resolved bugs to CLOSED after 5.7 release