From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26432 invoked by alias); 19 Mar 2015 05:50:43 -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: 34738 Received: (qmail 7991 invoked from network); 19 Mar 2015 05:50:41 -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,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:to:subject:mime-version :content-type; bh=p/WH3CLz/RMdPMBp4RXOJ1/ZG+a/LVXSUO8u9nqfI0M=; b=lZeAmioIfi3WHxjeNiBG+JfaRMQ52qY1SbmpTREENNqGHpZAM73l1dhAbVWdE/1YhW rA00l8nznnsy/+8+9ongR4gIAfX8li9j7H6XgvC5/6rn+9sewxzzE/SSk4EWCsGxaVwm Dnad/XpmaoDbqfeOyrRWARvV4Q1cndzPkM1rQ5eINltelE347js3Q2PBdH8t9OdYDiId 9Rar4ZIauzb08lTNSxXmvvgb00FsruFvvsSjr9708Oh7rpPobEa3LWj2i4crR3Mep1Gd nuA4RIpMOhBBZX519pdJiU/bI1eqoOJkCAJ8+E1nbHxlYHpExFUC4LXV9UDVoJ0Ne4WT kkLg== X-Gm-Message-State: ALoCoQmfAsJYdlpEW0UvXgdVlsyAwhoa2Js39qlVFEXQKiXLAlF9VXAAf8USYahr/79NFEoR7yNt X-Received: by 10.182.230.132 with SMTP id sy4mr60573643obc.29.1426744237641; Wed, 18 Mar 2015 22:50:37 -0700 (PDT) From: Bart Schaefer Message-Id: <150318225034.ZM17874@torch.brasslantern.com> Date: Wed, 18 Mar 2015 22:50:34 -0700 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Those two other alias bugs - w/fix for one MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii workers/34668 torch% alias \{='print foo' torch% {this is a test foothis is a test torch% { foothis is a test ------------ workers/34682 % alias -g S='"' % echo S abc def S dquote> " abc def S % echo S" abc def S " ------------ Sadly these are not the same bug (though they must be related somewhere in the re-parse-after-expansion pass). Patch below fixes the first one but not the second. Maybe there's a better way that catches both. No promises that this doesn't do other weird things if you go too far down the "alias -g" rabbit hole. diff --git a/Src/lex.c b/Src/lex.c index 1eb0bc7..42ccdfc 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -1747,6 +1747,16 @@ checkalias(void) if (an && !an->inuse && ((an->node.flags & ALIAS_GLOBAL) || (incmdpos && tok == STRING) || inalmore)) { + if (!lexstop) { + /* + * Tokens that don't require a space after, get one, else + * we can't be sure to correctly lex the expansion text + */ + int c = hgetc(); + hungetc(c); + if (!iblank(c)) + inpush(" ", INP_CONT, 0); + } inpush(an->text, INP_ALIAS, an); if (an->text[0] == ' ' && !(an->node.flags & ALIAS_GLOBAL)) aliasspaceflag = 1;