Bug 111467

Summary: Filename completion does not escape spaces
Product: [Fedora] Fedora Reporter: Greg Mohney <zenmerc>
Component: pdkshAssignee: Karsten Hopp <karsten>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-02-02 13:37:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Greg Mohney 2003-12-04 00:05:41 UTC
Description of problem:
The pdksh does not escape spaces or other special characters when
doing filename completion, as in bash.  For example, under bash:

$ ls
My Documents/ foo bar
$ cd M[TAB]

the directory name will be expanded with the space escaped:

$ cd My\ Documents/
$

Using pdksh, the filename is successfully completed, but the space is
not escaped (vi line editing mode shown):

$ cd M[Meta-\]

results in:

$ cd My Documents/
ksh: cd: bad substitution
$

Version-Release number of selected component (if applicable):
pdksh-5.2.14-23

How reproducible:
Always

Steps to Reproduce:
1. Execute /bin/ksh (pdksh)
2. Execute `echo bar > "file with spaces"`
3. Execute `cat fil[Meta-\]` (or whatever key sequence you have chosen
to do filename completion in pdksh; this depends on the line editing
mode you choose. in vi mode, this is Meta-\)

    

Actual Results:  Note that without manually escaping the spaces or
enclosing the entire filename in quotes, the contents of the file will
not be displayed with the error:

cat: file: No such file or directory

because the filename is expanded without escaping the spaces:

$ cat file with spaces

Expected Results:  As in bash, the spaces at least should be escaped
for convenience and security reasons.

$ cat fil[Meta-\]

should result in the following completion:

$ cat file\ with\ spaces

Additional info:

I seem to be the only person who cares about this.  However, it is a
bug and should be fixed :-)

Note the following url, I have one lone sympathizer who noticed this
bug in NetBSD and submitted a partial patch (only works in vi
line-editing mode):

http://mail-index.netbsd.org/tech-userlevel/1999/09/21/0000.html

Comment 1 Karsten Hopp 2005-02-02 13:37:25 UTC
We've removed pdksh and switched to AT&T's Kornshell.