From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1378 invoked by alias); 26 Sep 2013 21:03:22 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18005 Received: (qmail 9138 invoked from network); 26 Sep 2013 21:03:16 -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,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=O0GQk/O/dsgoXxIFU2cyOsaqIg/ZW6+XAUIQoPT94zE=; b=Zi3Dg88qGoxGoMc51C7OKMYBunOtB/QDSyFtV28iHxjPgii8HWjJIsZaazAuu5FNdO HoF6/22CcbXYi9krRH+5Y11do+7pe0ucWEazplNL0PWNYrfH3JZXCWcFJ+sOiXwnOYwi NPRL0Ew7BZBgcTEV0IaN2RgvSxKW+LwwcuLIZjpsyRl+7Vrdj98MYOgb2Ddv92D8FXRZ guS6hA0YNbMApAeF9I9a3JASxy5KIhciJLqMs8hVi+xwsvmxT6Yj4azZ7KV/xf9sqJbJ OVDuIAuwRE1UwGdmd+a6vyZtUie/kgmQtFsYoS5ZJvb2J0tRnFq1BtTDADtsDeWqLg7c b7cg== X-Gm-Message-State: ALoCoQmztWdWzY0xt/gEtTgah8QRWB34vtJANq+SwPBvSF768F623bTIMh2L0aqh71+0oIhfggE7 MIME-Version: 1.0 X-Received: by 10.112.51.101 with SMTP id j5mr5410866lbo.17.1380229387866; Thu, 26 Sep 2013 14:03:07 -0700 (PDT) In-Reply-To: References: <20130918185058.GA19235@Archie> <20130918211227.51cdbd0f@pws-pc.ntlworld.com> <130926101254.ZM23201@torch.brasslantern.com> Date: Thu, 26 Sep 2013 14:03:07 -0700 Message-ID: Subject: Re: Issue with histreduceblanks From: Bart Schaefer To: Raghavendra Prabhu Cc: Zsh Users Content-Type: multipart/alternative; boundary=001a113364605f654304e74fb25d --001a113364605f654304e74fb25d Content-Type: text/plain; charset=ISO-8859-1 On Thu, Sep 26, 2013 at 10:47 AM, Raghavendra Prabhu < raghu.prabhu13@gmail.com> wrote: > On Thu, Sep 26, 2013 at 10:42 PM, Bart Schaefer > wrote:> Did you see/try this? > Yes. > > Tested with different combinations: > ================== > zsh -f > Archie% print Only two kinds of witnesses exist. The first live in a > neighborhood where !#:7 !#:8 !#:9 > print Only two kinds of witnesses exist. The first live in a > neighborhood where The first live > Only two kinds of witnesses exist. The first live in a neighborhood > where The first live > OK, this is a clue, of sorts. When you reference !#:7, the parser first builds an array of the starting and ending positions of each of the words on the command line, and then pulls out the characters between the seventh start and seventh end. So the fact that !#:7 !#:8 !#:9 worked correctly means it's not having trouble locating the beginning and end of words. > Archie% print Only two kinds of witnesses exist. he fisst lvee in a > neighorrhood whrre he fisst ivee > And here we see that e.g. "live" is sometimes crunched into "lvee" but other times into "ivee". Which points to a problem with memcpy() being handed overlapping regions when doing the actual blank reduction. This might be a compiler optimization issue; in any case I think memcpy() is not guaranteed to work with overlapping regions and histreduceblanks() ought to be using memmove() instead. I seem to recall us having to fix this in a different part of the shell some while ago. --001a113364605f654304e74fb25d--