On 2023/07/20 17:27, Rafael Sadowski wrote:
> Let's start with a quote from an old try:
>
> "Our Xorg server doesn't run under the same uid as the client, the client
> needs to create the shared memory area with mode 0666.
>
> We are doing the same in misc/screen-shm. Of course, the consequence
> here would be to do it for all Qt applications."
>
> -- https://marc.info/?l=openbsd-ports&m=167110468109188&w=2
>
> There was a veto from sthen@, which was perfectly okay and right. For
> error analysis and to exclude that this function is not used, I need the
> shm mode from time to time. I would like to solve it with an environment
> variable (QT_OPENBSD_SHM_MODE).
>From that mail,
"What are the consequences of leaving this as-is? (i.e. what's broken
now that changing this would fix?)"
> Is that something we can live with?
>
> Feedback, OK?
>
> diff --git a/x11/qt5/qtbase/Makefile b/x11/qt5/qtbase/Makefile
> index 7a8676f3713..9fade59872e 100644
> --- a/x11/qt5/qtbase/Makefile
> +++ b/x11/qt5/qtbase/Makefile
> @@ -11,6 +11,7 @@ PKGNAME-mysql = qt5-mysql-${VERSION}
> PKGNAME-global = qt5-global-${VERSION}
> PKGNAME-psql = qt5-postgresql-${VERSION}
> PKGNAME-tds = qt5-tds-${VERSION}
> +REVISION-main = 0
>
> PKG_ARCH-global = *
> PKG_ARCH-examples = *
> diff --git
> a/x11/qt5/qtbase/patches/patch-src_plugins_platforms_xcb_qxcbbackingstore_cpp
> b/x11/qt5/qtbase/patches/patch-src_plugins_platforms_xcb_qxcbbackingstore_cpp
> new file mode 100644
> index 00000000000..ea72538e556
> --- /dev/null
> +++
> b/x11/qt5/qtbase/patches/patch-src_plugins_platforms_xcb_qxcbbackingstore_cpp
> @@ -0,0 +1,15 @@
> +The X serrver doesn't run under the same uid as the client, the client needs
> to
> +create the shm mode 0666
> +Index: src/plugins/platforms/xcb/qxcbbackingstore.cpp
> +--- src/plugins/platforms/xcb/qxcbbackingstore.cpp.orig
> ++++ src/plugins/platforms/xcb/qxcbbackingstore.cpp
> +@@ -406,7 +406,8 @@ void QXcbBackingStoreImage::createShmSegment(size_t se
> + bool QXcbBackingStoreImage::createSystemVShmSegment(xcb_connection_t *c,
> size_t segmentSize,
> + xcb_shm_segment_info_t
> *shmInfo)
> + {
> +- const int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0600);
> ++ const bool isOpenBsdShmMode =
> !QString::fromLocal8Bit(qgetenv("QT_OPENBSD_SHM_MODE")).isEmpty();
> ++ const int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT |
> isOpenBsdShmMode ? 0666 : 0600);
> + if (id == -1) {
> + qCWarning(lcQpaXcb, "shmget() failed (%d: %s) for size %zu", errno,
> strerror(errno), segmentSize);
> + return false;