[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: |
Mon, 06 Jun 2022 14:20:51 +0200 |
User-agent: |
Evolution 3.38.3-1 |
Arun Isaac schreef op ma 06-06-2022 om 16:57 [+0530]:
> Could we implement symlink/remove-old without catch and throw? Something
> like:
>
> --8<---------------cut here---------------start------------->8---
> (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."
> (when (file-exists? link)
> (delete-file link))
> (symlink target link))
> --8<---------------cut here---------------end--------------->8---
file-exists? does not check if the file exists -- for a broken symlink,
it will return #false instead of #true.
Also, this introduces additional non-atomicity (though in this
particular case, this does not seem to be a problem). It would also
make things a tiny bit slower, because file-exists? makes an additional
syscall.
For these three reasons, I would go for the more robust catch+throw.
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part
- Re: Move switch-symlinks to (guix build utils), (continued)
- Re: Move switch-symlinks to (guix build utils), Maxime Devos, 2022/06/01
- Re: Move switch-symlinks to (guix build utils), Arun Isaac, 2022/06/02
- Re: Move switch-symlinks to (guix build utils), Maxime Devos, 2022/06/02
- Re: Move switch-symlinks to (guix build utils), Ludovic Courtès, 2022/06/03
- Re: Move switch-symlinks to (guix build utils), Maxime Devos, 2022/06/03
- Re: Move switch-symlinks to (guix build utils), Ludovic Courtès, 2022/06/03
- Re: Move switch-symlinks to (guix build utils), Ludovic Courtès, 2022/06/03
- Re: Move switch-symlinks to (guix build utils), bokr, 2022/06/03
- Re: Move switch-symlinks to (guix build utils), Maxime Devos, 2022/06/04
- Re: Move switch-symlinks to (guix build utils), Arun Isaac, 2022/06/06
- Re: Move switch-symlinks to (guix build utils),
Maxime Devos <=
- Re: Move switch-symlinks to (guix build utils), Arun Isaac, 2022/06/08