zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Raghavendra Prabhu <raghu.prabhu13@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Issue with histreduceblanks
Date: Thu, 26 Sep 2013 14:03:07 -0700	[thread overview]
Message-ID: <CAH+w=7bFh9ULURuAruCHUihSvKnFRxHw662+ONz0dAVs_qP4kA@mail.gmail.com> (raw)
In-Reply-To: <CAEtq3tPwqqFaxMHuCkjgoq8diRyFrT9ZAyy+p1sHZBDqteTc9A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]

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
> <schaefer@brasslantern.com> 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.

      reply	other threads:[~2013-09-26 21:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-18 18:50 Raghavendra D Prabhu
2013-09-18 20:12 ` Peter Stephenson
2013-09-18 21:32   ` Bart Schaefer
2013-09-25 19:22   ` Raghavendra Prabhu
2013-09-26 17:12     ` Bart Schaefer
2013-09-26 17:47       ` Raghavendra Prabhu
2013-09-26 21:03         ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7bFh9ULURuAruCHUihSvKnFRxHw662+ONz0dAVs_qP4kA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=raghu.prabhu13@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).