bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash bug interpolating delete characters


From: Chet Ramey
Subject: Re: Bash bug interpolating delete characters
Date: Mon, 07 May 2012 16:46:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 5/3/12 5:53 AM, Ruediger Kuhlmann wrote:
> Hi,
> 
> please try the following bash script:
> 
> a=x
> del="$(echo -e "\\x7f")"
> 
> echo "$del${a#x}" | od -ta
> echo "$del ${a#x}" | od -ta
> echo " $del${a#x}" | od -ta
> 
> Using bash 3.2, the output is:
> 
> 0000000 del  nl
> 0000002
> 0000000 del  sp  nl
> 0000003
> 0000000  sp del  nl
> 0000003
> 
> however with bash 4.1 and bash 4.2.20, the output is only:
> 
> 0000000 del  nl
> 0000002
> 0000000  sp  nl
> 0000002
> 0000000  sp  nl
> 0000002
> 
> ... so in the second and third line, the delete character magically
> disappears. Neither OS nor locale seem to influence this. Using a delete
> character directly in the script instead of $del also has no impact, either.

It's a case of one part of the code violating assumptions made by (and
conditions imposed by) another.  Try the attached patch; it fixes the
issue for me.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

Attachment: del-expansion.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]