Gentoo Archives: gentoo-dev

From: Matt Turner <mattst88@g.o>
To: Sam James <sam@g.o>
Cc: gentoo-dev@l.g.o, fonts@g.o
Subject: Re: [gentoo-dev] [PATCH 2/2] font.eclass: Remove racy pkg_postinst code
Date: Tue, 08 Nov 2022 20:30:00
Message-Id: CAEdQ38FifRzkneXWC-chL9=_YRqoT6o_4WJQf2St4FMRqvn9Ug@mail.gmail.com
In Reply to: Re: [gentoo-dev] [PATCH 2/2] font.eclass: Remove racy pkg_postinst code by Sam James
1 On Mon, Nov 7, 2022 at 11:11 PM Sam James <sam@g.o> wrote:
2 >
3 >
4 >
5 > > On 8 Nov 2022, at 01:10, Matt Turner <mattst88@g.o> wrote:
6 > >
7 > > Noticed on ChromeOS when installing a large number of font packages in
8 > > parallel:
9 > >
10 > > /usr/share/fonts/noto/NotoSerifThai-Regular.ttf#new' from 0004 (------r--) to 2440 (r--r-S---)
11 > > * ERROR: media-fonts/ipaex-004.01-r1::chromiumos failed (postinst phase):
12 > > * failed to fix font files perms
13 > >
14 > > The "#new" filename is the hint. Portage uses "#new" suffixes when
15 > > copying files to the system, and then renames them to their final
16 > > filenames.
17 > >
18 > > This code was executing while another font was in the process of being
19 > > copied to the system. Font packages should just ensure that they install
20 > > files with correct permissions to begin with, and all except
21 > > media-fonts/x11fonts-jmk already use 0644 permissions.
22 > > media-fonts/x11fonts-jmk used 0444 (which was probably fine) until the
23 > > previous commit which changes its installed files to 0644.
24 > >
25 > > Bug: https://bugs.gentoo.org/187774
26 > > Signed-off-by: Matt Turner <mattst88@g.o>
27 > > ---
28 > > eclass/font.eclass | 6 ------
29 > > 1 file changed, 6 deletions(-)
30 > >
31 > > diff --git a/eclass/font.eclass b/eclass/font.eclass
32 > > index 4970c959f7c..0196755ce3e 100644
33 > > --- a/eclass/font.eclass
34 > > +++ b/eclass/font.eclass
35 > > @@ -186,12 +186,6 @@ font_src_install() {
36 > > # @DESCRIPTION:
37 > > # Updates fontcache if !prefix and media-libs/fontconfig installed
38 > > _update_fontcache() {
39 > > - if [[ -d "${EROOT}"/usr/share/fonts ]] ; then
40 > > - # unreadable font files = fontconfig segfaults
41 > > - find "${EROOT}"/usr/share/fonts/ -type f '!' -perm 0644 \
42 > > - -exec chmod -v 0644 2>/dev/null {} + || die "failed to fix font files perms"
43 > > - fi
44 > > -
45 > > if [[ -z ${ROOT} ]] ; then
46 > > if has_version media-libs/fontconfig ; then
47 > > ebegin "Updating global fontcache"
48 > > --
49 >
50 > Can we put an fperms call in src_install just in case (like the eclass originally had
51 > before moved to pkg_postinst)?
52
53 We can if you think it's necessary, but to be honest I think that the
54 original bug should have been WONTFIX. The user was manually
55 installing fonts into their system and then complained that things
56 didn't work when they configured the fonts with the wrong permissions.
57
58 I don't think fonts getting installed with unreadable permissions is a
59 real problem.