From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#61778: 30.0.50; [PATCH] Be more cautious in completing Eshell variable assignments Date: Fri, 24 Feb 2023 22:02:14 -0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------mfOho9OE71Vwr1s3YVUhbEu9" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27601"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca To: 61778@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 25 07:03:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVneY-0006wS-1N for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Feb 2023 07:03:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVneI-0004cq-Ke; Sat, 25 Feb 2023 01:03:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVneB-0004c9-Vw for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:03:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVneA-0005ZL-Ku for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:03:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVneA-0000Qk-4P; Sat, 25 Feb 2023 01:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Feb 2023 06:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61778 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca Original-Received: via spool by submit@debbugs.gnu.org id=B.16773049421596 (code B ref -1); Sat, 25 Feb 2023 06:03:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Feb 2023 06:02:22 +0000 Original-Received: from localhost ([127.0.0.1]:38836 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVndV-0000Pg-ID for submit@debbugs.gnu.org; Sat, 25 Feb 2023 01:02:21 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:53692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVndT-0000PZ-SJ for submit@debbugs.gnu.org; Sat, 25 Feb 2023 01:02:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVndT-0004YR-GP for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:02:19 -0500 Original-Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVndR-0005Uq-LG for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 01:02:19 -0500 Original-Received: by mail-pl1-x631.google.com with SMTP id h14so1615086plf.10 for ; Fri, 24 Feb 2023 22:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:from:content-language:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=n8ulcQjjWzLyjiMdeOjNwgFxV9J30fAFzU9GfJmH3ok=; b=hZuuoyMjxH3Ec/GQXQ/7dLwgZ7WeM/jEP/LnPSonNMkor1whVAagDzBYha66wEx7r3 wGD0dfbod9VksxSaOtpUGS0TNv6S1HAvmBq/suRbSAUwwBuswndVDsJLqmQc7zK7WfAl ddeSWCI6V4m6bBpRF76hzmpi5h3wJYpPe/iTwV5aiRrlgbPOates0Pv+PRessjgCvprr m/MkNGb6Nj1n4KS8X0ufZueSK1pIq6f4ZhpKQNd5k5B/mOsY4QaW9MEJTp8I4NT6ZDv9 fxLehumlycXGpxShWKWEtx49tDLxGnBpDJ2oLAOjLpRT5uSq2NEQsi4Gf20RFSicGiar fKUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:from:content-language:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n8ulcQjjWzLyjiMdeOjNwgFxV9J30fAFzU9GfJmH3ok=; b=5Ivm0o0wNuCwXISvev/FuIsrzxFW8NS9/+FHwEr2/OUy3Wr172KHzrhl7S5rc1buRd SpA82zEYtE94f/mGrMPfFS9MU8gvD+r95QxZJ3zTVOuDqR8bXgm8qijgtE4O3im5uCpb L3aoFdUF4oZlo1AAQUXD/upT5e2899IOJ5CBlk+wu5Hj5ccbrgEe7eFbpjOz/sDN4DGo Kg0OuDWbp/l1bgHRTyTYxtM5NclBqrzYB+nepLcPsuX+fMnkZbGS+1EZZCrccAWmAw4K zr6ao8OETMnS/AeTPXSzqvO1I3tUCBTtv1GbBcMXYPm2fwIad2zWmmAcx8tInvmlHKfp XtUQ== X-Gm-Message-State: AO0yUKW09lW/4WMd38j9+emp0t5qsXxbuyteRy9HrfvJ7FoZjI5CHjMT H/NJCAmFK7ZABFH/J1rCbEuRRuUNTFY= X-Google-Smtp-Source: AK7set/tUUxB0Uiw5sfnx5req6qIQUk3qqOALifH2U3hZF+MhQwapZKGESGhQYZ4aKtrlIGkjk7fxw== X-Received: by 2002:a17:902:ce0a:b0:19c:be63:a9ce with SMTP id k10-20020a170902ce0a00b0019cbe63a9cemr2131295plg.4.1677304935844; Fri, 24 Feb 2023 22:02:15 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id e9-20020a170902d38900b00199536fbc6fsm421457pld.280.2023.02.24.22.02.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Feb 2023 22:02:15 -0800 (PST) X-Mozilla-News-Host: news://news.gmane.io:119 Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256684 Archived-At: This is a multi-part message in MIME format. --------------mfOho9OE71Vwr1s3YVUhbEu9 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Debbugs-Cc: monnier@iro.umontreal.ca Starting from "emacs -Q": M-x shell RET tar --directory= ;; Notice that completions only show directories. M-x eshell RET tar --directory= ;; Completions include files *and* directories(!) After quite a bit of digging, I figured out the issue: Eshell was treating "--directory=" as the beginning of a local variable assignment (like when you run "CC=gcc make"). The function 'eshell-complete-variable-assignment' is over-aggressive in identifying local variable assignments, and so it picked this up as a false positive. Attached is a fix for this, plus a regression test. --------------mfOho9OE71Vwr1s3YVUhbEu9 Content-Type: text/plain; charset=UTF-8; name="0001-Be-more-cautious-in-completing-Eshell-variable-assig.patch" Content-Disposition: attachment; filename*0="0001-Be-more-cautious-in-completing-Eshell-variable-assig.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSBlODI2NDQwZGMxMTczZmM1MDBjMzAyMjU1MTZiMTBjMjYzOWNlNjQ2IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IEZyaSwgMjQgRmViIDIwMjMgMjE6NDk6NTQgLTA4MDAKU3ViamVjdDogW1BB VENIXSBCZSBtb3JlIGNhdXRpb3VzIGluIGNvbXBsZXRpbmcgRXNoZWxsIHZhcmlhYmxlIGFz c2lnbm1lbnRzCgpQcmV2aW91c2x5LCBFc2hlbGwgdHJlYXRlZCBjYXNlcyBsaWtlIHRoZSBz ZWNvbmQgYXJndW1lbnQgaW4gInRhcgotLWRpcmVjdG9yeT1kaXIiIGFzIGEgdmFyaWFibGUg YXNzaWdubWVudCwgYnV0IHRoYXQgcHJldmVudGVkCidwY29tcGxldGUvdGFyJyBmcm9tIGlt cGxlbWVudGluZyBpdHMgb3duIGNvbXBsZXRpb24gZm9yIHRoYXQKYXJndW1lbnQuCgoqIGxp c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