emacs-devel
[Top][All Lists]
Advanced

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

Re: master fails to build on FreeBSD when ACL support is on


From: Stefan Monnier
Subject: Re: master fails to build on FreeBSD when ACL support is on
Date: Fri, 19 Jan 2018 15:53:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> > -                        (make-temp-file (file-name-nondirectory 
>> > target-file)))
>> > +                        ;; If target-file is relative and includes
>> > +                        ;; leading directories, make-temp-file will
>> > +                        ;; assume those leading directories exist
>> > +                        ;; under temporary-file-directory, which might
>> > +                        ;; not be true.  So strip leading directories
>> > +                        ;; from relative file names before calling
>> > +                        ;; make-temp-file.
>> > +                        (if (file-name-absolute-p target-file)
>> > +                            (make-temp-file target-file)
>> > +                          (make-temp-file
>> > +                           (file-name-nondirectory target-file))))
>> 
>> Hmm.. the comment here doesn't explain the (file-name-absolute-p
>> target-file) test, and the commit message
> It doesn't?

No, it doesn't explain why we create the temp file next to the target if
target is absolute and we create it in /tmp if target is relative.

>> Or maybe we should just never use /tmp and just go with
>>     (make-temp-file (expand-file-name target-file))
>> ?
> Why is that better?

Looking at the history of the code, the temp-file code started with

    (make-temp-file target-file)

which seems to me to be the result of an oversight: the original coder
probably didn't realize that such a call would either create the temp
file in the same directory as target-file or under /tmp depending on
whether target-file is relative or absolute.

Furthermore, later the code does `rename-file` which is an operation
which works much better when the old name and new new are both in the
same partition.  So I think the intention of the code was to always put
the tempfile next to the target-file.


        Stefan



reply via email to

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