diff --git a/debian/changelog b/debian/changelog index 425ef7e..1069d93 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,18 @@ qt6-base (6.2.2+dfsg-3) UNRELEASED; urgency=medium + [ Pino Toscano ] + * Backport/add patches for Hurd support: + - backport upstream commit 099e0fff61f080e2d628c8f472df78f6fd2f5234 to + support Hurd in the CMake build system; patch + upstream_CMake-add-support-for-GNU-Hurd.patch + - backport upstream commit 13a11f1c3526112eaf28943185fadc14523fd496 to + fix an unconditional PIPE_BUF usage; patch + upstream_QProcess-Unix-fallback-on-_POSIX_PIPE_BUF-w-missing-.patch + - backport upstream commit bf2fe41616c54712f78ea0ffd173f3614eb20190 to + limit a Linux-only code block in the QStorageInfo implementation; patch + upstream_QStorageInfo-limit-Linux-only-code-with-Q_OS_LINUX.patch + - borrow path_max.diff from qt-base 5 to avoid an unconditional PATH_MAX + usage -- Debian Qt/KDE Maintainers Sat, 29 Jan 2022 05:42:03 +0100 diff --git a/debian/patches/path_max.diff b/debian/patches/path_max.diff new file mode 100644 index 0000000..b9014fa --- /dev/null +++ b/debian/patches/path_max.diff @@ -0,0 +1,21 @@ +Author: Pino Toscano +Description: Avoid unconditional PATH_MAX usage + Use a "safe" size in case PATH_MAX is not defined; in the end, this should not + be used, as a allocating realpath() will be used instead. +Forwarded: no +Last-Update: 2020-04-19 + +--- a/src/corelib/io/qfilesystemengine_unix.cpp ++++ b/src/corelib/io/qfilesystemengine_unix.cpp +@@ -689,7 +689,11 @@ QFileSystemEntry QFileSystemEngine::cano + Q_UNUSED(data); + return QFileSystemEntry(slowCanonicalized(absoluteName(entry).filePath())); + #else ++#ifdef PATH_MAX + char stack_result[PATH_MAX+1]; ++#else ++ char stack_result[4096+1]; ++#endif + char *resolved_name = nullptr; + # if defined(Q_OS_DARWIN) || defined(Q_OS_ANDROID) + // On some Android and macOS versions, realpath() will return a path even if diff --git a/debian/patches/series b/debian/patches/series index 007a6af..dc8eb5b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,10 @@ +# fixed in 4.3 +upstream_QStorageInfo-limit-Linux-only-code-with-Q_OS_LINUX.patch + +# fixed in 4.4 +upstream_CMake-add-support-for-GNU-Hurd.patch +upstream_QProcess-Unix-fallback-on-_POSIX_PIPE_BUF-w-missing-.patch + # Debian specific remove_privacy_breaches.diff +path_max.diff diff --git a/debian/patches/upstream_CMake-add-support-for-GNU-Hurd.patch b/debian/patches/upstream_CMake-add-support-for-GNU-Hurd.patch new file mode 100644 index 0000000..b441806 --- /dev/null +++ b/debian/patches/upstream_CMake-add-support-for-GNU-Hurd.patch @@ -0,0 +1,142 @@ +From 099e0fff61f080e2d628c8f472df78f6fd2f5234 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Sun, 21 Nov 2021 08:59:56 +0100 +Subject: [PATCH] CMake: add support for GNU/Hurd + +Add a "HURD" CMake platform specification, so it can be properly +checked in the build system. + +Set QT_DEFAULT_MKSPEC to the existing hurd-g++ mkspec. + +Hurd supports $ORIGIN in RPATH, so enable it. + +Hurd uses X11, so add it to the X11_SUPPORTED list. + +Enable few more feature checks that apply to Hurd as well: either +because they are provided by GNU libc itself, or because they are +implemented on Hurd. + +Check and set the ELF interpreter, as it is a common functionality of +the GNU toolchain. + +Change-Id: Id347033560bbc5a2a4e2c3abb493c948c002b40e +Reviewed-by: Edward Welbourne +Reviewed-by: Joerg Bornemann +Reviewed-by: Qt CI Bot +Reviewed-by: Alexandru Croitor +--- + cmake/QtBuild.cmake | 2 ++ + cmake/QtPlatformSupport.cmake | 1 + + cmake/QtRpathHelpers.cmake | 2 +- + src/corelib/CMakeLists.txt | 2 +- + src/corelib/configure.cmake | 8 ++++---- + src/gui/configure.cmake | 2 +- + 6 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake +index b06dec60d8..d267f560c1 100644 +--- a/cmake/QtBuild.cmake ++++ b/cmake/QtBuild.cmake +@@ -362,6 +362,8 @@ elseif(SOLARIS) + set(QT_DEFAULT_MKSPEC solaris-cc) + endif() + endif() ++elseif(HURD) ++ set(QT_DEFAULT_MKSPEC hurd-g++) + endif() + + if(NOT QT_QMAKE_TARGET_MKSPEC) +diff --git a/cmake/QtPlatformSupport.cmake b/cmake/QtPlatformSupport.cmake +index f39bf0e780..a10e7226eb 100644 +--- a/cmake/QtPlatformSupport.cmake ++++ b/cmake/QtPlatformSupport.cmake +@@ -18,6 +18,7 @@ qt_set01(FREEBSD CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # FIXME: How to identify + qt_set01(NETBSD CMAKE_SYSTEM_NAME STREQUAL "NetBSD") # FIXME: How to identify this? + qt_set01(WASM CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR EMSCRIPTEN) + qt_set01(SOLARIS CMAKE_SYSTEM_NAME STREQUAL "SunOS") ++qt_set01(HURD CMAKE_SYSTEM_NAME STREQUAL "GNU") + + qt_set01(BSD APPLE OR OPENBSD OR FREEBSD OR NETBSD) + +diff --git a/cmake/QtRpathHelpers.cmake b/cmake/QtRpathHelpers.cmake +index 6e3414b50f..cbe33a6b77 100644 +--- a/cmake/QtRpathHelpers.cmake ++++ b/cmake/QtRpathHelpers.cmake +@@ -20,7 +20,7 @@ function(qt_compute_relative_rpath_base rpath install_location out_var) + # needed in the .prf files, but for CMake we need to prepend them ourselves. + if(APPLE) + set(rpath_rel_base "@loader_path") +- elseif(LINUX OR SOLARIS OR FREEBSD) ++ elseif(LINUX OR SOLARIS OR FREEBSD OR HURD) + set(rpath_rel_base "$ORIGIN") + else() + message(WARNING "No known RPATH_REL_BASE for target platform.") +diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt +index c1259150ab..be4bc7b2de 100644 +--- a/src/corelib/CMakeLists.txt ++++ b/src/corelib/CMakeLists.txt +@@ -339,7 +339,7 @@ set_property(TARGET Core APPEND PROPERTY + PRIVATE_HEADER "${CMAKE_CURRENT_BINARY_DIR}/global/qconfig_p.h") + + # Find ELF interpreter and define a macro for that: +-if (LINUX AND NOT CMAKE_CROSSCOMPILING AND BUILD_SHARED_LIBS) ++if ((LINUX OR HURD) AND NOT CMAKE_CROSSCOMPILING AND BUILD_SHARED_LIBS) + if (NOT DEFINED ELF_INTERPRETER) + execute_process(COMMAND ${CMAKE_COMMAND} -E env LC_ALL=C readelf -l /bin/ls + RESULT_VARIABLE readelf_ok +diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake +index 08d1e0d976..71e237ae9c 100644 +--- a/src/corelib/configure.cmake ++++ b/src/corelib/configure.cmake +@@ -578,7 +578,7 @@ qt_feature("glib" PUBLIC PRIVATE + qt_feature_definition("glib" "QT_NO_GLIB" NEGATE VALUE "1") + qt_feature("glibc" PRIVATE + LABEL "GNU libc" +- AUTODETECT LINUX ++ AUTODETECT ( LINUX OR HURD ) + CONDITION TEST_glibc + ) + qt_feature("icu" PRIVATE +@@ -612,7 +612,7 @@ qt_feature("system-libb2" PRIVATE + # Currently only used by QTemporaryFile; linkat() exists on Android, but hardlink creation fails due to security rules + qt_feature("linkat" PRIVATE + LABEL "linkat()" +- AUTODETECT LINUX AND NOT ANDROID ++ AUTODETECT ( LINUX AND NOT ANDROID ) OR HURD + CONDITION TEST_linkat + ) + qt_feature("std-atomic64" PUBLIC +@@ -669,7 +669,7 @@ qt_feature("qqnx_pps" PRIVATE + ) + qt_feature("renameat2" PRIVATE + LABEL "renameat2()" +- CONDITION LINUX AND TEST_renameat2 ++ CONDITION ( LINUX OR HURD ) AND TEST_renameat2 + ) + qt_feature("slog2" PRIVATE + LABEL "slog2" +@@ -677,7 +677,7 @@ qt_feature("slog2" PRIVATE + ) + qt_feature("statx" PRIVATE + LABEL "statx() in libc" +- CONDITION LINUX AND TEST_statx ++ CONDITION ( LINUX OR HURD ) AND TEST_statx + ) + qt_feature("syslog" PRIVATE + LABEL "syslog" +diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake +index f5d26977af..b4625c77b4 100644 +--- a/src/gui/configure.cmake ++++ b/src/gui/configure.cmake +@@ -25,7 +25,7 @@ set_property(CACHE INPUT_libpng PROPERTY STRINGS undefined no qt system) + + + #### Libraries +-qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS) # special case ++qt_set01(X11_SUPPORTED LINUX OR HPUX OR FREEBSD OR NETBSD OR OPENBSD OR SOLARIS OR HURD) # special case + qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2 MODULE_NAME gui QMAKE_LIB atspi) + qt_find_package(DirectFB PROVIDED_TARGETS PkgConfig::DirectFB MODULE_NAME gui QMAKE_LIB directfb) + qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm) +-- +2.34.1 + diff --git a/debian/patches/upstream_QProcess-Unix-fallback-on-_POSIX_PIPE_BUF-w-missing-.patch b/debian/patches/upstream_QProcess-Unix-fallback-on-_POSIX_PIPE_BUF-w-missing-.patch new file mode 100644 index 0000000..7d93f08 --- /dev/null +++ b/debian/patches/upstream_QProcess-Unix-fallback-on-_POSIX_PIPE_BUF-w-missing-.patch @@ -0,0 +1,53 @@ +From 13a11f1c3526112eaf28943185fadc14523fd496 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Mon, 17 Jan 2022 20:43:01 +0100 +Subject: [PATCH] QProcess/Unix: fallback on _POSIX_PIPE_BUF w/ missing + PIPE_BUF + +PIPE_BUF is optional in POSIX, e.g. "where the corresponding value is +equal to or greater than the stated minimum, but where the value can +vary depending on the file to which it is applied." [1] + +GNU/Hurd does not provide PIPE_BUF, so fallback to its minimum +acceptable value, that is _POSIX_PIPE_BUF. + +[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html + +Also, explicitly include in this file, to make sure PIPE_BUF +or _POSIX_PIPE_BUF are available without relying on other headers to +pull . + +Change-Id: Ifae964db81841e1d31fc09e73b45594af9a326d1 +Reviewed-by: Oswald Buddenhagen +Reviewed-by: Thiago Macieira +--- + src/corelib/io/qprocess_unix.cpp | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp +index bf19fc2183..91005b0b67 100644 +--- a/src/corelib/io/qprocess_unix.cpp ++++ b/src/corelib/io/qprocess_unix.cpp +@@ -69,6 +69,7 @@ + #endif + + #include ++#include + #include + #include + +@@ -935,7 +936,11 @@ bool QProcessPrivate::startDetached(qint64 *pid) + { + QByteArray encodedWorkingDirectory = QFile::encodeName(workingDirectory); + ++#ifdef PIPE_BUF + static_assert(PIPE_BUF >= sizeof(ChildError)); ++#else ++ static_assert(_POSIX_PIPE_BUF >= sizeof(ChildError)); ++#endif + ChildError childStatus = { 0, {} }; + + AutoPipe startedPipe, pidPipe; +-- +2.34.1 + diff --git a/debian/patches/upstream_QStorageInfo-limit-Linux-only-code-with-Q_OS_LINUX.patch b/debian/patches/upstream_QStorageInfo-limit-Linux-only-code-with-Q_OS_LINUX.patch new file mode 100644 index 0000000..6a6da5b --- /dev/null +++ b/debian/patches/upstream_QStorageInfo-limit-Linux-only-code-with-Q_OS_LINUX.patch @@ -0,0 +1,39 @@ +From bf2fe41616c54712f78ea0ffd173f3614eb20190 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Sun, 21 Nov 2021 09:25:30 +0100 +Subject: [PATCH] QStorageInfo: limit Linux-only code with Q_OS_LINUX + +This fixes a build problem (use of PATH_MAX) by eliminating a +Linux-specific condition that can't happen on HURD anyway. + +Change-Id: I5dcaf104a60b7850b8af3964fc4cd02ab24acd7b +Reviewed-by: Thiago Macieira +(cherry picked from commit 5558eb4edb62ddc920fd5f4171e732fb7cbe53a7) +Reviewed-by: Qt Cherry-pick Bot +--- + src/corelib/io/qstorageinfo_unix.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp +index 566ffe46bc..2b635f63bb 100644 +--- a/src/corelib/io/qstorageinfo_unix.cpp ++++ b/src/corelib/io/qstorageinfo_unix.cpp +@@ -568,6 +568,7 @@ inline QByteArray QStorageIterator::fileSystemType() const + + inline QByteArray QStorageIterator::device() const + { ++#ifdef Q_OS_LINUX + // check that the device exists + if (mnt.mnt_fsname[0] == '/' && access(mnt.mnt_fsname, F_OK) != 0) { + // It doesn't, so let's try to resolve the dev_t from /dev/block. +@@ -583,6 +584,7 @@ inline QByteArray QStorageIterator::device() const + return dev; + } + } ++#endif + return QByteArray(mnt.mnt_fsname); + } + +-- +2.34.1 +