Subject: Re: bug#77487: 1.4 million extraneous symlinks under .guix-home/profile/share/icons

From: "Timo Wilken" <[email-masked]>
Date: Mon, 14 Apr 2025 18:49:04 +0200

Hi Leo, hi Guix,

On Sat 5 Apr 2025 at 7:27 pm CEST, Leo Famulari wrote:
> I have nothing like that with Guix itself (compared to Guix Home), but
> it's still a lot:
>
> $ find ~/.guix-profile/share/icons/ -type l -printf x | wc -c 
> 77714

Thanks for confirming it's not just me! :)

I've created a minimal reproducer of the problem at the guix repl:

--8<---------------cut here--------------->8--
$ guix repl
scheme@(guix-user)> ,use (gnu packages gtk)        ; for `gtk+'
scheme@(guix-user)> ,use (gnu packages gnome-xyz)  ; for `papirus-icon-theme'
scheme@(guix-user)> ,use (guix build union)
scheme@(guix-user)> ,use (guix profiles)
scheme@(guix-user)> ,use (guix monad-repl)
scheme@(guix-user)> (define gtk-icon-themes (@@ (guix profiles) gtk-icon-themes))
scheme@(guix-user)> ,run-in-store (gtk-icon-themes (packages->manifest (list papirus-icon-theme gtk+)))
$1 = #<derivation /gnu/store/26mhjywzy2k9317r6919d84mnchmh3di-gtk-icon-themes.drv => /gnu/store/b0jpr69mrczigdz0p0dy1mlnqgwanxf7-gtk-icon-themes 7f3d000cc820>
scheme@(guix-user)> ,build $1
$2 = "/gnu/store/b0jpr69mrczigdz0p0dy1mlnqgwanxf7-gtk-icon-themes"
scheme@(guix-user)> ,build papirus-icon-theme
$3 = "/gnu/store/s69hs11nn6bxi32by6ab1qaq36kgpvva-papirus-icon-theme-20250201"
scheme@(guix-user)> (define tmpdir (string-append (mkdtemp "/tmp/guix-profile-XXXXXX") "/profile"))
scheme@(guix-user)> ,run-in-store (union-build tmpdir (list $2 $3))
--8<---------------cut here--------------->8--

Warning: loads and loads of output -- one line for every one of the 1.4
million symlinks created!

You can also inspect the tree /tmp/guix-profile-*/profile/share/icons to see
that indeed, each icon file is symlinked individually.

If I build a union that does not include both the icon theme and the result of
the `gtk-icon-themes' hook, such as the following:

--8<---------------cut here--------------->8--
scheme@(guix-user)> ,build gtk+
$4 = "/gnu/store/w70sdx3n5bhancx10x1jfphq5v8943is-gtk+-3.24.43-bin"
$5 = "/gnu/store/4qrbd85gy5j38fj9prk8w31zchlxh3k1-gtk+-3.24.43"
scheme@(guix-user)> (define tmpdir (string-append (mkdtemp "/tmp/guix-profile-XXXXXX") "/profile"))
scheme@(guix-user)> ,run-in-store (union-build tmpdir (list $2 $5))
--8<---------------cut here--------------->8--

...then the icon themes are linked correctly in that profile, i.e. a single
symlink per theme under /tmp/guix-profile-*/profile/share/icons/.

Therefore, the problem must be including both the icon theme packages and the
result of the `gtk-icon-themes' hook in the same profile.

Would it make sense for Guix to remove the icon theme packages from the
profile before trying to build the final union? The icons should still be
linked through the result of `gtk-icon-themes'.

Cheers,
Timo