WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: Re: Bash bug interpolating delete characters

Re: Bash bug interpolating delete characters

by Chet Ramey :: Rate this Message:

| View in Thread

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@...    http://cnswww.cns.cwru.edu/~chet/


del-expansion.patch (1K) Download Attachment

 « Return to Thread: Re: Bash bug interpolating delete characters