From unknown Fri Jun 20 07:26:41 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#57353 <57353@debbugs.gnu.org> To: bug#57353 <57353@debbugs.gnu.org> Subject: Status: [PATCH] Fix parse-colon-path with UNC directory names Reply-To: bug#57353 <57353@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:26:41 +0000 retitle 57353 [PATCH] Fix parse-colon-path with UNC directory names reassign 57353 emacs submitter 57353 Richard Copley severity 57353 normal tag 57353 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 23 07:34:36 2022 Received: (at submit) by debbugs.gnu.org; 23 Aug 2022 11:34:36 +0000 Received: from localhost ([127.0.0.1]:42819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQSB1-0008Gt-SK for submit@debbugs.gnu.org; Tue, 23 Aug 2022 07:34:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:44636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQSB0-0008Gk-CY for submit@debbugs.gnu.org; Tue, 23 Aug 2022 07:34:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQSAy-0002Yb-HA for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 07:34:34 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:34362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQSAw-0001pQ-U7 for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 07:34:32 -0400 Received: by mail-ed1-x536.google.com with SMTP id z2so17647941edc.1 for ; Tue, 23 Aug 2022 04:34:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc; bh=qI3UsqsGtdxK3wOiVX3JlsrRMsVNEjYZKKfalsMiZIs=; b=RgpmZZ2poHJR4bwaEr+B8SpT87/ycNA1PPJcK0sK1N5rPL/zJ6wnOYl2UXqfaaFwmA wHpQsDntz9jnytLL0/WLKulK7tAC2AjWLZcZhXsdpLyeUZDlSYnH+Gupqoop9HlvVgJy wMpsrlCIaPL4w5zV30ku4V0VokLso7sZScpnO/cO8UUHslJOEZwmUpZJOK28PfIgBuPD ph4CsyQCYpFLMbzi5dFlUX9bhI49wXF//iHmkmpt6Vt5q1kois6PisYxtnD19YsgkP7P NbqNy9cQ3BTuTuHhQgBfne6FTOvUJwfVjgEx58SOwapPCiBO+z+sM1oj2Huxn4pizzUh Np5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc; bh=qI3UsqsGtdxK3wOiVX3JlsrRMsVNEjYZKKfalsMiZIs=; b=zojVZ2dmQnK4VfXSxTA+ym83hvGRtlg3qdNykrkx+U3K5HjYGqU2rXqZlIQyaj1R7j L5QsuziV2V0vthYApMiJD+O+1zCNbmHZ4mcXrsYiwmqHlPhy5zT1szN2pGv2HOeJPf2Q XH8SmrUDtQrPUYItOK8ehHDllIYJSDj0EnFJAPfFylIiOMC2spqttr9pmudPv05DapmO 71vaWdnfEijJHRlVtWFguhCaXpTJI9dHQ7kKDTwm1Rpjj5tDJgnD3eWfucuzFdmAqm6l K93TjYrBGlGzuSoTHIOQP2g5+dRC6aD/BOquu0xyWgCx+cVaiDmRarWJ0totRN/yxBF2 aSFg== X-Gm-Message-State: ACgBeo1+btzARTeP9kkwf9DJLxO77MtKITeJDf6L93qjM4mfXgyeVSNJ 9ORrTm4KJXfx0I24rLZetbAmhyJ4lf2v9hXTFi3xdp4qp+8= X-Google-Smtp-Source: AA6agR4qOh6+sr4YAsNjVN8FBtrq5a6c16FW/oJ9VweF2QvXuYuftteKuuEf1GRBMkt58iBj+d3ciNsyt9NyGqZbxc0= X-Received: by 2002:a05:6402:5190:b0:447:284c:b3a9 with SMTP id q16-20020a056402519000b00447284cb3a9mr1463170edd.428.1661254468522; Tue, 23 Aug 2022 04:34:28 -0700 (PDT) MIME-Version: 1.0 From: Richard Copley Date: Tue, 23 Aug 2022 12:34:02 +0100 Message-ID: Subject: [PATCH] Fix parse-colon-path with UNC directory names To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="0000000000007a77c205e6e6f294" Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=rcopley@gmail.com; helo=mail-ed1-x536.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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.3 (--) --0000000000007a77c205e6e6f294 Content-Type: text/plain; charset="UTF-8" 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. --0000000000007a77c205e6e6f294 Content-Type: text/plain; charset="US-ASCII"; name="0001-Fix-parse-colon-path-with-UNC-directory-names.patch" Content-Disposition: attachment; filename="0001-Fix-parse-colon-path-with-UNC-directory-names.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l763zo2m0 RnJvbSA1NWViOGMzN2VlYWJmMTFmOWZjMWVjMWY4NGM2NGZjMjM0ZWNmNTlmIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBSaWNoYXJkIENvcGxleSA8cmNvcGxleUBnbWFpbC5jb20+CkRh dGU6IFR1ZSwgMjMgQXVnIDIwMjIgMTI6MTE6MjAgKzAxMDAKU3ViamVjdDogW1BBVENIXSBGaXgg cGFyc2UtY29sb24tcGF0aCB3aXRoIFVOQyBkaXJlY3RvcnkgbmFtZXMKCiogbGlzcC9maWxlcy5l bCAocGFyc2UtY29sb24tcGF0aCk6IGRvbid0IGNvbGxhcHNlIG11bHRpcGxlIC8gYXQKYmVnaW5u aW5nIG9mIHBhdGggY29tcG9uZW50Ci0tLQogbGlzcC9maWxlcy5lbCB8IDkgKystLS0tLS0tCiAx IGZpbGUgY2hhbmdlZCwgMiBpbnNlcnRpb25zKCspLCA3IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdp dCBhL2xpc3AvZmlsZXMuZWwgYi9saXNwL2ZpbGVzLmVsCmluZGV4IGNmMmE1MjIxOTMuLjU2OWZk MDIyNGUgMTAwNjQ0Ci0tLSBhL2xpc3AvZmlsZXMuZWwKKysrIGIvbGlzcC9maWxlcy5lbApAQCAt ODUzLDEzICs4NTMsOCBAQCBuaWwgKG1lYW5pbmcgYGRlZmF1bHQtZGlyZWN0b3J5JykgYXMgdGhl IGFzc29jaWF0ZWQgbGlzdCBlbGVtZW50LiIKICAgKHdoZW4gKHN0cmluZ3Agc2VhcmNoLXBhdGgp CiAgICAgKGxldCAoKHNwYXRoIChzdWJzdGl0dXRlLWVudi12YXJzIHNlYXJjaC1wYXRoKSkpCiAg ICAgICAobWFwY2FyIChsYW1iZGEgKGYpCi0gICAgICAgICAgICAgICAgKGlmIChlcXVhbCAiIiBm KSBuaWwKLSAgICAgICAgICAgICAgICAgIChsZXQgKChkaXIgKGZpbGUtbmFtZS1hcy1kaXJlY3Rv cnkgZikpKQotICAgICAgICAgICAgICAgICAgICA7OyBQcmV2aW91cyBpbXBsZW1lbnRhdGlvbiB1 c2VkIGBzdWJzdGl0dXRlLWluLWZpbGUtbmFtZScKLSAgICAgICAgICAgICAgICAgICAgOzsgd2hp Y2ggY29sbGFwc2UgbXVsdGlwbGUgIi8iIGluIGZyb250LiAgRG8gdGhlIHNhbWUgZm9yCi0gICAg ICAgICAgICAgICAgICAgIDs7IGJhY2t3YXJkIGNvbXBhdGliaWxpdHkuCi0gICAgICAgICAgICAg ICAgICAgIChpZiAoc3RyaW5nLW1hdGNoICJcXGAvKyIgZGlyKQotICAgICAgICAgICAgICAgICAg ICAgICAgKHN1YnN0cmluZyBkaXIgKDEtIChtYXRjaC1lbmQgMCkpKSBkaXIpKSkpCisgICAgICAg ICAgICAgICAgKHVubGVzcyAoZXF1YWwgIiIgZikKKyAgICAgICAgICAgICAgICAgIChmaWxlLW5h bWUtYXMtZGlyZWN0b3J5IGYpKSkKICAgICAgICAgICAgICAgKHNwbGl0LXN0cmluZyBzcGF0aCBw YXRoLXNlcGFyYXRvcikpKSkpCiAKIChkZWZ1biBjZC1hYnNvbHV0ZSAoZGlyKQotLSAKMi4zNy4w LndpbmRvd3MuMQoK --0000000000007a77c205e6e6f294-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 23 09:21:18 2022 Received: (at 57353) by debbugs.gnu.org; 23 Aug 2022 13:21:18 +0000 Received: from localhost ([127.0.0.1]:42950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQTqH-0002ZX-Nm for submit@debbugs.gnu.org; Tue, 23 Aug 2022 09:21:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47528) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQTqG-0002ZI-Vx for 57353@debbugs.gnu.org; Tue, 23 Aug 2022 09:21:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQTqB-0005Wu-LM; Tue, 23 Aug 2022 09:21:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SnGF5AgbBhYGHhJMvPP13ek8yIM+QbdWsLWRIYI/DRU=; b=EuvABS4YR0Zw tkWq4ptOgDjA+1FmPPPhNuapMPYVDlGbyHVE0lH9yFAW2Tx+4r5BwUbaWnWPI15FsjyMTYwKmRDTF +OL6mlofxviVG1XSy5Ifbegbg2RfoDsffC2XFQysZFXZMcuCshIEA5FWzb33Vg6TGxB/OP6cexYL1 rQfEBbhsS3MbJ3P0wNvaOk0fPCSeKpRXqb/OWBVXpph8GxB0/o2NCzVfakfkY/Ab4BzSWGHo2LJQ4 lZuEQo2PrtW7qJj0uLxabppZScTROl2YNJV8sxN/Qw6zwXMH2ObKQ1l/SZAOSXsHpSBeIwgcJ7M3n WatUcpklx7qOqhR6okhLhg==; Received: from [87.69.77.57] (port=2754 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 1oQTqB-0002ZP-4S; Tue, 23 Aug 2022 09:21:11 -0400 Date: Tue, 23 Aug 2022 16:21:17 +0300 Message-Id: <83bksb859u.fsf@gnu.org> From: Eli Zaretskii To: Richard Copley In-Reply-To: (message from Richard Copley on Tue, 23 Aug 2022 12:34:02 +0100) Subject: Re: bug#57353: [PATCH] Fix parse-colon-path with UNC directory names References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 57353 Cc: 57353@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: Richard Copley > Date: Tue, 23 Aug 2022 12:34:02 +0100 > > 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" That is true, but: (substitute-in-file-name "///foo/a/b") => "//foo/a/b" So it does collapse multiple "/", at least sometimes. Moreover, the above is on MS-Windows, but on GNU/Linux: (substitute-in-file-name "///foo/a/b") => "/foo/a/b" So (a) this is system-dependent, and (b) substitute-in-file-name does collapse multiple slashes, but preserves UNCs on MS-Windows. Therefore, your patch needs some (minor) amendments. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 24 10:15:36 2022 Received: (at 57353) by debbugs.gnu.org; 24 Aug 2022 14:15:36 +0000 Received: from localhost ([127.0.0.1]:47582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQrAO-0006pj-6U for submit@debbugs.gnu.org; Wed, 24 Aug 2022 10:15:36 -0400 Received: from mail-ej1-f45.google.com ([209.85.218.45]:46765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQrAM-0006pT-7G for 57353@debbugs.gnu.org; Wed, 24 Aug 2022 10:15:34 -0400 Received: by mail-ej1-f45.google.com with SMTP id bj12so16765485ejb.13 for <57353@debbugs.gnu.org>; Wed, 24 Aug 2022 07:15:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=1BeedCnLtD9SguQZr9N5vvMzxCEaKllcyRiSnynIgD4=; b=h+PX8/FP28WHXGdOewJMGjKjBixBcUllPnbathv2L362/KjWo0CfUd593z295sUZur bOBZSPXsC5ZjBq2eaoNIKZoKGPgrehJU0TJgDc9p0YI0N1apOtXwNhHkXPN0TiQ++kDZ rPI4lKFVvRxpXsN26HJ6Uw3vQXK0fhj4q9I6dRTQ+3VVEmIs1DiyqE3kETTjKBKRcAzc WocfAhAEK0eC1GNyhuXK1BAdKbGWm4ufYD/k/aoi6XoebmpfoFuTNe5nSEIUNPsc13/S xgETxOxRenY2PsAoDBjQYKBcVpNzoVJu3r2MAmxcUGSvKagZ1176BXl7fOMfyfJqhtOM eIgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=1BeedCnLtD9SguQZr9N5vvMzxCEaKllcyRiSnynIgD4=; b=NaSOgKHyD175CzAARKr4I2Y4fIKYmk0YzNrDhvwqQly6vg6Fe+7If0GUnPsAsKG/L+ g+HVo5J9wiWHqSWl7fiqsfRqb64tTGXpeVm5LJ36gQvhIE+WR96Bv3S4bWVv+kh1kcKw AOgo57ed7oYMK2S/fRrDQob2o9yEIQqeE59UdQiESUdAaf75zk9hG1W7Dwgd+C4UTDqz Uh4elrcSj+0UnYrKvO5gmj2uIzOPDZhNeJlCwW2jLiXMHBpv33K8/+8vLk7Jg8hB2gPi FGWsEtzNFPlZnZ3I/CqrA8TDd9CvoKvOOHWD47rjd7udqlqH7gw7abNqS7umNtj7+xkY 8smQ== X-Gm-Message-State: ACgBeo2I7j7n/qZLmaRxGvT0Ym/GI2XZM3RPv5wUjuXIdSTjr8SykqFA OwPLivdUz9H6z2D5DlU3AvIq3Lc52y6BYCv2AO3L/VRIh5Y= X-Google-Smtp-Source: AA6agR6ZwZcWjprV/81qFfnxdm7tJV1ij0F/VOZehLeLRzCsY4ekvBGPoKM/4udnf65Zo8Kxexw6cSZqQdVEIdlWXck= X-Received: by 2002:a17:907:868a:b0:73d:6ec5:82bb with SMTP id qa10-20020a170907868a00b0073d6ec582bbmr3094471ejc.225.1661350528233; Wed, 24 Aug 2022 07:15:28 -0700 (PDT) MIME-Version: 1.0 References: <83bksb859u.fsf@gnu.org> In-Reply-To: <83bksb859u.fsf@gnu.org> From: Richard Copley Date: Wed, 24 Aug 2022 15:15:02 +0100 Message-ID: Subject: Re: bug#57353: [PATCH] Fix parse-colon-path with UNC directory names To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57353 Cc: 57353@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 (-) On Tue, 23 Aug 2022 at 14:21, Eli Zaretskii wrote: > > > From: Richard Copley > > Date: Tue, 23 Aug 2022 12:34:02 +0100 > > > > 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" > > That is true, but: > > (substitute-in-file-name "///foo/a/b") => "//foo/a/b" > > So it does collapse multiple "/", at least sometimes. Moreover, the > above is on MS-Windows, but on GNU/Linux: > > (substitute-in-file-name "///foo/a/b") => "/foo/a/b" > > So (a) this is system-dependent, and (b) substitute-in-file-name does > collapse multiple slashes, but preserves UNCs on MS-Windows. > > Therefore, your patch needs some (minor) amendments. If the goal is to be backward-compatible with substitute-in-file-name, we should do everything that function does, which is quite involved, and involves configuration that is not available to lisp. Easier to just revert the commits. But that wasn't the goal, see #21454. Tino doesn't explain why the particular case of multiple slashes at the start of a path component is any different from the other cases of multiple slashes, which are no longer changed. I'm afraid I don't understand the point of it. I'll apply a workaround locally, and leave it up to the developers to decide what to do, if anything. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 24 10:15:57 2022 Received: (at 57353) by debbugs.gnu.org; 24 Aug 2022 14:15:57 +0000 Received: from localhost ([127.0.0.1]:47589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQrAi-0006qR-Sc for submit@debbugs.gnu.org; Wed, 24 Aug 2022 10:15:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36886) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQrAd-0006q2-CV for 57353@debbugs.gnu.org; Wed, 24 Aug 2022 10:15:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37264) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQrAY-0002fu-0n; Wed, 24 Aug 2022 10:15:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9qcd6V7OqsPsvV45EhHj4ZHZDFV6PP8xLweA6S9RAO4=; b=h2RdZEfihl2a 7eCKox9vgEy+RG9uwYp/bRQYn5xWzihYtL3rSkhAFmWNcAVLSg42ZCj86Kepp4jmKoDg4R/Woln38 x0z3phXSLOtKmckR/1w2b/YXMXZFQSy6x+9nbo4H9eWPKAyGEYDTAXUKNEcrpIMQPpNJFHz6Ua966 a7HYQWQlj0If1aHQsvmyhA7rfwbXMI0vffMyZssXETK8JDDPwHvaEJp0nyOeaRzG4BcWFoCkNwvGJ Uoo5kunBOtM5HecRUjpTVzFLQtyqzjkkf8I4H8bQfKyxiunKUc5mtfHpM9/BqvqPdQ0ueqYCo4k4Z fnhYYF8u9zm2rV8gBK/I/Q==; Received: from [87.69.77.57] (port=3473 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 1oQrAX-0002g6-C5; Wed, 24 Aug 2022 10:15:45 -0400 Date: Wed, 24 Aug 2022 17:15:53 +0300 Message-Id: <83fshl682u.fsf@gnu.org> From: Eli Zaretskii To: rcopley@gmail.com In-Reply-To: <83bksb859u.fsf@gnu.org> (message from Eli Zaretskii on Tue, 23 Aug 2022 16:21:17 +0300) Subject: Re: bug#57353: [PATCH] Fix parse-colon-path with UNC directory names References: <83bksb859u.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 57353 Cc: 57353@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 (---) > Cc: 57353@debbugs.gnu.org > Date: Tue, 23 Aug 2022 16:21:17 +0300 > From: Eli Zaretskii > > > From: Richard Copley > > Date: Tue, 23 Aug 2022 12:34:02 +0100 > > > > 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" > > That is true, but: > > (substitute-in-file-name "///foo/a/b") => "//foo/a/b" > > So it does collapse multiple "/", at least sometimes. Moreover, the > above is on MS-Windows, but on GNU/Linux: > > (substitute-in-file-name "///foo/a/b") => "/foo/a/b" > > So (a) this is system-dependent, and (b) substitute-in-file-name does > collapse multiple slashes, but preserves UNCs on MS-Windows. > > Therefore, your patch needs some (minor) amendments. Does the patch below give good results in your use cases? diff --git a/lisp/files.el b/lisp/files.el index 8596d9a..26730df 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -856,10 +856,16 @@ parse-colon-path (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)))) + ;; which collapses multiple "/" in front, while + ;; preserving double slash where it matters. Do + ;; the same for backward compatibility. + (if (string-match "\\`//+" dir) + (substring dir + (- (match-end 0) + (if (memq system-type + '(windows-nt 'cygwin 'ms-dos)) + 2 1))) + dir)))) (split-string spath path-separator))))) (defun cd-absolute (dir) From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 24 10:24:31 2022 Received: (at 57353) by debbugs.gnu.org; 24 Aug 2022 14:24:31 +0000 Received: from localhost ([127.0.0.1]:47611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQrJ0-00074p-Nj for submit@debbugs.gnu.org; Wed, 24 Aug 2022 10:24:30 -0400 Received: from mail-ej1-f46.google.com ([209.85.218.46]:33574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQrIy-00074b-4H for 57353@debbugs.gnu.org; Wed, 24 Aug 2022 10:24:29 -0400 Received: by mail-ej1-f46.google.com with SMTP id j21so28449003ejs.0 for <57353@debbugs.gnu.org>; Wed, 24 Aug 2022 07:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=XDmj936pXfT1HOXMOOAkPXlmWZx12E4JjK5gUeJltKY=; b=BD5VNuDmbgkVm07w+Cam0B8j935r/XmSODOza82NLf53Dr29PTFhS6A1ZKAFjd1VhH 0kpDFdlBnU0UTHtezBbDweMCR2mux/c7spnyK5JIxlUcTSdZRcFhBjiHu7+G/SVCBgVs AweJQzQrUc4h+lKUEiCdZdEUBjLZZ1c1cbiYWSHO6VZNoY2AIF/oDPnfupDVfLiSRsd6 kKrbI0YIHLs4qniwcbo8aeHXueX1/2vbWzSCE6Qd+71xqpnjeH23XIBbqygPDyfkNVkf WuGtt3TXFaXt7llcTCag6DwZVvmLU9hwuJWIs7lZO21JtAFi1qANGCVE/Z13NE7ra4lb F5iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=XDmj936pXfT1HOXMOOAkPXlmWZx12E4JjK5gUeJltKY=; b=oZoB0gRIETw3WJ+U6iDuhBrQg2TR8D8TNpFGXxi+yTgM7RqLJjiJeW51EJ7cpbUvra 5TQoxioWAh9KUwoVMbhISZ4jjjIK7uCqtklUSZ8YqxqQ1TsDBmwqlIAEO0xFGqtQOVB4 I9J0EwE8YGYOYbCw+iOO5b4KS798NdCx+cVwPNE7sWOf8KNwiFc80CoSOT/XhucnCFBm 7yx7scFRIwq98QRPcwe7A/GBFCvHIqPXnY/3GxC3sNGUEtPiqbhLYeH8M9Dlc4Vx1gZh pbgTLADiidz7P3I0BeV2zGhPorxK8HMrRXYClE1y1HPmyZCTsmuhVBx9TnT8pPBYqANe akog== X-Gm-Message-State: ACgBeo3qRgbL4jwhO/X7fPJ+RMvP9l0T3TpPqtGmAYNPyo644HKe/R+Y AxOgV7fofFRMAqo09uQdY8PKCcZzhwJXukmQRkU= X-Google-Smtp-Source: AA6agR52eeWlkl0FAU5ZSp7+wtU3nRZckNbGRCsMhkyyzCqXxYz0fZXloSOgLg8iIva5GtMgoc1vjVSOlF1o7KouNBY= X-Received: by 2002:a17:907:3e81:b0:726:9615:d14d with SMTP id hs1-20020a1709073e8100b007269615d14dmr2916162ejc.517.1661351062310; Wed, 24 Aug 2022 07:24:22 -0700 (PDT) MIME-Version: 1.0 References: <83bksb859u.fsf@gnu.org> <83fshl682u.fsf@gnu.org> In-Reply-To: <83fshl682u.fsf@gnu.org> From: Richard Copley Date: Wed, 24 Aug 2022 15:23:56 +0100 Message-ID: Subject: Re: bug#57353: [PATCH] Fix parse-colon-path with UNC directory names To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 57353 Cc: 57353@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 (-) On Wed, 24 Aug 2022 at 15:15, Eli Zaretskii wrote: > > Does the patch below give good results in your use cases? > > diff --git a/lisp/files.el b/lisp/files.el > index 8596d9a..26730df 100644 > --- a/lisp/files.el > +++ b/lisp/files.el > @@ -856,10 +856,16 @@ parse-colon-path > (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)))) > + ;; which collapses multiple "/" in front, while > + ;; preserving double slash where it matters. Do > + ;; the same for backward compatibility. > + (if (string-match "\\`//+" dir) > + (substring dir > + (- (match-end 0) > + (if (memq system-type > + '(windows-nt 'cygwin 'ms-dos)) > + 2 1))) > + dir)))) > (split-string spath path-separator))))) > > (defun cd-absolute (dir) It does. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 24 12:21:51 2022 Received: (at 57353-done) by debbugs.gnu.org; 24 Aug 2022 16:21:51 +0000 Received: from localhost ([127.0.0.1]:47940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQt8Y-0001qy-N1 for submit@debbugs.gnu.org; Wed, 24 Aug 2022 12:21:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQt8X-0001qn-Dz for 57353-done@debbugs.gnu.org; Wed, 24 Aug 2022 12:21:50 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQt8Q-0008Jc-D5; Wed, 24 Aug 2022 12:21:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rKA9xvWTDMGc5+ABjRdCr6TjvXgovKDp+0jBxkW3eGA=; b=Lyj9ttlLad40 Vgjb4+zruBNAb8HEy58kZZpGgcVRrjl314LEXRFIFxD5blbRXucWIzEK8h/y2ei20GcQnXegY/mF0 delYASg/kW0IlakkGXIrQmPOsL8722f45+IHbNl4VOcLHrDdnxTz8qOx/N7Nr79I/Sx92lUTCgPOS otbNHw/layHuAj12EYzhAQ5aoW/SjBCF6fqa9oKoKUlRK1RusBbJriVfYBs+Ny2Ra2sUFW9PjNegG wgbGOcDogdbtUxlNXXG4MmOVl5sybNb4S0o4p16P6qcsgjfyXQLwHUoZtccw8rVshRslIFgXGn68b rIHou86W2ArlnGdWJdTufw==; Received: from [87.69.77.57] (port=3228 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 1oQt8M-0006wq-7k; Wed, 24 Aug 2022 12:21:40 -0400 Date: Wed, 24 Aug 2022 19:21:47 +0300 Message-Id: <835yih6290.fsf@gnu.org> From: Eli Zaretskii To: Richard Copley In-Reply-To: (message from Richard Copley on Wed, 24 Aug 2022 15:23:56 +0100) Subject: Re: bug#57353: [PATCH] Fix parse-colon-path with UNC directory names References: <83bksb859u.fsf@gnu.org> <83fshl682u.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 57353-done Cc: 57353-done@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: Richard Copley > Date: Wed, 24 Aug 2022 15:23:56 +0100 > Cc: 57353@debbugs.gnu.org > > On Wed, 24 Aug 2022 at 15:15, Eli Zaretskii wrote: > > > > Does the patch below give good results in your use cases? > > > > diff --git a/lisp/files.el b/lisp/files.el > > index 8596d9a..26730df 100644 > > --- a/lisp/files.el > > +++ b/lisp/files.el > > @@ -856,10 +856,16 @@ parse-colon-path > > (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)))) > > + ;; which collapses multiple "/" in front, while > > + ;; preserving double slash where it matters. Do > > + ;; the same for backward compatibility. > > + (if (string-match "\\`//+" dir) > > + (substring dir > > + (- (match-end 0) > > + (if (memq system-type > > + '(windows-nt 'cygwin 'ms-dos)) > > + 2 1))) > > + dir)))) > > (split-string spath path-separator))))) > > > > (defun cd-absolute (dir) > > It does. Thanks, installed with minor changes, and closing the bug. From unknown Fri Jun 20 07:26:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 22 Sep 2022 11:24:05 +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