From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 4992425C3B for ; Tue, 19 Mar 2024 13:34:59 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1710851699; b=fhseyFAFmq36Klt1mTiuBWRKH2j5Bg6X0/TW3UnpluVcM7xPGzVevXptiMQuuVhyurMDkzTSI1 whvs85pNsk2BFGwCXPGSUNZiyTQ7Rw7geI63xdSRGWwlAiSxWNCuiG52ZgOy/QLYHf2UKxxNmi IfXGqaXHgh9co3rRByS19gkMML8zXENFfDUck3QwOrABKGDY2+PPtytxUZAGQXkryKPRXHNaGa bfxfmchBdT7NkLEOt9F0L5jaoJxNnK7aXsPDZMNuzt8M+T4IlxfBN4SpD5KBv76G98TGmEqQyf TBG50RDcM28gHf1yxdp7Jt9tG6w49sbIrh8jiSxg06GxoA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1710851699; bh=zFwVparWE+kBN4ZW8zcJcwM/3vloqHM3e4oNDjMcudI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature; b=OArrxVomBlg96bI03MSwDfNKeXOEdvn3GWYU4Uu31xpCHKnNCng6i6QNe7HXgfPVVidxf+zhdO +ikjbCjoLyBskGxX7zKuyQH9xNfYx20oo0XMao2ZuxJzIzoznvU4KjdBi8vS+aRjSsSrtqNIg1 k13NKnsVF1fKHeBrBuMC5U9oapWEtOiTT6bCtwT92PKgud14hSoem6cKofEJuSWj6YX4xNVAu5 lE5oPaxESWRfmoSNlFElnLZkGXKWFyI6aF1+dBs+AS7Y3IoF77a1Zn9Zzr60n+sdZiTu0rN8ak IZ8JcooqikMfslq2VO3a5gLxccVd3UzHn8+324+yuMf/ZQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=kc/4B5Ot/zf78+L708AyaayUYajgiGCHSXCazsczOT0=; b=NiB1omusAtDo21yWNQhSo9B2dd swqsyGlG/0KYJOtdfrffHSocXukocDF7sW3F0juBXaKY92iI+xItSGVfh81flBlxoGh5V64fkj54t JuM8rB4OSkBtqsG6u02Rz9uupUhV2QeZhcOEkVNAE1zS2t3vjo6hT9tUFe9bDeeRv9T4gXxU6mJ7X 7jnPBNtev3eksm1/Xe3OwyyI8Af9o0E5EIK8QQ7bMGLswxPpW8Czuy2br8bxzlGDznOQm5w/dqcBJ 3dkCetWqIa5DtH9YgM6remiwl7gSI1XM0C9FbKoiw0DsMaQUXquwriF1Fymb+djnrcV5wCcTB4hPc wItTNwBg==; Received: by zero.zsh.org with local id 1rmYgF-000OFx-9U; Tue, 19 Mar 2024 12:34:59 +0000 Authentication-Results: zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none Received: from joooj.vinc17.net ([155.133.131.76]:48140) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rmYg0-000Nyu-TS; Tue, 19 Mar 2024 12:34:45 +0000 Received: from smtp-qaa.vinc17.net (135.197.67.86.rev.sfr.net [86.67.197.135]) by joooj.vinc17.net (Postfix) with ESMTPSA id 6A2E54E5; Tue, 19 Mar 2024 13:34:44 +0100 (CET) Received: by qaa.vinc17.org (Postfix, from userid 1000) id 0E713CA00AB; Tue, 19 Mar 2024 13:34:44 +0100 (CET) Date: Tue, 19 Mar 2024 13:34:44 +0100 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: HIST_IGNORE_DUPS also ignores command lines that differ by a space between quotes Message-ID: <20240319123444.GB4811@qaa.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20240313123817.GA3492761@cventin.lip.ens-lyon.fr> <20240315125317.GC3738413@cventin.lip.ens-lyon.fr> <20240319105745.GA4811@qaa.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.12+69 (354c5b11) vl-149028 (2023-12-10) X-Seq: 52773 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 2024-03-19 12:08:26 +0100, Mikael Magnusson wrote: > in hist.c: > if ((isset(HISTIGNOREDUPS) || isset(HISTIGNOREALLDUPS)) && save > 0 > && hist_ring && histstrcmp(chline, hist_ring->node.nam) == 0) { > /* This history entry compares the same as the previous. > * In case minor changes were made, we overwrite the > * previous one with the current one. This also gets the > * timestamp right. Perhaps, preserve the HIST_OLD flag. > */ > he = hist_ring; > newflags |= he->node.flags & HIST_OLD; /* Avoid re-saving */ > freehistdata(he, 0); > curline.histnum = curhist; > > and in hashtable.c (weird place for it): > /* Compare two strings with normalized white-space */ It is placed in hashtable.c perhaps because of its use for cmpnodes in this file: histtab->cmpnodes = histstrcmp; But is this correct? > /**/ > int > histstrcmp(const char *str1, const char *str2) [...] > seems you could simply replace histstrcmp with strcmp and be happy. Thanks. This now works as expected. BTW, without this change, the following commands are regarded as the same for HIST_IGNORE_DUPS, while they are very different: qaa:~> printf "%s\n" a\ b a b qaa:~> printf "%s\n" a\ b a b -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)