From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27956 invoked from network); 3 Jun 2022 00:28:23 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Jun 2022 00:28:23 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1654216103; b=qbM14iow/VWxCbpEWjJ4jfneB5A3B4UQgxGVCiBbzFue9PWiqgqbZbdjyVEACkNFqM/GSn5sPR U06dno2sTJr8XkuiVoeZWVwdCg5sz+p+IwzMXlIrjpgKJYzsmj7vlsFMuUTxiakTlAo940Nf62 lq3uqC/Kl2ifvxKysev5JmewG4Qz/E3RJhBLhguJFz4Vgs5I8f18C390Uuzh7LXZpfUDZekLe4 PJB7K0b/vMPQbfiuI8A9RLP/f5WKPXjDnlwzfhHmQOY9s+FdYr4KxCPIdGw+fNxItUDUBSif9U kMnMEe5ZI9sigqmKkYwfmxOsHyp1dWElu4pRp1+GKpiD5g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-qv1-f45.google.com) smtp.remote-ip=209.85.219.45; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1654216103; bh=gZ8Nuc5feNcBPUS6OqeMjt1LUld/3e8MFvEuD61TRnU=; 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:MIME-Version:DKIM-Signature:DKIM-Signature; b=AmZ/+lnVOIduFOcjPLeFtfPrwWa3TKxve4qfgzTXqMTUz7gmCO103iHBH43ci4otrfy+7k3FY6 FHm1MZoQl2hNezD5bzwJ2Kd4sYA+hEZNkTWG62s+3j1pKyDsbcvFsa0OEaRbyA0ugNtx2PFck4 pNYlYA98J6v1NpJutmAnAf5+sWyb/7EORiQcd1xL7ss3NtsJJoBUuLLNUJq1tfrH85J/k02vBq IPdPGx4Rytv4XGkkAnuMZQurihPBezQTvpYXNCywUX5RPA2uXzTadq4pIKzrplbKwZpCaq/k1g KWWEriJE3RXvSSoNZZaUcmmWqOGHR5yVhlqEFbUbDGkPlg==; 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:MIME-Version:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=/Mm5hOZ8HzbqVjWFsMx6ZXL20NwjCeIfhTYwq5JIz3s=; b=diW6VRducZZJW6ASVGlA0DJvta CHPaPBMALGL/ZYTcvEM7JMIPL+kMPF4YqhypDMohYBFYfcQSMjPIe5kssgybaog+acfU0Y9Uw4BHt ftpDSKmQSkyEpWUr88XGivyZTrgq++Jzvm6ErEA0aZm6du32HA7BmMKW1e3nU23q/2FlRfB6Klb2h zpdSCZTD46kW6hY/VVqqMiwoJLhq4u+VGf+S9xTkYzAgEtlbrjoOSF+ObACFo8EtXq042U3f6Jrgf DnTBb7BxElhIfNFnbTKcCcQcmQ92wI4sbhyIDQhLBHza6h+vEGMpJty4Dvl8qFJ/Kh/Ta+XRRcHci bzcC99rQ==; Received: from authenticated user by zero.zsh.org with local id 1nwvAr-000ANX-Np; Fri, 03 Jun 2022 00:28:21 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qv1-f45.google.com) smtp.remote-ip=209.85.219.45; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-qv1-f45.google.com ([209.85.219.45]:41519) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nwvAL-000A2Z-33; Fri, 03 Jun 2022 00:27:49 +0000 Received: by mail-qv1-f45.google.com with SMTP id s10so1514314qvt.8 for ; Thu, 02 Jun 2022 17:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=/Mm5hOZ8HzbqVjWFsMx6ZXL20NwjCeIfhTYwq5JIz3s=; b=WT7mnkhVOqaNnVsBDta9UTPzYB0tm2HMEa1+VBAbf9RiDvfBJkcUKGVsYXYRnxfmLI ojwSvcWhEre66OjgqGqwi0d6wCat6SdfK8gRvorIEnpufHRg+Dl5FaqNPTIbkAay+drv 4kHcj8ek+Z6VuyegnLl/W1V6T9b31u6Yo658ziK6T9Rp7xRXjBsLz0JZhSjL3U+dldr5 JLVlQw0TWLOH8p5V+NLlMFBXOTxEUsCW3lHcuntsMJK5s9oiYxxIIaNZOVA6KdX+Bbv6 1Ly+c6Mo/oiAjX28eL1rqzY0NMD4yK1iD+wU5MAYlPHpcYZhNprB/evirwFdw58KhuOE 1Dvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=/Mm5hOZ8HzbqVjWFsMx6ZXL20NwjCeIfhTYwq5JIz3s=; b=b94F+4A7BqPa+nX29+Kb3bTDLSHo1v8y3rfPbL81KsJRcRZB5PJShc7I5fw0OEtO3f kMWUFr6tM82ybKSs1bcdD3dFVrO74eTTZgGf7zND/CAIuq7gsIXXBzW0+WT3xNWm73kk Orl20JnqyQsLxU+dhTG6Sq1f8KXQOEsy7C+6n749sCc53L8/ue9czJSz1loYJnjLKJhw 8WlO9ou6u2JZmmBaKHEseeZfHBpu4fNwPtjo6CkWfzaVJ6jxMSbGtOEPh2lrpGcV6QCE b+XnLqT/38ciLB2Dwvaz4k52o3rp7YZ2RqKTJqGm1tLqTQJ8FuqKji+PWzQZEPULX3u/ TjLw== X-Gm-Message-State: AOAM532wnyGwriHY/PC1dktmaWDEEey0SVi3MVjF+XxJfRrUzfukx1iM IOSX6eZKCoqNGxDhlEQAdthVE7PYERGNJpf3hWqfbTN5dVM= X-Google-Smtp-Source: ABdhPJzAdyCPI0ijzDh1npmw+AnoKk/Qc0bJAd+6J8At21J3OqEf7ypuZo5OUhjv1UWJOwUWZWO8pjXR5a3y5tkDJus= X-Received: by 2002:ad4:5ba3:0:b0:467:dc64:cf9a with SMTP id 3-20020ad45ba3000000b00467dc64cf9amr1178166qvq.73.1654216067517; Thu, 02 Jun 2022 17:27:47 -0700 (PDT) MIME-Version: 1.0 From: John Heatherington Date: Thu, 2 Jun 2022 20:27:36 -0400 Message-ID: Subject: Regression affecting completion with NO_CASE_GLOB To: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 50322 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: After bisecting, I found a regression originating in the commit: d82604843bf2b743e04666d4644dd109831252f7 This was merged after https://zsh.org/workers/49661 The off-by-one fix appears to have traded one for another. I have a folder structure on my machine similar to the following: ~/Projects =E2=94=9C=E2=94=80=E2=94=80 Private =E2=94=9C=E2=94=80=E2=94=80 Public =E2=94=94=E2=94=80=E2=94=80 QT It can be simplified further for the purposes of testing: /tmp/zsh_test =E2=94=9C=E2=94=80=E2=94=80 a =E2=94=94=E2=94=80=E2=94=80 b 'a' and 'b' can be files or folders; I noticed with folders when attempting to change directory. The key is that the names need to be one character in separation, and CASE_GLOB must be turned off. Steps are as follows: $ zsh -f $ setopt NO_CASE_GLOB $ cd /tmp/zsh_test (press tab to trigger completion) $ cd /tmp/zsh_test/B (press tab again) $ cd /tmp/zsh_test/b/ I would expect the normal completion behavior to be: $ cd /tmp/zsh_test/ a/ b/ It looks like the change has caused case-insensitive, adjacent letters to be considered equivalent, so it goes ahead and starts to fill it in when completing a command. I've included a partial trace at the bottom for reference. I tried taking a look at the code, but I'm very unfamiliar with how things work, conceptually, so I thought I'd check here. In the old version, bld_line relies on (in the case of an equivalence) pattern_match1 returning (1 + the index), which would be later decremented by one in pattern_match_equivalence. This makes sense to me, since the return value of pattern_match1 is also being used to indicate success/failure for an equivalence class. The change was originally introduced to correct cfp_matcher_range, which doesn't call bld_line, so it seems like this could be fixed by putting the burden of adjusting the index on bld_line instead. I also noticed pattern_match_restrict uses a similar pattern, so it may need the same adjustment. Any thoughts? --- Breakpoint 1, pattern_match_equivalence (lp=3D0x5555557eff40, wind=3D27, wmtp=3D21, wchr=3D97) at compmatch.c:1322 1322 if (!PATMATCHINDEX(lp->u.str, wind, &lchr, &lmtp)) { (gdb) bt 15 #0 pattern_match_equivalence (lp=3D0x5555557eff40, wind=3D27, wmtp=3D21, wchr=3D97) at compmatch.c:1322 #1 0x000055555566626b in bld_line (mp=3D0x55555587cee0, line=3D0x7ffff7fbdfd8 L"", mword=3D0x7ffff7fbd941 "", word=3D0x7ffff7fbdc99 "", wlen=3D1, sfx=3D0) at compmatch.c:1805 #2 0x00005555556672f1 in join_sub (md=3D0x7ffffffe9ef0, str=3D0x7ffff7fbd940 "a", len=3D1, mlen=3D0x7ffffffe9ea0, sfx=3D0, join=3D1= ) at compmatch.c:2267 #3 0x0000555555667b96 in join_psfx (ot=3D0x7ffff7fbd948, nt=3D0x7ffff7fbdca0, orest=3D0x0, nrest=3D0x0, sfx=3D0) at compmatch.c:2509 #4 0x0000555555669187 in join_clines (o=3D0x7ffff7fbd948, n=3D0x7ffff7fbdca0) at compmatch.c:2952 #5 0x0000555555660081 in add_match_data (alt=3D0, str=3D0x7ffff7fbdd50 "b", orig=3D0x55555587cca0 "b", line=3D0x7ffff7fbdd58, ipre=3D0x7ffff7fbd7d= 8 "", ripre=3D0x0, isuf=3D0x7ffff7fbd7e0 "", pre=3D0x0, prpre=3D0x7ffff7fbd92= 0 "/tmp/zsh_test/", ppre=3D0x7ffff7fbd800 "/tmp/zsh_test/", pline=3D0x7ffff7fbd490, psuf=3D0x7ffff7fbd810 "", sline=3D0x0, suf=3D0x0, flags=3D1, exact=3D0) at compcore.c:2997 #6 0x000055555565e194 in addmatches (dat=3D0x7ffffffea6f0, argv=3D0x555555878038) at compcore.c:2550 #7 0x0000555555654952 in bin_compadd (name=3D0x7ffff7f93ee8 "compadd", argv=3D0x7ffff7e2cd78, ops=3D0x7ffffffea870, func=3D0) at complete.c:846 #8 0x000055555556edaf in execbuiltin (args=3D0x7ffff7f93fc0, assigns=3D0x0, bn=3D0x5555556f5e20 ) at builtin.c:506 #9 0x000055555559e4fd in execcmd_exec (state=3D0x7ffffffedd00, eparams=3D0x7ffffffeadb0, input=3D0, output=3D0, how=3D18, last1=3D2, close_if_forked=3D-1) at exec.c:4148 #10 0x000055555559770f in execpline2 (state=3D0x7ffffffedd00, pcode=3D45955, how=3D18, input=3D0, output=3D0, last1=3D0) at exec.c:1960 #11 0x0000555555595e2a in execpline (state=3D0x7ffffffedd00, slcode=3D17410, how=3D18, last1=3D0) at exec.c:1689 #12 0x0000555555594ebe in execlist (state=3D0x7ffffffedd00, dont_change_job=3D1, exiting=3D0) at exec.c:1444 #13 0x00005555555d446a in execif (state=3D0x7ffffffedd00, do_exec=3D0) at l= oop.c:582 #14 0x000055555559daf0 in execcmd_exec (state=3D0x7ffffffedd00, eparams=3D0x7ffffffeb640, input=3D0, output=3D0, how=3D18, last1=3D2, close_if_forked=3D-1) at exec.c:3968 (More stack frames follow...)