From: Richard Copley <rcopley@gmail.com>
To: 57353@debbugs.gnu.org
Subject: bug#57353: [PATCH] Fix parse-colon-path with UNC directory names
Date: Tue, 23 Aug 2022 12:34:02 +0100 [thread overview]
Message-ID: <CAPM58ojNvj3LDx0X6x4jkUEpKugyNqRDvHTaiJtAfukOdpushQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 589 bytes --]
The function `parse-colon-path' changes the leading double slash
in a UNC path component to a single slash:
(let path (mapconcat path-separator "one" "//server/share/dir")
(parse-colon-path path))
## -> ("one" "/server/share/dir")
A comment in `parse-colon-path' says:
;; Previous implementation used `substitute-in-file-name'
;; which collapse multiple "/" in front. Do the same for
;; backward compatibility.
However, `substitute-in-file-name' does not do that:
(substitute-in-file-name "//foo/a/b") // -> "//foo/a/b"
There's no reason to do it in `parse-colon-path' either.
[-- Attachment #2: 0001-Fix-parse-colon-path-with-UNC-directory-names.patch --]
[-- Type: text/plain, Size: 1323 bytes --]
From 55eb8c37eeabf11f9fc1ec1f84c64fc234ecf59f Mon Sep 17 00:00:00 2001
From: Richard Copley <rcopley@gmail.com>
Date: Tue, 23 Aug 2022 12:11:20 +0100
Subject: [PATCH] Fix parse-colon-path with UNC directory names
* lisp/files.el (parse-colon-path): don't collapse multiple / at
beginning of path component
---
lisp/files.el | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index cf2a522193..569fd0224e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -853,13 +853,8 @@ nil (meaning `default-directory') as the associated list element."
(when (stringp search-path)
(let ((spath (substitute-env-vars search-path)))
(mapcar (lambda (f)
- (if (equal "" f) nil
- (let ((dir (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))))
+ (unless (equal "" f)
+ (file-name-as-directory f)))
(split-string spath path-separator)))))
(defun cd-absolute (dir)
--
2.37.0.windows.1
next reply other threads:[~2022-08-23 11:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 11:34 Richard Copley [this message]
2022-08-23 13:21 ` bug#57353: [PATCH] Fix parse-colon-path with UNC directory names Eli Zaretskii
2022-08-24 14:15 ` Richard Copley
2022-08-24 14:15 ` Eli Zaretskii
2022-08-24 14:23 ` Richard Copley
2022-08-24 16:21 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPM58ojNvj3LDx0X6x4jkUEpKugyNqRDvHTaiJtAfukOdpushQ@mail.gmail.com \
--to=rcopley@gmail.com \
--cc=57353@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).