Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11776

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Bug in !! expansion, bash 4.4-beta
Date 2015-10-26 14:30 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.1095.1445884265.7904.bug-bash@gnu.org> (permalink)
References <CAAHpriMGZjhS=s9uvgENs9Q1JirM8kF9-oT3rhNe+Hdb4qWktg@mail.gmail.com>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Bug in !! expansion, bash 4.4-beta Chet Ramey <chet.ramey@case.edu> - 2015-10-26 14:30 -0400

csiph-web