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

Path csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail
From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Bug in !! expansion, bash 4.4-beta
Date Mon, 26 Oct 2015 14:30:43 -0400
Organization ITS, Case Western Reserve University
Lines 49
Approved bug-bash@gnu.org
Message-ID <mailman.1095.1445884265.7904.bug-bash@gnu.org> (permalink)
References <CAAHpriMGZjhS=s9uvgENs9Q1JirM8kF9-oT3rhNe+Hdb4qWktg@mail.gmail.com>
Reply-To chet.ramey@case.edu
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1445884265 11950 208.118.235.17 (26 Oct 2015 18:31:05 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Keith Thompson <Keith.S.Thompson@gmail.com>, chet.ramey@case.edu
To Keith Thompson <keithsthompson@gmail.com>, bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
In-Reply-To <CAAHpriMGZjhS=s9uvgENs9Q1JirM8kF9-oT3rhNe+Hdb4qWktg@mail.gmail.com>
X-Mirapoint-Virus-RAPID-Raw score=unknown(0), refid=str=0001.0A020201.562E715B.0116,ss=1,re=0.000,fgs=0, ip=149.160.129.54, so=2015-08-12 04:07:17, dmn=2011-05-27 18:58:46
X-Mirapoint-Loop-Id e3cb319b3a1f064385fe454f6f5be050
X-Junkmail-Whitelist YES (by domain whitelist at mpv1-2015.case.edu)
X-Mirapoint-Virus-RAPID-Raw score=unknown(0), refid=str=0001.0A020204.562E715D.02F0,ss=1,re=0.000,fgs=0, ip=149.160.129.54, so=2015-08-12 04:07:17, dmn=2011-05-27 18:58:46
X-Mirapoint-Loop-Id 6cf9ea65282c0308f02256054893efb6
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy]
X-Received-From 129.22.103.226
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11776

Show key headers only | 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