bug-bash
[Top][All Lists]
Advanced

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

Re: Bug in !! expansion, bash 4.4-beta


From: Chet Ramey
Subject: Re: Bug in !! expansion, bash 4.4-beta
Date: Mon, 26 Oct 2015 14:30:43 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/25/15 5:49 PM, Keith Thompson wrote:
> I'm running bash 4.4 beta, built from source (bash-4.4-beta.tar.gz) on
> Linux Mint 17.2.
> 
> !! history expansion works correctly in simple cases, but not when part of
> a $(...) expansion.
> 
> This problem does not occur with bash 4.3.11
> 
> The last error message shown occurred when I typed Esc Ctrl-E
> (shell-expand-line) after typing
> "echo $(!!".
> 
> $ bash --norc
> bash-4.4$ echo $BASH_VERSION
> 4.4.0(1)-beta
> bash-4.4$ echo hello
> hello
> bash-4.4$ !!
> echo hello
> hello
> bash-4.4$ echo hello
> hello
> bash-4.4$ echo $(!!)
> bash: !!: command not found

Yes.  This was a bug fix.  The history expansion should be deferred until
the subshell, since the rest of the processing of that command is performed
in the subshell.

http://lists.gnu.org/archive/html/bug-bash/2015-01/msg00028.html

is the original bug report.  I will have to see if there is a reasonable
way to perform history expansion in this context.

> bash-4.4$ echo hello
> hello
> bash-4.4$ echo $(!!TRACE: pid 3822: xparse_dolparen:17: ep[-1] != RPAREN
> (33), ep = `'
> TRACE: pid 3822: xparse_dolparen:17: base[8] != RPAREN (33), base = `echo 
> $(!!'

This happens because shell-expand-line attempts to perform word expansion,
and the unterminated command substitution causes this debug message.

-- 
``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/



reply via email to

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