From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 400df210ce0: Fix last change of 'delete-file' Date: Sat, 12 Aug 2023 13:36:30 +0300 Message-ID: <83h6p4eedt.fsf@gnu.org> References: <169133064669.24990.11219399079845613336@vcs2.savannah.gnu.org> <20230806140407.09E6BC038BE@vcs2.savannah.gnu.org> <875y5n6nz2.fsf@gmail.com> <83o7jfhvw3.fsf@gnu.org> <871qgb6mg9.fsf@gmail.com> <83h6p7hueg.fsf@gnu.org> <87wmy355aa.fsf@gmail.com> <83cyzvhri7.fsf@gnu.org> <87msyyt4ne.fsf@gmx.de> <83h6p5hmex.fsf@gnu.org> <87350pu7qq.fsf@gmx.de> <834jl5hj9x.fsf@gnu.org> <87ttt5sd9y.fsf@gmx.de> <83y1ihfp41.fsf@gnu.org> <878ragshvk.fsf@gmx.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4944"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rpluim@gmail.com, emacs-devel@gnu.org, esr@thyrsus.com To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 12 12:36:54 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qUlzI-00016r-TS for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Aug 2023 12:36:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUlyT-000810-O5; Sat, 12 Aug 2023 06:36:01 -0400 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 1qUlyS-00080s-Rc for emacs-devel@gnu.org; Sat, 12 Aug 2023 06:36:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUlyS-0004X3-AA; Sat, 12 Aug 2023 06:36:00 -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=nMa73tuTjWBbT7RpV9F5wEomfMv7eYgr5DIECZRf9hY=; b=mdM6xTSGL/W2 092V0lve89NLibc1xJu6oG9p6Wli0CTTg277yTxitczgkJcW4CwcGP6w2P4KxhOLj1ivGW4LrxY5B ZYGmkhwH5tIO8JZyXqZGpRTbdn/ac4Jwn4q/ggCeRUrmxeIqHmzHqohyk+hOWhU64ZLxtvyVFONnr rLwuH++IlOZjzfbNlHgzcldR/ZSGooN+U+2/oDbWCSyishixzBXGOoNFFQY+/IXAuIon6vVWNOx0c xW4GmAj7lvs6+TxR7jMkRVGn23BUAA7aq7fJjgZequa9oiFcdhi9kTuDZhuevSWeO2Kdm2n1p6sW6 86fbPWCksdIRA7YcL7irLw==; In-Reply-To: <878ragshvk.fsf@gmx.de> (message from Michael Albinus on Sat, 12 Aug 2023 11:57:19 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308614 Archived-At: > From: Michael Albinus > Cc: rpluim@gmail.com, emacs-devel@gnu.org, esr@thyrsus.com > Date: Sat, 12 Aug 2023 11:57:19 +0200 > > Eli Zaretskii writes: > > Hi Eli, > > >> > The addition of expand-file-name to delete-file made that function a > >> > bit slower, and for local files that is a net loss. We should extend > >> > instead find-file-name-handler to work for non-absolute file names to > >> > avoid this overhead. > >> > >> It is not a recent addition, it has been there for ages. In Fdelete_file. > > > > I'm talking about the situation on master now, after delete-file was > > split into two parts. After my change today, delete-file calls > > expand-file-name (because find-file-name-handler needs that), and then > > delete-file-internal calls expand-file-name again (because every > > primitive must). > > But this is due to moving delete-file from C core to Lisp. We have the > same situation with other Lisp functions, which support file name > handlers and call a C-level function. For example, make-temp-file / > make-temp-file-internal, make-directory / make-directory-internal, > delete-directory / delete-directory-internal. Which is a pity, don't you think? > > But the situation now is bad already: if I call > > file-name-as-directory, for example, with a relative file name in a > > remote directory, the handler is not invoked. Isn't that a bug? > > Perhaps. But in practice, I'm not aware of bug reports about. It's a ticking time bomb. > However, we cannot call Fexpand_file_name in Ffind_file_name_handler, > because expand-file-name supports also file name handlers. This would be > an infloop. And just binding file-name-handler-alist to nil doesn't > return the proper result, but a result which is similar only: We don't need to call expand-file-name in find-file-name-handler, unless both the file name and default-directory are non-absolute. > --8<---------------cut here---------------start------------->8--- > (let ((default-directory "/ssh::") > file-name-handler-alist) > (expand-file-name "123")) > > => "/ssh::/123" > --8<---------------cut here---------------end--------------->8--- > > This might be sufficient, but there are cases where we fail. On MS > Windows, for example, we have > > --8<---------------cut here---------------start------------->8--- > (let ((default-directory "/ssh::") > file-name-handler-alist) > (expand-file-name "123")) > > => "c:/ssh::/123" > --8<---------------cut here---------------end--------------->8--- Something to fix, I guess. I see no insoluble issues here, FWIW.