From unknown Sun Jun 22 07:34:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#49918 <49918@debbugs.gnu.org> To: bug#49918 <49918@debbugs.gnu.org> Subject: Status: 28.0.50; cd function expands CDPATH incorrectly Reply-To: bug#49918 <49918@debbugs.gnu.org> Date: Sun, 22 Jun 2025 14:34:07 +0000 retitle 49918 28.0.50; cd function expands CDPATH incorrectly reassign 49918 emacs submitter 49918 Phil Hagelberg severity 49918 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 06 21:18:28 2021 Received: (at submit) by debbugs.gnu.org; 7 Aug 2021 01:18:28 +0000 Received: from localhost ([127.0.0.1]:51603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCAyp-0004x5-IC for submit@debbugs.gnu.org; Fri, 06 Aug 2021 21:18:28 -0400 Received: from lists.gnu.org ([209.51.188.17]:44802) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCAyn-0004wu-1c for submit@debbugs.gnu.org; Fri, 06 Aug 2021 21:18:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCAym-0005VV-PY for bug-gnu-emacs@gnu.org; Fri, 06 Aug 2021 21:18:24 -0400 Received: from eastern.birch.relay.mailchannels.net ([23.83.209.55]:30129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCAyk-0005fq-FO for bug-gnu-emacs@gnu.org; Fri, 06 Aug 2021 21:18:24 -0400 X-Sender-Id: dreamhost|x-authsender|phil@hagelb.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id E61A85425B8 for ; Sat, 7 Aug 2021 01:18:18 +0000 (UTC) Received: from pdx1-sub0-mail-a56.g.dreamhost.com (100-96-17-214.trex-nlb.outbound.svc.cluster.local [100.96.17.214]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 7CAE0542584 for ; Sat, 7 Aug 2021 01:18:17 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|phil@hagelb.org Received: from pdx1-sub0-mail-a56.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.17.214 (trex/6.3.3); Sat, 07 Aug 2021 01:18:18 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|phil@hagelb.org X-MailChannels-Auth-Id: dreamhost X-Suffer-Ski: 49423c624f05c467_1628299098708_3181500846 X-MC-Loop-Signature: 1628299098708:3901683677 X-MC-Ingress-Time: 1628299098708 Received: from pdx1-sub0-mail-a56.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a56.g.dreamhost.com (Postfix) with ESMTP id BD68C7EF7F for ; Fri, 6 Aug 2021 18:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=hagelb.org; h=from:to :subject:date:message-id:mime-version:content-type; s= hagelb.org; bh=IsduMuRBiab4x0iKD7hP96O6erk=; b=GXQ7aUBkE5KcsL6yN ksh5oHtqRgP/cS1d2YI2ZeKdBuuPNxpGkinqokL8rjAjnyrC1gWGEqzSGlCjyfD1 q575qFHyT0Lg723kit7y20n/SL+Z4OGvNOhsaaIn0ZAqyF9NgpGaQNOTEedp+oZx VLT7XyxnLdSC0KTwQS9w7q44dI= Received: from reform (174-21-73-225.tukw.qwest.net [174.21.73.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: phil@hagelb.org) by pdx1-sub0-mail-a56.g.dreamhost.com (Postfix) with ESMTPSA id 927B27F1FA for ; Fri, 6 Aug 2021 18:18:16 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a56 From: Phil Hagelberg To: bug-gnu-emacs@gnu.org Subject: 28.0.50; cd function expands CDPATH incorrectly Date: Fri, 06 Aug 2021 18:18:10 -0700 Message-ID: <87lf5eyrvx.fsf@hagelb.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=23.83.209.55; envelope-from=phil@hagelb.org; helo=eastern.birch.relay.mailchannels.net 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) When using the function `cd' with a relative path and the $CDPATH environment variable set, it will expand the value of $CDPATH once and save off that expansion for future use. This causes all calls with relative paths to fail when run from a different directory. This reproduces the problem using eshell, but the bug affects any caller of the `cd' function, not just eshell. However, it does not affect M-x cd, which will always use absolute paths. CDPATH=.:$HOME/src emacs -Q M-x eshell cd / cd tmp No such directory found via CDPATH environment variable: tmp This happens because of this snippet inside the `cd' function: (unless cd-path (setq cd-path (or (parse-colon-path (getenv "CDPATH")) (list "./")))) The behavior of the `parse-colon-path' function changed in 2020 in commit 76098d39c992aa51f5bdb04fb39e40fc5eb409d5: - (mapcar (lambda (f) - (if (equal "" f) nil - (substitute-in-file-name (file-name-as-directory f)))) - (split-string search-path path-separator)))) + (let ((spath (substitute-env-vars search-path))) + (mapcar (lambda (f) + (if (equal "" f) nil + (let ((dir (expand-file-name (file-name-as-directory f)))) + ;; Previous implementation used `substitute-in-file-name' + ;; which collapse multiple "/" in front. Do the same for + ;; backward compatibility. + (if (string-match "\\`/+" dir) + (substring dir (1- (match-end 0))) dir)))) + (split-string spath path-separator))))) Previous behavior did not expand relative paths like "." but the new behavior does. That means that the above call which sets cd-path cannot use this function as is. Either the old behavior of parse-colon-path will need to be brought back, or `cd' needs to no longer call that function. Witness on the current master branch: ($PWD here is ~/src/emacs) (parse-colon-path ".:/hey") : -> ("/home/phil/src/emacs/" "/hey/") Whereas on 27, you get this: (parse-colon-path ".:/hey") : -> ("./" "/hey/") The old behavior is safe to set for the value of `cd-path' but the new behavior is not. In GNU Emacs 28.0.50 (build 1, aarch64-unknown-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2021-08-06 built on reform Repository revision: 0b049fe71d73f6885a3c81ea31829e3befc18933 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12099001 System Description: Debian GNU/Linux 11 (bullseye) Configured using: 'configure --with-cairo --with-modules --without-compress-install --with-gnutls --without-gconf --without-xaw3d --without-gsettings --with-mailutils --with-native-compilation --with-json --with-harfbuzz --without-imagemagick --with-jpeg --with-png --with-rsvg --with-tiff --with-wide-int --with-xft --with-xml2 --with-xpm 'CFLAGS=-O3 -mtune=native -march=native -fomit-frame-pointer' prefix=/usr/local' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Diff Minor modes in effect: recentf-mode: t whitespace-mode: t global-company-mode: t company-mode: t shell-dirtrack-mode: t winner-mode: t show-paren-mode: t save-place-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: ~/.emacs.d//phil/../custom hides /home/phil/src/emacs/lisp/custom Features: (shadow sort mail-extr emacsbug message rmc dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail hippie-exp sh-script executable smerge-mode diff flyspell ispell mhtml-mode css-mode smie eww xdg url-queue shr kinsoku svg xml browse-url puny mm-url gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils mm-util mail-prsvr js cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs sgml-mode facemenu dom scpaste htmlize url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse auth-source password-cache json map url-vars mailcap cl-print pulse color xref project eieio eieio-core eieio-loaddefs ielm pp tabify vc-annotate imenu hi-lock misearch multi-isearch add-log log-view pcvs-util vc vc-git diff-mode easy-mmode vc-dispatcher bug-reference find-func shortdoc text-property-search em-tramp em-xtra help-fns radix-tree recentf tree-widget wid-edit pcmpl-unix time-date paredit whitespace idle-highlight-mode thingatpt hl-line company-dabbrev-code company-dabbrev company-files company-capf company pcase em-unix em-term term disp-table shell ehelp em-script em-prompt em-ls em-hist em-pred em-glob em-dirs esh-var em-cmpl pcomplete comint ansi-color em-basic em-banner em-alias esh-mode eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util winner ring smex comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra help-mode advice my-autoload paren edmacro kmacro cl-loaddefs cl-lib saveplace ido seq byte-opt gv bytecomp byte-compile cconv iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 348427 19451) (symbols 48 19549 1) (strings 32 73704 4571) (string-bytes 1 2519167) (vectors 16 37842) (vector-slots 8 705331 23605) (floats 8 380 691) (intervals 56 21516 4320) (buffers 992 29)) From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 07 06:51:35 2021 Received: (at 49918) by debbugs.gnu.org; 7 Aug 2021 10:51:35 +0000 Received: from localhost ([127.0.0.1]:52023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCJvT-0002z4-3B for submit@debbugs.gnu.org; Sat, 07 Aug 2021 06:51:35 -0400 Received: from quimby.gnus.org ([95.216.78.240]:46178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCJvQ-0002yk-7p for 49918@debbugs.gnu.org; Sat, 07 Aug 2021 06:51:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GAsmKZ3Ci4rq0XwDAd5Lbtja1KUyjrA3bcLqW5YcLnQ=; b=Kl4NQoYGrlQjaK8irFd3DTNd3/ LFQevEyCCMwELgrJ63r/pE0lBcGTjVI9CcATI0xWgBTxoJx71aAhS0ue8zH697OwLhRXRayi/HrAR LMMvh9KuNEX92xEWrZwbTP1bhs7veOfkyBE6F4p/ke7UGhcEe1dOndiyxwPwkuJcwsSM=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mCJvH-0006t6-8j; Sat, 07 Aug 2021 12:51:25 +0200 From: Lars Ingebrigtsen To: Phil Hagelberg Subject: Re: bug#49918: 28.0.50; cd function expands CDPATH incorrectly References: <87lf5eyrvx.fsf@hagelb.org> Date: Sat, 07 Aug 2021 12:51:22 +0200 In-Reply-To: <87lf5eyrvx.fsf@hagelb.org> (Phil Hagelberg's message of "Fri, 06 Aug 2021 18:18:10 -0700") Message-ID: <87wnox7ck5.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Phil Hagelberg writes: > When using the function `cd' with a relative path and the $CDPATH > environment variable set, it will expand the value of $CDPATH once and > save off that expansion for future use. This causes all c [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49918 Cc: 49918@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Phil Hagelberg writes: > When using the function `cd' with a relative path and the $CDPATH > environment variable set, it will expand the value of $CDPATH once and > save off that expansion for future use. This causes all calls with > relative paths to fail when run from a different directory. > > This reproduces the problem using eshell, but the bug affects any caller > of the `cd' function, not just eshell. However, it does not affect M-x > cd, which will always use absolute paths. > > CDPATH=.:$HOME/src emacs -Q > M-x eshell > cd / > cd tmp > No such directory found via CDPATH environment variable: tmp > > This happens because of this snippet inside the `cd' function: > > (unless cd-path > (setq cd-path (or (parse-colon-path (getenv "CDPATH")) > (list "./")))) Yup. Thanks for the detailed analysis. This should now be fixed in Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 07 06:51:38 2021 Received: (at control) by debbugs.gnu.org; 7 Aug 2021 10:51:38 +0000 Received: from localhost ([127.0.0.1]:52026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCJvW-0002zL-Aw for submit@debbugs.gnu.org; Sat, 07 Aug 2021 06:51:38 -0400 Received: from quimby.gnus.org ([95.216.78.240]:46192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCJvU-0002yr-K6 for control@debbugs.gnu.org; Sat, 07 Aug 2021 06:51:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nF4hGvxJdEodKq7wJnZZwwhl7eW4vM/b5ZEnS5IncWM=; b=f0/VdpyOaQpYdvfFv1IDuwSYnP K3ibXcHnnDACZpnuF8kBqtdj48k0jB8MsbFkYxQheLbWV0kXK5kB43xCw8avcYxitK7j+qEBc8K+o yweqwPb3mSfvfGPUagb129Gy238KHhKyr3Ah6PwlqoKGWv8MqRkt4bo78FjrJS54DwXM=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mCJvM-0006tF-Rn for control@debbugs.gnu.org; Sat, 07 Aug 2021 12:51:30 +0200 Date: Sat, 07 Aug 2021 12:51:28 +0200 Message-Id: <87v94h7cjz.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #49918 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 49918 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 49918 28.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 07 08:17:26 2021 Received: (at 49918) by debbugs.gnu.org; 7 Aug 2021 12:17:26 +0000 Received: from localhost ([127.0.0.1]:52129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCLGY-0003Fk-IA for submit@debbugs.gnu.org; Sat, 07 Aug 2021 08:17:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCLGV-0003FW-9A for 49918@debbugs.gnu.org; Sat, 07 Aug 2021 08:17:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:53422) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mCLGP-0007MT-H0; Sat, 07 Aug 2021 08:17:17 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2381 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCLGP-0003ed-3k; Sat, 07 Aug 2021 08:17:17 -0400 Date: Sat, 07 Aug 2021 15:17:18 +0300 Message-Id: <835ywhih4h.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87wnox7ck5.fsf@gnus.org> (message from Lars Ingebrigtsen on Sat, 07 Aug 2021 12:51:22 +0200) Subject: Re: bug#49918: 28.0.50; cd function expands CDPATH incorrectly References: <87lf5eyrvx.fsf@hagelb.org> <87wnox7ck5.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49918 Cc: phil@hagelb.org, 49918@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Date: Sat, 07 Aug 2021 12:51:22 +0200 > Cc: 49918@debbugs.gnu.org > > > This happens because of this snippet inside the `cd' function: > > > > (unless cd-path > > (setq cd-path (or (parse-colon-path (getenv "CDPATH")) > > (list "./")))) > > Yup. Thanks for the detailed analysis. > > This should now be fixed in Emacs 28. Why does the current implementation of parse-colon-path use expand-file-name? The comment says "to expand "~", but the original implementation in Emacs 27 didn't do that. Bug#21454 only wanted to avoid mis-interpreting duplicate slashes in the input path, but there's no need to collapse them, so I don't see how the call to expand-file-name is at all necessary, and could potentially change behavior in unintended ways. Am I missing something? From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 07 11:50:50 2021 Received: (at 49918) by debbugs.gnu.org; 7 Aug 2021 15:50:50 +0000 Received: from localhost ([127.0.0.1]:53037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCOb3-0000oJ-UP for submit@debbugs.gnu.org; Sat, 07 Aug 2021 11:50:50 -0400 Received: from aye.elm.relay.mailchannels.net ([23.83.212.6]:19592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCOay-0000o6-43 for 49918@debbugs.gnu.org; Sat, 07 Aug 2021 11:50:48 -0400 X-Sender-Id: dreamhost|x-authsender|phil@hagelb.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D31BF121FC6; Sat, 7 Aug 2021 15:50:42 +0000 (UTC) Received: from pdx1-sub0-mail-a56.g.dreamhost.com (100-96-16-191.trex.outbound.svc.cluster.local [100.96.16.191]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 5C51C122057; Sat, 7 Aug 2021 15:50:40 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|phil@hagelb.org Received: from pdx1-sub0-mail-a56.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.16.191 (trex/6.3.3); Sat, 07 Aug 2021 15:50:42 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|phil@hagelb.org X-MailChannels-Auth-Id: dreamhost X-Bored-Rock: 7da17b9c03c76aed_1628351442515_1338386773 X-MC-Loop-Signature: 1628351442515:1658678419 X-MC-Ingress-Time: 1628351442515 Received: from pdx1-sub0-mail-a56.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a56.g.dreamhost.com (Postfix) with ESMTP id 09B147F097; Sat, 7 Aug 2021 08:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=hagelb.org; h=references :from:to:cc:subject:in-reply-to:date:message-id:mime-version :content-type; s=hagelb.org; bh=CBvQLv6FXKvhpUW2M/ZMUgDYveo=; b= xDbGBMFecmJkOc6f3O+pP4gXQtdhkCU0yxaf2TA2MGeralkmfTb5a3HAZnMOjWhw QWj7uymRs/nZkyc4bKJN0txJUQ6eLpgJeXi9nLKrOI3KaFMlFJ1waxZ4eEgfD57u 3sIRFIm03Op7zgYwQOtxbT+gWBa1JY7oKU+U1UDNTRs= Received: from reform (174-21-73-225.tukw.qwest.net [174.21.73.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: phil@hagelb.org) by pdx1-sub0-mail-a56.g.dreamhost.com (Postfix) with ESMTPSA id 6E1897EF8C; Sat, 7 Aug 2021 08:50:39 -0700 (PDT) References: <87lf5eyrvx.fsf@hagelb.org> <87wnox7ck5.fsf@gnus.org> <835ywhih4h.fsf@gnu.org> User-agent: mu4e 1.4.15; emacs 28.0.50 X-DH-BACKEND: pdx1-sub0-mail-a56 From: Phil Hagelberg To: Eli Zaretskii Subject: Re: bug#49918: 28.0.50; cd function expands CDPATH incorrectly In-reply-to: <835ywhih4h.fsf@gnu.org> Date: Sat, 07 Aug 2021 08:50:37 -0700 Message-ID: <87o8a9w8xe.fsf@hagelb.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 49918 Cc: Lars Ingebrigtsen , 49918@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Lars Ingebrigtsen >> Date: Sat, 07 Aug 2021 12:51:22 +0200 >> Cc: 49918@debbugs.gnu.org >>=20 >> > This happens because of this snippet inside the `cd' function: >> > >> > (unless cd-path >> > (setq cd-path (or (parse-colon-path (getenv "CDPATH")) >> > (list "./")))) >>=20 >> Yup. Thanks for the detailed analysis. >>=20 >> This should now be fixed in Emacs 28. Thanks for the fix! I can confirm it does solve the problem. > Why does the current implementation of parse-colon-path use > expand-file-name? The comment says "to expand "~", but the original > implementation in Emacs 27 didn't do that. > > Bug#21454 only wanted to avoid mis-interpreting duplicate slashes in > the input path, but there's no need to collapse them, so I don't see > how the call to expand-file-name is at all necessary, and could > potentially change behavior in unintended ways. Am I missing > something? I have to agree I don't understand the logic of the patch that added the `expand-file-name' call. It doesn't seem related to the bug it was intended to fix. It's certainly not necessary from the context of `parse-colon-path' being called from `cd' but I didn't take the time to examine other callers to see if it would be relevant from those contexts. But it's not unreasonable to assume that expansion should happen downstream of the call to `parse-colon-path'. =2DPhil --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJEBAEBCgAuFiEEjyyF/8HrwBajtoPei9OMKMz9LaYFAmEOq80QHHBoaWxAaGFn ZWxiLm9yZwAKCRCL04wozP0tpoxnD/4se9fVhrIzkIs9gb4/rRJyrLZJ88W1xZGd /wEgL4P/c0l55vredvLR+74mgQGKbwtYkU4WPpYrhwPU/v+aSCW/twTH2on3pzhf QDjZYwMNFY/msrQeq2VQLkvv1xBkknYylgdgW8HNSyk9qRFznc9KxKjsozB87+lY rJ+y5NeKj/YMi6HDkUzTM4XTYWwz+RTRKF5+43jQcfe0nhQ/ONojrQD7j78Rluur oo28ddNiXR39SC2+JtIu++j5KIdnCY5lx9AGIgEHuBKikbx3L9rBoAImOBpWRJFK vfCY4vqv9SJRM6ZsyTrk7MasW84omk7s7H2uG6DU+Mw4OgjAPA2FxqGcLPMl+uG/ dXHm/0TV514V4ayMt2FTFJDrCrljrX/I+XAKF1ugYOqY22Y3x5D0/DTF9vjhnp4a KwX0P9dgTCOpujXyPsnk+n5bwkQSK3T992gw9O2k6wbRppbp9itSTkgH3rPclVaa 8mLn75eC7KKTPgpFRd01Oy4VUsg2/ZBu3+RumZ8KThoIoDndnWTOkC62fJXaeuzE eMgEBA+3s6+SJJnM5Od3SCstIFfNcM0bLsz1Tam8N5pcUpxCLGZU2KqcustWCxyG aUE0+TY7LEAH7CvVoI8xgrA3tD87YOpfgRMCNI3eqbdikEsZ5gUdxJVr+mwb5ARQ 4VUeXDb1Ww== =JOsC -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 08 08:43:00 2021 Received: (at 49918) by debbugs.gnu.org; 8 Aug 2021 12:43:01 +0000 Received: from localhost ([127.0.0.1]:53786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCi8q-0002Gg-MB for submit@debbugs.gnu.org; Sun, 08 Aug 2021 08:43:00 -0400 Received: from quimby.gnus.org ([95.216.78.240]:55990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCi8n-0002GR-4H for 49918@debbugs.gnu.org; Sun, 08 Aug 2021 08:42:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2cVryAC1ddIrVfyAo/aVIHMB2Ffdnk3GiZcd1CGAS+8=; b=PaZ+mWWBYU0UxqOUIvSvew3sQ7 X1HiV2wk74aLneq9Od9Lfu0pKa0aojm0UyA1xVW6oCZZFYjEq9+44Amwf7ptfci94pOANWVTtyZy+ WQT5cMrhmlFcDN9Q2BvuTUulkBwTRHe6KTXMlqNM0K91W1kj3XpVAwMXFL7XD5kYWBxk=; Received: from [84.212.220.105] (helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mCi8d-0002BU-Er; Sun, 08 Aug 2021 14:42:50 +0200 From: Lars Ingebrigtsen To: Eli Zaretskii Subject: Re: bug#49918: 28.0.50; cd function expands CDPATH incorrectly References: <87lf5eyrvx.fsf@hagelb.org> <87wnox7ck5.fsf@gnus.org> <835ywhih4h.fsf@gnu.org> Date: Sun, 08 Aug 2021 14:42:46 +0200 In-Reply-To: <835ywhih4h.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 07 Aug 2021 15:17:18 +0300") Message-ID: <87v94g5cqh.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: > Why does the current implementation of parse-colon-path use > expand-file-name? The comment says "to expand "~", but the original > implementation in Emacs 27 didn't do that. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49918 Cc: phil@hagelb.org, 49918@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Why does the current implementation of parse-colon-path use > expand-file-name? The comment says "to expand "~", but the original > implementation in Emacs 27 didn't do that. I should probably have written (etc) after that comment... > Bug#21454 only wanted to avoid mis-interpreting duplicate slashes in > the input path, but there's no need to collapse them, so I don't see > how the call to expand-file-name is at all necessary, and could > potentially change behavior in unintended ways. Am I missing > something? Tino's tests in files-tests-bug-21454 test explicitly for the duplicate slash collapsing, so I assumed that was part of the point. But I may well be mistaken -- feel free to adjust this some more. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 08 10:32:32 2021 Received: (at 49918) by debbugs.gnu.org; 8 Aug 2021 14:32:32 +0000 Received: from localhost ([127.0.0.1]:54692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCjqq-00053h-G4 for submit@debbugs.gnu.org; Sun, 08 Aug 2021 10:32:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCjql-00053R-3l for 49918@debbugs.gnu.org; Sun, 08 Aug 2021 10:32:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36812) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mCjqf-0004Ej-0E; Sun, 08 Aug 2021 10:32:21 -0400 Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2004 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCjqc-00028R-Dl; Sun, 08 Aug 2021 10:32:20 -0400 Date: Sun, 08 Aug 2021 17:32:23 +0300 Message-Id: <83lf5cgg7c.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen In-Reply-To: <87v94g5cqh.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 08 Aug 2021 14:42:46 +0200) Subject: Re: bug#49918: 28.0.50; cd function expands CDPATH incorrectly References: <87lf5eyrvx.fsf@hagelb.org> <87wnox7ck5.fsf@gnus.org> <835ywhih4h.fsf@gnu.org> <87v94g5cqh.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49918 Cc: phil@hagelb.org, 49918@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Lars Ingebrigtsen > Cc: phil@hagelb.org, 49918@debbugs.gnu.org > Date: Sun, 08 Aug 2021 14:42:46 +0200 > > Eli Zaretskii writes: > > > Why does the current implementation of parse-colon-path use > > expand-file-name? The comment says "to expand "~", but the original > > implementation in Emacs 27 didn't do that. > > I should probably have written (etc) after that comment... > > > Bug#21454 only wanted to avoid mis-interpreting duplicate slashes in > > the input path, but there's no need to collapse them, so I don't see > > how the call to expand-file-name is at all necessary, and could > > potentially change behavior in unintended ways. Am I missing > > something? > > Tino's tests in files-tests-bug-21454 test explicitly for the duplicate > slash collapsing, so I assumed that was part of the point. But I may > well be mistaken -- feel free to adjust this some more. Done. I don't think we should collapse slashes except the leading one, it isn't something this function should do, and is not in its documentation. From unknown Sun Jun 22 07:34:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 06 Sep 2021 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator