emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 400df210ce0: Fix last change of 'delete-file'


From: Michael Albinus
Subject: Re: master 400df210ce0: Fix last change of 'delete-file'
Date: Fri, 11 Aug 2023 09:33:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli & Robert,

>>     >> I was thinking of the opposite case, where someone has a personal file
>>     >> handler with a regexp with an absolute path in it.
>> 
>>     Eli> That'd be a buggy file handler, I think, unless it also checks
>>     Eli> default-directory.
>> 
>> The file handler isnʼt buggy: it never gets a chance to run.
>> 
>> Let me illustrate. Suppose we have an entry of
>> 
>> ("\\`/var/.*\\.txt" . my-file-handler)
>> 
>> in `file-name-handler-alist'.
>> 
>> (delete-file "foo.txt") when `default-directory' is "/var" would
>> previously result in `my-file-handler' being called. Now itʼs not
>> called at all, and the deletion is handled by `delete-file-internal'
>
> But the same would be true for substitute-in-file-name, for example,
> and for directory-file-name, and file-name-as-directory, and several
> other primitives, which call Ffind_file_name_handler without calling
> expand-file-name before that.
>
> But maybe I'm missing something here, so let's ask Michael (CC'ed) for
> his opinion on this.

In Emacs 29, we have in Fdelete_file:

--8<---------------cut here---------------start------------->8---
  filename = Fexpand_file_name (filename, Qnil);

  handler = Ffind_file_name_handler (filename, Qdelete_file);
  if (!NILP (handler))
    return call3 (handler, Qdelete_file, filename, trash);
--8<---------------cut here---------------end--------------->8---

So the file name is always absolute. Now in Emacs 30, the file name is
not expanded prior calling find-file-name-handler in delete-file. That
is an error in the transition from C to Lisp.

Cc to Eric, who has done the transition.

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]