[asdf-devel] rename-file-overwriting-target on clisp

Faré fahree at gmail.com
Tue Oct 15 19:02:18 UTC 2013

Dear Sam,

thanks for getting contacting the asdf-devel mailing-list.

On Tue, Oct 15, 2013 at 2:19 PM, Sam Steingold <sds at gnu.org> wrote:
> I wonder why this function has a special case for clisp:
>   (defun rename-file-overwriting-target (source target)
>     #+clisp ;; But for a bug in CLISP 2.48, we should use :if-exists
> :overwrite and be atomic
>     (posix:copy-file source target :method :rename)
>     #-clisp
>     (rename-file source target
>                  #+clozure :if-exists #+clozure :rename-and-delete))
> it would seem that a more portable solution would be
> (defun rename-file-overwriting-target (source target)
>   #-clozure (when (probe-file target) (delete-file target))
>   (rename-file source target
>                  #+clozure :if-exists #+clozure :rename-and-delete))
One of the goals of that function is to be atomic if possible,
i.e. use the system call rename(2) on unix, or the equivalent on Windows
(MoveFileTransacted is the suggestion found by a quick Google search,
which is available starting with Windows Server 2008).

Most (all?) Unix implementations of CL already use that system call,
and it's just Clozure CL being pedantic about it.
That leaves Windows implementations. This code should probably be tested
and made to work on every implementation. I admit I don't have Windows,
and don't have the energy to fight to make it work there at this
point, and I'm falling back to best effort. So, ahem, patches

> this code causes build problems in clisp because when asdf is
> distributed with clisp, it is built before the posix module is
> available.
Is there a way to achieve the same effect without the posix module?
Can you "just" change the build order?
Or I can make it a dynamic call, as in
  (symbol-call :posix :copy-file source target :method :rename)
quite possibly prepended by (require :posix)

> also, nobody uses 2.48 anymore, so I think you can safely assume 2.49.
Good to know (for reference, this laptop using Ubuntu 12.04.3 LTS
provides a "GNU CLISP 2.49+ (2010-07-17)".

So: what should be the proper CLISP version of this function, in 2013?

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Memetics isn't about the "truth" of memes, but about their stability.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20131015/20b63f5a/attachment.html>

More information about the asdf-devel mailing list