From 46e12978ff396782823a0b09ab9f1eb5eb14e64c Mon Sep 17 00:00:00 2001 From: Marcel Partap Date: Sun, 29 Nov 2020 22:10:19 +0100 Subject: [PATCH] Prevent loop of unsuccessfull attempts (invalid cross-device link) to move desktop file when user's cache directory lies on a tmpfs mount (unburden-home-dir set up to minimize flash writes) appimaged: 2020/11/29 19:33:24 Registering AppImages in [/home/user/Downloads /home/user/Desktop /home/user/Applications /opt /usr/local/bin] appimaged: 2020/11/29 ERROR main: rename /home/user/.cache/applications//appimagekit_6f9acfe2118f26ccc7b52fb34e248f97.desktop /home/user/.local/share/applications/appimagekit_6f9acfe2118f26ccc7b52fb34e248f97.desktop: invalid cross-device link appimaged: 2020/11/29 19:33:27 main: Moved 1 desktop files to /home/user/.local/share/applications/; use -v to see details appimaged: 2020/11/29 19:33:27 Desktop notification: Added application appimaged: 2020/11/29 19:33:27 Ran update-desktop-database /home/user/.local/share/applications/ --- src/appimaged/appimaged.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/appimaged/appimaged.go b/src/appimaged/appimaged.go index 73f0b10f..406492f6 100644 --- a/src/appimaged/appimaged.go +++ b/src/appimaged/appimaged.go @@ -314,7 +314,10 @@ func moveDesktopFiles() { if *verbosePtr == true { log.Println("main: Moving", file.Name(), "to", xdg.DataHome+"/applications/") } - err = os.Rename(desktopcachedir+"/"+file.Name(), xdg.DataHome+"/applications/"+file.Name()) + + // Call external mv because os.Rename() may fail with EXDEV error "invalid cross-device link" + cmd := exec.Command("mv", desktopcachedir+"/"+file.Name(), xdg.DataHome+"/applications/") + err := cmd.Run() helpers.LogError("main", err) }