From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 441 invoked by alias); 18 Apr 2013 20:04:25 -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: 31268 Received: (qmail 22298 invoked from network); 18 Apr 2013 20:04:21 -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 Received-SPF: neutral (ns1.primenet.com.au: 209.85.212.172 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-proxyuser-ip:date:from:to:subject:message-id :in-reply-to:references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=mMzYS81PpAjnbepZ3LVXZrXhshmV+orD2cIzKJNSjfs=; b=ebquL1IZJ0cL1flfxcHoWcNCQjglQNlVVnOZ0YDXC5XT/Qo+nWyNosz8NX8ztQ95dW lNZj4KrU5LCXoiRz0BnlCouMkgTko2lTsx/oN4FMACNePPEBa/Bwp2SBxYcKmONNvskP jkX9uRTTZnaOngkVQJuEt/nknbUK7n09zTUc3vQWYg5P8tjlx8Jf31fysy7+XJb0ulOE af0QgdNl+geYy1JQ4znIb5earh4cOzqT208wF9Bl80hszk4LW64Zb04UzmqU1j51T6El 4ajNMNkk7Qm7ljuU5R51a+nUO3qRB99/PCV1k6H0DqqVOKtx7/L32FDH+bdCQQC4jGcn aB0w== X-Received: by 10.194.158.4 with SMTP id wq4mr11779587wjb.46.1366315454228; Thu, 18 Apr 2013 13:04:14 -0700 (PDT) X-ProxyUser-IP: 86.6.30.159 Date: Thu, 18 Apr 2013 21:04:11 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: HIST_IGNORE_DUPS ignores lines which differ by a different number of spaces Message-ID: <20130418210411.3254ac63@pws-pc.ntlworld.com> In-Reply-To: <20130416170518.GD18872@xvii.vinc17.org> References: <20130416170518.GD18872@xvii.vinc17.org> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQl4zzjgk0FCW1LHGve8Ihigtx3pI6KVc0HWRAjqePvVKLhdYfWQRcZXerRFi44ZgDv8cQR8 On Tue, 16 Apr 2013 19:05:18 +0200 Vincent Lefevre wrote: > % setopt HIST_IGNORE_DUPS > % echo " " > % echo " " > > If I type the up arrow, I get > > echo " " > > as expected, but if I type the up arrow a second time, I get > > setopt HIST_IGNORE_DUPS > > instead of > > echo " " > > and: > > % history > 1 setopt HIST_IGNORE_DUPS > 2 echo " " This turns out to be hard. Fixing the basic comparison is straightforward, and I did, but it turns out that's not good enough. Then it gets complicated. After the code has decided whether the line is identical to the previous one or not, it gets added as a hash node to the history table. This has buried into it at quite a low level the comparison function that compares lines ignoring white space. I don't quite understand how the hash business comes into it, given that the basic point of hend() is to use the history ring and I can't actually see anything ever being retrieved from the table. The whole way history is stored in histtab apparently makes it impossible to take account of white space --- even when retrieving a node where the only information you've got is the name, which is what's really stumped me, since the information about words within the line isn't available at that point --- so unless someone can explain what's going on here I'm stuck. It's possible the hash table business is a red herring --- the comparison behaviour ignoring all white space is present even when HIST_IGNORE_DUPS isn't set --- and there's a problem somewhere else that I haven't spotted, but I did confirm that my change caused the lines to compare differently around line 1273 of hist.c, so it's something subtle. My best guess is it's got something to do with freehistdata(), which appears to be the only way the hash table can affect the history ring. pws