aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2024-10-23 22:26:34 +0200
committerLudovic Courtès <ludo@gnu.org>2024-10-24 14:50:08 +0200
commit23ab6fc29f28b0fa9ad94bf2ceed135ee3fdea34 (patch)
tree4828d7ecb2a0d70cae4391e9ceea92be8d0531de
parent573a07b689fedcf3f36fa46a4625153fda273344 (diff)
downloadguix-23ab6fc29f28b0fa9ad94bf2ceed135ee3fdea34.tar.gz
guix-23ab6fc29f28b0fa9ad94bf2ceed135ee3fdea34.zip
environment: Gracefully handle preexistence of /bin/cc in FHS.
* guix/scripts/environment.scm (setup-fhs): When /bin/cc already exists, keep it. Reported-by: Marco Fortina <marco_fortina@hotmail.it> Change-Id: I73d39d2aa6fbafd236061a0e3b8d1fe327b2bb19
-rw-r--r--guix/scripts/environment.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index a219b2ac89..fc7fa84be7 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -464,8 +464,15 @@ providing a symlink for CC if GCC is in the container PROFILE, and writing
;; /bin since that already has the sh symlink and the other (optional) FHS
;; bin directories will link to /bin.
(let ((gcc-path (string-append profile "/bin/gcc")))
- (if (file-exists? gcc-path)
- (symlink gcc-path "/bin/cc")))
+ (when (file-exists? gcc-path)
+ (catch 'system-error
+ (lambda ()
+ (symlink gcc-path "/bin/cc"))
+ (lambda args
+ ;; If /bin/cc already exists because it was provided by another
+ ;; package in PROFILE, such as 'clang-toolchain', leave it.
+ (unless (= EEXIST (system-error-errno args))
+ (apply throw args))))))
;; Guix's ldconfig doesn't search in FHS default locations, so provide a
;; minimal ld.so.conf.