guix-devel
[Top][All Lists]
Advanced

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

Re: Move switch-symlinks to (guix build utils)


From: Maxime Devos
Subject: Re: Move switch-symlinks to (guix build utils)
Date: Fri, 03 Jun 2022 19:09:02 +0200
User-agent: Evolution 3.38.3-1

Ludovic Courtès schreef op vr 03-06-2022 om 18:38 [+0200]:
> That’s EACCES?

It's EEXIST.

> > If we move it to (guix build utils), I'd prefer the bug to be addressed 
> > first.
> 
> Yes, better be cautious before “setting it in stone”.  Do you have a fix
> in mind?

Maybe replace

   (symlink target pivot)

by (symlink/remove-old target pivot)

where

(define (symlink/remove-old target link)
  "Make a symbolic link named LINK pointing to TARGET.
If LINK already exists, it will be removed first.
This is not an atomic operation."
  (catch 'system-error
    (lambda ()
      (symlink target link))
    (lambda stuff
      (if (= (system-error-errno stuff) EEXIST)
          (begin
            ;; remove old link and retry
            (delete-file link)
            (symlink/remove-old link target))
          (apply throw stuff)))))

?

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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