From 14c9a6720e9fed900cfc3ab04e6ea6d9fa56aa0e Mon Sep 17 00:00:00 2001 From: Angus Gibson Date: Tue, 26 May 2026 23:12:22 +0100 Subject: services: network-manager: Only delete symlinks into store Instead of potentially deleting in the store itself, ensure only the symlink to the store is deleted by using delete-file. * gnu/services/networking.scm (network-manager-activation): : Use readlink instead of canonicalize path. Use delete-file instead of delete-files-recursively. : Likewise. Change-Id: I2e84ecfebb8a6c8797d851b35e90bb747432c0b2 Signed-off-by: Liliana Marie Prikler --- gnu/services/networking.scm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index c8a7ce21c95..cc3876492d8 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -1487,11 +1487,9 @@ project's documentation} for more information." #$@(if (pair? dnsmasq-configuration-files) ;if non-empty ;; If /etc/NetworkManager/dnsmasq.d is a symlink to a store file, ;; delete it. - `((if (and (file-exists? "/etc/NetworkManager/dnsmasq.d") - (store-file-name? - (canonicalize-path "/etc/NetworkManager/dnsmasq.d"))) - (delete-file-recursively - "/etc/NetworkManager/dnsmasq.d")) + `((when (false-if-exception + (store-file-name? (readlink "/etc/NetworkManager/dnsmasq.d"))) + (delete-file "/etc/NetworkManager/dnsmasq.d")) (symlink ,(file-union "network-manager-dnsmasq-configuration-directory" dnsmasq-configuration-files) @@ -1500,11 +1498,9 @@ project's documentation} for more information." #$@(if (pair? extra-configuration-files) ;if non-empty ;; If /etc/NetworkManager/conf.d is a symlink to a store file, ;; delete it. - `((if (and (file-exists? "/etc/NetworkManager/conf.d") - (store-file-name? - (canonicalize-path "/etc/NetworkManager/conf.d"))) - (delete-file-recursively - "/etc/NetworkManager/conf.d")) + `((when (false-if-exception + (store-file-name? (readlink "/etc/NetworkManager/conf.d"))) + (delete-file "/etc/NetworkManager/conf.d")) ;; If it exists but is not a symlink to a store file, then ;; this will fail with EEXIST; we leave this for the user to ;; handle, since they probably created the directory -- cgit v1.2.3