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


Groups > gnu.bash.bug > #11776 > unrolled thread

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

Started byChet Ramey <chet.ramey@case.edu>
First post2015-10-26 14:30 -0400
Last post2015-10-26 14:30 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#11776 — Re: Bug in !! expansion, bash 4.4-beta

FromChet Ramey <chet.ramey@case.edu>
Date2015-10-26 14:30 -0400
SubjectRe: Bug in !! expansion, bash 4.4-beta
Message-ID<mailman.1095.1445884265.7904.bug-bash@gnu.org>
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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web