Bug 256970 - multimedia/pipewire: unbreak xdg-desktop-portal-wlr after 0.3.31 update
Summary: multimedia/pipewire: unbreak xdg-desktop-portal-wlr after 0.3.31 update
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2021-07-04 10:28 UTC by Jan Beich
Modified: 2021-07-08 00:32 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (arrowd)
jbeich: merge-quarterly+


Attachments
v1 (revert upstream change) (2.40 KB, patch)
2021-07-04 10:28 UTC, Jan Beich
no flags Details | Diff
v1.1 (revert upstream change) (3.64 KB, patch)
2021-07-04 10:41 UTC, Jan Beich
no flags Details | Diff
v2 (2.90 KB, patch)
2021-07-04 19:03 UTC, Evgeniy Khramtsov
evgeniy: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2021-07-04 10:28:29 UTC
Created attachment 226210 [details]
v1 (revert upstream change)

In 0.3.31 update ( ports ea3170c51fd4) https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/cb6dbd165a37 made public API incompatible with consumers using _POSIX_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE: <sys/mount.h> isn't standalone but depends on BSD-specific types in <sys/types.h> which are hidden when POSIX compliance is requested. xdg-desktop-portal-wlr passes -D_POSIX_C_SOURCE=200809L via meson.build which works for its own code and all other dependencies.

In file included from ../src/core/main.c:7:
In file included from /usr/local/include/pipewire-0.3/pipewire/pipewire.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/client.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/proxy.h:108:
In file included from /usr/local/include/pipewire-0.3/pipewire/protocol.h:48:
In file included from /usr/local/include/pipewire-0.3/pipewire/utils.h:34:
In file included from /usr/include/sys/mount.h:38:
/usr/include/sys/ucred.h:99:2: error: unknown type name 'u_int'
        u_int   cr_version;             /* structure layout version */
        ^
In file included from ../src/core/main.c:7:
In file included from /usr/local/include/pipewire-0.3/pipewire/pipewire.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/client.h:35:
In file included from /usr/local/include/pipewire-0.3/pipewire/proxy.h:108:
In file included from /usr/local/include/pipewire-0.3/pipewire/protocol.h:48:
In file included from /usr/local/include/pipewire-0.3/pipewire/utils.h:34:


http://www.ipv6proxy.net/go.php?u=http://beefy18.nyi.freebsd.org/data/main-amd64-default/p8656d375678d_s6329ca325e/logs/errors/xdg-desktop-portal-wlr-0.4.0.log
Comment 1 Jan Beich freebsd_committer 2021-07-04 10:41:46 UTC
Created attachment 226211 [details]
v1.1 (revert upstream change)

Fixed wording in patch comment.

Note, xdg-desktop-portal-wlr upstream tests FreeBSD on CI. Dropping -D_POSIX_C_SOURCE=200809L requires convincing upstream first that this is *not* a bug in the dependency.

https://github.com/emersion/xdg-desktop-portal-wlr/blob/master/.builds/freebsd.yml
Comment 2 Jan Beich freebsd_committer 2021-07-04 10:45:08 UTC
Marking for MFH as 2021Q3 was recently branched.
Comment 3 Evgeniy Khramtsov 2021-07-04 19:03:15 UTC
Created attachment 226225 [details]
v2

What do you think about this? I wait for Linux CI to complete,
if it is OK to you, I'll MR this upstream. I'll write more about
xdg-desktop-portal-wlr under this bug later, but I've just got home
and want to fix it ASAP now, so I reply now.
Comment 4 Evgeniy Khramtsov 2021-07-04 19:27:35 UTC
(In reply to Evgeniy Khramtsov from comment #3)

> If it is OK to you

Nevermind: https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/815/commits
Comment 5 Evgeniy Khramtsov 2021-07-04 19:49:07 UTC
> xdg-desktop-portal-wlr passes -D_POSIX_C_SOURCE

Even though Wayland depends on Linux-specific DRM and GBM, weird...

> Dropping -D_POSIX_C_SOURCE=200809L requires convincing upstream first that this is *not* a bug in the dependency.

I doubt xdg-desktop-portal-wlr will do it, it seems that POSIX compliance matters to them. I MR'ed a workaround for xdg-desktop-portal-wlr in PipeWire for now. Unfortunately, I can't really invest much time nowadays... (255348 somewhat related).
Comment 6 Evgeniy Khramtsov 2021-07-04 19:52:56 UTC
(In reply to Evgeniy Khramtsov from comment #5)
> Linux-specific GBM

nevermind, i better go have a rest
Comment 7 Evgeniy Khramtsov 2021-07-05 10:17:46 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256988 to unbreak xdg-desktop-portal-wlr for now.
Comment 8 Jan Beich freebsd_committer 2021-07-05 14:13:23 UTC
(In reply to Evgeniy Khramtsov from comment #3)
Why <sys/mount.h> is included in a header (namespace pollution) instead of *.c files that call statfs() ? For example, src/modules/module-protocol-pulse/utils.c has <sys/vfs.h> but not <sys/mount.h> despite both headers being used to declare statfs() on different platforms.
Comment 9 Evgeniy Khramtsov 2021-07-05 14:30:18 UTC
(In reply to Jan Beich from comment #8)

> Why <sys/mount.h> is included in a header (namespace pollution) instead of *.c files that call statfs() ? For example, src/modules/module-protocol-pulse/utils.c has <sys/vfs.h> but not <sys/mount.h> despite both headers being used to declare statfs() on different platforms.

I want to keep FreeBSD-specific definitions in less files, preferably. See https://github.com/PipeWire/pipewire/blob/master/src/pipewire/utils.h#L73,
utils.h was claimed for FreeBSD-specific defines first by Greg V. Definitions
from here get passed to the whole PipeWire, so LOCAL_PEERCRED from here
should get defined for everything (if upstream refactor again, etc),
but I had no idea that this utils.h gets included from public API for consumers.

In short: I added FreeBSD-specific definitions to the place where they were.
I agree that this is namespace pollution, these definitions should be moved somewhere else, so they are not public.
Comment 10 Evgeniy Khramtsov 2021-07-05 14:36:17 UTC
(In reply to Evgeniy Khramtsov from comment #9)

> I agree that this is namespace pollution, these definitions should be moved somewhere else, so they are not public.

v1.1 (revert upstream change) can be submitted upstream, I guess. You are the
author of v1.1, feel free to submit upstream if you want, but I would still wait for arrowd@ to say which way would be fine.
Comment 11 Jan Beich freebsd_committer 2021-07-08 00:32:12 UTC
Landed in ports 701a40c48b3b (and MFH'd in ports 4dd7d7e9db8e) to avoid pkg-fallout@ spam and unblock https://github.com/emersion/xdg-desktop-portal-wlr/pull/141#issuecomment-874822700