Bug 254963

Summary: x11-fonts/fontconfig update to 2.13.93 breaks building as non-root
Product: Ports & Packages Reporter: Piotr Smyrak <ps.ports>
Component: Individual Port(s)Assignee: freebsd-desktop (Team) <desktop>
Status: Closed FIXED    
Severity: Affects Some People CC: diizzy, gerald, jcfyecrayz
Priority: --- Flags: bugzilla: maintainer-feedback? (desktop)
ps.ports: maintainer-feedback?
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Reproducible failure log
none
Patch for fontconfig
none
Patch for fontconfig v2
none
[patch] add option to disable running fc-cache
none
[patch] add option to disable running fc-cache (v2) jcfyecrayz: maintainer-approval? (diizzy)

Description Piotr Smyrak 2021-04-10 21:55:15 UTC
Created attachment 224004 [details]
Reproducible failure log

The changes of 253212 seem to prevent the port from being buildable as non-root user. See attached log for a reproducible build failure as a non privileged user.
Comment 1 John Hein 2021-08-16 18:19:41 UTC
This is still a problem with 2.13.94

Obviously, 'make stage' should not be running 'fc-cache' on files in /usr/local (and fc-cache/meson.build tries to do this).
Comment 2 John Hein 2021-08-16 18:20:52 UTC
I mentioned this in bug 257119.  Committer CC'd.
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2021-08-17 07:38:08 UTC
Hi,

Just to confirm, commenting out https://gitlab.freedesktop.org/fontconfig/fontconfig/-/blob/main/fc-cache/meson.build#L11 resolves the issue?

That seems to have been the previous workaround looking at https://cgit.freebsd.org/ports/tree/x11-fonts/fontconfig/files/patch-Makefile.in?id=475b88f2899abefb323e1ebf44db4590d08a4ac7

Sorry for not noticing this bug report earlier.

Best regards,
Daniel
Comment 4 Piotr Smyrak 2021-08-17 18:21:20 UTC
(In reply to Daniel Engberg from comment #3)

Indeed. The suggested change to fc-cache/meson.build got this through.
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2021-08-18 09:09:44 UTC
Created attachment 227303 [details]
Patch for fontconfig

Fix generation of cache
Comment 6 Daniel Engberg freebsd_committer freebsd_triage 2021-08-18 10:12:48 UTC
Comment on attachment 224004 [details]
Reproducible failure log

Use SUB_ functions instead manually invoking sed (thanks tcberner@)
Comment 7 Daniel Engberg freebsd_committer freebsd_triage 2021-08-18 10:13:29 UTC
Created attachment 227305 [details]
Patch for fontconfig v2
Comment 8 John Hein 2021-08-18 11:06:33 UTC
Created attachment 227307 [details]
[patch] add option to disable running fc-cache

Here's the patch I came up with (meant to send this a couple days ago).  This can be upstreamed.

Verified with poudriere (used testport -i to manually run 'make stage' in the jail with a regular user account).

QA:
 - testport (ok)
 - portlint (ok, no new warnings)
Comment 9 John Hein 2021-08-18 11:36:33 UTC
(In reply to John Hein from comment #8)
Upstream issue:

https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/296
Comment 10 John Hein 2021-08-18 16:17:15 UTC
Created attachment 227310 [details]
[patch] add option to disable running fc-cache (v2)

In my previous patch, I forgot to remove pkg-install.in, made unnecessary by this patch (use pkg-plist instead).
Comment 11 Gerald Pfeifer freebsd_committer freebsd_triage 2021-09-05 10:58:37 UTC
Comment on attachment 227310 [details]
[patch] add option to disable running fc-cache (v2)

Interestingly this has not triggered for me, building as a regular user.

Alas there is another problem (which has been there for longer):

  @dir /var/db/fontconfig

in pkg-plist.  This ignore $PREFIX and also breaks building as user.


In any case, thank you for addressing the fc-cache issue and working
this upstream!
Comment 12 commit-hook freebsd_committer freebsd_triage 2021-09-06 18:05:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1215cfdc188e71f377e4274a7525f4afc2315ba8

commit 1215cfdc188e71f377e4274a7525f4afc2315ba8
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2021-09-06 17:54:36 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2021-09-06 18:05:09 +0000

    x11-fonts/fontconfig: Restore generation of font cache

    Restore generation of cache prior to Meson switch
    Upstream patch provided by John Hein

    PR:             254963
    Reported by:    Piotr Smyrak
    Tested by:      Piotr Smyrak and John Hein
    Approved by:    arrowd (mentor)
    Obtained from:  https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/296
    Differential Revision:  https://reviews.freebsd.org/D31602

 x11-fonts/fontconfig/Makefile                               |  4 +++-
 x11-fonts/fontconfig/files/patch-fc-cache_meson.build (new) | 10 ++++++++++
 x11-fonts/fontconfig/files/patch-meson__options.txt (new)   |  8 ++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)
Comment 13 Daniel Engberg freebsd_committer freebsd_triage 2021-09-06 18:27:42 UTC
Thanks everyone for reporting and debugging this issue
Comment 14 John Hein 2021-09-06 20:14:45 UTC
(In reply to Daniel Engberg from comment #13)
I don't think the SUB_FILES & SUB_LIST additions were needed, right?
Comment 15 Daniel Engberg freebsd_committer freebsd_triage 2021-09-06 20:36:56 UTC
(In reply to John Hein from comment #14)
They are as only the patch you submitted upstream is in repo
Comment 16 John Hein 2021-09-07 20:20:19 UTC
(In reply to Daniel Engberg from comment #15)
Ah... I didn't notice you didn't use my full patch which included removal of pkg-install.in in favor of @postexec in pkg-plist.  I still carry that change locally, and the SUB_* settings in Makefile are not needed.
Comment 17 Gerald Pfeifer freebsd_committer freebsd_triage 2021-09-08 15:54:15 UTC
(In reply to Gerald Pfeifer from comment #11)
> Alas there is another problem (which has been there for longer):
>
>  @dir /var/db/fontconfig
>
> in pkg-plist.  This ignore $PREFIX and also breaks building as user.

I filed a separate issue for this in bug #258372.