$ mkdir 'example *' 'example _' $ sftp localhost Connecting to localhost... sftp> cd 'example *' sftp> ls /private/example _/ sftp> pwd Remote working directory: /private/tmp/example * sftp>
The problem is here: 1344 case I_LS: 1345 if (!path1) { 1346 do_globbed_ls(conn, *pwd, *pwd, lflag); 1347 break; 1348 } 1349 1350 /* Strip pwd off beginning of non-absolute paths */ 1351 tmp = NULL; 1352 if (*path1 != '/') 1353 tmp = *pwd; 1354 1355 path1 = make_absolute(path1, *pwd); 1356 err = do_globbed_ls(conn, path1, tmp, lflag); 1357 break; I think we need to glob-escape the pwd before calling do_globbed_ls(). There might be other instances of this bug in sftp too.
Created attachment 1865 [details] /home/djm/sftp-unbreak-ls-of-glob.diff don't try to glob ls of cwd
Fix applied - this will be in openssh-5.6. Thanks for the nice testcase.
Move resolved bugs to CLOSED after 5.7 release