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 CBE94201CA for ; Wed, 20 Mar 2024 18:47:34 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1710956854; b=mX4z+ieLNLgVKCcBnXG31H6SOoTNUjMaJQGfJGSvv0xpH1f97RZnhSX9IeJobWVhFyD9/tyVQV ZdDnAjHK3z7olLcxLkWaUKablIIk98RswmdCNRU1gGRq903j6eosJWEllIV/ZLLNpDEwvtDB75 o5y/g8WUQW3+DcH4ZRbcUfaxWYt/OoP/nOb5WK9J1y9lhKEYZcRBBIP8NSlu6TkQ01HB22jK5r be70RvH6P1PT9q0IQSL1pzZYS7QnVqHXe1m6PlNubREemvPjCZPIz7KWQ3xHAM4ei7Y3MMsctx WqxqCGj1z8Zl79Ryt6VMS/22SONDCs5hNmyFeSgfFGKE2w==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f53.google.com) smtp.remote-ip=209.85.208.53; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1710956854; bh=dm+6VRfhoF+wMp265AkuMKoOh3ZYHSIRnS1uZAyEpdc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=r1J4iYtjktHgUGXigNNpc/tQNSCcMEtU6d5BgJcvCSWcFobd/Xf9YOAZdFqsVNkOkJFlcjqX/8 k57h5YQ57emz7/bgPYgyVmB20Yg1nd87ui2qcYLoQ16sqwf5B1Ni4+d08F1zz6q2sqohT36jvr 8Utgnp9xhoknaAA7gu4LdPc7Qu/WXFO8/e69lHWsb4znAsVfv293FDnAgP7dxWxXwjDnKWVLV5 R+az+Y6Y4fSfSAUTb8K1HNf5TXNgdFrNxESGcI96adg1EIxagkd8XnqlUaTl7qZIldFSoQqvCO vNScGZVGPDolPerKmODImUvT/WPjABOByIAV5604Lzu5Dw==; 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:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=0d+Qs9ZhON1AONWX7Enak8lVylECmZpec6nY6s+ynSA=; b=iQKds+/DsZBpwUzRvTH2z5bAax nymKQSzSwlEQY80dCH/XqkDjsqySz8GXRxgEg+of+C3RVzQ6D5U6s5QeN4Kn/l7xw3QIRjpgigLK4 DSUj0ieIycDrxpAZqkZ+HKO/lkN2JHnmQzuEbsysOnxLZ7ZXkPPYzbjSK1vX83DbzCXI4HLSDznxQ 0UM8bnX4tP/ctGHJhaQbpYeVgUplN3WzG+UbDPtJRoS8dD6OPRkLd4vVwnb+APIftENfSBoUvlYF8 dNCSXMtZyqT3EiD2jyHROz1IFnrt/soGQ1lNr6Soq0hfK0kq+dY6znU/46Bx46swgA9T/8JnjDR77 nGH6Ws6g==; Received: by zero.zsh.org with local id 1rn02H-000MOF-QO; Wed, 20 Mar 2024 17:47:33 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f53.google.com) smtp.remote-ip=209.85.208.53; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f53.google.com ([209.85.208.53]:61864) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rn01h-000M3l-4P; Wed, 20 Mar 2024 17:46:58 +0000 Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-56890b533aaso42781a12.3 for ; Wed, 20 Mar 2024 10:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1710956816; x=1711561616; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0d+Qs9ZhON1AONWX7Enak8lVylECmZpec6nY6s+ynSA=; b=s6kxxM+Sy1QQR85JtDKbFKIsBefVZBkccpNrCaVgVc/pwYDujIowufFXjx1is38ZPE ncVQbNv0dDn6G+QZA2lVPcaEMlm8hWqMCypgcKx1brMe9XiHzPMIThVYIv9/GrgPsvbd L3tKtiMTy5rIjZPvopF6q1sb4cTiGZxYLqPWC+zbOTltNlN88P2TiIsD2JWZPxkMlr0d 4MjFookPZO25plviYdrDyDqRoEYSd1sk1xNjM04qIFk3YHwdmDPruxnr5RrT8mEcXp4o f6p8xBVpfqVFbxCpXoyA8275F14hatM3Cz3uFWzAO2dhVP18/frg2auS9MHoaMRzdD5e rw3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710956816; x=1711561616; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0d+Qs9ZhON1AONWX7Enak8lVylECmZpec6nY6s+ynSA=; b=itQsmC6MRjcwotqZoKwK62/tIkpaEbaElpQgJgGmf79jy2Xdx46a564IqtCZpeJRZ/ r60PPQfDzdTgk8/2MAUkDwe6eC8aYHHzcuWsvydFxLnIcvmKT4Nhx3k/thuS9H/8Apil NsLP9Bf2PzKjxSdWzSBFBpu7p+etjcb+Nfak4YpK07EEMY/7E/TGr2LXp4oqpWrlZ//m sJXsmxy3bNo7qTt9wcCaOv1k1xA0V9drzakQh5em+U7NYbHlSOhau8xFgHzX9vHlz4EJ UdA11T3FSRxCnZFAbj0tXPaK2qI+caXfIioQuwfsVIxOUs++UUHBpbJTClyuBvtWi4St hndA== X-Gm-Message-State: AOJu0YwqDNmCaDbncT5yl9BavLj29UDj37/8TV1zkm7P9ldr5egJjF4O dIIYQuArg9M236lSSAUKygl3ZpfoStgjuqZ/le8mrtq1O1xq/YOdFFzc7sJkmbwKyZ8ZqaJJJ7h yhKpo4LvjXcDIvBx5KVq2SZnGbmFNreHU4gG3D0UQEOOAmE/+K06n X-Google-Smtp-Source: AGHT+IGwfDbEYRSolcRLuDszN9mNwuIC/NifJtntYH6ezugUh0PyV/4jl4RPriY2GqNNKUNVZhJ8LKFfBHv/a9P6SNM= X-Received: by 2002:aa7:d40e:0:b0:56b:b855:1794 with SMTP id z14-20020aa7d40e000000b0056bb8551794mr1080410edq.14.1710956816181; Wed, 20 Mar 2024 10:46:56 -0700 (PDT) MIME-Version: 1.0 References: <20240313123817.GA3492761@cventin.lip.ens-lyon.fr> <20240315125317.GC3738413@cventin.lip.ens-lyon.fr> <20240319105745.GA4811@qaa.vinc17.org> <20240319123444.GB4811@qaa.vinc17.org> In-Reply-To: <20240319123444.GB4811@qaa.vinc17.org> From: Bart Schaefer Date: Wed, 20 Mar 2024 10:46:44 -0700 Message-ID: Subject: Re: HIST_IGNORE_DUPS also ignores command lines that differ by a space between quotes To: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52781 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 Tue, Mar 19, 2024 at 5:34=E2=80=AFAM Vincent Lefevre wrote: > > On 2024-03-19 12:08:26 +0100, Mikael Magnusson wrote: > > 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 Yes. That's connected to what I said about history search also working the way ignoredups does. That placement is not necessary given that it isn't a static function ... if it ever was, that's buried somewhere in the pre-version-control zsh-workers archives. > > 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: Although this statement is correct, I'm reluctant to discard a quarter century of practice about which there has not previously been a complaint. It could lead to significantly larger history files and/or the "expiration" of commands with more obvious distinctions -- not because those distinctions are more "important" but because they're more likely to be noticed and their loss complained about. So how about this as a compromise: diff --git a/Src/hashtable.c b/Src/hashtable.c index 75b06c4ad..e1f575a52 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -1397,6 +1397,14 @@ histstrcmp(const char *str1, const char *str2) { while (inblank(*str1)) str1++; while (inblank(*str2)) str2++; + + /* If significant whitespace has already been eliminated, + * there is no reason to expend similar effort here. Also, + * this is more accurate in cases of quoted whitespace. + */ + if (isset(HISTREDUCEBLANKS)) + return strcmp(str1, str2); + while (*str1 && *str2) { if (inblank(*str1)) { if (!inblank(*str2))