* [bug#74872] bugfix: update symlinks
@ 2024-12-14 16:49 ngraves--- via Guix-patches via
2024-12-23 18:03 ` bug#74872: " Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: ngraves--- via Guix-patches via @ 2024-12-14 16:49 UTC (permalink / raw)
To: 74872
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
For some reason, rename-file fails when the target and destination are
not in the same filesystem. However, we can't assume for the
update-symlink script that all users will always have e.g.
~/.local/share/applications (managed by guix-home) and ~ on the same
filesystem. My use-case is trying to implement home impermanence. The
patch is attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-home-Replace-rename-in-update-symlinks-scripts.patch --]
[-- Type: text/x-diff; name=0001-gnu-home-Replace-rename-in-update-symlinks-scripts.patch, Size: 1159 bytes --]
From fe07066b88556c3755db3fc29665ce93d23cc071 Mon Sep 17 00:00:00 2001
From: Nicolas Graves <ngraves@ngraves.fr>
Date: Sat, 14 Dec 2024 12:38:14 +0100
Subject: [PATCH] gnu: home: Replace rename in update-symlinks scripts.
* gnu/home/services/symlink-manager.scm (update-symlinks): Use
copy-file and delete-file instead of rename-file to avoid an error
when the target and backup are not in the same filesystem.
---
gnu/home/services/symlink-manager.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gnu/home/services/symlink-manager.scm b/gnu/home/services/symlink-manager.scm
index 560e03a839..d7b22d7fba 100644
--- a/gnu/home/services/symlink-manager.scm
+++ b/gnu/home/services/symlink-manager.scm
@@ -106,7 +106,8 @@ (define backup
(mkdir-p backup-directory)
(format #t (G_ "Backing up ~a...") (target-file file))
(mkdir-p (dirname backup))
- (rename-file (target-file file) backup)
+ (copy-file (target-file file) backup)
+ (delete-file (target-file file))
(display (G_ " done\n")))
(define (cleanup-symlinks home-generation)
--
2.46.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#74872: bugfix: update symlinks
2024-12-14 16:49 [bug#74872] bugfix: update symlinks ngraves--- via Guix-patches via
@ 2024-12-23 18:03 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2024-12-23 18:03 UTC (permalink / raw)
To: ngraves; +Cc: 74872-done
ngraves@ngraves.fr skribis:
> For some reason, rename-file fails when the target and destination are
> not in the same filesystem. However, we can't assume for the
> update-symlink script that all users will always have
> e.g. ~/.local/share/applications (managed by guix-home) and ~ on the
> same filesystem. My use-case is trying to implement home
> impermanence. The patch is attached.
>
> From fe07066b88556c3755db3fc29665ce93d23cc071 Mon Sep 17 00:00:00 2001
> From: Nicolas Graves <ngraves@ngraves.fr>
> Date: Sat, 14 Dec 2024 12:38:14 +0100
> Subject: [PATCH] gnu: home: Replace rename in update-symlinks scripts.
>
> * gnu/home/services/symlink-manager.scm (update-symlinks): Use
> copy-file and delete-file instead of rename-file to avoid an error
> when the target and backup are not in the same filesystem.
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-23 18:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-14 16:49 [bug#74872] bugfix: update symlinks ngraves--- via Guix-patches via
2024-12-23 18:03 ` bug#74872: " Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).