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
This commit is contained in:
Ludovic Courtès 2024-10-23 22:26:34 +02:00
parent 573a07b689
commit 23ab6fc29f
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -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.