From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18121 invoked by alias); 21 Sep 2016 17:59:15 -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: 39404 Received: (qmail 7157 invoked from network); 21 Sep 2016 17:59:15 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf0-f169.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.192.169):SA:0(0.0/5.0):. Processed in 0.346336 secs); 21 Sep 2016 17:59:15 -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=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) 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=Os/GG0QeLEGcIcOEOPytgbeJd5CDa7BFImfSpvsBRr4=; b=tA9zMwyYVMZ6iq5+4Odw3WR8tLsHEeC8ReEQUhcEjfyRh6SxCoqrKvKGsWLDjvS9Qj Rr2fKhXZAxJUB8damLYo2NI/yF+yqsG5RKRJenNqphLyxm437BcYSJ/rx7YUVx77LZD+ 5wxPaKLxCPrWfwCeR+oAbgh63Zw+lv9B9GLZgc37KK54AZIjx3QUzGy1CVzUmr+ZTNB/ z7dDBlYT4zYN+pgUnCKar30b+0Vmb0p7c4KhfMoCohMvTOm7OeO7VFDA70Z1UdCEVejD 8uUyVKOqKFIVzdqlTTuv3jv2U9DH4EhQe+uv5kFpwHfKO5BkWocA7NLss8rH+IHyPHGC tBew== 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:in-reply-to:comments :references:to:subject:mime-version; bh=Os/GG0QeLEGcIcOEOPytgbeJd5CDa7BFImfSpvsBRr4=; b=Ok6JTmPClA9riTKsggeWzCbM9IPhRf4jEYz/lJL1YkblAFJhIiom2nJ8qs08XDa+l0 buqGvx0Cy+wIqKWX03WxHqbSzp4QS3YOQqXDfdBsuNhzyEIzlxBBSI6zSwlPEwFCXqNG 8b9PF2GWAgGW0AFid8l/LhGIOvsTS91tjiQOQst1nSfUa6Dk1b5Ck4bVWp7d54yy9yYC p2ZAvh4TtC5puyPr47jl3672Hkg4fK9SX2mTxI9KZFgAFrCcNvfl5gzgp/pGnnZe8Pd0 2iW2X35mOcwsfItE49hMAyEQ4xx+eJfdvLRk5cJjllRl05z6jaxxp2GgpA+xJxlKcOXa GBYw== X-Gm-Message-State: AE9vXwPUhMmX7OuRG+eFcuJI0eOFo75isTh0gIuNi2xN2/FaA4xta/JulD9trx84qYDEaQ== X-Received: by 10.98.22.21 with SMTP id 21mr37924795pfw.4.1474480750341; Wed, 21 Sep 2016 10:59:10 -0700 (PDT) From: Bart Schaefer Message-Id: <160921105913.ZM3095@torch.brasslantern.com> Date: Wed, 21 Sep 2016 10:59:13 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "[BUG] String equal when compared, processed differently via //" (Sep 21, 10:57am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: [BUG] String equal when compared, processed differently via // MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 21, 10:57am, Sebastian Gniazdowski wrote: } Subject: [BUG] String equal when compared, processed differently via // } } # hash \1 message \2 repo info \3 date \4 author } # match[1] match[2] match[3] match[4] match[5] } gitout=( "${gitout[@]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)/${CMDR_GREEN}${match[1]}${CMDR_GREEN_E} } ${(q-)match[2]}} >${match[3]}< } ${CMDR_MAGENTA}${(q-)match[4]}${CMDR_MAGENTA_E} ${match[5]}" ) } } On input, there is: } } 15f1acd^AUpdated README.md^B (HEAD -> master, origin/master)^C4 days } ago^DSebastian Gniazdowski } } On output, there should be: } } ^C15f1acd^Y 'Updated README.md' > (HEAD -> master, origin/master)< } ^E'4 days ago'^Y Sebastian Gniazdowski } } THE THING IS: output string gets truncated after ^B in the input } string. If I replace your single gitout=( ... ) assignment with this loop -- integer i for ((i=$#gitout; i ; i--)) { gitout[i]="${gitout[i]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)(#B)/${match[1]} ${(q-)match[2]}} >${match[3]}< ${(q-)match[4]} ${match[5]}" } -- then I get the output you expect (at least, on a zsh git tree). I suspect it is because you are referencing $match[3] through $match[5] outside the closing brace of the ${...//.../...} expression. If I move the 2nd closing brace from after ${(q-)match[2]} to place it after ${match[5]} instead, then to the best of my understanding I also get the output you expect. I looked at all the subsequent "minimal" examples from your follow-up email and all of them have the 2nd closing brace after $match[2], so they would all have suffered from this same problem. That (I:2:) changes anything is mostly coincidental. -- Barton E. Schaefer