From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16799 invoked by alias); 29 Apr 2011 14:20:59 -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: 29110 Received: (qmail 1023 invoked from network); 29 Apr 2011 14:20:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110429072032.ZM13518@torch.brasslantern.com> Date: Fri, 29 Apr 2011 07:20:32 -0700 In-reply-to: <20110429084444.GE5625@prunille.vinc17.org> Comments: In reply to Vincent Lefevre "Re: completion on brace + 4 characters doesn't work" (Apr 29, 10:44am) References: <20110428111148.GA3109@ypig.lip.ens-lyon.fr> <110428081240.ZM11395@torch.brasslantern.com> <20110428222754.GC5625@prunille.vinc17.org> <20110429003149.GA21935@prunille.vinc17.org> <20110429005909.GB21935@prunille.vinc17.org> <20110429013438.GC21935@prunille.vinc17.org> <110428205657.ZM12615@torch.brasslantern.com> <20110429084444.GE5625@prunille.vinc17.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: completion on brace + 4 characters doesn't work MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Apr 29, 10:44am, Vincent Lefevre wrote: } } > The code there apparently assumes a naive implementation of strcpy() } > that goes left-to-right incrementing the source and destination } > pointers in lock step. } } It also assumes that the length of the string is less than len Not really, because if the naive copy is done then the only thing that matters is that len >= 0. } (because the source and the destination may not overlap). The } compiler can use this fact to optimize the code. And as this is } not true, the generated code may be incorrect. Yes, I was aware of all this, I just didn't think it was worth spelling out (it's implicitly not "naive"). Keep in mind that this portion of zle_tricky.c was written at least 10 years ago by a college student; zsh was rarely if ever built with highly-optimized compilers/libc on 64-bit platforms, at the time. Which is why I said: } > It would not surprise me to } > find this assumption made elsewhere in the zsh sources. I don't suppose you could run through the entire "make check" test suite under valgrind? Even that won't exercise everything but it'll find the ones most likely to bite somebody.