From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8062 invoked by alias); 10 Sep 2017 22:25:52 -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: 41665 Received: (qmail 8463 invoked by uid 1010); 10 Sep 2017 22:25:52 -0000 X-Qmail-Scanner-Diagnostics: from mail-io0-f173.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.223.173):SA:0(-4.2/5.0):. Processed in 1.142233 secs); 10 Sep 2017 22:25:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_SORBS_SPAM,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=MJKelcljstzYcGtBOWD3/ZFnJpJqsbJXK8zXxRTftqU=; b=tqts9cnWYJUKSpnAHrYBHDWixkxttQJyL53Rm2UuhMlfHSJyrfO61LA9Tcfr9xP4fD WVBHIilmsiAptHo/Mo41OWvTlOEOAK6WuKM1VcAzJ7bB8Qn9SOGoULqcqbPMl03uBlHd NjdGt8PI5KbyqzolQjJnuxjT4blIOjYFmiIW/EteRAFSVtP9u76xMmilktos2rUenzi/ bUhYOngyOCuEDavoxp3kNAfcNoC9+kDiQNM56yS7/ckow899IqU/HcBN40Z5ZntopOWa aS/RFJ2Jfb4Ith/nVn3lFrCQQIxgddOW3Znh5QMfd2kooQTHI23j+e6OKhSo49IYvWY5 6paQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=MJKelcljstzYcGtBOWD3/ZFnJpJqsbJXK8zXxRTftqU=; b=qZ9hvmnjwFVgikrFELDzoNNSxYBhM6UQrk3NePZrAyudS4TD2h9xJhku8vWDY/rG+Q 3fOk7KKfG6fS5p5cM2XZXf82jLRnoebKfzmJE6P0/NiitDs+dOttzojGElCSMIEikJ2P dcTzk/OxVlqeBDap2yljX0CvE/JZ72ouGGzWWaat6+A/PU3pipTbw1oKD1mu8gJgu6m9 1JI0afufI6ZZVmUFCR9Z/g2im5UnIR0zj32bs1pQ4/FW9LzbzcK9q6WsPpOJcnyy2/pn 0Gq/83s1v9fniQ/LPc2sjqsofqX9Z69pr0huAP38dg0pQmSFyzChp+Bn9H3HUillBLSX gnbw== X-Gm-Message-State: AHPjjUiQY+QvM5t4eVJM92/xXlWQf5SMdyq663cB7RqpGNLkYXU69Pba 36T+cxcMpKZ7TVFOcwI= X-Google-Smtp-Source: AOwi7QBIHbV1CI+T4d2yO1dJ1YAn+hTZQbcpNyTPIm7KzNzARFndPpiYJd1pGUmvx3EQFX9cmJe5wA== X-Received: by 10.202.195.195 with SMTP id t186mr12226600oif.24.1505082346537; Sun, 10 Sep 2017 15:25:46 -0700 (PDT) From: Bart Schaefer Message-Id: <170910152711.ZM4470@torch.brasslantern.com> Date: Sun, 10 Sep 2017 15:27:11 -0700 In-Reply-To: <20170910210636.17bc0581@ntlworld.com> Comments: In reply to Peter Stephenson "Re: Comment (# char) behavior in the sub-shell" (Sep 10, 9:06pm) References: <20170910210636.17bc0581@ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Comment (# char) behavior in the sub-shell MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 10, 9:06pm, Peter Stephenson wrote: } } I suspect this changed some versions ago now. At some point we changed } the way we handled $(...) to parse it better. I think this is much older than that, and has more to do with the fact that comments are stripped out before aliases are expanded. With no aliasing at all: torch% echo $ZSH_VERSION 4.2.0 torch% echo $(echo 1 10 # 9) 1 10 To demonstrate that it's not related to global aliasing: torch% alias #='echo foo' torch% # foo torch% echo X $(# 1 10) Y X Y torch% } It so happens we don't keep the expanded aliases from the original parse } in the string we later replay. If that were the only issue, then removing "#" from $histchars would not "fix" the problem, I think? } I'm not sure how much effort this is worth. Using the comment delimiter as a global alias because interactive shells don't recognize comments, certainly seems to me to be painting oneself into a pretty tight corner case. Still: torch% echo $(echo $options[interactive]) on torch% so one might ask why no_interactive_comments does not apply. The following changes it, and all tests still pass, but I'm relatively sure there is something or other that it breaks. diff --git a/Src/exec.c b/Src/exec.c index e2432fd..4230329 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4441,7 +4441,12 @@ getoutput(char *cmd, int qt) pid_t pid; char *s; - if (!(prog = parse_string(cmd, 0))) + int onc = nocomments; + nocomments = (interact && unset(INTERACTIVECOMMENTS)); + prog = parse_string(cmd, 0); + nocomments = onc; + + if (!prog) return NULL; if ((s = simple_redir_name(prog, REDIR_READ))) {