Subject: bug#77487: closed (Re: [bug#77251] [PATCH] guix: gtk-icon-themes: produce only cache in output)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 27 Apr 2025 02:36:04 +0000

Your bug report

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

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77487: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77487
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#77251] [PATCH] guix: gtk-icon-themes: produce only cache in output
From: 宋文武 <[email-masked]>
To: Rutherther <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sun, 27 Apr 2025 10:40:22 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Rutherther <[email-masked]> writes:

> This patch changes the behavior of gtk-icon-themes to produce only the
> icon-theme.cache cache files, instead of producing the whole union.
> The reason for this is that by producing the whole union, the icons are put to
> the profile twice. This throws off the union build of the profile and symlinks
> all the individual files instead of symlinking folders. This means
> unnecessarily high numbers of symlinks are produced.
>
> * guix/profiles.scm (gtk-icon-themes): Produce only caches

Pushed to master as commit 32575294, with simplified commit message.

Thank you!

Subject: 1.4 million extraneous symlinks under .guix-home/profile/share/icons
From: "Timo Wilken" <[email-masked]>
To: <[email-masked]>
Date: Thu, 03 Apr 2025 14:05:40 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

In my ~/.guix-home/profile/share/icons/, I have a total of 1.4 million
symlinks:

$ find ~/.guix-home/profile/share/icons/ -type l -printf x | wc -c
1425657

The directory itself is not a symlink. Instead, it contains the following
structure (with the papirus-icon-theme package installed):

~/.guix-home/profile/share/icons/
  + Papirus/
    + icon-theme.cache -> /gnu/store/...-gtk-icon-themes/share/icons/Papirus/icon-theme.cache
    + index.theme -> /gnu/store/...-gtk-icon-themes/share/icons/Papirus/index.theme
    + 16x16/
      + apps/
        + 010editor.svg -> /gnu/store/...-gtk-icon-themes/share/icons/Papirus/16x16/apps/010editor.svg
        + 09BE_EpicGamesLauncher.0.svg -> /gnu/store/...-gtk-icon-themes/share/icons/Papirus/16x16/apps/09BE_EpicGamesLauncher.0.svg
        + 0ad.svg -> /gnu/store/...-gtk-icon-themes/share/icons/Papirus/16x16/apps/0ad.svg
        [and so on, and so forth...]

I.e., every single image file in every single icon theme is linked
individually -- none of the 16x16 (etc) directories are symlinks!

These files are also all symlinks to
/gnu/store/...-gtk-icon-themes/share/icons/<icon>, where <icon> is their own
filename under ~/.guix-homme/profile/share/icons/. There are no symlinks that
point anywhere else -- even the icon-theme.cache and index.theme symlinks
point into the same "gtk-icon-themes" union.

I've checked this using the following shell snippet:

$ cd ~/.guix-home/profile/share/icons
$ find */ -type l -printf '%p\t%l\n' | awk -F'\t' '{
    gsub(/[^a-zA-Z0-9/_-]/, "[&]", $1)   # escape symlink path as regex
    sub("/" $1 "$", "", $2)   # remove symlink path from the end of its target path
    print $2                  # print trimmed target path
}' | uniq -c
1433393 /gnu/store/zg7wwydwjaykpp0dwzq97hzilzd3q85f-gtk-icon-themes/share/icons

My question is therefore: why isn't ~/.guix-home/profile/share/icons itself a
symlink to /gnu/store/...-gtk-icon-themes/share/icons? That would get my home
profile down from 1,440,513 to a measly 14,857 symlinks in total -- and
presumably speed up the home profile creation by a lot (instead of taking over
a minute on a fast NVME SSD)!

I've tried digging into (guix build union) and (guix profiles), but I've not
found anything obviously wrong...

Cheers,
Timo