Subject: bug#35701: guix size should account for hard links in its disk space calculation

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 12 May 2019 15:18:36 -0400

Consider the following operating system declaration:

$ guix size `guix system build robot-framework-system.scm`

gives:

store item                                                       total    self
/gnu/store/f9fy1b2yf1qxy523732r7z34ymwqz64b-linux-libre-5.1        241.5   241.5  21.8%
/gnu/store/1lcniyxkxkh8g73zvh2gpbccvl6ggna7-locale-2.28             91.8    91.8   8.3%
/gnu/store/zm3188ipzi262s0m8bxm24br77yh9pd8-python-3.7.0           183.0    74.6   6.7%
/gnu/store/h8l1pby3cm6b4fxsfwwr65b4d1hyh6cs-python-3.7.0           183.0    74.6   6.7%
/gnu/store/wqr8rwnwpmag01i6kb0laf62vsqnhrxy-python-3.7.0           183.0    74.6   6.7%
/gnu/store/b7fqhszxl02g6pfm3vw6b3cjz472qrly-python-3.7.0           182.8    74.6   6.7%
[...]

total: 1106.3 MiB

But,

$ guix size `guix system --no-grafts build robot-framework-system.scm`

store item                                                       total    self
/gnu/store/f9fy1b2yf1qxy523732r7z34ymwqz64b-linux-libre-5.1        241.5   241.5  28.4%
/gnu/store/1lcniyxkxkh8g73zvh2gpbccvl6ggna7-locale-2.28             91.8    91.8  10.8%
/gnu/store/b7fqhszxl02g6pfm3vw6b3cjz472qrly-python-3.7.0           182.8    74.6   8.8%
/gnu/store/ybglr7nfs8v9kpnm8vf4drg3gafnvd15-guile-static-stripped-2.2.4    45.9    45.9   5.4%
total: 851.2 MiB

Conclusion: the size of grafts is added multiple times even though they
should be very light on disk usage given that they are mostly hard links
to the original, ungrafted output.