From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#57102: 29.0.50; Peculiar file-name-split edge case Date: Wed, 17 Aug 2022 12:55:11 +0200 Message-ID: <87o7wjjg1c.fsf@gnus.org> References: <87a68cwlnv.fsf@posteo.net> <87y1vtmq4d.fsf@gnus.org> <87bkspa225.fsf@posteo.net> <87lertlafe.fsf@gnus.org> <87zgg98lyc.fsf@posteo.net> <87y1vsjrkx.fsf@gnus.org> <877d3cl1ip.fsf@posteo.net> <87r11idpb9.fsf@gnus.org> <83ilmtivsv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="417"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: philipk@posteo.net, 57102@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 17 12:56:19 2022 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 1oOGih-000AXh-F1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Aug 2022 12:56:19 +0200 Original-Received: from localhost ([::1]:43990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOGig-00009O-8x for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Aug 2022 06:56:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOGiS-000092-4a for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2022 06:56:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOGiQ-000422-KT for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2022 06:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oOGiQ-0008CP-GY for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2022 06:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Aug 2022 10:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57102 X-GNU-PR-Package: emacs Original-Received: via spool by 57102-submit@debbugs.gnu.org id=B57102.166073372231466 (code B ref 57102); Wed, 17 Aug 2022 10:56:02 +0000 Original-Received: (at 57102) by debbugs.gnu.org; 17 Aug 2022 10:55:22 +0000 Original-Received: from localhost ([127.0.0.1]:49527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOGhm-0008BR-EJ for submit@debbugs.gnu.org; Wed, 17 Aug 2022 06:55:22 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:44252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOGhk-0008BD-Ud for 57102@debbugs.gnu.org; Wed, 17 Aug 2022 06:55:21 -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:Date:References: In-Reply-To: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=quHpM/bkGylmuHG4jVh4L0ycdIGdfPQFTdTqKi0eMlQ=; b=FYlmtrqhGsfDZTI1kjnH9kfr23 WMEzK37qyQh3xLaEwdMf027g+cq+IU7tklaR1CrH5Sfkbh/Xzj91uHNB31UQjQmJOSwAkVCkfXmqB 1wFe+1FsBb85gt+YqQABz4uCnI/3CIKFH2fu5BJTBZOlZgAzW9eCJmT5TWFPVupUz8wM=; Original-Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOGhb-0008Bm-JJ; Wed, 17 Aug 2022 12:55:13 +0200 In-Reply-To: <83ilmtivsv.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 15 Aug 2022 14:35:28 +0300") X-Now-Playing: King Crimson's _Three of a Perfect Pair_: "No Warning" 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" Xref: news.gmane.io gmane.emacs.bugs:240040 Archived-At: Eli Zaretskii writes: >> (file-name-split "/a/b") >> => '("a" "b") > > This should return '("/" "a" "b"), or '("/a" "b") I think. > >> (file-name-split "//a////b////") >> => '("a" "b") > > And this should return '("/" "a" "b" "/"), or '("/a" "b/"). > >> I'm not sure what >> >> (file-name-split "c:/a/b") >> >> on Windows should return in that case, though. > > If you agree with the above, then '("c:/" "a" "b"). > > If you don't care about the root directory, then '("a" "b") > (a.k.a. "leave the interpretation to the caller"). I'm not at all sure, and perhaps we should have two different functions here for the two different use cases that I think this function has. The use cases, as I see it, are 1) "I just want to know which bits are in the path". This is used by dabbrev, which wants to add "a" and "b" here to the abbrevs. In that case, "c:/" is not what it wants. 2) "I need to perform some operation on each segment and then put the file name back together again". This is what browse-url does -- it wants to %-encode each segment, but not the "/"s, so it wants to preserve the absolute/relative distinction. (But it needs to know that the "c:/" part is not something to be encoded anyway.) In that case, I think we want '("/" "a" "b") and '("c:/" "a" "b"). So perhaps file-name-split should keep the current semantics (but the bugs identified should be fixed) for 2), but we could add a new function (or optional parameter) for 1) which would leave "/"/"c:/" off.