Tilde seen as backspace in shell

Chris Johns chrisj at rtems.org
Fri Jan 23 00:13:50 UTC 2009


Gene Smith wrote:
> I don't know if this is a bug or a feature I don't understand about 
> terminal protocols or shells.

Bug.

> When I enter a tilde (~) the effect is the 
> same as hitting backspace. This makes it impossible to enter a filename 
> that contains a ~ which is how LFNs are now displayed when they exist in 
> the filesystem.
> 
> I have seen this with RTEMS shell running in linux xterms, cygwin rxvt, 
> XP cmd window and Ed Sutter's uCon. Changing terminal setting make no 
> difference.
> 
> Looking with wireshark and telnet filter I see tilde go out. But then an 
> echo of \b  (0x07, backspace) is send by RTEMS and in the next packet I 
> see 0x20,0x07 (space backspace). So the net result of typing tilde is a 
> backspace: (backspace, space, backspace).
> 
> Looking in cpukit/libmisc/shell/shell.c I found where ~ (Ascii value 
> 0x7e) is converted to a backspace. Backspace and DEL are also treated 
> this way but I guess that is OK.

Bug.

> 
> Also, near the bottom of the same function (rtems_shell_line_editor()) 
> at the default of the case only chars between space and 'z' are printed. 
> For some reason {|}~ are excluded from printing.
> 
> So to allow ~ to act as a regular char, I had to exclude it from being 
> converted to backspace and open up the allowed ascii range to include tilde.
> 

Fixed in CVS. Please update or get a copy and place in your source tree.

Joel, is this change ok for the 4.9 branch ?

Regards
Chris



More information about the users mailing list