From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10990 invoked by alias); 19 Mar 2015 12:28:04 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34743 Received: (qmail 22709 invoked from network); 19 Mar 2015 12:27:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=R2ZmZgh0OprqQjRUDS33fs34jr9hzLe42dti7Tjrnzs=; b=F+I1mu1zDxJIa3YLryIA8kOAQDZV0huura07RzgxPkHm6e30EsSHwBxTJhmQSblEDP JlL/4CjM57/mE9CtfR3FGlj6vN/5Ba8lFNF7GgWoldifh2ug7NcqoDkeidUp/02hPIv9 FKgxyQybHAS7vtP9KoJGC+DkztiVzU5myIqw21Nr8v7cnxaFZ8ik7pKLDyVGeBC6yCKd dLP56uRT6M7FeJ8Ljh/CCut8VcCU43gJbbCALk57CJ0GtlpCmhkB4uUTenGcBMSuKjXC w3RTQ7cFRdC1LiMUwoC11nyVjIuYb+zkhHXWnNQMpLy1KwvIuWm7kGFCOzCjIsaNTyL1 9Ycw== MIME-Version: 1.0 X-Received: by 10.52.135.241 with SMTP id pv17mr77962541vdb.25.1426768076728; Thu, 19 Mar 2015 05:27:56 -0700 (PDT) Sender: ethersoft@gmail.com In-Reply-To: <20150319105716.620cd931@pwslap01u.europe.root.pri> References: <20150319105716.620cd931@pwslap01u.europe.root.pri> Date: Thu, 19 Mar 2015 08:27:56 -0400 X-Google-Sender-Auth: fCRexTAnFcDLjsznY3KFMzG3CTw Message-ID: Subject: Re: capturing output of !! not working From: Vin Shelton To: Peter Stephenson Cc: "Zsh Hackers' List" Content-Type: text/plain; charset=UTF-8 But it still doesn't work. The !! command now appears inside the $(), but the output is not captured: $ mkdir foo $ cd foo $ touch a $ echo abc > b $ grep -l abc ? b $ ls -l $(!!) ls -l $(grep -l abc ?) total 4 -rw-r--r-- 1 acs acs 0 Mar 19 08:25 a -rw-r--r-- 1 acs acs 4 Mar 19 08:25 b - Vin On Thu, Mar 19, 2015 at 6:57 AM, Peter Stephenson wrote: > On Wed, 18 Mar 2015 21:49:37 -0400 > Vin Shelton wrote: >> $ ls -l $(!!) >> ls -l $() > > This is due to special code for handling aliases inside command > substitutions that got applied too widely because the flag that > indicates aliases also indicates history expansion; however, there's a > discriminator in another bit. I suspect restricting application of > INP_ALIAS is a better fix overall, but it needs a lot more code tracking > down plus safety checks. > > Another case where we need a framework for testing interactive shells. > > pws > > diff --git a/Src/hist.c b/Src/hist.c > index aa07ce8..b7ef522 100644 > --- a/Src/hist.c > +++ b/Src/hist.c > @@ -338,7 +338,8 @@ ihwaddc(int c) > * fashion as we never need the expansion in the history > * line, only in the lexer and above. > */ > - !((histactive & HA_INWORD) && (inbufflags & INP_ALIAS))) { > + !((histactive & HA_INWORD) && > + (inbufflags & (INP_ALIAS|INP_HIST)) == INP_ALIAS)) { > /* Quote un-expanded bangs in the history line. */ > if (c == bangchar && stophist < 2 && qbang) > /* If qbang is not set, we do not escape this bangchar as it's * > @@ -901,7 +902,8 @@ ihungetc(int c) > zlemetall--; > exlast++; > } > - if (!(histactive & HA_INWORD) || !(inbufflags & INP_ALIAS)) { > + if (!(histactive & HA_INWORD) || > + (inbufflags & (INP_ALIAS|INP_HIST)) != INP_ALIAS) { > DPUTS(hptr <= chline, "BUG: hungetc attempted at buffer start"); > hptr--; > DPUTS(*hptr != (char) c, "BUG: wrong character in hungetc() ");