summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/abseil-cpp-fix-gtest.patch16
-rw-r--r--gnu/packages/patches/agg-2.5-gcc8.patch14
-rw-r--r--gnu/packages/patches/atlas-gfortran-compat.patch37
-rw-r--r--gnu/packages/patches/awesome-4.3-fno-common.patch178
-rw-r--r--gnu/packages/patches/bdb-5.3-atomics-on-gcc-9.patch22
-rw-r--r--gnu/packages/patches/biber-fix-encoding-write.patch31
-rw-r--r--gnu/packages/patches/biber-sortinithash.patch1666
-rw-r--r--gnu/packages/patches/binutils-2.37-file-descriptor-leak.patch231
-rw-r--r--gnu/packages/patches/binutils-loongson-workaround.patch14
-rw-r--r--gnu/packages/patches/binutils-mingw-w64-timestamp.patch39
-rw-r--r--gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch126
-rw-r--r--gnu/packages/patches/cdrkit-libre-cross-compile.patch32
-rw-r--r--gnu/packages/patches/ceph-boost-compat.patch18
-rw-r--r--gnu/packages/patches/ceph-fix-snappy-breaking-change.patch13
-rw-r--r--gnu/packages/patches/ceph-rocksdb-compat.patch303
-rw-r--r--gnu/packages/patches/cheese-vala-update.patch180
-rw-r--r--gnu/packages/patches/classpath-miscompilation.patch71
-rw-r--r--gnu/packages/patches/cling-use-shared-library.patch329
-rw-r--r--gnu/packages/patches/coreutils-gnulib-tests.patch45
-rw-r--r--gnu/packages/patches/cups-CVE-2020-10001.patch47
-rw-r--r--gnu/packages/patches/curl-7.76-use-ssl-cert-env.patch64
-rw-r--r--gnu/packages/patches/curl-7.77-tls-priority-string.patch98
-rw-r--r--gnu/packages/patches/curl-use-ssl-cert-env.patch4
-rw-r--r--gnu/packages/patches/dbus-CVE-2020-12049.patch58
-rw-r--r--gnu/packages/patches/diffutils-fix-signal-processing.patch58
-rw-r--r--gnu/packages/patches/diffutils-gets-undeclared.patch71
-rw-r--r--gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch11
-rw-r--r--gnu/packages/patches/docbook-xsl-support-old-url.patch17
-rw-r--r--gnu/packages/patches/doxygen-1.8.17-runtests.patch73
-rw-r--r--gnu/packages/patches/doxygen-test.patch60
-rw-r--r--gnu/packages/patches/elogind-revert-polkit-detection.patch41
-rw-r--r--gnu/packages/patches/evolution-CVE-2020-11879.patch122
-rw-r--r--gnu/packages/patches/evolution-data-server-CVE-2020-14928.patch115
-rw-r--r--gnu/packages/patches/evolution-data-server-CVE-2020-16117.patch28
-rw-r--r--gnu/packages/patches/evolution-data-server-libical-compat.patch36
-rw-r--r--gnu/packages/patches/evolution-data-server-locales.patch33
-rw-r--r--gnu/packages/patches/farstream-gupnp.patch140
-rw-r--r--gnu/packages/patches/findutils-test-rwlock-threads.patch38
-rw-r--r--gnu/packages/patches/fontconfig-cache-ignore-mtime.patch15
-rw-r--r--gnu/packages/patches/fontconfig-hurd-path-max.patch17
-rw-r--r--gnu/packages/patches/freecad-boost-serialization.patch27
-rw-r--r--gnu/packages/patches/freecad-vtk9.patch827
-rw-r--r--gnu/packages/patches/freeglut-gcc-compat.patch53
-rw-r--r--gnu/packages/patches/ganeti-preserve-PYTHONPATH.patch21
-rw-r--r--gnu/packages/patches/gcc-10-cross-environment-variables.patch51
-rw-r--r--gnu/packages/patches/gcc-5-fix-powerpc64le-build.patch64
-rw-r--r--gnu/packages/patches/gcc-cross-gxx-include-dir.patch73
-rw-r--r--gnu/packages/patches/gd-Revert-fix-303-gdlib.pc.patch179
-rw-r--r--gnu/packages/patches/gdb-fix-gnu-nat-build.patch254
-rw-r--r--gnu/packages/patches/gdb-hurd.patch69
-rw-r--r--gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch53
-rw-r--r--gnu/packages/patches/gdm-default-session.patch27
-rw-r--r--gnu/packages/patches/gdm-elogind-support.patch211
-rw-r--r--gnu/packages/patches/gdm-pass-gdk-pixbuf-loader-env.patch24
-rw-r--r--gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch22
-rw-r--r--gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch35
-rw-r--r--gnu/packages/patches/geary-CVE-2020-24661.patch133
-rw-r--r--gnu/packages/patches/geeqie-clutter.patch35
-rw-r--r--gnu/packages/patches/genimage-mke2fs-test.patch10
-rw-r--r--gnu/packages/patches/ghostscript-CVE-2020-15900.patch36
-rw-r--r--gnu/packages/patches/ghostscript-freetype-compat.patch35
-rw-r--r--gnu/packages/patches/ghostscript-no-header-creationdate.patch22
-rw-r--r--gnu/packages/patches/glade-gls-set-script-name.patch32
-rw-r--r--gnu/packages/patches/glade-test-widget-null-icon.patch30
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27218.patch132
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-01.patch176
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-02.patch264
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-03.patch136
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-04.patch308
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-05.patch47
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-06.patch94
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-07.patch118
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-08.patch94
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-09.patch98
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-10.patch52
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-11.patch57
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-12.patch30
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-13.patch32
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-14.patch32
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-15.patch95
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-16.patch43
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-17.patch37
-rw-r--r--gnu/packages/patches/glib-CVE-2021-27219-18.patch232
-rw-r--r--gnu/packages/patches/glib-CVE-2021-28153.patch283
-rw-r--r--gnu/packages/patches/glib-networking-32-bit-time.patch61
-rw-r--r--gnu/packages/patches/glib-networking-gnutls-binding.patch21
-rw-r--r--gnu/packages/patches/glib-skip-failing-test.patch27
-rw-r--r--gnu/packages/patches/glib-tests-timer.patch15
-rw-r--r--gnu/packages/patches/glibc-2.27-git-fixes.patch702
-rw-r--r--gnu/packages/patches/glibc-2.27-supported-locales.patch33
-rw-r--r--gnu/packages/patches/glibc-2.28-git-fixes.patch248
-rw-r--r--gnu/packages/patches/glibc-2.28-supported-locales.patch33
-rw-r--r--gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch84
-rw-r--r--gnu/packages/patches/glibc-bootstrap-system.patch37
-rw-r--r--gnu/packages/patches/glibc-cross-objcopy.patch159
-rw-r--r--gnu/packages/patches/glibc-cross-objdump.patch159
-rw-r--r--gnu/packages/patches/glibc-dl-cache.patch140
-rw-r--r--gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch19
-rw-r--r--gnu/packages/patches/glibc-skip-c++.patch31
-rw-r--r--gnu/packages/patches/glibc-static-nss.patch1244
-rw-r--r--gnu/packages/patches/gnome-boxes-add-guix-logo.patch32
-rw-r--r--gnu/packages/patches/gnome-online-miners-tracker-3.patch1505
-rw-r--r--gnu/packages/patches/gnome-screenshot-meson-0.60.patch39
-rw-r--r--gnu/packages/patches/gnome-session-support-elogind.patch73
-rw-r--r--gnu/packages/patches/gnome-shell-CVE-2020-17489.patch46
-rw-r--r--gnu/packages/patches/gnome-shell-disable-test.patch25
-rw-r--r--gnu/packages/patches/gnome-shell-theme.patch51
-rw-r--r--gnu/packages/patches/gnome-todo-delete-esource-duplicate.patch10
-rw-r--r--gnu/packages/patches/gnupg-1-build-with-gcc10.patch64
-rw-r--r--gnu/packages/patches/gnutls-CVE-2021-20231.patch62
-rw-r--r--gnu/packages/patches/gnutls-CVE-2021-20232.patch60
-rw-r--r--gnu/packages/patches/gnutls-guile-eintr-eagain.patch56
-rw-r--r--gnu/packages/patches/graphviz-CVE-2020-18032.patch49
-rw-r--r--gnu/packages/patches/gst-libav-64channels-stack-corruption.patch31
-rw-r--r--gnu/packages/patches/gst-plugins-bad-fix-overflow.patch263
-rw-r--r--gnu/packages/patches/gst-plugins-base-fix-id3v2-invalid-read.patch40
-rw-r--r--gnu/packages/patches/gst-plugins-good-CVE-2021-3497.patch174
-rw-r--r--gnu/packages/patches/gst-plugins-good-CVE-2021-3498.patch22
-rw-r--r--gnu/packages/patches/gst-plugins-ugly-fix-out-of-bound-reads.patch119
-rw-r--r--gnu/packages/patches/gtk-doc-respect-xml-catalog.patch16
-rw-r--r--gnu/packages/patches/gtk2-fix-builder-test.patch94
-rw-r--r--gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch51
-rw-r--r--gnu/packages/patches/guile-email-fix-tests.patch35
-rw-r--r--gnu/packages/patches/guile-git-adjust-for-libgit2-1.2.0.patch78
-rw-r--r--gnu/packages/patches/guile-ssh-fix-test-suite.patch217
-rw-r--r--gnu/packages/patches/guile-ssh-read-error.patch18
-rw-r--r--gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch34
-rw-r--r--gnu/packages/patches/helm-fix-gcc-9-build.patch140
-rw-r--r--gnu/packages/patches/icu4c-CVE-2020-10531.patch127
-rw-r--r--gnu/packages/patches/inetutils-hurd.patch583
-rw-r--r--gnu/packages/patches/json-c-CVE-2020-12762.patch193
-rw-r--r--gnu/packages/patches/jsoncpp-fix-inverted-case.patch22
-rw-r--r--gnu/packages/patches/jsoncpp-pkg-config-version.patch24
-rw-r--r--gnu/packages/patches/julia-allow-parallel-build.patch32
-rw-r--r--gnu/packages/patches/lcms-CVE-2018-16435.patch171
-rw-r--r--gnu/packages/patches/ldc-bootstrap-disable-tests.patch72
-rw-r--r--gnu/packages/patches/ldc-disable-phobos-tests.patch22
-rw-r--r--gnu/packages/patches/lib2geom-fix-tests.patch192
-rw-r--r--gnu/packages/patches/libmicrohttpd-0.9.73-test-ssl3.patch35
-rw-r--r--gnu/packages/patches/librime-fix-build-with-gcc10.patch41
-rw-r--r--gnu/packages/patches/libtirpc-hurd-client.patch50
-rw-r--r--gnu/packages/patches/libunwind-julia-fix-GCC10-fno-common.patch40
-rw-r--r--gnu/packages/patches/libxml2-parent-pointers.patch228
-rw-r--r--gnu/packages/patches/libxml2-terminating-newline.patch33
-rw-r--r--gnu/packages/patches/libxml2-xpath-recursion-limit.patch20
-rw-r--r--gnu/packages/patches/libxt-guix-search-paths.patch13
-rw-r--r--gnu/packages/patches/llvm-3.6-fix-build-with-gcc-10.patch13
-rw-r--r--gnu/packages/patches/mariadb-CVE-2021-27928.patch642
-rw-r--r--gnu/packages/patches/mesa-opencl-all-targets.patch25
-rw-r--r--gnu/packages/patches/mesa-skip-tests.patch48
-rw-r--r--gnu/packages/patches/meson-allow-dirs-outside-of-prefix.patch20
-rw-r--r--gnu/packages/patches/meson-for-build-rpath.patch24
-rw-r--r--gnu/packages/patches/metabat-fix-compilation.patch39
-rw-r--r--gnu/packages/patches/mit-krb5-hurd.patch15
-rw-r--r--gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch29
-rw-r--r--gnu/packages/patches/mpg321-gcc-10.patch83
-rw-r--r--gnu/packages/patches/network-manager-meson.patch21
-rw-r--r--gnu/packages/patches/network-manager-plugin-path.patch69
-rw-r--r--gnu/packages/patches/nss-getcwd-nonnull.patch30
-rw-r--r--gnu/packages/patches/ocaml-4.09-multiple-definitions.patch41
-rw-r--r--gnu/packages/patches/ocaml-multiple-definitions.patch43
-rw-r--r--gnu/packages/patches/p11-kit-hurd.patch46
-rw-r--r--gnu/packages/patches/perl-cross.patch60
-rw-r--r--gnu/packages/patches/perl-deterministic-ordering.patch29
-rw-r--r--gnu/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch33
-rw-r--r--gnu/packages/patches/perl-no-sys-dirs.patch99
-rw-r--r--gnu/packages/patches/pipewire-0.2.7-fno-common.patch51
-rw-r--r--gnu/packages/patches/pitivi-fix-build-with-meson-0.60.patch46
-rw-r--r--gnu/packages/patches/polkit-CVE-2021-3560.patch21
-rw-r--r--gnu/packages/patches/polkit-configure-elogind.patch15
-rw-r--r--gnu/packages/patches/polkit-use-duktape.patch5030
-rw-r--r--gnu/packages/patches/python-2.7-no-static-lib.patch70
-rw-r--r--gnu/packages/patches/python-3-fix-tests.patch194
-rw-r--r--gnu/packages/patches/python-3-hurd-configure.patch27
-rw-r--r--gnu/packages/patches/python-3-no-static-lib.patch75
-rw-r--r--gnu/packages/patches/python-3.8-CVE-2021-3177.patch194
-rw-r--r--gnu/packages/patches/python-3.8-fix-tests.patch42
-rw-r--r--gnu/packages/patches/python-3.9-fix-tests.patch370
-rw-r--r--gnu/packages/patches/python-babel-fix-parse-future-test.patch68
-rw-r--r--gnu/packages/patches/python-chai-drop-python2.patch32
-rw-r--r--gnu/packages/patches/python-docopt-pytest6-compat.patch29
-rw-r--r--gnu/packages/patches/python-fixtures-remove-monkeypatch-test.patch59
-rw-r--r--gnu/packages/patches/python-poppler-qt5-fix-build.patch116
-rw-r--r--gnu/packages/patches/python-pyflakes-test-location.patch42
-rw-r--r--gnu/packages/patches/python-random2-getrandbits-test.patch23
-rw-r--r--gnu/packages/patches/python-testtools.patch57
-rw-r--r--gnu/packages/patches/python-typing-inspect-fix.patch38
-rw-r--r--gnu/packages/patches/python-werkzeug-tests.patch58
-rw-r--r--gnu/packages/patches/qtwebkit-fix-building-with-bison-3.7.patch54
-rw-r--r--gnu/packages/patches/qtwebkit-fix-building-with-glib-2.68.patch21
-rw-r--r--gnu/packages/patches/qtwebkit-fix-building-with-icu-68.patch152
-rw-r--r--gnu/packages/patches/qtwebkit-fix-building-with-python-3.9.patch35
-rw-r--r--gnu/packages/patches/range-v3-build-with-gcc10.patch122
-rw-r--r--gnu/packages/patches/rust-1.19-mrustc.patch28
-rw-r--r--gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch111
-rw-r--r--gnu/packages/patches/rust-1.30-gdb-llvm.patch89
-rw-r--r--gnu/packages/patches/rust-1.45-linker-locale.patch14
-rw-r--r--gnu/packages/patches/rust-1.48-linker-locale.patch14
-rw-r--r--gnu/packages/patches/rust-bootstrap-stage0-test.patch55
-rw-r--r--gnu/packages/patches/rust-reproducible-builds.patch25
-rw-r--r--gnu/packages/patches/rustc-1.39.0-src.patch99
-rw-r--r--gnu/packages/patches/scalapack-blacs-mpi-deprecations.patch170
-rw-r--r--gnu/packages/patches/scalapack-gcc-10-compilation.patch5684
-rw-r--r--gnu/packages/patches/strace-readlink-tests.patch46
-rw-r--r--gnu/packages/patches/syslinux-gcc10.patch87
-rw-r--r--gnu/packages/patches/syslinux-strip-gnu-property.patch31
-rw-r--r--gnu/packages/patches/tcl-fix-cross-compilation.patch39
-rw-r--r--gnu/packages/patches/tcsh-fix-autotest.patch11
-rw-r--r--gnu/packages/patches/texlive-bin-poppler-0.83.patch52
-rw-r--r--gnu/packages/patches/texlive-bin-poppler-0.86.patch17
-rw-r--r--gnu/packages/patches/tor-sandbox-i686.patch36
-rw-r--r--gnu/packages/patches/transmission-remote-gtk-fix-appstream.patch61
-rw-r--r--gnu/packages/patches/vigra-python-compat.patch18
-rw-r--r--gnu/packages/patches/xf86-video-mach64-bool-to-boolean.patch79
-rw-r--r--gnu/packages/patches/xf86-video-nouveau-fixup-ABI.patch64
-rw-r--r--gnu/packages/patches/xygrib-fix-finding-data.patch131
-rw-r--r--gnu/packages/patches/zstd-CVE-2021-24031_CVE-2021-24032.patch68
-rw-r--r--gnu/packages/patches/zziplib-CVE-2018-16548.patch49
218 files changed, 21660 insertions, 11377 deletions
diff --git a/gnu/packages/patches/abseil-cpp-fix-gtest.patch b/gnu/packages/patches/abseil-cpp-fix-gtest.patch
deleted file mode 100644
index 38971448f3..0000000000
--- a/gnu/packages/patches/abseil-cpp-fix-gtest.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-The GTEST_ALLOW_UNINSTANTIATED_PARAMTERIZED_TEST macro was added to googletest
-in commit 0b024bd9 on master. It has been used in an abseil-cpp release before
-a googletest release.
-
---- a/absl/container/internal/unordered_map_modifiers_test.h
-+++ b/absl/container/internal/unordered_map_modifiers_test.h
-@@ -286,7 +286,9 @@ class UniquePtrModifiersTest : public ::testing::Test {
- }
- };
-
-+#ifdef GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST
- GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UniquePtrModifiersTest);
-+#endif
-
- TYPED_TEST_SUITE_P(UniquePtrModifiersTest);
-
diff --git a/gnu/packages/patches/agg-2.5-gcc8.patch b/gnu/packages/patches/agg-2.5-gcc8.patch
new file mode 100644
index 0000000000..dfcfc6cd4a
--- /dev/null
+++ b/gnu/packages/patches/agg-2.5-gcc8.patch
@@ -0,0 +1,14 @@
+Taken from: https://gitweb.gentoo.org/repo/gentoo.git/tree/x11-libs/agg/files/agg-2.5-gcc8.patch.
+
+diff -uprN agg-2.5/include/agg_renderer_outline_aa.h agg-2.5-fixed/include/agg_renderer_outline_aa.h
+--- agg-2.5/include/agg_renderer_outline_aa.h 2018-08-25 02:02:52.507254241 +0800
++++ agg-2.5-fixed/include/agg_renderer_outline_aa.h 2018-08-25 02:04:15.291175316 +0800
+@@ -1375,7 +1375,7 @@ namespace agg
+ //---------------------------------------------------------------------
+ void profile(const line_profile_aa& prof) { m_profile = &prof; }
+ const line_profile_aa& profile() const { return *m_profile; }
+- line_profile_aa& profile() { return *m_profile; }
++ const line_profile_aa& profile() { return *m_profile; }
+
+ //---------------------------------------------------------------------
+ int subpixel_width() const { return m_profile->subpixel_width(); }
diff --git a/gnu/packages/patches/atlas-gfortran-compat.patch b/gnu/packages/patches/atlas-gfortran-compat.patch
new file mode 100644
index 0000000000..5b46f5a64d
--- /dev/null
+++ b/gnu/packages/patches/atlas-gfortran-compat.patch
@@ -0,0 +1,37 @@
+Fix build with gfortran 10.
+
+Taken from Debian:
+https://salsa.debian.org/science-team/atlas/-/blob/master/debian/patches/gfortran-10.patch
+
+--- a/interfaces/blas/C/testing/c_dblat1.f
++++ b/interfaces/blas/C/testing/c_dblat1.f
+@@ -247,11 +247,11 @@
+ IF (ICASE.EQ.7) THEN
+ * .. DNRM2TEST ..
+ STEMP(1) = DTRUE1(NP1)
+- CALL STEST1(DNRM2TEST(N,SX,INCX),STEMP,STEMP,SFAC)
++ CALL STEST1(DNRM2TEST(N,SX,INCX),STEMP(1),STEMP,SFAC)
+ ELSE IF (ICASE.EQ.8) THEN
+ * .. DASUMTEST ..
+ STEMP(1) = DTRUE3(NP1)
+- CALL STEST1(DASUMTEST(N,SX,INCX),STEMP,STEMP,SFAC)
++ CALL STEST1(DASUMTEST(N,SX,INCX),STEMP(1),STEMP,SFAC)
+ ELSE IF (ICASE.EQ.9) THEN
+ * .. DSCALTEST ..
+ CALL DSCALTEST(N,SA((INCX-1)*5+NP1),SX,INCX)
+--- a/interfaces/blas/C/testing/c_sblat1.f
++++ b/interfaces/blas/C/testing/c_sblat1.f
+@@ -247,11 +247,11 @@
+ IF (ICASE.EQ.7) THEN
+ * .. SNRM2TEST ..
+ STEMP(1) = DTRUE1(NP1)
+- CALL STEST1(SNRM2TEST(N,SX,INCX),STEMP,STEMP,SFAC)
++ CALL STEST1(SNRM2TEST(N,SX,INCX),STEMP(1),STEMP,SFAC)
+ ELSE IF (ICASE.EQ.8) THEN
+ * .. SASUMTEST ..
+ STEMP(1) = DTRUE3(NP1)
+- CALL STEST1(SASUMTEST(N,SX,INCX),STEMP,STEMP,SFAC)
++ CALL STEST1(SASUMTEST(N,SX,INCX),STEMP(1),STEMP,SFAC)
+ ELSE IF (ICASE.EQ.9) THEN
+ * .. SSCALTEST ..
+ CALL SSCALTEST(N,SA((INCX-1)*5+NP1),SX,INCX)
diff --git a/gnu/packages/patches/awesome-4.3-fno-common.patch b/gnu/packages/patches/awesome-4.3-fno-common.patch
new file mode 100644
index 0000000000..62f153d012
--- /dev/null
+++ b/gnu/packages/patches/awesome-4.3-fno-common.patch
@@ -0,0 +1,178 @@
+Taken from: https://github.com/awesomeWM/awesome/commit/d256d9055095f27a33696e0aeda4ee20ed4fb1a0
+Author: Reiner Herrmann <reiner@reiner-h.de>
+
+--- a/common/lualib.c
++++ b/common/lualib.c
+@@ -20,6 +20,8 @@
+ #include "common/lualib.h"
+ #include "luaa.h"
+
++lua_CFunction lualib_dofunction_on_error;
++
+ void luaA_checkfunction(lua_State *L, int idx)
+ {
+ if(!lua_isfunction(L, idx))
+--- a/common/lualib.h
++++ b/common/lualib.h
+@@ -28,7 +28,7 @@
+ #include "common/util.h"
+
+ /** Lua function to call on dofunction() error */
+-lua_CFunction lualib_dofunction_on_error;
++extern lua_CFunction lualib_dofunction_on_error;
+
+ void luaA_checkfunction(lua_State *, int);
+ void luaA_checktable(lua_State *, int);
+--- a/luaa.c
++++ b/luaa.c
+@@ -91,6 +91,8 @@ extern const struct luaL_Reg awesome_mouse_meta[];
+ extern const struct luaL_Reg awesome_root_methods[];
+ extern const struct luaL_Reg awesome_root_meta[];
+
++signal_array_t global_signals;
++
+ /** A call into the Lua code aborted with an error.
+ *
+ * This signal is used in the example configuration, @{05-awesomerc.md},
+--- a/luaa.h
++++ b/luaa.h
+@@ -317,7 +317,7 @@ const char *luaA_find_config(xdgHandle *, const char *, luaA_config_callback *);
+ bool luaA_parserc(xdgHandle *, const char *);
+
+ /** Global signals */
+-signal_array_t global_signals;
++extern signal_array_t global_signals;
+
+ int luaA_class_index_miss_property(lua_State *, lua_object_t *);
+ int luaA_class_newindex_miss_property(lua_State *, lua_object_t *);
+--- a/objects/button.c
++++ b/objects/button.c
+@@ -35,6 +35,8 @@
+
+ #include "button.h"
+
++lua_class_t button_class;
++
+ /** Button object.
+ *
+ * @tfield int button The mouse button number, or 0 for any button.
+--- a/objects/button.h
++++ b/objects/button.h
+@@ -39,7 +39,7 @@ typedef struct button_t
+ xcb_button_t button;
+ } button_t;
+
+-lua_class_t button_class;
++extern lua_class_t button_class;
+ LUA_OBJECT_FUNCS(button_class, button_t, button)
+ ARRAY_FUNCS(button_t *, button, DO_NOTHING)
+
+--- a/objects/client.c
++++ b/objects/client.c
+@@ -108,6 +108,8 @@
+ #include <xcb/shape.h>
+ #include <cairo-xcb.h>
+
++lua_class_t client_class;
++
+ /** Client class.
+ *
+ * This table allow to add more dynamic properties to the clients. For example,
+--- a/objects/client.h
++++ b/objects/client.h
+@@ -200,7 +200,7 @@ struct client_t
+ ARRAY_FUNCS(client_t *, client, DO_NOTHING)
+
+ /** Client class */
+-lua_class_t client_class;
++extern lua_class_t client_class;
+
+ LUA_OBJECT_FUNCS(client_class, client_t, client)
+
+--- a/objects/drawin.c
++++ b/objects/drawin.c
+@@ -46,6 +46,8 @@
+ #include <cairo-xcb.h>
+ #include <xcb/shape.h>
+
++lua_class_t drawin_class;
++
+ /** Drawin object.
+ *
+ * @field border_width Border width.
+--- a/objects/drawin.h
++++ b/objects/drawin.h
+@@ -52,7 +52,7 @@ void luaA_drawin_systray_kickout(lua_State *);
+
+ void drawin_class_setup(lua_State *);
+
+-lua_class_t drawin_class;
++extern lua_class_t drawin_class;
+
+ #endif
+ // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
+--- a/objects/key.c
++++ b/objects/key.c
+@@ -43,6 +43,8 @@
+ #include <xkbcommon/xkbcommon.h>
+ #include <glib.h>
+
++lua_class_t key_class;
++
+ /** Key object.
+ *
+ * @tfield string key The key to trigger an event.
+--- a/objects/key.h
++++ b/objects/key.h
+@@ -36,7 +36,7 @@ typedef struct keyb_t
+ xcb_keycode_t keycode;
+ } keyb_t;
+
+-lua_class_t key_class;
++extern lua_class_t key_class;
+ LUA_OBJECT_FUNCS(key_class, keyb_t, key)
+ DO_ARRAY(keyb_t *, key, DO_NOTHING)
+
+--- a/objects/tag.c
++++ b/objects/tag.c
+@@ -190,6 +190,8 @@
+ #include "ewmh.h"
+ #include "luaa.h"
+
++lua_class_t tag_class;
++
+ /**
+ * @signal request::select
+ */
+--- a/objects/tag.h
++++ b/objects/tag.h
+@@ -46,7 +46,7 @@ struct tag
+ client_array_t clients;
+ };
+
+-lua_class_t tag_class;
++extern lua_class_t tag_class;
+ LUA_OBJECT_FUNCS(tag_class, tag_t, tag)
+
+ void tag_class_setup(lua_State *);
+--- a/objects/window.c
++++ b/objects/window.c
+@@ -59,6 +59,7 @@
+ #include "property.h"
+ #include "xwindow.h"
+
++lua_class_t window_class;
+ LUA_CLASS_FUNCS(window, window_class)
+
+ static xcb_window_t
+--- a/objects/window.h
++++ b/objects/window.h
+@@ -80,7 +80,7 @@ typedef struct
+ WINDOW_OBJECT_HEADER
+ } window_t;
+
+-lua_class_t window_class;
++extern lua_class_t window_class;
+
+ void window_class_setup(lua_State *);
+
diff --git a/gnu/packages/patches/bdb-5.3-atomics-on-gcc-9.patch b/gnu/packages/patches/bdb-5.3-atomics-on-gcc-9.patch
new file mode 100644
index 0000000000..56d404da15
--- /dev/null
+++ b/gnu/packages/patches/bdb-5.3-atomics-on-gcc-9.patch
@@ -0,0 +1,22 @@
+Patch borrowed from Arch Linux. Allows compiling bdb 5.3 and earlier with GCC newer than 7.
+
+--- src/dbinc/atomic.h 2013-03-12 14:07:22.000000000 -0400
++++ src/dbinc/atomic.h.change 2013-03-12 14:06:35.000000000 -0400
+@@ -144,7 +144,7 @@
+ #define atomic_inc(env, p) __atomic_inc(p)
+ #define atomic_dec(env, p) __atomic_dec(p)
+ #define atomic_compare_exchange(env, p, o, n) \
+- __atomic_compare_exchange((p), (o), (n))
++ __atomic_compare_exchange_db((p), (o), (n))
+ static inline int __atomic_inc(db_atomic_t *p)
+ {
+ int temp;
+@@ -176,7 +176,7 @@
+ * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
+ * which configure could be changed to use.
+ */
+-static inline int __atomic_compare_exchange(
++static inline int __atomic_compare_exchange_db(
+ db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
+ {
+ atomic_value_t was;
diff --git a/gnu/packages/patches/biber-fix-encoding-write.patch b/gnu/packages/patches/biber-fix-encoding-write.patch
deleted file mode 100644
index 56cd11212e..0000000000
--- a/gnu/packages/patches/biber-fix-encoding-write.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 2a9b15aefb842a734637f3d230936ea1b7c60096 Mon Sep 17 00:00:00 2001
-From: Philip Kime <Philip@kime.org.uk>
-Date: Thu, 8 Nov 2018 22:02:09 +0100
-Subject: [PATCH] Fix to address #239
-
----
- lib/Biber.pm | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lib/Biber.pm b/lib/Biber.pm
-index 8b1f80a5..d97fca29 100644
---- a/lib/Biber.pm
-+++ b/lib/Biber.pm
-@@ -311,6 +311,8 @@ sub parse_ctrlfile {
- unless (eval {$checkbuf = File::Slurper::read_text($ctrl_file_path, 'latin1')}) {
- biber_error("$ctrl_file_path is not UTF-8 or even latin1, how horrible.");
- }
-+ # Write ctrl file as UTF-8
-+ File::Slurper::write_text($ctrl_file_path, NFC($checkbuf));# Unicode NFC boundary
- }
-
- $checkbuf = NFD($checkbuf);# Unicode NFD boundary
-@@ -319,8 +321,6 @@ sub parse_ctrlfile {
- unlink($output) unless $output eq '-';# ignore deletion of STDOUT marker
- biber_error("$ctrl_file_path is malformed, last biblatex run probably failed. Deleted $output");
- }
-- # Write ctrl file as UTF-8
-- File::Slurper::write_text($ctrl_file_path, NFC($checkbuf));# Unicode NFC boundary
-
- # Validate if asked to
- if (Biber::Config->getoption('validate_control')) {
diff --git a/gnu/packages/patches/biber-sortinithash.patch b/gnu/packages/patches/biber-sortinithash.patch
deleted file mode 100644
index 5a626705e6..0000000000
--- a/gnu/packages/patches/biber-sortinithash.patch
+++ /dev/null
@@ -1,1666 +0,0 @@
-This is a backport of this upstream commit to Biber 2.12:
-
- From 6b61b4c13778cf638f82569ab9e413f09f111ba5 Mon Sep 17 00:00:00 2001
- From: Philip Kime <Philip@kime.org.uk>
- Date: Sat, 12 Jan 2019 17:19:51 +0100
- Subject: [PATCH] Updated tests after U::C upgrade changed sortinit hashes
-
-It addresses test failures found with recent versions of the
-Biber dependencies.
-
-diff --git a/t/annotations.t b/t/annotations.t
-index b4f641e..c6f86c7 100644
---- a/t/annotations.t
-+++ b/t/annotations.t
-@@ -73,7 +73,7 @@ my $ann1 = q| \entry{ann1}{misc}{}
- \strng{authorfullhash}{90ae96c82de92e36949bc64254bbde0c}
- \field{extraname}{1}
- \field{sortinit}{L}
-- \field{sortinithash}{2c7981aaabc885868aba60f0c09ee20f}
-+ \field{sortinithash}{dad3efd0836470093a7b4a7bb756eb8c}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
- \field{title}{The Title}
-@@ -116,7 +116,7 @@ my $ann2 = q| \entry{ann2}{misc}{}
- \strng{authorfullhash}{90ae96c82de92e36949bc64254bbde0c}
- \field{extraname}{2}
- \field{sortinit}{L}
-- \field{sortinithash}{2c7981aaabc885868aba60f0c09ee20f}
-+ \field{sortinithash}{dad3efd0836470093a7b4a7bb756eb8c}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
- \field{title}{The Title}
-diff --git a/t/basic-misc.t b/t/basic-misc.t
-index d4664b1..a9168cc 100644
---- a/t/basic-misc.t
-+++ b/t/basic-misc.t
-@@ -97,7 +97,7 @@ my $u1 = q| \entry{u1}{misc}{}
- \strng{authorfullhash}{b78abdc838d79b6576f2ed0021642766}
- \field{labelalpha}{AAA\textbf{+}00}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{singletitle}
- \true{uniquework}
- \field{labelnamesource}{author}
-@@ -231,7 +231,7 @@ my $murray1 = q| \entry{murray}{article}{}
- \strng{authorfullhash}{1572cc3fd324f560e5e71d041a6bd764}
- \field{labelalpha}{Hos\textbf{+}98}
- \field{sortinit}{H}
-- \field{sortinithash}{5f15a7bc777ad49ff15aa4d2831b1681}
-+ \field{sortinithash}{6db6145dae8dc9e1271a8d556090b50a}
- \true{singletitle}
- \true{uniquework}
- \field{labelnamesource}{author}
-@@ -348,7 +348,7 @@ my $murray2 = q| \entry{murray}{article}{}
- \strng{authorfullhash}{1572cc3fd324f560e5e71d041a6bd764}
- \field{labelalpha}{Hos98}
- \field{sortinit}{H}
-- \field{sortinithash}{5f15a7bc777ad49ff15aa4d2831b1681}
-+ \field{sortinithash}{6db6145dae8dc9e1271a8d556090b50a}
- \true{singletitle}
- \true{uniquework}
- \field{labelnamesource}{author}
-@@ -389,7 +389,7 @@ my $t1 = q+ \entry{t1}{misc}{}
- \field{extraname}{1}
- \field{labelalpha}{Bro92}
- \field{sortinit}{B}
-- \field{sortinithash}{276475738cc058478c1677046f857703}
-+ \field{sortinithash}{8de16967003c7207dae369d874f1456e}
- \true{uniquework}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -419,7 +419,7 @@ my $t2 = q| \entry{t2}{misc}{}
- \field{extraname}{2}
- \field{labelalpha}{Bro94}
- \field{sortinit}{B}
-- \field{sortinithash}{276475738cc058478c1677046f857703}
-+ \field{sortinithash}{8de16967003c7207dae369d874f1456e}
- \true{uniquework}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -452,7 +452,7 @@ my $anon1 = q| \entry{anon1}{unpublished}{}
- \strng{shortauthorfullhash}{9873a6cc65c553faa2b21aaad626fe4b}
- \field{labelalpha}{XAn35}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{singletitle}
- \true{uniquework}
- \field{labelnamesource}{shortauthor}
-@@ -491,7 +491,7 @@ my $anon2 = q| \entry{anon2}{unpublished}{}
- \strng{shortauthorfullhash}{f64c29e89ea49402b997956610b58ef6}
- \field{labelalpha}{YAn39}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{singletitle}
- \true{uniquework}
- \field{labelnamesource}{shortauthor}
-@@ -526,7 +526,7 @@ my $url1 = q| \entry{url1}{misc}{}
- \field{extraname}{4}
- \field{labelalpha}{Ali05}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \field{extraalpha}{4}
- \field{labelnamesource}{author}
- \field{year}{2005}
-@@ -710,7 +710,7 @@ my $isbn1 = q| \entry{isbn1}{misc}{}
- \field{extraname}{1}
- \field{labelalpha}{Flu}
- \field{sortinit}{F}
-- \field{sortinithash}{669c706c6f1fbf3b5a83d26f1d9e9e72}
-+ \field{sortinithash}{fb0c0faa89eb6abae8213bf60e6799ea}
- \field{extraalpha}{1}
- \field{labelnamesource}{author}
- \field{isbn}{978-0-8165-2066-4}
-@@ -735,7 +735,7 @@ my $isbn2 = q| \entry{isbn2}{misc}{}
- \field{extraname}{2}
- \field{labelalpha}{Flu}
- \field{sortinit}{F}
-- \field{sortinithash}{669c706c6f1fbf3b5a83d26f1d9e9e72}
-+ \field{sortinithash}{fb0c0faa89eb6abae8213bf60e6799ea}
- \field{extraalpha}{2}
- \field{labelnamesource}{author}
- \field{isbn}{978-0-8165-2066-4}
-@@ -778,7 +778,7 @@ my $clone1 = q| \entry{snk1}{book}{}
- \field{extraname}{2}
- \field{labelalpha}{vDoe}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{extraalpha}{2}
- \field{labelnamesource}{author}
- \endentry
-@@ -807,7 +807,7 @@ my $clone2 = q| \entry{clone-snk1}{book}{}
- \field{extraname}{1}
- \field{labelalpha}{vDoe}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{extraalpha}{1}
- \field{labelnamesource}{author}
- \field{addendum}{add}
-@@ -839,7 +839,7 @@ my $ent1 = q| \entry{ent1}{book}{}
- \strng{authorfullhash}{b2536a425d549b46de5f21c4d468050a}
- \field{labelalpha}{SdB}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \true{singletitle}
- \field{labelnamesource}{author}
- \endentry
-@@ -862,7 +862,7 @@ my $verb1 = q| \entry{verb1}{book}{}
- \strng{authorfullhash}{cac5a25f503e71f5ef28f474e14007b6}
- \field{labelalpha}{All}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{singletitle}
- \field{labelnamesource}{author}
- \verb{verba}
-diff --git a/t/biblatexml.t b/t/biblatexml.t
-index ad9ad25..0959bfa 100644
---- a/t/biblatexml.t
-+++ b/t/biblatexml.t
-@@ -111,7 +111,7 @@ my $l1 = q| \entry{bltx1}{misc}{useprefix=false}
- \strng{translatornamehash}{b44eba830fe9817fbe8e53c82f1cbe04}
- \strng{translatorfullhash}{b44eba830fe9817fbe8e53c82f1cbe04}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -158,7 +158,7 @@ my $l1 = q| \entry{bltx1}{misc}{useprefix=false}
-
- my $l2 = q| \entry{loopkey:a}{book}{}
- \field{sortinit}{0}
-- \field{sortinithash}{168ad0c7c5ed09f1d28c6675717b5b03}
-+ \field{sortinithash}{bcf7a1f4afb88b7299f988caccb80d1c}
- \endentry
- |;
-
-diff --git a/t/crossrefs.t b/t/crossrefs.t
-index 915b52b..b6191c6 100644
---- a/t/crossrefs.t
-+++ b/t/crossrefs.t
-@@ -82,7 +82,7 @@ my $cr1 = q| \entry{cr1}{inbook}{}
- \strng{editornamehash}{c129df5593fdaa7475548811bfbb227d}
- \strng{editorfullhash}{c129df5593fdaa7475548811bfbb227d}
- \field{sortinit}{G}
-- \field{sortinithash}{5e8d2bf9d38de41b1528bd307546008f}
-+ \field{sortinithash}{62eb2aa29549e4fdbd3cb154ec5711cb}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -131,7 +131,7 @@ my $cr2 = q| \entry{cr2}{inbook}{}
- \strng{editornamehash}{c129df5593fdaa7475548811bfbb227d}
- \strng{editorfullhash}{c129df5593fdaa7475548811bfbb227d}
- \field{sortinit}{F}
-- \field{sortinithash}{669c706c6f1fbf3b5a83d26f1d9e9e72}
-+ \field{sortinithash}{fb0c0faa89eb6abae8213bf60e6799ea}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -165,7 +165,7 @@ my $cr_m = q| \entry{cr_m}{book}{}
- \strng{editornamehash}{c129df5593fdaa7475548811bfbb227d}
- \strng{editorfullhash}{c129df5593fdaa7475548811bfbb227d}
- \field{sortinit}{G}
-- \field{sortinithash}{5e8d2bf9d38de41b1528bd307546008f}
-+ \field{sortinithash}{62eb2aa29549e4fdbd3cb154ec5711cb}
- \true{crossrefsource}
- \true{uniquetitle}
- \field{labeltitlesource}{title}
-@@ -203,7 +203,7 @@ my $cr3 = q| \entry{cr3}{inbook}{}
- \strng{editornamehash}{a1f5c22413396d599ec766725b226735}
- \strng{editorfullhash}{a1f5c22413396d599ec766725b226735}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -248,7 +248,7 @@ my $cr4 = q| \entry{cr4}{inbook}{}
- \strng{editornamehash}{6ea89bd4958743a20b70fe17647d6af5}
- \strng{editorfullhash}{6ea89bd4958743a20b70fe17647d6af5}
- \field{sortinit}{M}
-- \field{sortinithash}{cfd219b90152c06204fab207bc6c7cab}
-+ \field{sortinithash}{2e5c2f51f7fa2d957f3206819bf86dc3}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -279,7 +279,7 @@ my $crt = q| \entry{crt}{book}{}
- \strng{editornamehash}{a1f5c22413396d599ec766725b226735}
- \strng{editorfullhash}{a1f5c22413396d599ec766725b226735}
- \field{sortinit}{B}
-- \field{sortinithash}{276475738cc058478c1677046f857703}
-+ \field{sortinithash}{8de16967003c7207dae369d874f1456e}
- \true{uniquetitle}
- \field{labeltitlesource}{title}
- \field{title}{Beasts of the Burbling Burns}
-@@ -315,7 +315,7 @@ my $cr6 = q| \entry{cr6}{inproceedings}{}
- \strng{editorfullhash}{344a7f427fb765610ef96eb7bce95257}
- \field{extraname}{2}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{uniquetitle}
- \true{uniquework}
- \field{labelnamesource}{author}
-@@ -366,7 +366,7 @@ my $cr7 = q| \entry{cr7}{inbook}{}
- \strng{bookauthorfullhash}{91a1dd4aeed3c4ec29ca74c4e778be5f}
- \field{extraname}{1}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{uniquetitle}
- \true{uniquework}
- \field{labelnamesource}{author}
-@@ -401,7 +401,7 @@ my $cr8 = q| \entry{cr8}{incollection}{}
- \strng{authorfullhash}{3d449e56eb3ca1ae80dc99a18d689795}
- \field{extraname}{4}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -431,7 +431,7 @@ my $xr1 = q| \entry{xr1}{inbook}{}
- \strng{authornamehash}{e0ecc4fc668ee499d1afba44e1ac064d}
- \strng{authorfullhash}{e0ecc4fc668ee499d1afba44e1ac064d}
- \field{sortinit}{Z}
-- \field{sortinithash}{156173bd08b075d7295bc3e0f4735a04}
-+ \field{sortinithash}{8f7b480688e809b50b6f6577b16f3db5}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -460,7 +460,7 @@ my $xr2 = q| \entry{xr2}{inbook}{}
- \strng{authornamehash}{6afa09374ecfd6b394ce714d2d9709c7}
- \strng{authorfullhash}{6afa09374ecfd6b394ce714d2d9709c7}
- \field{sortinit}{I}
-- \field{sortinithash}{320bc8fe8101b9376f9f21cd507de0e8}
-+ \field{sortinithash}{9417e9a1288a9371e2691d999083ed39}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -491,7 +491,7 @@ my $xrm = q| \entry{xrm}{book}{}
- \strng{editornamehash}{809950f9b59ae207092b909a19dcb27b}
- \strng{editorfullhash}{809950f9b59ae207092b909a19dcb27b}
- \field{sortinit}{C}
-- \field{sortinithash}{963e9d84a3da2344e8833203de5aed05}
-+ \field{sortinithash}{4c244ceae61406cdc0cc2ce1cb1ff703}
- \true{xrefsource}
- \true{uniquetitle}
- \field{labeltitlesource}{title}
-@@ -516,7 +516,7 @@ my $xr3 = q| \entry{xr3}{inbook}{}
- \strng{authornamehash}{9788055665b9bb4b37c776c3f6b74f16}
- \strng{authorfullhash}{9788055665b9bb4b37c776c3f6b74f16}
- \field{sortinit}{N}
-- \field{sortinithash}{f7242c3ed3dc50029fca1be76c497c7c}
-+ \field{sortinithash}{98cf339a479c0454fe09153a08675a15}
- \true{singletitle}
- \true{uniquetitle}
- \true{uniquework}
-@@ -546,7 +546,7 @@ my $xrt = q| \entry{xrt}{book}{}
- \strng{editornamehash}{bf7d6b02f3e073913e5bfe5059508dd5}
- \strng{editorfullhash}{bf7d6b02f3e073913e5bfe5059508dd5}
- \field{sortinit}{K}
-- \field{sortinithash}{9fd838a31ba64d981e8f44562bd33f89}
-+ \field{sortinithash}{d3edc18d54b9438a72c24c925bfb38f4}
- \true{uniquetitle}
- \field{labeltitlesource}{title}
- \field{title}{Kings, Cork and Calculation}
-@@ -572,7 +572,7 @@ my $xr4 = q| \entry{xr4}{inbook}{}
- \strng{authorfullhash}{7804ffef086c0c4686c235807f5cb502}
- \field{extraname}{1}
- \field{sortinit}{M}
-- \field{sortinithash}{cfd219b90152c06204fab207bc6c7cab}
-+ \field{sortinithash}{2e5c2f51f7fa2d957f3206819bf86dc3}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
- \field{origyear}{1933}
-@@ -600,7 +600,7 @@ my $mxr = q| \entry{mxr}{inbook}{}
- \strng{authorfullhash}{7804ffef086c0c4686c235807f5cb502}
- \field{extraname}{2}
- \field{sortinit}{M}
-- \field{sortinithash}{cfd219b90152c06204fab207bc6c7cab}
-+ \field{sortinithash}{2e5c2f51f7fa2d957f3206819bf86dc3}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
- \field{origyear}{1933}
-@@ -625,7 +625,7 @@ my $mcr = q| \entry{mcr}{inbook}{}
- \strng{authorfullhash}{7804ffef086c0c4686c235807f5cb502}
- \field{extraname}{3}
- \field{sortinit}{M}
-- \field{sortinithash}{cfd219b90152c06204fab207bc6c7cab}
-+ \field{sortinithash}{2e5c2f51f7fa2d957f3206819bf86dc3}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
- \field{origyear}{1933}
-@@ -660,7 +660,7 @@ my $ccr1 = q| \entry{ccr2}{book}{}
- \strng{editorfullhash}{cfee758a1c82df2e26af1985e061bb0a}
- \field{extraname}{1}
- \field{sortinit}{V}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \true{uniquetitle}
- \true{uniquework}
- \field{labelnamesource}{author}
-@@ -694,7 +694,7 @@ my $ccr2 = q| \entry{ccr3}{inbook}{}
- \strng{editornamehash}{cfee758a1c82df2e26af1985e061bb0a}
- \strng{editorfullhash}{cfee758a1c82df2e26af1985e061bb0a}
- \field{sortinit}{P}
-- \field{sortinithash}{8d51b3d5b78d75b54308d706b9bbe285}
-+ \field{sortinithash}{bb5b15f2db90f7aef79bb9e83defefcb}
- \true{uniquetitle}
- \field{labeltitlesource}{title}
- \field{booktitle}{Misc etc.}
-@@ -726,7 +726,7 @@ my $ccr3 = q| \entry{ccr4}{inbook}{}
-
- my $s1 = q| \entry{s1}{inbook}{}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \true{uniquetitle}
- \field{labeltitlesource}{title}
- \strng{crossref}{s2}
-@@ -760,7 +760,7 @@ my $xc2 = q| \entry{xc2}{inbook}{}
- \strng{bookauthorfullhash}{1a0f7d518cccdad859a74412ef956474}
- \field{extraname}{2}
- \field{sortinit}{C}
-- \field{sortinithash}{963e9d84a3da2344e8833203de5aed05}
-+ \field{sortinithash}{4c244ceae61406cdc0cc2ce1cb1ff703}
- \true{xrefsource}
- \field{labelnamesource}{author}
- \field{booktitle}{Title}
-@@ -769,7 +769,7 @@ my $xc2 = q| \entry{xc2}{inbook}{}
-
- my $b1 = q| \entry{b1}{inbook}{}
- \field{sortinit}{2}
-- \field{sortinithash}{cbff857e587bcb4635511624d773949e}
-+ \field{sortinithash}{ed39bb39cf854d5250e95b1c1f94f4ed}
- \strng{crossref}{b2}
- \field{day}{3}
- \field{month}{3}
-@@ -803,7 +803,7 @@ my $sup1 = q| \entry{sup1}{mvbook}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{3}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \true{crossrefsource}
- \true{singletitle}
- \field{labelnamesource}{author}
-@@ -828,7 +828,7 @@ my $sup2 = q| \entry{sup2}{book}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{1}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \true{singletitle}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-diff --git a/t/datalists.t b/t/datalists.t
-index 3081cc4..4855e3d 100644
---- a/t/datalists.t
-+++ b/t/datalists.t
-@@ -187,7 +187,7 @@ my $K11 = q| \entry{K11}{book}{}
- \strng{authornamehash}{4edc280a0ef229f9c061e3b121b17482}
- \strng{authorfullhash}{4edc280a0ef229f9c061e3b121b17482}
- \field{sortinit}{a}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -219,7 +219,7 @@ my $K12 = q| \entry{K12}{book}{}
- \strng{authornamehash}{a846a485fc9cbb59b0ebeedd6ac637e4}
- \strng{authorfullhash}{a846a485fc9cbb59b0ebeedd6ac637e4}
- \field{sortinit}{Z}
-- \field{sortinithash}{156173bd08b075d7295bc3e0f4735a04}
-+ \field{sortinithash}{8f7b480688e809b50b6f6577b16f3db5}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-diff --git a/t/dateformats.t b/t/dateformats.t
-index 6beb567..0d5072a 100644
---- a/t/dateformats.t
-+++ b/t/dateformats.t
-@@ -88,7 +88,7 @@ my $l13c = q| \entry{L13}{book}{}
- \strng{authorfullhash}{8c77336299b25bdada7bf8038f46722f}
- \field{extraname}{3}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -126,7 +126,7 @@ my $l14 = q| \entry{L14}{book}{}
- \strng{authorfullhash}{8c77336299b25bdada7bf8038f46722f}
- \field{extraname}{4}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradate}{3}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
-@@ -168,7 +168,7 @@ my $l15 = q| \entry{L15}{book}{}
- \strng{authorfullhash}{8c77336299b25bdada7bf8038f46722f}
- \field{extraname}{12}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradate}{4}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -201,7 +201,7 @@ my $l16 = q| \entry{L16}{proceedings}{}
- \strng{editorfullhash}{8c77336299b25bdada7bf8038f46722f}
- \field{extraname}{13}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradate}{7}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{event}
-@@ -240,7 +240,7 @@ my $l17 = q| \entry{L17}{proceedings}{}
- \strng{editorfullhash}{8c77336299b25bdada7bf8038f46722f}
- \field{extraname}{5}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradate}{4}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
-@@ -299,7 +299,7 @@ my $l17c = q| \entry{L17}{proceedings}{}
- \strng{editorfullhash}{8c77336299b25bdada7bf8038f46722f}
- \field{extraname}{5}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{orig}
- \field{labelnamesource}{editor}
-@@ -357,7 +357,7 @@ my $l17e = q| \entry{L17}{proceedings}{}
- \strng{editorfullhash}{8c77336299b25bdada7bf8038f46722f}
- \field{extraname}{5}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{event}
- \field{labelnamesource}{editor}
-@@ -479,7 +479,7 @@ my $era1 = q| \entry{era1}{article}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{9}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -512,7 +512,7 @@ my $era2 = q| \entry{era2}{inproceedings}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{10}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -546,7 +546,7 @@ my $era3 = q| \entry{era3}{inproceedings}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{11}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -580,7 +580,7 @@ my $era4 = q| \entry{era4}{inproceedings}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{6}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -622,7 +622,7 @@ my $time1 = q| \entry{time1}{article}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{2}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -671,7 +671,7 @@ my $range1 = q| \entry{range1}{inproceedings}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{7}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradate}{1}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
-@@ -712,7 +712,7 @@ my $range2 = q| \entry{range2}{inproceedings}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{8}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradate}{2}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
-@@ -753,7 +753,7 @@ my $season1 = q| \entry{season1}{inproceedings}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{1}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -785,7 +785,7 @@ my $unspec1 = q| \entry{unspec1}{inproceedings}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{4}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -838,7 +838,7 @@ my $unspec2 = q| \entry{unspec2}{article}{}
- \strng{authorfullhash}{556c8dba145b472e6a8598d506f7cbe2}
- \field{extraname}{3}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-diff --git a/t/encoding.t b/t/encoding.t
-index a150b4f..36d9955 100644
---- a/t/encoding.t
-+++ b/t/encoding.t
-@@ -52,7 +52,7 @@ my $encode1 = q| \entry{testŠ}{book}{}
- \strng{authorfullhash}{06a47edae2e847800cfd78323a0e6be8}
- \field{labelalpha}{Enc99}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{labeldatesource}{year}
- \true{singletitle}
- \field{labelnamesource}{author}
-@@ -82,7 +82,7 @@ my $encode2 = q| \entry{test1}{book}{}
- \strng{authorfullhash}{06a47edae2e847800cfd78323a0e6be8}
- \field{labelalpha}{Enc99}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{labeldatesource}{year}
- \true{singletitle}
- \field{labelnamesource}{author}
-@@ -112,7 +112,7 @@ my $encode3 = q| \entry{test1}{book}{}
- \strng{authorfullhash}{06a47edae2e847800cfd78323a0e6be8}
- \field{labelalpha}{Enc99}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{labeldatesource}{year}
- \true{singletitle}
- \field{labelnamesource}{author}
-@@ -142,7 +142,7 @@ my $encode5 = q| \entry{test}{book}{}
- \strng{authorfullhash}{06a47edae2e847800cfd78323a0e6be8}
- \field{labelalpha}{Enc99}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{labeldatesource}{year}
- \true{singletitle}
- \field{labelnamesource}{author}
-@@ -172,7 +172,7 @@ my $encode6 = q| \entry{test}{book}{}
- \strng{authorfullhash}{06a47edae2e847800cfd78323a0e6be8}
- \field{labelalpha}{Enc99}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{labeldatesource}{year}
- \true{singletitle}
- \field{labelnamesource}{author}
-@@ -202,7 +202,7 @@ my $encode7 = q| \entry{test}{book}{}
- \strng{authorfullhash}{06a47edae2e847800cfd78323a0e6be8}
- \field{labelalpha}{Enc99}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{labeldatesource}{year}
- \true{singletitle}
- \field{labelnamesource}{author}
-diff --git a/t/names.t b/t/names.t
-index 7228042..b73f2ed 100644
---- a/t/names.t
-+++ b/t/names.t
-@@ -188,7 +188,7 @@ my $l1 = q| \entry{L1}{book}{}
- \strng{authornamehash}{72287a68c1714cb1b9f4ab9e03a88b96}
- \strng{authorfullhash}{72287a68c1714cb1b9f4ab9e03a88b96}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -208,7 +208,7 @@ my $l2 = q| \entry{L2}{book}{}
- \strng{authornamehash}{2098d59d0f19a2e003ee06c1aa750d57}
- \strng{authorfullhash}{2098d59d0f19a2e003ee06c1aa750d57}
- \field{sortinit}{B}
-- \field{sortinithash}{276475738cc058478c1677046f857703}
-+ \field{sortinithash}{8de16967003c7207dae369d874f1456e}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -228,7 +228,7 @@ my $l3 = q| \entry{L3}{book}{}
- \strng{authornamehash}{c8b06fe88bde128b25eb0b3b1cc5837c}
- \strng{authorfullhash}{c8b06fe88bde128b25eb0b3b1cc5837c}
- \field{sortinit}{C}
-- \field{sortinithash}{963e9d84a3da2344e8833203de5aed05}
-+ \field{sortinithash}{4c244ceae61406cdc0cc2ce1cb1ff703}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -248,7 +248,7 @@ my $l4 = q| \entry{L4}{book}{}
- \strng{authornamehash}{5ec958b850c0c2de7de7c42c84b9c419}
- \strng{authorfullhash}{5ec958b850c0c2de7de7c42c84b9c419}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -270,7 +270,7 @@ my $l5 = q| \entry{L5}{book}{}
- \strng{authornamehash}{c6b9d281cc1ff3f35570f76f463d4244}
- \strng{authorfullhash}{c6b9d281cc1ff3f35570f76f463d4244}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -292,7 +292,7 @@ my $l6 = q| \entry{L6}{book}{}
- \strng{authornamehash}{5fd24d3d1608a310ec205a6b201a5495}
- \strng{authorfullhash}{5fd24d3d1608a310ec205a6b201a5495}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -314,7 +314,7 @@ my $l7 = q| \entry{L7}{book}{}
- \strng{authornamehash}{98edb0b90251df22b74328d9227eceb7}
- \strng{authorfullhash}{98edb0b90251df22b74328d9227eceb7}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -336,7 +336,7 @@ my $l8 = q| \entry{L8}{book}{}
- \strng{authornamehash}{1211dc8dbbc191cbcab4da3c3c1fc48a}
- \strng{authorfullhash}{1211dc8dbbc191cbcab4da3c3c1fc48a}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -356,7 +356,7 @@ my $l9 = q| \entry{L9}{book}{}
- \strng{authornamehash}{bae61a889ab149a6deafe45333204cf0}
- \strng{authorfullhash}{bae61a889ab149a6deafe45333204cf0}
- \field{sortinit}{I}
-- \field{sortinithash}{320bc8fe8101b9376f9f21cd507de0e8}
-+ \field{sortinithash}{9417e9a1288a9371e2691d999083ed39}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -379,7 +379,7 @@ my $l10 = q| \entry{L10}{book}{}
- \strng{authornamehash}{37b4325752e394ddfb2fc810f6c88e27}
- \strng{authorfullhash}{37b4325752e394ddfb2fc810f6c88e27}
- \field{sortinit}{J}
-- \field{sortinithash}{fce5f8d0bd05e8d93f3dbe21c78897ca}
-+ \field{sortinithash}{c45040a764d616897e7f5b30174d7b92}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -402,7 +402,7 @@ my $l10a = q| \entry{L10a}{book}{}
- \strng{authornamehash}{7bf2c9d8b89a1930ee91bfddcaf20c9c}
- \strng{authorfullhash}{7bf2c9d8b89a1930ee91bfddcaf20c9c}
- \field{sortinit}{P}
-- \field{sortinithash}{8d51b3d5b78d75b54308d706b9bbe285}
-+ \field{sortinithash}{bb5b15f2db90f7aef79bb9e83defefcb}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -427,7 +427,7 @@ my $l11 = q| \entry{L11}{book}{}
- \strng{authornamehash}{9f48d231be68c9435fab4faca55a5caf}
- \strng{authorfullhash}{9f48d231be68c9435fab4faca55a5caf}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -449,7 +449,7 @@ my $l12 = q| \entry{L12}{book}{}
- \strng{authornamehash}{d7ca88c13a8f7ce1c23e920010a31f83}
- \strng{authorfullhash}{d7ca88c13a8f7ce1c23e920010a31f83}
- \field{sortinit}{d}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \true{uniqueprimaryauthor}
- \field{labelnamesource}{author}
- \endentry
-@@ -470,7 +470,7 @@ my $l13 = q| \entry{L13}{book}{}
- \strng{authornamehash}{227ac48bb788a658cfaa4eefc71ff0cc}
- \strng{authorfullhash}{227ac48bb788a658cfaa4eefc71ff0cc}
- \field{sortinit}{V}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -490,7 +490,7 @@ my $l14 = q| \entry{L14}{book}{}
- \strng{authornamehash}{779475052c17ed56dc3be900d0dfdf87}
- \strng{authorfullhash}{779475052c17ed56dc3be900d0dfdf87}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -513,7 +513,7 @@ my $l15 = q| \entry{L15}{book}{}
- \strng{authorfullhash}{783c636e853e47a854ae034ebe9dde62}
- \field{extraname}{1}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -536,7 +536,7 @@ my $l16 = q| \entry{L16}{book}{}
- \strng{authorfullhash}{783c636e853e47a854ae034ebe9dde62}
- \field{extraname}{2}
- \field{sortinit}{v}
-- \field{sortinithash}{75dd7385c90b2252c3ae853a80ca853b}
-+ \field{sortinithash}{02432525618c08e2b03cac47c19764af}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -557,7 +557,7 @@ my $l17 = q| \entry{L17}{book}{}
- \strng{authorfullhash}{b51f667a3384d92ea5458ba80716bff7}
- \field{extraname}{1}
- \field{sortinit}{L}
-- \field{sortinithash}{2c7981aaabc885868aba60f0c09ee20f}
-+ \field{sortinithash}{dad3efd0836470093a7b4a7bb756eb8c}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -578,7 +578,7 @@ my $l18 = q| \entry{L18}{book}{}
- \strng{authorfullhash}{b51f667a3384d92ea5458ba80716bff7}
- \field{extraname}{2}
- \field{sortinit}{L}
-- \field{sortinithash}{2c7981aaabc885868aba60f0c09ee20f}
-+ \field{sortinithash}{dad3efd0836470093a7b4a7bb756eb8c}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -598,7 +598,7 @@ my $l19 = q| \entry{L19}{book}{}
- \strng{authornamehash}{83caa52f21f97e572dd3267bdf62978a}
- \strng{authorfullhash}{83caa52f21f97e572dd3267bdf62978a}
- \field{sortinit}{M}
-- \field{sortinithash}{cfd219b90152c06204fab207bc6c7cab}
-+ \field{sortinithash}{2e5c2f51f7fa2d957f3206819bf86dc3}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -618,7 +618,7 @@ my $l19a = q| \entry{L19a}{book}{}
- \strng{authornamehash}{0963f6904ccfeaac2770c5882a587001}
- \strng{authorfullhash}{0963f6904ccfeaac2770c5882a587001}
- \field{sortinit}{L}
-- \field{sortinithash}{2c7981aaabc885868aba60f0c09ee20f}
-+ \field{sortinithash}{dad3efd0836470093a7b4a7bb756eb8c}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -639,7 +639,7 @@ my $l20 = q| \entry{L20}{book}{}
- \strng{authornamehash}{5f26c2f3b33095d5b005714893f4d698}
- \strng{authorfullhash}{5f26c2f3b33095d5b005714893f4d698}
- \field{sortinit}{F}
-- \field{sortinithash}{669c706c6f1fbf3b5a83d26f1d9e9e72}
-+ \field{sortinithash}{fb0c0faa89eb6abae8213bf60e6799ea}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -660,7 +660,7 @@ my $l21 = q| \entry{L21}{book}{}
- \strng{authorfullhash}{4389a3c0dc7da74487b50808ba9436ad}
- \field{extraname}{1}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -681,7 +681,7 @@ my $l22u = q| \entry{L22}{book}{}
- \strng{authorfullhash}{e58b861545799d0eaf883402a882126e}
- \field{extraname}{1}
- \field{sortinit}{Š}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -703,7 +703,7 @@ my $l22 = q| \entry{L22}{book}{}
- \strng{authorfullhash}{e58b861545799d0eaf883402a882126e}
- \field{extraname}{1}
- \field{sortinit}{\v{S}}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \true{uniqueprimaryauthor}
- \field{labelnamesource}{author}
- \endentry
-@@ -726,7 +726,7 @@ my $l23 = q| \entry{L23}{book}{}
- \strng{authorfullhash}{4389a3c0dc7da74487b50808ba9436ad}
- \field{extraname}{3}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -747,7 +747,7 @@ my $l24 = q| \entry{L24}{book}{}
- \strng{authorfullhash}{e58b861545799d0eaf883402a882126e}
- \field{extraname}{2}
- \field{sortinit}{Š}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -765,7 +765,7 @@ my $l25 = q| \entry{L25}{book}{}
- \strng{authornamehash}{d7cd2c5ea0848abc3e90609558b84a45}
- \strng{authorfullhash}{d7cd2c5ea0848abc3e90609558b84a45}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -783,7 +783,7 @@ my $l26 = q| \entry{L26}{book}{}
- \strng{authornamehash}{8eee1dbafdbd0a4b73157e60f18b4784}
- \strng{authorfullhash}{8eee1dbafdbd0a4b73157e60f18b4784}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -791,7 +791,7 @@ my $l26 = q| \entry{L26}{book}{}
- # Malformed anyway but a decent test
- my $l28 = q| \entry{L28}{book}{}
- \field{sortinit}{0}
-- \field{sortinithash}{168ad0c7c5ed09f1d28c6675717b5b03}
-+ \field{sortinithash}{bcf7a1f4afb88b7299f988caccb80d1c}
- \warn{\item Name "Deux et al.,, O." is malformed (consecutive commas): skipping name}
- \endentry
- |;
-@@ -810,7 +810,7 @@ my $l29 = q| \entry{L29}{book}{}
- \strng{authornamehash}{27ad192a3a715aa89152b2a4ee392e8c}
- \strng{authorfullhash}{27ad192a3a715aa89152b2a4ee392e8c}
- \field{sortinit}{U}
-- \field{sortinithash}{36a2444f5238e0dcf4bb59704df6624d}
-+ \field{sortinithash}{77a6935510e008adcf5b555e7b4f0711}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -850,7 +850,7 @@ my $l31 = q| \entry{L31}{book}{}
- \strng{translatornamehash}{29c3ff92fff79d09a8b44d2f775de0b1}
- \strng{translatorfullhash}{29c3ff92fff79d09a8b44d2f775de0b1}
- \field{sortinit}{\~{Z}}
-- \field{sortinithash}{156173bd08b075d7295bc3e0f4735a04}
-+ \field{sortinithash}{8f7b480688e809b50b6f6577b16f3db5}
- \true{uniqueprimaryauthor}
- \field{labelnamesource}{author}
- \endentry
-diff --git a/t/options.t b/t/options.t
-index 940a282..c14d694 100644
---- a/t/options.t
-+++ b/t/options.t
-@@ -100,7 +100,7 @@ my $l1 = q| \entry{L1}{book}{}
- \strng{authornamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -137,7 +137,7 @@ my $l2 = q| \entry{L2}{book}{maxcitenames=3,maxbibnames=3,maxsortnames=3,maxi
- \strng{authornamehash}{19eec87c959944d6d9c72434a42856ba}
- \strng{authorfullhash}{19eec87c959944d6d9c72434a42856ba}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -169,7 +169,7 @@ my $l3 = q| \entry{L3}{book}{blah=10}
- \strng{authornamehash}{490250da1f3b92580d97563dc96c6c84}
- \strng{authorfullhash}{490250da1f3b92580d97563dc96c6c84}
- \field{sortinit}{B}
-- \field{sortinithash}{276475738cc058478c1677046f857703}
-+ \field{sortinithash}{8de16967003c7207dae369d874f1456e}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-diff --git a/t/related-entries.t b/t/related-entries.t
-index 53dce64..b38ac79 100644
---- a/t/related-entries.t
-+++ b/t/related-entries.t
-@@ -56,7 +56,7 @@ my $k1 = q| \entry{key1}{article}{}
- \strng{authorfullhash}{a517747c3d12f99244ae598910d979c5}
- \field{extraname}{1}
- \field{sortinit}{1}
-- \field{sortinithash}{2174f786c6195e7fe2ee1c229b416e29}
-+ \field{sortinithash}{50c6687d7fc80f50136d75228e3c59ba}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -95,7 +95,7 @@ my $k2 = q| \entry{key2}{inbook}{}
- \strng{authorfullhash}{a517747c3d12f99244ae598910d979c5}
- \field{extraname}{2}
- \field{sortinit}{2}
-- \field{sortinithash}{cbff857e587bcb4635511624d773949e}
-+ \field{sortinithash}{ed39bb39cf854d5250e95b1c1f94f4ed}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -243,7 +243,7 @@ my $kck4 = q| \entry{caf8e34be07426ae7127c1b4829983c1}{inbook}{dataonly,useed
-
- my $c1 = q| \entry{c1}{book}{}
- \field{sortinit}{3}
-- \field{sortinithash}{a4b52e5432884761f50fb9571273b93e}
-+ \field{sortinithash}{a37a8ef248a93c322189792c34fc68c9}
- \field{related}{9ab62b5ef34a985438bfdf7ee0102229}
- \endentry
- |;
-@@ -330,7 +330,7 @@ my $un1 = q| \entry{kullback}{book}{}
- \strng{authorfullhash}{34c5bbf9876c37127c3abe4e7d7a7198}
- \field{extraname}{1}
- \field{sortinit}{5}
-- \field{sortinithash}{3c19c3776b658b3558e9e2e4840c01e2}
-+ \field{sortinithash}{5dd416adbafacc8226114bc0202d5fdd}
- \field{extradatescope}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -364,7 +364,7 @@ my $un2 = q| \entry{kullback:related}{book}{}
- \strng{authorfullhash}{34c5bbf9876c37127c3abe4e7d7a7198}
- \field{extraname}{2}
- \field{sortinit}{6}
-- \field{sortinithash}{57e57fb8451e7fcfa45d1e069f6d3136}
-+ \field{sortinithash}{7851c86048328b027313775d8fbd2131}
- \field{extradatescope}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-diff --git a/t/remote-files.t b/t/remote-files.t
-index c747dcd..6f4cf4d 100644
---- a/t/remote-files.t
-+++ b/t/remote-files.t
-@@ -86,7 +86,7 @@ my $cu1 = q| \entry{citeulike:8283461}{article}{}
- \strng{authornamehash}{a700cc0bdce78f5a1f50ff6314ff6f2a}
- \strng{authorfullhash}{094b095bbb7ac93fdd3e2eafdcec0cac}
- \field{sortinit}{M}
-- \field{sortinithash}{cfd219b90152c06204fab207bc6c7cab}
-+ \field{sortinithash}{2e5c2f51f7fa2d957f3206819bf86dc3}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
-@@ -133,7 +133,7 @@ my $dl1 = q| \entry{AbdelbarH98}{article}{}
- \strng{authornamehash}{bb887c5d0458bfb1f3f7e6afc8d1def4}
- \strng{authorfullhash}{bb887c5d0458bfb1f3f7e6afc8d1def4}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
-diff --git a/t/set-dynamic.t b/t/set-dynamic.t
-index 9ab5fdd..0846f8a 100644
---- a/t/set-dynamic.t
-+++ b/t/set-dynamic.t
-@@ -51,7 +51,7 @@ my $out = $biber->get_output_obj;
- my $string1 = q| \entry{DynSet}{set}{}
- \set{Dynamic1,Dynamic2,Dynamic3}
- \field{sortinit}{1}
-- \field{sortinithash}{2174f786c6195e7fe2ee1c229b416e29}
-+ \field{sortinithash}{50c6687d7fc80f50136d75228e3c59ba}
- \endentry
- |;
-
-@@ -71,7 +71,7 @@ my $string2 = q| \entry{Dynamic1}{book}{}
- \strng{authornamehash}{252caa7921a061ca92087a1a52f15b78}
- \strng{authorfullhash}{252caa7921a061ca92087a1a52f15b78}
- \field{sortinit}{8}
-- \field{sortinithash}{07edf88d4ea82509b9c4b4d13f41c452}
-+ \field{sortinithash}{1b24cab5087933ef0826a7cd3b99e994}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -98,7 +98,7 @@ my $string3 = q| \entry{Dynamic2}{book}{}
- \strng{authornamehash}{894a5fe6de820f5dcce84a65581667f4}
- \strng{authorfullhash}{894a5fe6de820f5dcce84a65581667f4}
- \field{sortinit}{9}
-- \field{sortinithash}{1dd72ab054147731c9d824b49aba0534}
-+ \field{sortinithash}{54047ffb55bdefa0694bbd554c1b11a0}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -124,7 +124,7 @@ my $string4 = q| \entry{Dynamic3}{book}{}
- \strng{authornamehash}{fc3cc97631ceaecdde2aee6cc60ab42b}
- \strng{authorfullhash}{fc3cc97631ceaecdde2aee6cc60ab42b}
- \field{sortinit}{1}
-- \field{sortinithash}{2174f786c6195e7fe2ee1c229b416e29}
-+ \field{sortinithash}{50c6687d7fc80f50136d75228e3c59ba}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -151,7 +151,7 @@ my $string5 = q| \entry{Dynamic3}{book}{}
- \strng{authornamehash}{fc3cc97631ceaecdde2aee6cc60ab42b}
- \strng{authorfullhash}{fc3cc97631ceaecdde2aee6cc60ab42b}
- \field{sortinit}{1}
-- \field{sortinithash}{2174f786c6195e7fe2ee1c229b416e29}
-+ \field{sortinithash}{50c6687d7fc80f50136d75228e3c59ba}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-diff --git a/t/set-legacy.t b/t/set-legacy.t
-index 4e56991..9d40acb 100644
---- a/t/set-legacy.t
-+++ b/t/set-legacy.t
-@@ -45,7 +45,7 @@ my $out = $biber->get_output_obj;
- my $string1 = q| \entry{Elias1955}{set}{}
- \set{Elias1955a,Elias1955b}
- \field{sortinit}{1}
-- \field{sortinithash}{2174f786c6195e7fe2ee1c229b416e29}
-+ \field{sortinithash}{50c6687d7fc80f50136d75228e3c59ba}
- \endentry
- |;
-
-diff --git a/t/set-static.t b/t/set-static.t
-index 1e45d4d..a6cbe73 100644
---- a/t/set-static.t
-+++ b/t/set-static.t
-@@ -47,7 +47,7 @@ my $out = $biber->get_output_obj;
- my $string1 = q| \entry{Static1}{set}{}
- \set{Static2,Static4,Static3}
- \field{sortinit}{B}
-- \field{sortinithash}{276475738cc058478c1677046f857703}
-+ \field{sortinithash}{8de16967003c7207dae369d874f1456e}
- \field{annotation}{Some notes}
- \endentry
- |;
-@@ -68,7 +68,7 @@ my $string2 = q| \entry{Static2}{book}{}
- \strng{authornamehash}{43874d80d7ce68027102819f16c47df1}
- \strng{authorfullhash}{43874d80d7ce68027102819f16c47df1}
- \field{sortinit}{B}
-- \field{sortinithash}{276475738cc058478c1677046f857703}
-+ \field{sortinithash}{8de16967003c7207dae369d874f1456e}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -94,7 +94,7 @@ my $string3 = q| \entry{Static3}{book}{}
- \strng{authornamehash}{22dafa5cd57bb5dd7f3e3bab98fd539c}
- \strng{authorfullhash}{22dafa5cd57bb5dd7f3e3bab98fd539c}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -119,7 +119,7 @@ my $string4 = q| \entry{Static4}{book}{}
- \strng{authornamehash}{da80091c8cd89e5269bd55af1bd5d2fa}
- \strng{authorfullhash}{da80091c8cd89e5269bd55af1bd5d2fa}
- \field{sortinit}{C}
-- \field{sortinithash}{963e9d84a3da2344e8833203de5aed05}
-+ \field{sortinithash}{4c244ceae61406cdc0cc2ce1cb1ff703}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -145,7 +145,7 @@ my $string5 = q| \entry{Static2}{book}{}
- \strng{authornamehash}{43874d80d7ce68027102819f16c47df1}
- \strng{authorfullhash}{43874d80d7ce68027102819f16c47df1}
- \field{sortinit}{1}
-- \field{sortinithash}{2174f786c6195e7fe2ee1c229b416e29}
-+ \field{sortinithash}{50c6687d7fc80f50136d75228e3c59ba}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-diff --git a/t/skips.t b/t/skips.t
-index 7c80d39..caa835f 100644
---- a/t/skips.t
-+++ b/t/skips.t
-@@ -50,7 +50,7 @@ my $set1 = q| \entry{seta}{set}{}
- \field{labelalpha}{Doe10}
- \field{extraalpha}{1}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \endentry
- |;
-
-@@ -70,7 +70,7 @@ my $set2 = q| \entry{set:membera}{book}{}
- \strng{authornamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -97,7 +97,7 @@ my $set3 = q| \entry{set:memberb}{book}{}
- \strng{authornamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -123,7 +123,7 @@ my $set4 = q| \entry{set:memberc}{book}{}
- \strng{authornamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -150,7 +150,7 @@ my $noset1 = q| \entry{noseta}{book}{}
- \field{extraname}{3}
- \field{labelalpha}{Doe10}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradate}{2}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
-@@ -180,7 +180,7 @@ my $noset2 = q| \entry{nosetb}{book}{}
- \field{extraname}{4}
- \field{labelalpha}{Doe10}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradate}{3}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
-@@ -210,7 +210,7 @@ my $noset3 = q| \entry{nosetc}{book}{}
- \field{extraname}{5}
- \field{labelalpha}{Doe10}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extradate}{4}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
-@@ -244,7 +244,7 @@ my $sk4 = q| \entry{skip4}{article}{dataonly}
- \strng{authornamehash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{labeldatesource}{year}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-diff --git a/t/sort-complex.t b/t/sort-complex.t
-index aa3e564..d52db08 100644
---- a/t/sort-complex.t
-+++ b/t/sort-complex.t
-@@ -123,7 +123,7 @@ my $l4 = q| \entry{L4}{book}{}
- \field{extraname}{2}
- \field{labelalpha}{Doe\textbf{+}95}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extraalpha}{2}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -155,7 +155,7 @@ my $l1 = q| \entry{L1}{book}{}
- \field{extraname}{1}
- \field{labelalpha}{Doe95}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extraalpha}{1}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -187,7 +187,7 @@ my $l2 = q| \entry{L2}{book}{}
- \field{extraname}{3}
- \field{labelalpha}{Doe95}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extraalpha}{3}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -219,7 +219,7 @@ my $l3 = q| \entry{L3}{book}{}
- \field{extraname}{2}
- \field{labelalpha}{Doe95}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extraalpha}{2}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -253,7 +253,7 @@ my $l5 = q| \entry{L5}{book}{}
- \field{extraname}{1}
- \field{labelalpha}{Doe\textbf{+}95}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \field{extraalpha}{1}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-diff --git a/t/tdata/full-bbl.bbl b/t/tdata/full-bbl.bbl
-index 4f168de..07c2fab 100644
---- a/t/tdata/full-bbl.bbl
-+++ b/t/tdata/full-bbl.bbl
-@@ -36,7 +36,7 @@
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{labelalpha}{\emph{A}}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{singletitle}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -63,7 +63,7 @@
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{labelalpha}{\emph{A}}
- \field{sortinit}{A}
-- \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
-+ \field{sortinithash}{a3dcedd53b04d1adfd5ac303ecd5e6fa}
- \true{singletitle}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-@@ -90,7 +90,7 @@
- \strng{authorfullhash}{bd051a2f7a5f377e3a62581b0e0f8577}
- \field{labelalpha}{\emph{A}}
- \field{sortinit}{D}
-- \field{sortinithash}{2ef1bd9a78cc71eb74d7231c635177b8}
-+ \field{sortinithash}{c438b3d5d027251ba63f5ed538d98af5}
- \true{singletitle}
- \field{labelnamesource}{author}
- \field{labeltitlesource}{title}
-diff --git a/t/tdata/full-bblxml.bblxml b/t/tdata/full-bblxml.bblxml
-index 9eea7d1..a39a787 100644
---- a/t/tdata/full-bblxml.bblxml
-+++ b/t/tdata/full-bblxml.bblxml
-@@ -47,7 +47,7 @@
- <bbl:field name="authorbibnamehash">860705eb8ffac6e40507746c7ede79ca</bbl:field>
- <bbl:field name="labelalpha">Aks\textbf{+}06</bbl:field>
- <bbl:field name="sortinit">A</bbl:field>
-- <bbl:field name="sortinithash">d77c7cdd82ff690d4c3ef13216f92f0b</bbl:field>
-+ <bbl:field name="sortinithash">a3dcedd53b04d1adfd5ac303ecd5e6fa</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="indextitle">Effect of immobilization on catalytic characteristics</bbl:field>
-@@ -79,7 +79,7 @@
- <bbl:field name="authorbibnamehash">9717d2d959a4b18727868ca7928c34b4</bbl:field>
- <bbl:field name="labelalpha">Ang02</bbl:field>
- <bbl:field name="sortinit">A</bbl:field>
-- <bbl:field name="sortinithash">d77c7cdd82ff690d4c3ef13216f92f0b</bbl:field>
-+ <bbl:field name="sortinithash">a3dcedd53b04d1adfd5ac303ecd5e6fa</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">shorttitle</bbl:field>
- <bbl:field name="annotation">A German article in a French journal. Apart from that, a typical article entry. Note the indextitle field</bbl:field>
-@@ -109,7 +109,7 @@
- </bbl:set>
- <bbl:field name="labelalpha">Gla61</bbl:field>
- <bbl:field name="sortinit">G</bbl:field>
-- <bbl:field name="sortinithash">5e8d2bf9d38de41b1528bd307546008f</bbl:field>
-+ <bbl:field name="sortinithash">62eb2aa29549e4fdbd3cb154ec5711cb</bbl:field>
- <bbl:field name="annotation">A set entry with three members discussing the standard model of particle physics.</bbl:field>
- </bbl:entry>
- <bbl:entry key="stdmodel:glashow" type="article">
-@@ -129,7 +129,7 @@
- <bbl:field name="authorfullhash">eb3f242602109f5bdbeb41fdd990fcc0</bbl:field>
- <bbl:field name="authorbibnamehash">eb3f242602109f5bdbeb41fdd990fcc0</bbl:field>
- <bbl:field name="sortinit">G</bbl:field>
-- <bbl:field name="sortinithash">5e8d2bf9d38de41b1528bd307546008f</bbl:field>
-+ <bbl:field name="sortinithash">62eb2aa29549e4fdbd3cb154ec5711cb</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="journaltitle">Nucl. Phys.</bbl:field>
-@@ -168,7 +168,7 @@
- <bbl:field name="extraname">1</bbl:field>
- <bbl:field name="labelalpha">Knu86</bbl:field>
- <bbl:field name="sortinit">K</bbl:field>
-- <bbl:field name="sortinithash">9fd838a31ba64d981e8f44562bd33f89</bbl:field>
-+ <bbl:field name="sortinithash">d3edc18d54b9438a72c24c925bfb38f4</bbl:field>
- <bbl:field name="extraalpha">1</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">shorttitle</bbl:field>
-@@ -207,7 +207,7 @@
- <bbl:field name="extraname">2</bbl:field>
- <bbl:field name="labelalpha">Knu86</bbl:field>
- <bbl:field name="sortinit">K</bbl:field>
-- <bbl:field name="sortinithash">9fd838a31ba64d981e8f44562bd33f89</bbl:field>
-+ <bbl:field name="sortinithash">d3edc18d54b9438a72c24c925bfb38f4</bbl:field>
- <bbl:field name="extraalpha">2</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">shorttitle</bbl:field>
-@@ -236,7 +236,7 @@
- <bbl:field name="authorbibnamehash">d52f05e0199eae563725b4165f4b2520</bbl:field>
- <bbl:field name="labelalpha">Ree58</bbl:field>
- <bbl:field name="sortinit">R</bbl:field>
-- <bbl:field name="sortinithash">da6b42bd3ab22fee61abed031ee405f7</bbl:field>
-+ <bbl:field name="sortinithash">b9c68a358aea118dfa887b6e902414a7</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="annotation">An article entry with a series and a volume field. Note the format of the series. If the value of the series field is an integer, this number is printed as an ordinal and the string *series is appended automatically</bbl:field>
-@@ -286,7 +286,7 @@
- <bbl:field name="editorfullhash">d0ec890e59163c24c111a08d2a4be982</bbl:field>
- <bbl:field name="editorbibnamehash">d0ec890e59163c24c111a08d2a4be982</bbl:field>
- <bbl:field name="sortinit">S</bbl:field>
-- <bbl:field name="sortinithash">322b1d5276f2f6c1bccdcd15920dbee6</bbl:field>
-+ <bbl:field name="sortinithash">c319cff79d99c853d775f88277d4e45f</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="booksubtitle">Relativistic groups and analyticity</bbl:field>
-@@ -317,7 +317,7 @@
- <bbl:field name="authorbibnamehash">93f17724cbd884231ef39a73755ef5bb</bbl:field>
- <bbl:field name="labelalpha">Sho91</bbl:field>
- <bbl:field name="sortinit">S</bbl:field>
-- <bbl:field name="sortinithash">322b1d5276f2f6c1bccdcd15920dbee6</bbl:field>
-+ <bbl:field name="sortinithash">c319cff79d99c853d775f88277d4e45f</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="annotation">An article entry with series, volume, and number fields. Note the format of the series which is a localization key</bbl:field>
-@@ -353,7 +353,7 @@
- <bbl:field name="authorfullhash">15e144c72b0b9d10db00ddc6d37a19e6</bbl:field>
- <bbl:field name="authorbibnamehash">15e144c72b0b9d10db00ddc6d37a19e6</bbl:field>
- <bbl:field name="sortinit">W</bbl:field>
-- <bbl:field name="sortinithash">ecb89ff85896a47dc313960773ac311d</bbl:field>
-+ <bbl:field name="sortinithash">1af34bd8c148ffb32de1494636b49713</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="journaltitle">Phys. Rev. Lett.</bbl:field>
-@@ -411,7 +411,7 @@
- <bbl:field name="authorbibnamehash">860705eb8ffac6e40507746c7ede79ca</bbl:field>
- <bbl:field name="labelalpha">Aks\textbf{+}06</bbl:field>
- <bbl:field name="sortinit">A</bbl:field>
-- <bbl:field name="sortinithash">d77c7cdd82ff690d4c3ef13216f92f0b</bbl:field>
-+ <bbl:field name="sortinithash">a3dcedd53b04d1adfd5ac303ecd5e6fa</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="indextitle">Effect of immobilization on catalytic characteristics</bbl:field>
-@@ -443,7 +443,7 @@
- <bbl:field name="authorbibnamehash">9717d2d959a4b18727868ca7928c34b4</bbl:field>
- <bbl:field name="labelalpha">Ang02</bbl:field>
- <bbl:field name="sortinit">A</bbl:field>
-- <bbl:field name="sortinithash">d77c7cdd82ff690d4c3ef13216f92f0b</bbl:field>
-+ <bbl:field name="sortinithash">a3dcedd53b04d1adfd5ac303ecd5e6fa</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">shorttitle</bbl:field>
- <bbl:field name="annotation">A German article in a French journal. Apart from that, a typical article entry. Note the indextitle field</bbl:field>
-@@ -473,7 +473,7 @@
- </bbl:set>
- <bbl:field name="labelalpha">Gla61</bbl:field>
- <bbl:field name="sortinit">G</bbl:field>
-- <bbl:field name="sortinithash">5e8d2bf9d38de41b1528bd307546008f</bbl:field>
-+ <bbl:field name="sortinithash">62eb2aa29549e4fdbd3cb154ec5711cb</bbl:field>
- <bbl:field name="annotation">A set entry with three members discussing the standard model of particle physics.</bbl:field>
- </bbl:entry>
- <bbl:entry key="stdmodel:glashow" type="article">
-@@ -493,7 +493,7 @@
- <bbl:field name="authorfullhash">eb3f242602109f5bdbeb41fdd990fcc0</bbl:field>
- <bbl:field name="authorbibnamehash">eb3f242602109f5bdbeb41fdd990fcc0</bbl:field>
- <bbl:field name="sortinit">G</bbl:field>
-- <bbl:field name="sortinithash">5e8d2bf9d38de41b1528bd307546008f</bbl:field>
-+ <bbl:field name="sortinithash">62eb2aa29549e4fdbd3cb154ec5711cb</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="journaltitle">Nucl. Phys.</bbl:field>
-@@ -532,7 +532,7 @@
- <bbl:field name="extraname">1</bbl:field>
- <bbl:field name="labelalpha">Knu86</bbl:field>
- <bbl:field name="sortinit">K</bbl:field>
-- <bbl:field name="sortinithash">9fd838a31ba64d981e8f44562bd33f89</bbl:field>
-+ <bbl:field name="sortinithash">d3edc18d54b9438a72c24c925bfb38f4</bbl:field>
- <bbl:field name="extraalpha">1</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">shorttitle</bbl:field>
-@@ -571,7 +571,7 @@
- <bbl:field name="extraname">2</bbl:field>
- <bbl:field name="labelalpha">Knu86</bbl:field>
- <bbl:field name="sortinit">K</bbl:field>
-- <bbl:field name="sortinithash">9fd838a31ba64d981e8f44562bd33f89</bbl:field>
-+ <bbl:field name="sortinithash">d3edc18d54b9438a72c24c925bfb38f4</bbl:field>
- <bbl:field name="extraalpha">2</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">shorttitle</bbl:field>
-@@ -600,7 +600,7 @@
- <bbl:field name="authorbibnamehash">d52f05e0199eae563725b4165f4b2520</bbl:field>
- <bbl:field name="labelalpha">Ree58</bbl:field>
- <bbl:field name="sortinit">R</bbl:field>
-- <bbl:field name="sortinithash">da6b42bd3ab22fee61abed031ee405f7</bbl:field>
-+ <bbl:field name="sortinithash">b9c68a358aea118dfa887b6e902414a7</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="annotation">An article entry with a series and a volume field. Note the format of the series. If the value of the series field is an integer, this number is printed as an ordinal and the string *series is appended automatically</bbl:field>
-@@ -650,7 +650,7 @@
- <bbl:field name="editorfullhash">d0ec890e59163c24c111a08d2a4be982</bbl:field>
- <bbl:field name="editorbibnamehash">d0ec890e59163c24c111a08d2a4be982</bbl:field>
- <bbl:field name="sortinit">S</bbl:field>
-- <bbl:field name="sortinithash">322b1d5276f2f6c1bccdcd15920dbee6</bbl:field>
-+ <bbl:field name="sortinithash">c319cff79d99c853d775f88277d4e45f</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="booksubtitle">Relativistic groups and analyticity</bbl:field>
-@@ -681,7 +681,7 @@
- <bbl:field name="authorbibnamehash">93f17724cbd884231ef39a73755ef5bb</bbl:field>
- <bbl:field name="labelalpha">Sho91</bbl:field>
- <bbl:field name="sortinit">S</bbl:field>
-- <bbl:field name="sortinithash">322b1d5276f2f6c1bccdcd15920dbee6</bbl:field>
-+ <bbl:field name="sortinithash">c319cff79d99c853d775f88277d4e45f</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="annotation">An article entry with series, volume, and number fields. Note the format of the series which is a localization key</bbl:field>
-@@ -717,7 +717,7 @@
- <bbl:field name="authorfullhash">15e144c72b0b9d10db00ddc6d37a19e6</bbl:field>
- <bbl:field name="authorbibnamehash">15e144c72b0b9d10db00ddc6d37a19e6</bbl:field>
- <bbl:field name="sortinit">W</bbl:field>
-- <bbl:field name="sortinithash">ecb89ff85896a47dc313960773ac311d</bbl:field>
-+ <bbl:field name="sortinithash">1af34bd8c148ffb32de1494636b49713</bbl:field>
- <bbl:field name="labelnamesource">author</bbl:field>
- <bbl:field name="labeltitlesource">title</bbl:field>
- <bbl:field name="journaltitle">Phys. Rev. Lett.</bbl:field>
-diff --git a/t/tdata/remote-files.bcf b/t/tdata/remote-files.bcf
-index c2d784b..a2a1842 100644
---- a/t/tdata/remote-files.bcf
-+++ b/t/tdata/remote-files.bcf
-@@ -1853,12 +1853,12 @@
- <bcf:datasource type="file" datatype="bibtex">http://www.citeulike.org/bibtex/group/8082</bcf:datasource>
- <bcf:datasource type="file" datatype="bibtex">http://people.cs.uu.nl/hansb/graphs-bib/definitions.bib</bcf:datasource>
- <bcf:datasource type="file" datatype="bibtex">http://people.cs.uu.nl/hansb/graphs-bib/papers.bib</bcf:datasource>
-- <bcf:datasource type="file" datatype="bibtex">https://api.zotero.org/groups/9097/items/II22KQ7D?format=bibtex&amp;limit=1</bcf:datasource>
-+ <bcf:datasource type="file" datatype="bibtex">https://api.zotero.org/groups/9097/items/8VITAT46?format=bibtex&amp;limit=1</bcf:datasource>
- </bcf:bibdata>
- <bcf:section number="0">
- <bcf:citekey order="1">citeulike:8283461</bcf:citekey>
- <bcf:citekey order="2">AbdelbarH98</bcf:citekey>
-- <bcf:citekey order="3">merleau-ponty_philosophe_2010</bcf:citekey>
-+ <bcf:citekey order="3">crossley_politics_1994</bcf:citekey>
- </bcf:section>
- <!-- SORTING TEMPLATES -->
- <bcf:sortingtemplate name="nty">
-diff --git a/t/uniqueness-nameparts.t b/t/uniqueness-nameparts.t
-index beb2e39..1fb65a8 100644
---- a/t/uniqueness-nameparts.t
-+++ b/t/uniqueness-nameparts.t
-@@ -81,7 +81,7 @@ my $un1 = q| \entry{un1}{article}{}
- \strng{authorfullhash}{329d8f9192ea3349d700160c9ddb505d}
- \field{labelalpha}{SmiJohSim}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -106,7 +106,7 @@ my $un2 = q| \entry{un2}{article}{}
- \strng{authorfullhash}{7551114aede4ef69e4b3683039801706}
- \field{labelalpha}{SmiJohAla}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -131,7 +131,7 @@ my $un3 = q| \entry{un3}{article}{}
- \strng{authorfullhash}{401aebda288799a7c757526242d8c9fc}
- \field{labelalpha}{SmiJohArt}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -156,7 +156,7 @@ my $un4 = q| \entry{un4}{article}{}
- \strng{authorfullhash}{f6038a264619efefd49c7daac56424ca}
- \field{labelalpha}{SmiAlaSim}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -181,7 +181,7 @@ my $un1a = q| \entry{un1}{article}{}
- \strng{authorfullhash}{329d8f9192ea3349d700160c9ddb505d}
- \field{labelalpha}{SmiJohSim}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -206,7 +206,7 @@ my $un2a = q| \entry{un2}{article}{}
- \strng{authorfullhash}{7551114aede4ef69e4b3683039801706}
- \field{labelalpha}{SmiJohAla}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -231,7 +231,7 @@ my $un3a = q| \entry{un3}{article}{}
- \strng{authorfullhash}{401aebda288799a7c757526242d8c9fc}
- \field{labelalpha}{SmiJohArt}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -257,7 +257,7 @@ my $un4a = q| \entry{un4}{article}{}
- \strng{authorfullhash}{f6038a264619efefd49c7daac56424ca}
- \field{labelalpha}{SmiAlaSim}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -285,7 +285,7 @@ my $un1b = q| \entry{un1}{article}{}
- \field{extraname}{5}
- \field{labelalpha}{SmiJohSim}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradate}{5}
- \field{labelnamesource}{author}
- \endentry
-@@ -311,7 +311,7 @@ my $un2b = q| \entry{un2}{article}{}
- \strng{authorfullhash}{7551114aede4ef69e4b3683039801706}
- \field{labelalpha}{SmiJohAla}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -336,7 +336,7 @@ my $un3b = q| \entry{un3}{article}{}
- \strng{authorfullhash}{401aebda288799a7c757526242d8c9fc}
- \field{labelalpha}{SmiJohArt}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{labelnamesource}{author}
- \endentry
- |;
-@@ -364,7 +364,7 @@ my $un4b = q| \entry{un4}{article}{}
- \field{extraname}{1}
- \field{labelalpha}{SmiAlaSim}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradate}{1}
- \field{labelnamesource}{author}
- \endentry
-@@ -393,7 +393,7 @@ my $un5 = q| \entry{un5}{article}{uniquenametemplatename=test3}
- \field{extraname}{2}
- \field{labelalpha}{SmiArtSim}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradate}{2}
- \field{labelnamesource}{author}
- \endentry
-@@ -422,7 +422,7 @@ my $un6 = q| \entry{un6}{article}{}
- \field{extraname}{3}
- \field{labelalpha}{SmiArtSmy}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradate}{3}
- \field{labelnamesource}{author}
- \\endentry
-@@ -451,7 +451,7 @@ my $un7 = q| \entry{un7}{article}{}
- \field{extraname}{4}
- \field{labelalpha}{SmiArtSme}
- \field{sortinit}{S}
-- \field{sortinithash}{322b1d5276f2f6c1bccdcd15920dbee6}
-+ \field{sortinithash}{c319cff79d99c853d775f88277d4e45f}
- \field{extradate}{4}
- \field{labelnamesource}{author}
- \endentry
-diff --git a/t/xdata.t b/t/xdata.t
-index 7411b1d..73dcb8b 100644
---- a/t/xdata.t
-+++ b/t/xdata.t
-@@ -75,7 +75,7 @@ my $xd1 = q| \entry{xd1}{book}{}
- \strng{authorfullhash}{51db4bfd331cba22959ce2d224c517cd}
- \field{extraname}{2}
- \field{sortinit}{E}
-- \field{sortinithash}{f615fb9c6fba11c6f962fb3fd599810e}
-+ \field{sortinithash}{c554bd1a0b76ea92b9f105fe36d9c7b0}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
-@@ -107,7 +107,7 @@ my $xd2 = q| \entry{xd2}{book}{}
- \strng{authornamehash}{68539e0ce4922cc4957c6cabf35e6fc8}
- \strng{authorfullhash}{68539e0ce4922cc4957c6cabf35e6fc8}
- \field{sortinit}{P}
-- \field{sortinithash}{8d51b3d5b78d75b54308d706b9bbe285}
-+ \field{sortinithash}{bb5b15f2db90f7aef79bb9e83defefcb}
- \field{extradatescope}{labelyear}
- \field{labeldatesource}{}
- \field{labelnamesource}{author}
diff --git a/gnu/packages/patches/binutils-2.37-file-descriptor-leak.patch b/gnu/packages/patches/binutils-2.37-file-descriptor-leak.patch
new file mode 100644
index 0000000000..1fd3d3d9b7
--- /dev/null
+++ b/gnu/packages/patches/binutils-2.37-file-descriptor-leak.patch
@@ -0,0 +1,231 @@
+From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 26 Jul 2021 05:59:55 -0700
+Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd
+
+Close the file descriptor if there is no archive plugin file descriptor
+to avoid running out of file descriptors on thin archives with many
+archive members.
+
+bfd/
+
+ PR ld/28138
+ * plugin.c (bfd_plugin_close_file_descriptor): Close the file
+ descriptor there is no archive plugin file descriptor.
+
+ld/
+
+ PR ld/28138
+ * testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for
+ native build.
+
+ PR ld/28138
+ * testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
+ * testsuite/ld-plugin/pr28138.c: New file.
+ * testsuite/ld-plugin/pr28138-1.c: Likewise.
+ * testsuite/ld-plugin/pr28138-2.c: Likewise.
+ * testsuite/ld-plugin/pr28138-3.c: Likewise.
+ * testsuite/ld-plugin/pr28138-4.c: Likewise.
+ * testsuite/ld-plugin/pr28138-5.c: Likewise.
+ * testsuite/ld-plugin/pr28138-6.c: Likewise.
+ * testsuite/ld-plugin/pr28138-7.c: Likewise.
+
+(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742)
+(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2)
+---
+ bfd/plugin.c | 8 +++++++
+ ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++
+ ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++
+ 10 files changed, 104 insertions(+)
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138.c
+
+diff --git a/bfd/plugin.c b/bfd/plugin.c
+index 6cfa2b66470..3bab8febe88 100644
+--- a/bfd/plugin.c
++++ b/bfd/plugin.c
+@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *abfd, int fd)
+ && !bfd_is_thin_archive (abfd->my_archive))
+ abfd = abfd->my_archive;
+
++ /* Close the file descriptor if there is no archive plugin file
++ descriptor. */
++ if (abfd->archive_plugin_fd == -1)
++ {
++ close (fd);
++ return;
++ }
++
+ abfd->archive_plugin_fd_open_count--;
+ /* Dup the archive plugin file descriptor for later use, which
+ will be closed by _bfd_archive_close_and_cleanup. */
+diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
+index def69e43ab3..999d911ce6a 100644
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_shared_available] } {
+ }
+ }
+
++run_cc_link_tests [list \
++ [list \
++ "Build pr28138.a" \
++ "-T" "" \
++ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \
++ pr28138-6.c pr28138-7.c} {} "pr28138.a" \
++ ] \
++ [list \
++ "Build pr28138.o" \
++ "" "" \
++ {pr28138.c} {} \
++ ] \
++]
++
++set exec_output [run_host_cmd "sh" \
++ "-c \"ulimit -n 20; \
++ $CC -Btmpdir/ld -o tmpdir/pr28138 \
++ tmpdir/pr28138.o tmpdir/pr28138.a\""]
++set exec_output [prune_warnings $exec_output]
++if [string match "" $exec_output] then {
++ if { [isnative] } {
++ set exec_output [run_host_cmd "tmpdir/pr28138" ""]
++ if [string match "PASS" $exec_output] then {
++ pass "PR ld/28138"
++ } else {
++ fail "PR ld/28138"
++ }
++ } else {
++ pass "PR ld/28138"
++ }
++} else {
++ fail "PR ld/28138"
++}
++
+ set testname "Build liblto-11.a"
+ remote_file host delete "tmpdir/liblto-11.a"
+ set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
+diff --git a/ld/testsuite/ld-plugin/pr28138-1.c b/ld/testsuite/ld-plugin/pr28138-1.c
+new file mode 100644
+index 00000000000..51d119e1642
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-1.c
+@@ -0,0 +1,6 @@
++extern int a0(void);
++int
++a1(void)
++{
++ return 1 + a0();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-2.c b/ld/testsuite/ld-plugin/pr28138-2.c
+new file mode 100644
+index 00000000000..1120cd797e9
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-2.c
+@@ -0,0 +1,6 @@
++extern int a1(void);
++int
++a2(void)
++{
++ return 1 + a1();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-3.c b/ld/testsuite/ld-plugin/pr28138-3.c
+new file mode 100644
+index 00000000000..ec464947ee6
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-3.c
+@@ -0,0 +1,6 @@
++extern int a2(void);
++int
++a3(void)
++{
++ return 1 + a2();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-4.c b/ld/testsuite/ld-plugin/pr28138-4.c
+new file mode 100644
+index 00000000000..475701b2c5c
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-4.c
+@@ -0,0 +1,6 @@
++extern int a3(void);
++int
++a4(void)
++{
++ return 1 + a3();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-5.c b/ld/testsuite/ld-plugin/pr28138-5.c
+new file mode 100644
+index 00000000000..e24f86c363e
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-5.c
+@@ -0,0 +1,6 @@
++extern int a4(void);
++int
++a5(void)
++{
++ return 1 + a4();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-6.c b/ld/testsuite/ld-plugin/pr28138-6.c
+new file mode 100644
+index 00000000000..b5b938bdb21
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-6.c
+@@ -0,0 +1,6 @@
++extern int a5(void);
++int
++a6(void)
++{
++ return 1 + a5();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-7.c b/ld/testsuite/ld-plugin/pr28138-7.c
+new file mode 100644
+index 00000000000..4ef75bf0f0c
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-7.c
+@@ -0,0 +1,6 @@
++extern int a6(void);
++int
++a7(void)
++{
++ return 1 + a6();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138.c b/ld/testsuite/ld-plugin/pr28138.c
+new file mode 100644
+index 00000000000..68252c9f382
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138.c
+@@ -0,0 +1,20 @@
++#include <stdio.h>
++
++extern int a7(void);
++
++int
++a0(void)
++{
++ return 0;
++}
++
++int
++main()
++{
++ if (a7() == 7)
++ {
++ printf ("PASS\n");
++ return 0;
++ }
++ return 1;
++}
+--
+2.27.0
diff --git a/gnu/packages/patches/binutils-loongson-workaround.patch b/gnu/packages/patches/binutils-loongson-workaround.patch
index f43572a53d..f05d6c3c96 100644
--- a/gnu/packages/patches/binutils-loongson-workaround.patch
+++ b/gnu/packages/patches/binutils-loongson-workaround.patch
@@ -4,22 +4,22 @@ Patch by Mark H Weaver <mhw@netris.org>.
--- binutils/gas/config/tc-mips.c.orig 2012-09-04 10:21:03.000000000 -0400
+++ binutils/gas/config/tc-mips.c 2013-10-06 02:23:21.651983768 -0400
-@@ -910,10 +910,10 @@
+@@ -934,10 +934,10 @@ enum fix_vr4120_class
};
/* ...likewise -mfix-loongson2f-jump. */
--static bfd_boolean mips_fix_loongson2f_jump;
-+static bfd_boolean mips_fix_loongson2f_jump = FALSE;
+-static bool mips_fix_loongson2f_jump;
++static bool mips_fix_loongson2f_jump = FALSE;
/* ...likewise -mfix-loongson2f-nop. */
--static bfd_boolean mips_fix_loongson2f_nop;
-+static bfd_boolean mips_fix_loongson2f_nop = TRUE;
+-static bool mips_fix_loongson2f_nop;
++static bool mips_fix_loongson2f_nop = TRUE;
/* True if -mfix-loongson2f-nop or -mfix-loongson2f-jump passed. */
- static bfd_boolean mips_fix_loongson2f;
+ static bool mips_fix_loongson2f;
--- binutils/gas/testsuite/gas/mips/mips.exp.orig 2012-09-04 10:17:13.000000000 -0400
+++ binutils/gas/testsuite/gas/mips/mips.exp 2013-10-06 02:23:21.663983768 -0400
-@@ -91,6 +91,12 @@
+@@ -110,6 +110,12 @@ proc mips_arch_init {} {
# Catch because the variable won't be set the first time through.
catch {unset mips_arches}
diff --git a/gnu/packages/patches/binutils-mingw-w64-timestamp.patch b/gnu/packages/patches/binutils-mingw-w64-timestamp.patch
index b785043b62..fcfe4a36aa 100644
--- a/gnu/packages/patches/binutils-mingw-w64-timestamp.patch
+++ b/gnu/packages/patches/binutils-mingw-w64-timestamp.patch
@@ -4,14 +4,14 @@ https://salsa.debian.org/mingw-w64-team/binutils-mingw-w64.git
Invoke the following in the aforementioned repo to see the original patch:
- $ git show da63f6b:debian/patches/specify-timestamp.patch
+ $ git show faf7c64:debian/patches/specify-timestamp.patch
Description: Allow the PE timestamp to be specified
Author: Stephen Kitt <skitt@debian.org>
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
-@@ -70,6 +70,9 @@
+@@ -77,6 +77,9 @@
#include <wctype.h>
#endif
@@ -21,20 +21,20 @@ Author: Stephen Kitt <skitt@debian.org>
/* NOTE: it's strange to be including an architecture specific header
in what's supposed to be general (to PE/PEI) code. However, that's
where the definitions are, and they don't vary per architecture
-@@ -879,10 +882,38 @@
+@@ -876,9 +879,36 @@
/* Use a real timestamp by default, unless the no-insert-timestamp
option was chosen. */
-- if ((pe_data (abfd)->insert_timestamp))
+- if ((pe_data (abfd)->timestamp) == -1)
- H_PUT_32 (abfd, time (0), filehdr_out->f_timdat);
- else
-+ if (pe_data (abfd)->insert_timestamp) {
++ if ((pe_data (abfd)->timestamp) == -1) {
+ time_t now;
+ char *source_date_epoch;
+ unsigned long long epoch;
+ char *endptr;
+
-+ now = time(NULL);
++ now = time (NULL);
+ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+ if (source_date_epoch) {
+ errno = 0;
@@ -57,30 +57,29 @@ Author: Stephen Kitt <skitt@debian.org>
+ }
+ }
+ H_PUT_32 (abfd, now, filehdr_out->f_timdat);
-+ } else {
- H_PUT_32 (abfd, 0, filehdr_out->f_timdat);
-+ }
++ } else
+ H_PUT_32 (abfd, pe_data (abfd)->timestamp, filehdr_out->f_timdat);
PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr,
- filehdr_out->f_symptr);
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
-@@ -26,6 +26,8 @@
- #include "filenames.h"
+@@ -27,6 +27,8 @@
#include "safe-ctype.h"
+ #include "ctf-api.h"
+#include <errno.h>
+#include <limits.h>
#include <time.h>
#include "ld.h"
-@@ -1202,8 +1204,36 @@
+@@ -1218,9 +1220,36 @@
memset (edata_d, 0, edata_sz);
-- if (pe_data (abfd)->insert_timestamp)
+- if (pe_data (abfd)->timestamp == -1)
- H_PUT_32 (abfd, time (0), edata_d + 4);
-+ if (pe_data (abfd)->insert_timestamp) {
+- else
++ if (pe_data (abfd)->timestamp == -1) {
+ time_t now;
+ char *source_date_epoch;
+ unsigned long long epoch;
@@ -109,13 +108,13 @@ Author: Stephen Kitt <skitt@debian.org>
+ }
+ }
+ H_PUT_32 (abfd, now, edata_d + 4);
-+ }
++ } else
+ H_PUT_32 (abfd, pe_data (abfd)->timestamp, edata_d + 4);
if (pe_def_file->version_major != -1)
- {
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
-@@ -303,7 +303,7 @@
+@@ -304,7 +304,7 @@
OPTION_USE_NUL_PREFIXED_IMPORT_TABLES},
{"no-leading-underscore", no_argument, NULL, OPTION_NO_LEADING_UNDERSCORE},
{"leading-underscore", no_argument, NULL, OPTION_LEADING_UNDERSCORE},
@@ -126,7 +125,7 @@ Author: Stephen Kitt <skitt@debian.org>
/* getopt allows abbreviations, so we do this to stop it
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
-@@ -321,7 +321,7 @@
+@@ -323,7 +323,7 @@
{"no-bind", no_argument, NULL, OPTION_NO_BIND},
{"wdmdriver", no_argument, NULL, OPTION_WDM_DRIVER},
{"tsaware", no_argument, NULL, OPTION_TERMINAL_SERVER_AWARE},
@@ -134,4 +133,4 @@ Author: Stephen Kitt <skitt@debian.org>
+ {"insert-timestamp", optional_argument, NULL, OPTION_INSERT_TIMESTAMP},
{"no-insert-timestamp", no_argument, NULL, OPTION_NO_INSERT_TIMESTAMP},
{"build-id", optional_argument, NULL, OPTION_BUILD_ID},
- {NULL, no_argument, NULL, 0}
+ {"enable-reloc-section", no_argument, NULL, OPTION_ENABLE_RELOC_SECTION},
diff --git a/gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch b/gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch
new file mode 100644
index 0000000000..0629212688
--- /dev/null
+++ b/gnu/packages/patches/c++-gsl-move-array-bounds-tests.patch
@@ -0,0 +1,126 @@
+Description: Move tests that trigger -Warray-bounds to separate compilation unit
+ GCC 10 is now smart enough to detect violation of array boundaries that tests
+ are actually tested. Along with -Werror this led to tests failure, so I move
+ such tests to another compilation unit to have the warning deactivated for
+ only these tests.
+Bug-Debian: https://bugs.debian.org/966895
+Author: Nicholas Guriev <guriev-ns@ya.ru>
+Last-Modified: Wed, 19 Aug 2020 08:55:52 +0300
+
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -179,6 +179,7 @@ add_gsl_test(owner_tests)
+ add_gsl_test(byte_tests)
+ add_gsl_test(algorithm_tests)
+ add_gsl_test(strict_notnull_tests)
++add_gsl_test(array_bounds)
+
+
+ # No exception tests
+--- /dev/null
++++ b/tests/array_bounds.cpp
+@@ -0,0 +1,68 @@
++///////////////////////////////////////////////////////////////////////////////
++//
++// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
++//
++// This code is licensed under the MIT License (MIT).
++//
++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
++// THE SOFTWARE.
++//
++///////////////////////////////////////////////////////////////////////////////
++
++#ifdef __GNUC__
++#pragma GCC diagnostic warning "-Warray-bounds"
++#endif // __GNUC__
++
++#include <gtest/gtest.h>
++
++#include <gsl/multi_span> // for gsl::multi_span
++
++namespace gsl
++{
++struct fail_fast;
++} // namespace gsl
++
++namespace
++{
++static constexpr char deathstring[] = "Expected Death";
++} // namespace
++
++TEST(array_bounds, subspan_from_multi_span_test)
++{
++ int arr[5] = {1, 2, 3, 4, 5};
++ gsl::multi_span<int> av = arr;
++
++ std::set_terminate([] {
++ std::cerr << "Expected Death. subspan";
++ std::abort();
++ });
++
++ EXPECT_DEATH(av.subspan(6).length(), deathstring);
++}
++
++TEST(array_bounds, strided_span_bounds_from_strided_span_tests)
++{
++ int arr[] = {0, 1, 2, 3};
++ gsl::multi_span<int> av(arr);
++
++ std::set_terminate([] {
++ std::cerr << "Expected Death. strided_span_bounds";
++ std::abort();
++ });
++
++ // incorrect sections
++ EXPECT_DEATH(av.section(0, 0)[0], deathstring);
++ EXPECT_DEATH(av.section(1, 0)[0], deathstring);
++ EXPECT_DEATH(av.section(1, 1)[1], deathstring);
++
++ EXPECT_DEATH(av.section(2, 5), deathstring);
++ EXPECT_DEATH(av.section(5, 2), deathstring);
++ EXPECT_DEATH(av.section(5, 0), deathstring);
++ EXPECT_DEATH(av.section(0, 5), deathstring);
++ EXPECT_DEATH(av.section(5, 5), deathstring);
++}
+--- a/tests/multi_span_tests.cpp
++++ b/tests/multi_span_tests.cpp
+@@ -1042,10 +1042,6 @@ TEST(multi_span_test, subspan)
+ EXPECT_TRUE(av.subspan(1).length() == 4);
+ EXPECT_TRUE(av.subspan(4).length() == 1);
+ EXPECT_TRUE(av.subspan(5).length() == 0);
+- // Disabled test instead of fixing since multi_span is deprecated. (PR#835)
+-#if !(defined(__GNUC__) && __GNUC__ == 8)
+- EXPECT_DEATH(av.subspan(6).length(), deathstring);
+-#endif
+ auto av2 = av.subspan(1);
+ for (int i = 0; i < 4; ++i) EXPECT_TRUE(av2[i] == i + 2);
+ }
+--- a/tests/strided_span_tests.cpp
++++ b/tests/strided_span_tests.cpp
+@@ -403,20 +403,6 @@ TEST(strided_span_tests, strided_span_bo
+ });
+
+ {
+- // incorrect sections
+-
+- EXPECT_DEATH(av.section(0, 0)[0], deathstring);
+- EXPECT_DEATH(av.section(1, 0)[0], deathstring);
+- EXPECT_DEATH(av.section(1, 1)[1], deathstring);
+-
+- EXPECT_DEATH(av.section(2, 5), deathstring);
+- EXPECT_DEATH(av.section(5, 2), deathstring);
+- EXPECT_DEATH(av.section(5, 0), deathstring);
+- EXPECT_DEATH(av.section(0, 5), deathstring);
+- EXPECT_DEATH(av.section(5, 5), deathstring);
+- }
+-
+- {
+ // zero stride
+ strided_span<int, 1> sav{av, {{4}, {}}};
+ EXPECT_TRUE(sav[0] == 0);
diff --git a/gnu/packages/patches/cdrkit-libre-cross-compile.patch b/gnu/packages/patches/cdrkit-libre-cross-compile.patch
new file mode 100644
index 0000000000..09c34b8c0a
--- /dev/null
+++ b/gnu/packages/patches/cdrkit-libre-cross-compile.patch
@@ -0,0 +1,32 @@
+Patch extracted from a set of patches to cross-compile ffmeg and dependencies for mingw-w64.
+https://github.com/Warblefly/MultimediaTools-mingw-w64/commit/01e30a17637b67afd65c1e24302f8daf94b19b32#diff-503bd595ad2a49840cc56acdb3432487a20a0acb7981ce83be51fe311216de8f
+
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index 99a69fd..e5ba8a7 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -35,8 +35,6 @@ endif(VA_LIST_IS_ARRAY)
+ INCLUDE(TestBigEndian)
+ TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
+
+-TRY_RUN(BITFIELDS_HTOL TEST_DUMMY ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/test_BITFIELDS_HTOL.c)
+-
+ INCLUDE(CheckIncludeFiles)
+
+ #SET(CMAKE_REQUIRED_INCLUDES "/usr/include;/usr/local/include")
+diff --git a/include/xconfig.h.in b/include/xconfig.h.in
+index c130600..476c00b 100644
+--- a/include/xconfig.h.in
++++ b/include/xconfig.h.in
+@@ -233,7 +233,11 @@
+ /* If using network byte order */
+ #cmakedefine WORDS_BIGENDIAN
+ /* If high bits come first in structures */
+-#cmakedefine BITFIELDS_HTOL
++#ifdef WORDS_BIGENDIAN
++#define BITFIELDS_HTOL
++#else
++#define BITFIELDS_LTOH
++#endif
+ #define HAVE_C_BIGENDIAN /* Flag that WORDS_BIGENDIAN test was done */
+ #define HAVE_C_BITFIELDS /* Flag that BITFIELDS_HTOL test was done */
diff --git a/gnu/packages/patches/ceph-boost-compat.patch b/gnu/packages/patches/ceph-boost-compat.patch
new file mode 100644
index 0000000000..1aecfbbed5
--- /dev/null
+++ b/gnu/packages/patches/ceph-boost-compat.patch
@@ -0,0 +1,18 @@
+Add extra includes required for Boost 1.75 and later.
+
+Taken from upstram:
+
+ https://github.com/ceph/ceph/commit/ebf3a0398f18eab67d2ba25e6a10b41ff140f6a4
+
+diff --git a/src/rgw/rgw_string.h b/src/rgw/rgw_string.h
+index 257daa9c1fe6e..90e64f98a2587 100644
+--- a/src/rgw/rgw_string.h
++++ b/src/rgw/rgw_string.h
+@@ -8,5 +8,7 @@
+ #include <stdlib.h>
+ #include <limits.h>
+ #include <string_view>
++#include <string>
++#include <stdexcept>
+
+ #include <boost/container/small_vector.hpp>
diff --git a/gnu/packages/patches/ceph-fix-snappy-breaking-change.patch b/gnu/packages/patches/ceph-fix-snappy-breaking-change.patch
deleted file mode 100644
index 7a10e2e4ae..0000000000
--- a/gnu/packages/patches/ceph-fix-snappy-breaking-change.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Patch tracked upstream at https://tracker.ceph.com/issues/50934
-
---- a/src/compressor/snappy/SnappyCompressor.h
-+++ b/src/compressor/snappy/SnappyCompressor.h
-@@ -96,7 +96,7 @@ class SnappyCompressor : public Compressor {
- if (qat_enabled)
- return qat_accel.decompress(p, compressed_len, dst);
- #endif
-- snappy::uint32 res_len = 0;
-+ uint32_t res_len = 0;
- BufferlistSource source_1(p, compressed_len);
- if (!snappy::GetUncompressedLength(&source_1, &res_len)) {
- return -1;
diff --git a/gnu/packages/patches/ceph-rocksdb-compat.patch b/gnu/packages/patches/ceph-rocksdb-compat.patch
new file mode 100644
index 0000000000..9fb9b0caeb
--- /dev/null
+++ b/gnu/packages/patches/ceph-rocksdb-compat.patch
@@ -0,0 +1,303 @@
+Adjust for newer versions of RocksDB.
+
+Taken from upstream:
+
+ https://github.com/ceph/ceph/pull/42815
+ https://github.com/ceph/ceph/commit/ff7f192ea3cf88ca1098bcf9396ff4f8ed1e8792.diff
+
+diff --git a/src/kv/rocksdb_cache/BinnedLRUCache.cc b/src/kv/rocksdb_cache/BinnedLRUCache.cc
+index 0d657883e92de..47c56e2ddd769 100644
+--- a/src/kv/rocksdb_cache/BinnedLRUCache.cc
++++ b/src/kv/rocksdb_cache/BinnedLRUCache.cc
+@@ -151,13 +151,20 @@ void BinnedLRUCacheShard::EraseUnRefEntries() {
+ }
+ }
+
+-void BinnedLRUCacheShard::ApplyToAllCacheEntries(void (*callback)(void*, size_t),
+- bool thread_safe) {
++void BinnedLRUCacheShard::ApplyToAllCacheEntries(
++ const std::function<void(const rocksdb::Slice& key,
++ void* value,
++ size_t charge,
++ DeleterFn)>& callback,
++ bool thread_safe)
++{
+ if (thread_safe) {
+ mutex_.lock();
+ }
+ table_.ApplyToAllCacheEntries(
+- [callback](BinnedLRUHandle* h) { callback(h->value, h->charge); });
++ [callback](BinnedLRUHandle* h) {
++ callback(h->key(), h->value, h->charge, h->deleter);
++ });
+ if (thread_safe) {
+ mutex_.unlock();
+ }
+@@ -345,7 +352,7 @@ bool BinnedLRUCacheShard::Release(rocksdb::Cache::Handle* handle, bool force_era
+
+ rocksdb::Status BinnedLRUCacheShard::Insert(const rocksdb::Slice& key, uint32_t hash, void* value,
+ size_t charge,
+- void (*deleter)(const rocksdb::Slice& key, void* value),
++ DeleterFn deleter,
+ rocksdb::Cache::Handle** handle, rocksdb::Cache::Priority priority) {
+ auto e = new BinnedLRUHandle();
+ rocksdb::Status s;
+@@ -464,6 +471,12 @@ std::string BinnedLRUCacheShard::GetPrintableOptions() const {
+ return std::string(buffer);
+ }
+
++DeleterFn BinnedLRUCacheShard::GetDeleter(rocksdb::Cache::Handle* h) const
++{
++ auto* handle = reinterpret_cast<BinnedLRUHandle*>(h);
++ return handle->deleter;
++}
++
+ BinnedLRUCache::BinnedLRUCache(CephContext *c,
+ size_t capacity,
+ int num_shard_bits,
+@@ -519,6 +532,13 @@ void BinnedLRUCache::DisownData() {
+ #endif // !__SANITIZE_ADDRESS__
+ }
+
++#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
++DeleterFn BinnedLRUCache::GetDeleter(Handle* handle) const
++{
++ return reinterpret_cast<const BinnedLRUHandle*>(handle)->deleter;
++}
++#endif
++
+ size_t BinnedLRUCache::TEST_GetLRUSize() {
+ size_t lru_size_of_all_shards = 0;
+ for (int i = 0; i < num_shards_; i++) {
+diff --git a/src/kv/rocksdb_cache/BinnedLRUCache.h b/src/kv/rocksdb_cache/BinnedLRUCache.h
+index 85608be0e5734..88bf4502e8927 100644
+--- a/src/kv/rocksdb_cache/BinnedLRUCache.h
++++ b/src/kv/rocksdb_cache/BinnedLRUCache.h
+@@ -56,7 +56,7 @@ std::shared_ptr<rocksdb::Cache> NewBinnedLRUCache(
+
+ struct BinnedLRUHandle {
+ void* value;
+- void (*deleter)(const rocksdb::Slice&, void* value);
++ DeleterFn deleter;
+ BinnedLRUHandle* next_hash;
+ BinnedLRUHandle* next;
+ BinnedLRUHandle* prev;
+@@ -189,7 +189,7 @@ class alignas(CACHE_LINE_SIZE) BinnedLRUCacheShard : public CacheShard {
+ // Like Cache methods, but with an extra "hash" parameter.
+ virtual rocksdb::Status Insert(const rocksdb::Slice& key, uint32_t hash, void* value,
+ size_t charge,
+- void (*deleter)(const rocksdb::Slice& key, void* value),
++ DeleterFn deleter,
+ rocksdb::Cache::Handle** handle,
+ rocksdb::Cache::Priority priority) override;
+ virtual rocksdb::Cache::Handle* Lookup(const rocksdb::Slice& key, uint32_t hash) override;
+@@ -205,13 +205,19 @@ class alignas(CACHE_LINE_SIZE) BinnedLRUCacheShard : public CacheShard {
+ virtual size_t GetUsage() const override;
+ virtual size_t GetPinnedUsage() const override;
+
+- virtual void ApplyToAllCacheEntries(void (*callback)(void*, size_t),
+- bool thread_safe) override;
++ virtual void ApplyToAllCacheEntries(
++ const std::function<void(const rocksdb::Slice& key,
++ void* value,
++ size_t charge,
++ DeleterFn)>& callback,
++ bool thread_safe) override;
+
+ virtual void EraseUnRefEntries() override;
+
+ virtual std::string GetPrintableOptions() const override;
+
++ virtual DeleterFn GetDeleter(rocksdb::Cache::Handle* handle) const override;
++
+ void TEST_GetLRUList(BinnedLRUHandle** lru, BinnedLRUHandle** lru_low_pri);
+
+ // Retrieves number of elements in LRU, for unit test purpose only
+@@ -304,7 +310,9 @@ class BinnedLRUCache : public ShardedCache {
+ virtual size_t GetCharge(Handle* handle) const override;
+ virtual uint32_t GetHash(Handle* handle) const override;
+ virtual void DisownData() override;
+-
++#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
++ virtual DeleterFn GetDeleter(Handle* handle) const override;
++#endif
+ // Retrieves number of elements in LRU, for unit test purpose only
+ size_t TEST_GetLRUSize();
+ // Sets the high pri pool ratio
+diff --git a/src/kv/rocksdb_cache/ShardedCache.cc b/src/kv/rocksdb_cache/ShardedCache.cc
+index 367140a94d8be..6cbd89ad6472c 100644
+--- a/src/kv/rocksdb_cache/ShardedCache.cc
++++ b/src/kv/rocksdb_cache/ShardedCache.cc
+@@ -44,7 +44,7 @@ void ShardedCache::SetStrictCapacityLimit(bool strict_capacity_limit) {
+ }
+
+ rocksdb::Status ShardedCache::Insert(const rocksdb::Slice& key, void* value, size_t charge,
+- void (*deleter)(const rocksdb::Slice& key, void* value),
++ DeleterFn deleter,
+ rocksdb::Cache::Handle** handle, Priority priority) {
+ uint32_t hash = HashSlice(key);
+ return GetShard(Shard(hash))
+@@ -109,13 +109,36 @@ size_t ShardedCache::GetPinnedUsage() const {
+ return usage;
+ }
+
++#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
++DeleterFn ShardedCache::GetDeleter(Handle* handle) const
++{
++ uint32_t hash = GetHash(handle);
++ return GetShard(Shard(hash))->GetDeleter(handle);
++}
++
++void ShardedCache::ApplyToAllEntries(
++ const std::function<void(const rocksdb::Slice& key, void* value, size_t charge,
++ DeleterFn deleter)>& callback,
++ const ApplyToAllEntriesOptions& opts)
++{
++ int num_shards = 1 << num_shard_bits_;
++ for (int s = 0; s < num_shards; s++) {
++ GetShard(s)->ApplyToAllCacheEntries(callback, true /* thread_safe */);
++ }
++}
++#else
+ void ShardedCache::ApplyToAllCacheEntries(void (*callback)(void*, size_t),
+ bool thread_safe) {
+ int num_shards = 1 << num_shard_bits_;
+ for (int s = 0; s < num_shards; s++) {
+- GetShard(s)->ApplyToAllCacheEntries(callback, thread_safe);
++ GetShard(s)->ApplyToAllCacheEntries(
++ [callback](const rocksdb::Slice&, void* value, size_t charge, DeleterFn) {
++ callback(value, charge);
++ },
++ thread_safe);
+ }
+ }
++#endif
+
+ void ShardedCache::EraseUnRefEntries() {
+ int num_shards = 1 << num_shard_bits_;
+@@ -131,7 +154,7 @@ std::string ShardedCache::GetPrintableOptions() const {
+ char buffer[kBufferSize];
+ {
+ std::lock_guard<std::mutex> l(capacity_mutex_);
+- snprintf(buffer, kBufferSize, " capacity : %" ROCKSDB_PRIszt "\n",
++ snprintf(buffer, kBufferSize, " capacity : %zu\n",
+ capacity_);
+ ret.append(buffer);
+ snprintf(buffer, kBufferSize, " num_shard_bits : %d\n", num_shard_bits_);
+diff --git a/src/kv/rocksdb_cache/ShardedCache.h b/src/kv/rocksdb_cache/ShardedCache.h
+index 4d64893ab1c7b..f98421a09a33a 100644
+--- a/src/kv/rocksdb_cache/ShardedCache.h
++++ b/src/kv/rocksdb_cache/ShardedCache.h
+@@ -14,6 +14,7 @@
+ #include <string>
+ #include <mutex>
+
++#include "rocksdb/version.h"
+ #include "rocksdb/cache.h"
+ #include "include/ceph_hash.h"
+ #include "common/PriorityCache.h"
+@@ -22,10 +23,11 @@
+ #ifndef CACHE_LINE_SIZE
+ #define CACHE_LINE_SIZE 64 // XXX arch-specific define
+ #endif
+-#define ROCKSDB_PRIszt "zu"
+
+ namespace rocksdb_cache {
+
++using DeleterFn = void (*)(const rocksdb::Slice& key, void* value);
++
+ // Single cache shard interface.
+ class CacheShard {
+ public:
+@@ -34,7 +36,7 @@ class CacheShard {
+
+ virtual rocksdb::Status Insert(const rocksdb::Slice& key, uint32_t hash, void* value,
+ size_t charge,
+- void (*deleter)(const rocksdb::Slice& key, void* value),
++ DeleterFn deleter,
+ rocksdb::Cache::Handle** handle, rocksdb::Cache::Priority priority) = 0;
+ virtual rocksdb::Cache::Handle* Lookup(const rocksdb::Slice& key, uint32_t hash) = 0;
+ virtual bool Ref(rocksdb::Cache::Handle* handle) = 0;
+@@ -44,10 +46,15 @@ class CacheShard {
+ virtual void SetStrictCapacityLimit(bool strict_capacity_limit) = 0;
+ virtual size_t GetUsage() const = 0;
+ virtual size_t GetPinnedUsage() const = 0;
+- virtual void ApplyToAllCacheEntries(void (*callback)(void*, size_t),
+- bool thread_safe) = 0;
++ virtual void ApplyToAllCacheEntries(
++ const std::function<void(const rocksdb::Slice& key,
++ void* value,
++ size_t charge,
++ DeleterFn)>& callback,
++ bool thread_safe) = 0;
+ virtual void EraseUnRefEntries() = 0;
+ virtual std::string GetPrintableOptions() const { return ""; }
++ virtual DeleterFn GetDeleter(rocksdb::Cache::Handle* handle) const = 0;
+ };
+
+ // Generic cache interface which shards cache by hash of keys. 2^num_shard_bits
+@@ -57,34 +64,43 @@ class ShardedCache : public rocksdb::Cache, public PriorityCache::PriCache {
+ public:
+ ShardedCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit);
+ virtual ~ShardedCache() = default;
++ // rocksdb::Cache
+ virtual const char* Name() const override = 0;
+- virtual CacheShard* GetShard(int shard) = 0;
+- virtual const CacheShard* GetShard(int shard) const = 0;
+- virtual void* Value(Handle* handle) override = 0;
+- virtual size_t GetCharge(Handle* handle) const = 0;
+- virtual uint32_t GetHash(Handle* handle) const = 0;
+- virtual void DisownData() override = 0;
+-
+- virtual void SetCapacity(size_t capacity) override;
+- virtual void SetStrictCapacityLimit(bool strict_capacity_limit) override;
+-
+ virtual rocksdb::Status Insert(const rocksdb::Slice& key, void* value, size_t charge,
+- void (*deleter)(const rocksdb::Slice& key, void* value),
++ DeleterFn,
+ rocksdb::Cache::Handle** handle, Priority priority) override;
+ virtual rocksdb::Cache::Handle* Lookup(const rocksdb::Slice& key, rocksdb::Statistics* stats) override;
+ virtual bool Ref(rocksdb::Cache::Handle* handle) override;
+ virtual bool Release(rocksdb::Cache::Handle* handle, bool force_erase = false) override;
++ virtual void* Value(Handle* handle) override = 0;
+ virtual void Erase(const rocksdb::Slice& key) override;
+ virtual uint64_t NewId() override;
+- virtual size_t GetCapacity() const override;
++ virtual void SetCapacity(size_t capacity) override;
++ virtual void SetStrictCapacityLimit(bool strict_capacity_limit) override;
+ virtual bool HasStrictCapacityLimit() const override;
++ virtual size_t GetCapacity() const override;
+ virtual size_t GetUsage() const override;
+ virtual size_t GetUsage(rocksdb::Cache::Handle* handle) const override;
+ virtual size_t GetPinnedUsage() const override;
++ virtual size_t GetCharge(Handle* handle) const = 0;
++#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
++ virtual DeleterFn GetDeleter(Handle* handle) const override;
++#endif
++ virtual void DisownData() override = 0;
++#if (ROCKSDB_MAJOR >= 6 && ROCKSDB_MINOR >= 22)
++ virtual void ApplyToAllEntries(
++ const std::function<void(const rocksdb::Slice& key, void* value, size_t charge,
++ DeleterFn deleter)>& callback,
++ const ApplyToAllEntriesOptions& opts) override;
++#else
+ virtual void ApplyToAllCacheEntries(void (*callback)(void*, size_t),
+ bool thread_safe) override;
++#endif
+ virtual void EraseUnRefEntries() override;
+ virtual std::string GetPrintableOptions() const override;
++ virtual CacheShard* GetShard(int shard) = 0;
++ virtual const CacheShard* GetShard(int shard) const = 0;
++ virtual uint32_t GetHash(Handle* handle) const = 0;
+
+ int GetNumShardBits() const { return num_shard_bits_; }
+
+@@ -120,7 +136,7 @@ class ShardedCache : public rocksdb::Cache, public PriorityCache::PriCache {
+ // return Hash(s.data(), s.size(), 0);
+ }
+
+- uint32_t Shard(uint32_t hash) {
++ uint32_t Shard(uint32_t hash) const {
+ // Note, hash >> 32 yields hash in gcc, not the zero we expect!
+ return (num_shard_bits_ > 0) ? (hash >> (32 - num_shard_bits_)) : 0;
+ }
diff --git a/gnu/packages/patches/cheese-vala-update.patch b/gnu/packages/patches/cheese-vala-update.patch
new file mode 100644
index 0000000000..cb18952ce4
--- /dev/null
+++ b/gnu/packages/patches/cheese-vala-update.patch
@@ -0,0 +1,180 @@
+Taken from upstream:
+https://gitlab.gnome.org/GNOME/cheese/-/commit/7cf6268e54620bbbe5e6e61800c50fb0cb4bea57.patch.
+
+From 7cf6268e54620bbbe5e6e61800c50fb0cb4bea57 Mon Sep 17 00:00:00 2001 From:
+=?UTF-8?q?Corentin=20No=C3=ABl?= <corentin@elementary.io> Date: Fri, 16 Oct
+2020 19:56:26 +0200 Subject: [PATCH] Change GLib.PtrArray into
+GLib.GenericArray
+
+This is the vala-friendly way of handling GPtrArray.
+Fix several memory leaks on the go and unnecessary reference increase.
+---
+ src/cheese-preferences.vala | 26 ++++++++++++--------------
+ src/cheese-window.vala | 22 +++++++++++-----------
+ src/vapi/cheese-common.vapi | 2 +-
+ 3 files changed, 24 insertions(+), 26 deletions(-)
+
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index f56af7e0..80a92431 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -100,7 +100,7 @@ public PreferencesDialog (Cheese.Camera camera)
+ */
+ private void initialize_camera_devices ()
+ {
+- unowned GLib.PtrArray devices = camera.get_camera_devices ();
++ GLib.GenericArray<unowned Cheese.CameraDevice> devices = camera.get_camera_devices ();
+ camera_model = new Gtk.ListStore (2, typeof (string), typeof (Cheese.CameraDevice));
+
+ source_combo.model = camera_model;
+@@ -357,13 +357,13 @@ public PreferencesDialog (Cheese.Camera camera)
+ */
+ private void on_camera_update_num_camera_devices ()
+ {
+- unowned GLib.PtrArray devices = camera.get_camera_devices ();
+- Cheese.CameraDevice dev;
++ GLib.GenericArray<unowned Cheese.CameraDevice> devices = camera.get_camera_devices ();
++ unowned Cheese.CameraDevice dev;
+
+ // Add (if) / Remove (else) a camera device.
+- if (devices.len > camera_model.iter_n_children (null))
++ if (devices.length > camera_model.iter_n_children (null))
+ {
+- dev = (Cheese.CameraDevice) devices.index (devices.len - 1);
++ dev = devices.get (devices.length - 1);
+ add_camera_device(dev);
+ }
+ else
+@@ -382,12 +382,11 @@ public PreferencesDialog (Cheese.Camera camera)
+ bool device_removed = false;
+ devices.foreach ((device) =>
+ {
+- var old_device = (Cheese.CameraDevice) device;
+ Cheese.CameraDevice new_device;
+ camera_model.get (iter, 1, out new_device, -1);
+
+ // Found the device that was removed.
+- if (old_device != new_device)
++ if (device != new_device)
+ {
+ remove_camera_device (iter, new_device, active_device);
+ device_removed = true;
+@@ -418,17 +417,16 @@ public PreferencesDialog (Cheese.Camera camera)
+ *
+ * @param device a Cheese.CameraDevice to add to the device combo box model
+ */
+- private void add_camera_device (void *device)
++ private void add_camera_device (Cheese.CameraDevice device)
+ {
+ TreeIter iter;
+- Cheese.CameraDevice dev = (Cheese.CameraDevice) device;
+
+ camera_model.append (out iter);
+ camera_model.set (iter,
+- 0, dev.get_name (),
+- 1, dev);
++ 0, device.get_name (),
++ 1, device);
+
+- if (camera.get_selected_device () == dev)
++ if (camera.get_selected_device () == device)
+ source_combo.set_active_iter (iter);
+
+ if (camera_model.iter_n_children (null) > 1)
+@@ -445,12 +443,12 @@ public PreferencesDialog (Cheese.Camera camera)
+ private void remove_camera_device (TreeIter iter, Cheese.CameraDevice device_node,
+ Cheese.CameraDevice active_device_node)
+ {
+- unowned GLib.PtrArray devices = camera.get_camera_devices ();
++ GLib.GenericArray<unowned Cheese.CameraDevice> devices = camera.get_camera_devices ();
+
+ // Check if the camera that we want to remove, is the active one
+ if (device_node == active_device_node)
+ {
+- if (devices.len > 0)
++ if (devices.length > 0)
+ set_new_available_camera_device (iter);
+ else
+ this.hide ();
+diff --git a/src/cheese-window.vala b/src/cheese-window.vala
+index ff069808..cc119b68 100644
+--- a/src/cheese-window.vala
++++ b/src/cheese-window.vala
+@@ -1216,9 +1216,9 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ */
+ public void on_switch_camera_clicked ()
+ {
+- Cheese.CameraDevice selected;
+- Cheese.CameraDevice next = null;
+- GLib.PtrArray cameras;
++ unowned Cheese.CameraDevice selected;
++ unowned Cheese.CameraDevice next = null;
++ GLib.GenericArray<unowned Cheese.CameraDevice> cameras;
+ uint i;
+
+ if (camera == null)
+@@ -1235,9 +1235,9 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+
+ cameras = camera.get_camera_devices ();
+
+- for (i = 0; i < cameras.len; i++)
++ for (i = 0; i < cameras.length; i++)
+ {
+- next = (Cheese.CameraDevice )cameras.index (i);
++ next = cameras.get (i);
+
+ if (next == selected)
+ {
+@@ -1245,13 +1245,13 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ }
+ }
+
+- if (i + 1 < cameras.len)
++ if (i + 1 < cameras.length)
+ {
+- next = (Cheese.CameraDevice )cameras.index (i + 1);
++ next = cameras.get (i + 1);
+ }
+ else
+ {
+- next = (Cheese.CameraDevice )cameras.index (0);
++ next = cameras.get (0);
+ }
+
+ if (next == selected)
+@@ -1269,8 +1269,8 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ */
+ public void set_switch_camera_button_state ()
+ {
+- Cheese.CameraDevice selected;
+- GLib.PtrArray cameras;
++ unowned Cheese.CameraDevice selected;
++ GLib.GenericArray<unowned Cheese.CameraDevice> cameras;
+
+ if (camera == null)
+ {
+@@ -1288,7 +1288,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+
+ cameras = camera.get_camera_devices ();
+
+- if (cameras.len > 1)
++ if (cameras.length > 1)
+ {
+ switch_camera_button.set_visible (true);
+ return;
+diff --git a/src/vapi/cheese-common.vapi b/src/vapi/cheese-common.vapi
+index 6517cdfc..e4ae7ad3 100644
+--- a/src/vapi/cheese-common.vapi
++++ b/src/vapi/cheese-common.vapi
+@@ -35,7 +35,7 @@ namespace Cheese
+ [CCode (has_construct_function = false)]
+ public Camera (Clutter.Actor video_texture, string camera_device_node, int x_resolution, int y_resolution);
+ public bool get_balance_property_range (string property, double min, double max, double def);
+- public unowned GLib.PtrArray get_camera_devices ();
++ public GLib.GenericArray<unowned Cheese.CameraDevice> get_camera_devices ();
+ public unowned Cheese.VideoFormat get_current_video_format ();
+ public int get_num_camera_devices ();
+ public unowned Cheese.CameraDevice get_selected_device ();
+--
+GitLab
+
diff --git a/gnu/packages/patches/classpath-miscompilation.patch b/gnu/packages/patches/classpath-miscompilation.patch
new file mode 100644
index 0000000000..c3a569ea4f
--- /dev/null
+++ b/gnu/packages/patches/classpath-miscompilation.patch
@@ -0,0 +1,71 @@
+For some reason, the original code gets miscompiled on x86_64, leading
+'Java_java_io_VMFile_isFile' to return true when the return value of
+'cpio_checkType' is ENOENT (= 2).
+
+See <https://issues.guix.gnu.org/issue/36685>
+and <https://issues.guix.gnu.org/49990>.
+
+diff --git a/native/jni/java-io/java_io_VMFile.c b/native/jni/java-io/java_io_VMFile.c
+index de1320b..6695e1f 100644
+--- a/native/jni/java-io/java_io_VMFile.c
++++ b/native/jni/java-io/java_io_VMFile.c
+@@ -240,6 +240,7 @@ Java_java_io_VMFile_exists (JNIEnv * env,
+ #ifndef WITHOUT_FILESYSTEM
+ const char *filename;
+ int result;
++ jboolean exists;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+@@ -250,9 +251,10 @@ Java_java_io_VMFile_exists (JNIEnv * env,
+ }
+
+ result = cpio_isFileExists (filename);
++ exists = (result == CPNATIVE_OK ? 1 : 0);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+- return result == CPNATIVE_OK ? 1 : 0;
++ return exists;
+ #else /* not WITHOUT_FILESYSTEM */
+ return 0;
+ #endif /* not WITHOUT_FILESYSTEM */
+@@ -278,6 +280,7 @@ Java_java_io_VMFile_isFile (JNIEnv * env,
+ const char *filename;
+ int result;
+ jint entryType;
++ jboolean isfile;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+@@ -288,9 +291,10 @@ Java_java_io_VMFile_isFile (JNIEnv * env,
+ }
+
+ result = cpio_checkType (filename, &entryType);
++ isfile = (result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+- return result == CPNATIVE_OK && entryType == CPFILE_FILE ? 1 : 0;
++ return isfile;
+ #else /* not WITHOUT_FILESYSTEM */
+ return 0;
+ #endif /* not WITHOUT_FILESYSTEM */
+@@ -315,6 +319,7 @@ Java_java_io_VMFile_isDirectory (JNIEnv * env,
+ const char *filename;
+ int result;
+ jint entryType;
++ jboolean isdirectory;
+
+ /* Don't use the JCL convert function because it throws an exception
+ on failure */
+@@ -325,9 +330,10 @@ Java_java_io_VMFile_isDirectory (JNIEnv * env,
+ }
+
+ result = cpio_checkType (filename, &entryType);
++ isdirectory = (result == CPNATIVE_OK && entryType == CPFILE_DIRECTORY ? 1 : 0);
+ (*env)->ReleaseStringUTFChars (env, name, filename);
+
+- return result == CPNATIVE_OK && entryType == CPFILE_DIRECTORY ? 1 : 0;
++ return isdirectory;
+ #else /* not WITHOUT_FILESYSTEM */
+ return 0;
+ #endif /* not WITHOUT_FILESYSTEM */
diff --git a/gnu/packages/patches/cling-use-shared-library.patch b/gnu/packages/patches/cling-use-shared-library.patch
new file mode 100644
index 0000000000..6385b307b3
--- /dev/null
+++ b/gnu/packages/patches/cling-use-shared-library.patch
@@ -0,0 +1,329 @@
+From 811f0a575231496318b5e9c9a0ff0ed195b16dc0 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Tue, 7 Sep 2021 16:35:07 -0400
+Subject: [PATCH] build: Allow building Cling using the Clang shared library.
+
+The officially supported way to build LLVM/Clang as a shared library
+is via the LLVM_BUILD_LLVM_DYLIB and LLVM_LINK_LLVM_DYLIB CMake
+options (see: https://llvm.org/docs/BuildingADistribution.html). When
+built this way, the whole of Clang API is exposed as a shared
+library (libclang-cpp.so).
+
+* CMakeLists.txt: Query if we're in shared mode via llvm-config, and
+register the result as LLVM_LIB_IS_SHARED.
+[LLVM_LIB_IS_SHARED] <target_link_libraries>: Use the PUBLIC interface of the
+LLVM shared library.
+* lib/Interpreter/CMakeLists.txt [LLVM_LIB_IS_SHARED]: When defined, replace the
+individual Clang components by clang-cpp.
+* lib/MetaProcessor/CMakeLists.txt: Likewise.
+* lib/Utils/CMakeLists.txt: Likewise.
+* tools/Jupyter/CMakeLists.txt: Likewise.
+* tools/driver/CMakeLists.txt: Likewise.
+* tools/libcling/CMakeLists.txt: Likewise.
+---
+ CMakeLists.txt | 10 ++++++--
+ lib/Interpreter/CMakeLists.txt | 40 ++++++++++++++++++--------------
+ lib/MetaProcessor/CMakeLists.txt | 16 +++++++++----
+ lib/Utils/CMakeLists.txt | 34 +++++++++++++++------------
+ tools/Jupyter/CMakeLists.txt | 11 ++++++++-
+ tools/driver/CMakeLists.txt | 16 +++----------
+ tools/libcling/CMakeLists.txt | 38 +++++++++++++++---------------
+ 7 files changed, 93 insertions(+), 72 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 65b14b27..888f7ee9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,6 +23,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ "--libdir"
+ "--includedir"
+ "--prefix"
++ "--shared-mode"
+ "--src-root")
+ execute_process(
+ COMMAND ${CONFIG_COMMAND}
+@@ -47,7 +48,8 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
+ list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
+ list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
+ list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
+- list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
++ list(GET CONFIG_OUTPUT 5 LLVM_LIB_IS_SHARED)
++ list(GET CONFIG_OUTPUT 6 MAIN_SRC_DIR)
+
+ if(NOT MSVC_IDE)
+ set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
+@@ -427,7 +429,11 @@ macro(add_cling_library name)
+ endif()
+
+ if(TARGET ${name})
+- target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
++ if(LLVM_LIB_IS_SHARED)
++ target_link_libraries(${name} PUBLIC LLVM)
++ else()
++ target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
++ endif()
+
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libcling")
+ install(TARGETS ${name}
+diff --git a/lib/Interpreter/CMakeLists.txt b/lib/Interpreter/CMakeLists.txt
+index 921c773c..af65c020 100644
+--- a/lib/Interpreter/CMakeLists.txt
++++ b/lib/Interpreter/CMakeLists.txt
+@@ -6,22 +6,28 @@
+ # LICENSE.TXT for details.
+ #------------------------------------------------------------------------------
+
+-set(LIBS
+- clingUtils
+- clangCodeGen
+- clangDriver
+- clangFrontend
+- clangParse
+- clangSema
+- clangAnalysis
+- clangEdit
+- clangRewrite
+- clangRewriteFrontend
+- clangSerialization
+- clangAST
+- clangBasic
+- clangLex
+-)
++if (LLVM_LIB_IS_SHARED)
++ set(LIBS
++ clang-cpp
++ clingUtils)
++else()
++ set(LIBS
++ clingUtils
++ clangCodeGen
++ clangDriver
++ clangFrontend
++ clangParse
++ clangSema
++ clangAnalysis
++ clangEdit
++ clangRewrite
++ clangRewriteFrontend
++ clangSerialization
++ clangAST
++ clangBasic
++ clangLex
++ )
++endif()
+
+ set(LLVM_LINK_COMPONENTS
+ analysis
+@@ -369,4 +375,4 @@ if ((NOT builtin_llvm) AND builtin_clang)
+ get_property(P SOURCE TransactionUnloader.cpp PROPERTY INCLUDE_DIRECTORIES)
+ list(INSERT P 0 ${FixInclude})
+ set_property(SOURCE TransactionUnloader.cpp PROPERTY INCLUDE_DIRECTORIES "${P}")
+-endif()
+\ No newline at end of file
++endif()
+diff --git a/lib/MetaProcessor/CMakeLists.txt b/lib/MetaProcessor/CMakeLists.txt
+index e753dca3..5f4641bb 100644
+--- a/lib/MetaProcessor/CMakeLists.txt
++++ b/lib/MetaProcessor/CMakeLists.txt
+@@ -10,7 +10,16 @@ set( LLVM_LINK_COMPONENTS
+ core
+ support
+ binaryformat
+-)
++ )
++
++if (LLVM_LIB_IS_SHARED)
++ set(LIBS clang-cpp)
++else()
++ set(LIBS
++ clangLex
++ clangAST
++ clangBasic)
++endif()
+
+ add_cling_library(clingMetaProcessor OBJECT
+ Display.cpp
+@@ -21,10 +30,7 @@ add_cling_library(clingMetaProcessor OBJECT
+ MetaSema.cpp
+
+ LINK_LIBS
+- clangLex
+- clangAST
+- clangBasic
+-
++ ${LIBS}
+ clingInterpreter
+ clingUtils
+ )
+diff --git a/lib/Utils/CMakeLists.txt b/lib/Utils/CMakeLists.txt
+index 327c9fff..fbe4bd87 100644
+--- a/lib/Utils/CMakeLists.txt
++++ b/lib/Utils/CMakeLists.txt
+@@ -26,21 +26,25 @@ set(LLVM_LINK_COMPONENTS
+ ${LLVM_TARGETS_TO_BUILD}
+ )
+
+-set(LIBS
+- clangCodeGen
+- clangDriver
+- clangFrontend
+- clangParse
+- clangSema
+- clangAnalysis
+- clangEdit
+- clangRewrite
+- clangRewriteFrontend
+- clangSerialization
+- clangAST
+- clangBasic
+- clangLex
+-)
++if (LLVM_LIB_IS_SHARED)
++ set(LIBS clang-cpp)
++else()
++ set(LIBS
++ clangCodeGen
++ clangDriver
++ clangFrontend
++ clangParse
++ clangSema
++ clangAnalysis
++ clangEdit
++ clangRewrite
++ clangRewriteFrontend
++ clangSerialization
++ clangAST
++ clangBasic
++ clangLex
++ )
++endif()
+
+ find_library(DL_LIBRARY_PATH dl)
+ if (DL_LIBRARY_PATH)
+diff --git a/tools/Jupyter/CMakeLists.txt b/tools/Jupyter/CMakeLists.txt
+index aad5f3f7..8b4ac36f 100644
+--- a/tools/Jupyter/CMakeLists.txt
++++ b/tools/Jupyter/CMakeLists.txt
+@@ -39,6 +39,14 @@ else()
+ endif()
+ endif()
+
++if (LLVM_LIB_IS_SHARED)
++ set(LIBS
++ clang-cpp
++ clingUserInterface
++ clingMetaProcessor
++ ${INTERPRETER}
++ clingUtils)
++else()
+ set(LIBS
+ clangAST
+ clangBasic
+@@ -54,7 +62,8 @@ set(LIBS
+ clingMetaProcessor
+ ${INTERPRETER}
+ clingUtils
+- )
++ )
++endif()
+
+ if( LLVM_ENABLE_PIC )
+ set(ENABLE_SHARED SHARED)
+diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
+index 1968b97f..5ed53fb7 100644
+--- a/tools/driver/CMakeLists.txt
++++ b/tools/driver/CMakeLists.txt
+@@ -9,23 +9,13 @@
+ # Keep symbols for JIT resolution
+ set(LLVM_NO_DEAD_STRIP 1)
+
+-if(BUILD_SHARED_LIBS)
+- set(LIBS
+- LLVMSupport
+-
+- clangFrontendTool
+-
+- clingInterpreter
+- clingMetaProcessor
+- clingUserInterface
+- clingUtils
+- )
++if(LLVM_LIB_IS_SHARED)
++ set(LIBS clang-cpp clingUserInterface)
+ add_cling_executable(cling
+ cling.cpp
+ )
+ else()
+ set(LIBS
+- LLVMSupport
+
+ clangASTMatchers
+ clangFrontendTool
+@@ -38,7 +28,7 @@ else()
+ $<TARGET_OBJECTS:obj.clingMetaProcessor>
+ $<TARGET_OBJECTS:obj.clingUtils>
+ )
+-endif(BUILD_SHARED_LIBS)
++endif(LLVM_LIB_IS_SHARED)
+
+ set_target_properties(cling
+ PROPERTIES ENABLE_EXPORTS 1)
+diff --git a/tools/libcling/CMakeLists.txt b/tools/libcling/CMakeLists.txt
+index 143d3bdb..ba000d44 100644
+--- a/tools/libcling/CMakeLists.txt
++++ b/tools/libcling/CMakeLists.txt
+@@ -10,21 +10,25 @@ set(SOURCES
+ ADDITIONAL_HEADERS
+ )
+
+-set(LIBS
+- clangAnalysis
+- clangDriver
+- clangFrontend
+- clangParse
+- clangSema
+- clangAST
+- clangLex
+- clangSerialization
+- clangCodeGen
+- clangBasic
+- clangEdit
+-
+- clingUtils
+-)
++if (LLVM_LIB_IS_SHARED)
++ set(LIBS clang-cpp)
++else()
++ set(LIBS
++ clangAnalysis
++ clangDriver
++ clangFrontend
++ clangParse
++ clangSema
++ clangAST
++ clangLex
++ clangSerialization
++ clangCodeGen
++ clangBasic
++ clangEdit
++
++ clingUtils
++ )
++endif()
+
+ set( LLVM_LINK_COMPONENTS
+ analysis
+@@ -63,10 +67,6 @@ option(LIBCLING_BUILD_STATIC
+ # set(LLVM_EXPORTED_SYMBOL_FILE)
+ #endif()
+
+-if( LLVM_ENABLE_PIC )
+- set(ENABLE_SHARED SHARED)
+-endif()
+-
+ if((NOT LLVM_ENABLE_PIC OR LIBCLING_BUILD_STATIC) AND NOT WIN32)
+ set(ENABLE_STATIC STATIC)
+ endif()
+--
+2.33.0
+
diff --git a/gnu/packages/patches/coreutils-gnulib-tests.patch b/gnu/packages/patches/coreutils-gnulib-tests.patch
new file mode 100644
index 0000000000..7142401202
--- /dev/null
+++ b/gnu/packages/patches/coreutils-gnulib-tests.patch
@@ -0,0 +1,45 @@
+Fix Gnulib test failures showing up on ARMv7:
+
+ https://issues.guix.gnu.org/49459
+
+This is a backport of this Gnulib commit:
+
+ commit 175e0bc72808d564074c4adcc72aeadb74adfcc6
+ Author: Paul Eggert <eggert@cs.ucla.edu>
+ Date: Thu Aug 27 17:52:58 2020 -0700
+
+ perror, strerror_r: remove unportable tests
+
+ Problem reported by Florian Weimer in:
+ https://lists.gnu.org/r/bug-gnulib/2020-08/msg00220.html
+ * tests/test-perror2.c (main):
+ * tests/test-strerror_r.c (main): Omit unportable tests.
+
+diff --git a/tests/test-perror2.c b/tests/test-perror2.c
+index 1d14eda7be..c6214dd25c 100644
+--- a/gnulib-tests/test-perror2.c
++++ b/gnulib-tests/test-perror2.c
+@@ -79,9 +79,6 @@ main (void)
+ errno = -5;
+ perror ("");
+ ASSERT (!ferror (stderr));
+- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
+- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
+- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
+ ASSERT (STREQ (msg4, str4));
+
+ free (str1);
+diff --git a/tests/test-strerror_r.c b/tests/test-strerror_r.c
+index b11d6fd9f6..c1dbcf837b 100644
+--- a/gnulib-tests/test-strerror_r.c
++++ b/gnulib-tests/test-strerror_r.c
+@@ -165,9 +165,6 @@ main (void)
+
+ strerror_r (EACCES, buf, sizeof buf);
+ strerror_r (-5, buf, sizeof buf);
+- ASSERT (msg1 == msg2 || msg1 == msg4 || STREQ (msg1, str1));
+- ASSERT (msg2 == msg4 || STREQ (msg2, str2));
+- ASSERT (msg3 == msg4 || STREQ (msg3, str3));
+ ASSERT (STREQ (msg4, str4));
+
+ free (str1);
diff --git a/gnu/packages/patches/cups-CVE-2020-10001.patch b/gnu/packages/patches/cups-CVE-2020-10001.patch
deleted file mode 100644
index 1b16c7d97c..0000000000
--- a/gnu/packages/patches/cups-CVE-2020-10001.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From efbea1742bd30f842fbbfb87a473e5c84f4162f9 Mon Sep 17 00:00:00 2001
-From: Michael R Sweet <msweet@msweet.org>
-Date: Mon, 1 Feb 2021 15:02:32 -0500
-Subject: [PATCH] Fix a buffer (read) overflow in ippReadIO (CVE-2020-10001)
-
----
-
-diff --git a/cups/ipp.c b/cups/ipp.c
-index 3d529346c..adbb26fba 100644
---- a/cups/ipp.c
-+++ b/cups/ipp.c
-@@ -2866,7 +2866,8 @@ ippReadIO(void *src, /* I - Data source */
- unsigned char *buffer, /* Data buffer */
- string[IPP_MAX_TEXT],
- /* Small string buffer */
-- *bufptr; /* Pointer into buffer */
-+ *bufptr, /* Pointer into buffer */
-+ *bufend; /* End of buffer */
- ipp_attribute_t *attr; /* Current attribute */
- ipp_tag_t tag; /* Current tag */
- ipp_tag_t value_tag; /* Current value tag */
-@@ -3441,6 +3442,7 @@ ippReadIO(void *src, /* I - Data source */
- }
-
- bufptr = buffer;
-+ bufend = buffer + n;
-
- /*
- * text-with-language and name-with-language are composite
-@@ -3454,7 +3456,7 @@ ippReadIO(void *src, /* I - Data source */
-
- n = (bufptr[0] << 8) | bufptr[1];
-
-- if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE) || n >= (int)sizeof(string))
-+ if ((bufptr + 2 + n + 2) > bufend || n >= (int)sizeof(string))
- {
- _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
- _("IPP language length overflows value."), 1);
-@@ -3481,7 +3483,7 @@ ippReadIO(void *src, /* I - Data source */
- bufptr += 2 + n;
- n = (bufptr[0] << 8) | bufptr[1];
-
-- if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE))
-+ if ((bufptr + 2 + n) > bufend)
- {
- _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
- _("IPP string length overflows value."), 1);
diff --git a/gnu/packages/patches/curl-7.76-use-ssl-cert-env.patch b/gnu/packages/patches/curl-7.76-use-ssl-cert-env.patch
deleted file mode 100644
index 24be6e31d9..0000000000
--- a/gnu/packages/patches/curl-7.76-use-ssl-cert-env.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-Make libcurl respect the SSL_CERT_{DIR,FILE} variables by default. The variables
-are fetched during initialization to preserve thread-safety (curl_global_init(3)
-must be called when no other threads exist).
-
-This fixes network functionality in rust:cargo, and probably removes the need
-for other future workarounds.
-===================================================================
---- curl-7.66.0.orig/lib/easy.c 2020-01-02 15:43:11.883921171 +0100
-+++ curl-7.66.0/lib/easy.c 2020-01-02 16:18:54.691882797 +0100
-@@ -134,6 +134,9 @@
- # pragma warning(default:4232) /* MSVC extension, dllimport identity */
- #endif
-
-+char * Curl_ssl_cert_dir = NULL;
-+char * Curl_ssl_cert_file = NULL;
-+
- /**
- * curl_global_init() globally initializes curl given a bitwise set of the
- * different features of what to initialize.
-@@ -155,6 +158,9 @@
- #endif
- }
-
-+ Curl_ssl_cert_dir = curl_getenv("SSL_CERT_DIR");
-+ Curl_ssl_cert_file = curl_getenv("SSL_CERT_FILE");
-+
- if(!Curl_ssl_init()) {
- DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n"));
- return CURLE_FAILED_INIT;
-@@ -260,6 +266,9 @@
- Curl_ssl_cleanup();
- Curl_resolver_global_cleanup();
-
-+ free(Curl_ssl_cert_dir);
-+ free(Curl_ssl_cert_file);
-+
- #ifdef WIN32
- Curl_win32_cleanup(init_flags);
- #endif
-diff -ur curl-7.66.0.orig/lib/url.c curl-7.66.0/lib/url.c
---- curl-7.66.0.orig/lib/url.c 2020-01-02 15:43:11.883921171 +0100
-+++ curl-7.66.0/lib/url.c 2020-01-02 16:21:11.563880346 +0100
-@@ -524,6 +524,21 @@
- if(result)
- return result;
- #endif
-+ extern char * Curl_ssl_cert_dir;
-+ extern char * Curl_ssl_cert_file;
-+ if(Curl_ssl_cert_dir) {
-+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], Curl_ssl_cert_dir))
-+ return result;
-+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], Curl_ssl_cert_dir))
-+ return result;
-+ }
-+
-+ if(Curl_ssl_cert_file) {
-+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], Curl_ssl_cert_file))
-+ return result;
-+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY], Curl_ssl_cert_file))
-+ return result;
-+ }
- }
-
- set->wildcard_enabled = FALSE;
diff --git a/gnu/packages/patches/curl-7.77-tls-priority-string.patch b/gnu/packages/patches/curl-7.77-tls-priority-string.patch
deleted file mode 100644
index bf1bfa8aaa..0000000000
--- a/gnu/packages/patches/curl-7.77-tls-priority-string.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-cURL 7.77.0 would use a bogus TLS priority string favoring older TLS
-protocol versions, which in turn would prevent access to bitbucket.org:
-
- https://issues.guix.gnu.org/49035
- https://github.com/curl/curl/pull/7278
-
-This patch fixes it.
-From <https://github.com/curl/curl/pull/7278/commits/b98f79f6ecdb708c67f9a0cec56ce48952a54556>.
-
-From b98f79f6ecdb708c67f9a0cec56ce48952a54556 Mon Sep 17 00:00:00 2001
-From: Daniel Stenberg <daniel@haxx.se>
-Date: Fri, 18 Jun 2021 14:54:07 +0200
-Subject: [PATCH] gnutls: set the prefer ciphers in correct order
-
-Reported-by: civodul on github
-Assisted-by: Nikos Mavrogiannopoulos
-Fixes #7277
----
- lib/vtls/gtls.c | 30 +++++++++++++-----------------
- 1 file changed, 13 insertions(+), 17 deletions(-)
-
-diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
-index d9bc5611e8f9..da2af64955c3 100644
---- a/lib/vtls/gtls.c
-+++ b/lib/vtls/gtls.c
-@@ -330,6 +330,9 @@ set_ssl_version_min_max(struct Curl_easy *data,
- ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_2;
- }
- }
-+ else if(ssl_version_max == CURL_SSLVERSION_MAX_DEFAULT) {
-+ ssl_version_max = CURL_SSLVERSION_MAX_TLSv1_3;
-+ }
-
- switch(ssl_version | ssl_version_max) {
- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_0:
-@@ -338,11 +341,11 @@ set_ssl_version_min_max(struct Curl_easy *data,
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_1:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-- "+VERS-TLS1.0:+VERS-TLS1.1";
-+ "+VERS-TLS1.1:+VERS-TLS1.0";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_2:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-- "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2";
-+ "+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_1:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-@@ -350,7 +353,7 @@ set_ssl_version_min_max(struct Curl_easy *data,
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_2:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-- "+VERS-TLS1.1:+VERS-TLS1.2";
-+ "+VERS-TLS1.2:+VERS-TLS1.1";
- return CURLE_OK;
- case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_2:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-@@ -360,25 +363,17 @@ set_ssl_version_min_max(struct Curl_easy *data,
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
- "+VERS-TLS1.3";
- return CURLE_OK;
-- case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_DEFAULT:
-- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-- "+VERS-TLS1.0:+VERS-TLS1.1:+VERS-TLS1.2"
-- ":+VERS-TLS1.3";
-+ case CURL_SSLVERSION_TLSv1_0 | CURL_SSLVERSION_MAX_TLSv1_3:
-+ *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0";
- return CURLE_OK;
-- case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_DEFAULT:
-+ case CURL_SSLVERSION_TLSv1_1 | CURL_SSLVERSION_MAX_TLSv1_3:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-- "+VERS-TLS1.1:+VERS-TLS1.2"
-- ":+VERS-TLS1.3";
-+ "+VERS-TLS1.3:+VERS-TLS1.2:+VERS-TLS1.1";
- return CURLE_OK;
-- case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT:
-+ case CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_3:
- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-- "+VERS-TLS1.2"
-- ":+VERS-TLS1.3";
-+ "+VERS-TLS1.3:+VERS-TLS1.2";
- return CURLE_OK;
-- case CURL_SSLVERSION_TLSv1_3 | CURL_SSLVERSION_MAX_DEFAULT:
-- *prioritylist = GNUTLS_CIPHERS ":-VERS-SSL3.0:-VERS-TLS-ALL:"
-- "+VERS-TLS1.2"
-- ":+VERS-TLS1.3";
- return CURLE_OK;
- }
-
-@@ -608,6 +603,7 @@ gtls_connect_step1(struct Curl_easy *data,
- }
- else {
- #endif
-+ infof(data, "GnuTLS ciphers: %s\n", prioritylist);
- rc = gnutls_priority_set_direct(session, prioritylist, &err);
- #ifdef HAVE_GNUTLS_SRP
- }
diff --git a/gnu/packages/patches/curl-use-ssl-cert-env.patch b/gnu/packages/patches/curl-use-ssl-cert-env.patch
index c8e80b4445..24be6e31d9 100644
--- a/gnu/packages/patches/curl-use-ssl-cert-env.patch
+++ b/gnu/packages/patches/curl-use-ssl-cert-env.patch
@@ -47,14 +47,14 @@ diff -ur curl-7.66.0.orig/lib/url.c curl-7.66.0/lib/url.c
+ extern char * Curl_ssl_cert_dir;
+ extern char * Curl_ssl_cert_file;
+ if(Curl_ssl_cert_dir) {
-+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_ORIG], Curl_ssl_cert_dir))
++ if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], Curl_ssl_cert_dir))
+ return result;
+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], Curl_ssl_cert_dir))
+ return result;
+ }
+
+ if(Curl_ssl_cert_file) {
-+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_ORIG], Curl_ssl_cert_file))
++ if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], Curl_ssl_cert_file))
+ return result;
+ if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY], Curl_ssl_cert_file))
+ return result;
diff --git a/gnu/packages/patches/dbus-CVE-2020-12049.patch b/gnu/packages/patches/dbus-CVE-2020-12049.patch
deleted file mode 100644
index 71280144a1..0000000000
--- a/gnu/packages/patches/dbus-CVE-2020-12049.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-Fix CVE-2020-12049:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-12049
-https://lists.freedesktop.org/archives/ftp-release/2020-June/000753.html
-
-Taken from upstream:
-
-https://gitlab.freedesktop.org/dbus/dbus/-/commit/272d484283883fa9ff95b69d924fff6cd34842f5
-
-diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
---- a/dbus/dbus-sysdeps-unix.c
-+++ b/dbus/dbus-sysdeps-unix.c
-@@ -435,18 +435,6 @@ _dbus_read_socket_with_unix_fds (DBusSocket fd,
- struct cmsghdr *cm;
- dbus_bool_t found = FALSE;
-
-- if (m.msg_flags & MSG_CTRUNC)
-- {
-- /* Hmm, apparently the control data was truncated. The bad
-- thing is that we might have completely lost a couple of fds
-- without chance to recover them. Hence let's treat this as a
-- serious error. */
--
-- errno = ENOSPC;
-- _dbus_string_set_length (buffer, start);
-- return -1;
-- }
--
- for (cm = CMSG_FIRSTHDR(&m); cm; cm = CMSG_NXTHDR(&m, cm))
- if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_RIGHTS)
- {
-@@ -501,6 +489,26 @@ _dbus_read_socket_with_unix_fds (DBusSocket fd,
- if (!found)
- *n_fds = 0;
-
-+ if (m.msg_flags & MSG_CTRUNC)
-+ {
-+ unsigned int i;
-+
-+ /* Hmm, apparently the control data was truncated. The bad
-+ thing is that we might have completely lost a couple of fds
-+ without chance to recover them. Hence let's treat this as a
-+ serious error. */
-+
-+ /* We still need to close whatever fds we *did* receive,
-+ * otherwise they'll never get closed. (CVE-2020-12049) */
-+ for (i = 0; i < *n_fds; i++)
-+ close (fds[i]);
-+
-+ *n_fds = 0;
-+ errno = ENOSPC;
-+ _dbus_string_set_length (buffer, start);
-+ return -1;
-+ }
-+
- /* put length back (doesn't actually realloc) */
- _dbus_string_set_length (buffer, start + bytes_read);
-
diff --git a/gnu/packages/patches/diffutils-fix-signal-processing.patch b/gnu/packages/patches/diffutils-fix-signal-processing.patch
new file mode 100644
index 0000000000..134dd3f718
--- /dev/null
+++ b/gnu/packages/patches/diffutils-fix-signal-processing.patch
@@ -0,0 +1,58 @@
+Author: Frédéric Bonnard <frediz@debian.org>
+
+Obtained from:
+
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=922552#19
+
+Fixes bug reported upstream at:
+
+https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34519
+
+diff --git a/src/diff.c b/src/diff.c
+index e2eb32437353..b574e8282dc9 100644
+--- a/src/diff.c
++++ b/src/diff.c
+@@ -1451,6 +1451,8 @@ compare_files (struct comparison const *parent,
+ }
+ }
+
++ final_process_signals ();
++
+ /* Now the comparison has been done, if no error prevented it,
+ and STATUS is the value this function will return. */
+
+diff --git a/src/diff.h b/src/diff.h
+index 03daaa4a0530..e177fe600a25 100644
+--- a/src/diff.h
++++ b/src/diff.h
+@@ -390,6 +390,7 @@ extern enum changes analyze_hunk (struct change *, lin *, lin *, lin *, lin *);
+ extern void begin_output (void);
+ extern void debug_script (struct change *);
+ extern void fatal (char const *) __attribute__((noreturn));
++extern void final_process_signals (void);
+ extern void finish_output (void);
+ extern void message (char const *, char const *, char const *);
+ extern void message5 (char const *, char const *, char const *,
+diff --git a/src/util.c b/src/util.c
+index 4f4d9bb285eb..56d292de2927 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -237,6 +237,18 @@ process_signals (void)
+ }
+ }
+
++/* Process remaining signals once before exit */
++void
++final_process_signals (void)
++{
++ static int last = 1;
++
++ if (last) {
++ process_signals ();
++ last = 0;
++ }
++}
++
+ static void
+ install_signal_handlers (void)
+ {
diff --git a/gnu/packages/patches/diffutils-gets-undeclared.patch b/gnu/packages/patches/diffutils-gets-undeclared.patch
deleted file mode 100644
index b6cdc77caa..0000000000
--- a/gnu/packages/patches/diffutils-gets-undeclared.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-This patch is needed to allow builds with newer versions of
-the GNU libc (2.16+).
-
-
-commit 66712c23388e93e5c518ebc8515140fa0c807348
-Author: Eric Blake <eblake@redhat.com>
-Date: Thu Mar 29 13:30:41 2012 -0600
-
- stdio: don't assume gets any more
-
- Gnulib intentionally does not have a gets module, and now that C11
- and glibc have dropped it, we should be more proactive about warning
- any user on a platform that still has a declaration of this dangerous
- interface.
-
- * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
- support.
- * modules/stdio (Makefile.am): Likewise.
- * lib/stdio-read.c (gets): Likewise.
- * tests/test-stdio-c++.cc: Likewise.
- * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
- * lib/stdio.in.h (gets): Make warning occur in more places.
- * doc/posix-functions/gets.texi (gets): Update documentation.
- Reported by Christer Solskogen.
-
- Signed-off-by: Eric Blake <eblake@redhat.com>
-
-diff --git a/lib/stdio.in.h b/lib/stdio.in.h
-index aa7b599..c377b6e 100644
---- a/lib/stdio.in.h
-+++ b/lib/stdio.in.h
-@@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
- # endif
- #endif
-
--#if @GNULIB_GETS@
--# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
--# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
--# undef gets
--# define gets rpl_gets
--# endif
--_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
--_GL_CXXALIAS_RPL (gets, char *, (char *s));
--# else
--_GL_CXXALIAS_SYS (gets, char *, (char *s));
--# undef gets
--# endif
--_GL_CXXALIASWARN (gets);
- /* It is very rare that the developer ever has full control of stdin,
-- so any use of gets warrants an unconditional warning. Assume it is
-- always declared, since it is required by C89. */
-+ so any use of gets warrants an unconditional warning; besides, C11
-+ removed it. */
-+#undef gets
-+#if HAVE_RAW_DECL_GETS
- _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
- #endif
-
-@@ -1053,9 +1042,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
- # endif
- #endif
-
--/* Some people would argue that sprintf should be handled like gets
-- (for example, OpenBSD issues a link warning for both functions),
-- since both can cause security holes due to buffer overruns.
-+/* Some people would argue that all sprintf uses should be warned about
-+ (for example, OpenBSD issues a link warning for it),
-+ since it can cause security holes due to buffer overruns.
- However, we believe that sprintf can be used safely, and is more
- efficient than snprintf in those safe cases; and as proof of our
- belief, we use sprintf in several gnulib modules. So this header
diff --git a/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch b/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch
index 4199dd18a5..fed4b76429 100644
--- a/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch
+++ b/gnu/packages/patches/docbook-xsl-nonrecursive-string-subst.patch
@@ -5,7 +5,7 @@ https://bugzilla.samba.org/show_bug.cgi?id=9515
https://bugzilla.gnome.org/show_bug.cgi?id=736077 (for xsltproc)
Patch copied from Debian:
-https://anonscm.debian.org/cgit/collab-maint/docbook-xsl.git/tree/debian/patches/765567_non-recursive_string_subst.patch
+https://salsa.debian.org/debian/docbook-xsl/-/blob/master/debian/patches/765567_non-recursive_string_subst.patch
Description: use EXSLT "replace" function when available
A recursive implementation of string.subst is problematic,
@@ -15,11 +15,12 @@ Bug-Debian: https://bugs.debian.org/750593
--- a/lib/lib.xsl
+++ b/lib/lib.xsl
-@@ -10,7 +10,10 @@
+@@ -6,7 +6,11 @@
+
This module implements DTD-independent functions
- ******************************************************************** -->
--<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+- ******************************************************************** --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
++ ******************************************************************** -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:str="http://exslt.org/strings"
+ exclude-result-prefixes="str"
@@ -27,7 +28,7 @@ Bug-Debian: https://bugs.debian.org/750593
<xsl:template name="dot.count">
<!-- Returns the number of "." characters in a string -->
-@@ -56,6 +59,9 @@
+@@ -52,6 +56,9 @@
<xsl:param name="replacement"/>
<xsl:choose>
diff --git a/gnu/packages/patches/docbook-xsl-support-old-url.patch b/gnu/packages/patches/docbook-xsl-support-old-url.patch
new file mode 100644
index 0000000000..5b7dda458f
--- /dev/null
+++ b/gnu/packages/patches/docbook-xsl-support-old-url.patch
@@ -0,0 +1,17 @@
+Docbook 1.79.2 makes very few changes apart from changing the canonical URL
+to cdn.docbook.org. This patch adds support for the previous URL to avoid
+breaking packages that still use that.
+
+Adapted from Debian:
+https://salsa.debian.org/debian/docbook-xsl/-/blob/master/debian/patches/0005-catalog.xml-Compatibility-with-1.79.1-or-earlier.patch
+
+--- a/catalog.xml
++++ b/catalog.xml
+@@ -5,4 +5,7 @@
+ <rewriteSystem systemIdStartString="http://cdn.docbook.org/release/xsl/current/" rewritePrefix="./"/>
+ <rewriteURI uriStartString="http://cdn.docbook.org/release/xsl/1.79.2/" rewritePrefix="./"/>
+ <rewriteSystem systemIdStartString="http://cdn.docbook.org/release/xsl/1.79.2/" rewritePrefix="./"/>
++ <!-- Also support old URI of v1.79.1 or earlier -->
++ <rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="./"/>
++ <rewriteSystem systemIdStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="./"/>
+ </catalog>
diff --git a/gnu/packages/patches/doxygen-1.8.17-runtests.patch b/gnu/packages/patches/doxygen-1.8.17-runtests.patch
deleted file mode 100644
index 0340c72448..0000000000
--- a/gnu/packages/patches/doxygen-1.8.17-runtests.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-1.8.17 was released with a broken test runner.
-
-https://github.com/doxygen/doxygen/issues/7464
-
-Taken from upstream:
-https://github.com/doxygen/doxygen/commit/cd9dee013dc749a10bbe019c350e0e62b6635795
-
-diff --git a/testing/runtests.py b/testing/runtests.py
-index a4118b865..10fe50214 100755
---- a/testing/runtests.py
-+++ b/testing/runtests.py
-@@ -3,6 +3,7 @@
- from __future__ import print_function
- import argparse, glob, itertools, re, shutil, os, sys
- import subprocess
-+import shlex
-
- config_reg = re.compile('.*\/\/\s*(?P<name>\S+):\s*(?P<value>.*)$')
-
-@@ -28,10 +29,10 @@ def xpopen(cmd, cmd1="",encoding='utf-8-sig', getStderr=False):
- return os.popen(cmd).read() # Python 2 without encoding
- else:
- if (getStderr):
-- proc = subprocess.run(cmd1,encoding=encoding,capture_output=True) # Python 3 with encoding
-- return proc.stderr
-+ proc = subprocess.Popen(shlex.split(cmd1),stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding=encoding) # Python 3 with encoding
-+ return proc.stderr.read()
- else:
-- proc = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding=encoding) # Python 3 with encoding
-+ proc = subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding=encoding) # Python 3 with encoding
- return proc.stdout.read()
-
- class Tester:
-@@ -137,7 +138,7 @@ def prepare_test(self):
- print('GENERATE_DOCBOOK=NO', file=f)
- if (self.args.xhtml):
- print('GENERATE_HTML=YES', file=f)
-- # HTML_OUTPUT can also be set locally
-+ # HTML_OUTPUT can also have been set locally
- print('HTML_OUTPUT=%s/html' % self.test_out, file=f)
- print('HTML_FILE_EXTENSION=.xhtml', file=f)
- if (self.args.pdf):
-@@ -184,7 +185,7 @@ def update_test(self,testmgr):
- print('Non-existing file %s after \'check:\' statement' % check_file)
- return
- # convert output to canonical form
-- data = xpopen('%s --format --noblanks --nowarning %s' % (self.args.xmllint,check_file)).read()
-+ data = xpopen('%s --format --noblanks --nowarning %s' % (self.args.xmllint,check_file))
- if data:
- # strip version
- data = re.sub(r'xsd" version="[0-9.-]+"','xsd" version=""',data).rstrip('\n')
-@@ -326,7 +327,7 @@ def perform_test(self,testmgr):
- tests.append(glob.glob('%s/*.xml' % (docbook_output)))
- tests.append(glob.glob('%s/*/*/*.xml' % (docbook_output)))
- tests = ' '.join(list(itertools.chain.from_iterable(tests))).replace(self.args.outputdir +'/','').replace('\\','/')
-- exe_string = '%s --nonet --postvalid %s' % (self.args.xmllint,tests)
-+ exe_string = '%s --noout --nonet --postvalid %s' % (self.args.xmllint,tests)
- exe_string1 = exe_string
- exe_string += ' %s' % (redirx)
- exe_string += ' %s more "%s/temp"' % (separ,docbook_output)
-@@ -346,7 +347,11 @@ def perform_test(self,testmgr):
- redirx=' 2> %s/temp >nul:'%html_output
- else:
- redirx='2>%s/temp >/dev/null'%html_output
-- exe_string = '%s --path dtd --nonet --postvalid %s/*xhtml' % (self.args.xmllint,html_output)
-+ check_file = []
-+ check_file.append(glob.glob('%s/*.xhtml' % (html_output)))
-+ check_file.append(glob.glob('%s/*/*/*.xhtml' % (html_output)))
-+ check_file = ' '.join(list(itertools.chain.from_iterable(check_file))).replace(self.args.outputdir +'/','').replace('\\','/')
-+ exe_string = '%s --noout --path dtd --nonet --postvalid %s' % (self.args.xmllint,check_file)
- exe_string1 = exe_string
- exe_string += ' %s' % (redirx)
- exe_string += ' %s more "%s/temp"' % (separ,html_output)
diff --git a/gnu/packages/patches/doxygen-test.patch b/gnu/packages/patches/doxygen-test.patch
deleted file mode 100644
index 1c0d4eb946..0000000000
--- a/gnu/packages/patches/doxygen-test.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-Modify the expected outcome of test 012 so that it passes when bibtex is
-not in the path, as we do not wish to add texlive as an input just for this
-test.
-
-diff -u -r doxygen-1.8.7.orig/testing/012/citelist.xml doxygen-1.8.7/testing/012/citelist.xml
---- doxygen-1.8.7.orig/testing/012/citelist.xml 2014-04-24 23:43:34.000000000 +0200
-+++ doxygen-1.8.7/testing/012/citelist.xml 2014-04-24 23:49:43.000000000 +0200
-@@ -6,38 +6,6 @@
- <briefdescription>
- </briefdescription>
- <detaileddescription>
-- <para>
-- <variablelist>
-- <varlistentry>
-- <term><anchor id="citelist_1CITEREF_Be09"/>[1]</term>
-- </varlistentry>
-- <listitem>
-- <para>P.<nonbreakablespace/>Belotti. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3_5">Disjunctive cuts for non-convex MINLP</ulink>. In <ulink url="#CITEREF_LeLe12">Lee and Leyffer</ulink> <ulink url="#CITEREF_LeLe12">[4]</ulink>, pages 117<ndash/>144.</para>
-- <para/>
-- </listitem>
-- <varlistentry>
-- <term><anchor id="citelist_1CITEREF_BertholdHeinzVigerske2009"/>[2]</term>
-- </varlistentry>
-- <listitem>
-- <para>T.<nonbreakablespace/>Berthold, S.<nonbreakablespace/>Heinz, and S.<nonbreakablespace/>Vigerske. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3_15">Extending a CIP framework to solve MIQCPs</ulink>. In <ulink url="#CITEREF_LeLe12">Lee and Leyffer</ulink> <ulink url="#CITEREF_LeLe12">[4]</ulink>, pages 427<ndash/>444.</para>
-- <para/>
-- </listitem>
-- <varlistentry>
-- <term><anchor id="citelist_1CITEREF_knuth79"/>[3]</term>
-- </varlistentry>
-- <listitem>
-- <para>Donald<nonbreakablespace/>E. Knuth. <emphasis>Tex and Metafont, New Directions in Typesetting</emphasis>. American Mathematical Society and Digital Press, Stanford, 1979.</para>
-- <para/>
-- </listitem>
-- <varlistentry>
-- <term><anchor id="citelist_1CITEREF_LeLe12"/>[4]</term>
-- </varlistentry>
-- <listitem>
-- <para>Jon Lee and Sven Leyffer, editors. <ulink url="http://doi.org/10.1007/978-1-4614-1927-3"><emphasis>Mixed Integer Nonlinear Programming</emphasis></ulink>, volume 154 of <emphasis>The IMA Volumes in Mathematics and its Applications</emphasis>. Springer, 2012.</para>
-- <para/>
-- </listitem>
-- </variablelist>
-- </para>
- </detaileddescription>
- </compounddef>
- </doxygen>
-diff -u -r doxygen-1.8.7.orig/testing/012/indexpage.xml doxygen-1.8.7/testing/012/indexpage.xml
---- doxygen-1.8.7.orig/testing/012/indexpage.xml 2014-04-24 23:43:34.000000000 +0200
-+++ doxygen-1.8.7/testing/012/indexpage.xml 2014-04-24 23:44:05.000000000 +0200
-@@ -6,8 +6,8 @@
- <briefdescription>
- </briefdescription>
- <detaileddescription>
-- <para>See <ref refid="citelist_1CITEREF_knuth79" kindref="member">[3]</ref> for more info.</para>
-- <para>Other references with cross references see <ref refid="citelist_1CITEREF_Be09" kindref="member">[1]</ref> and <ref refid="citelist_1CITEREF_BertholdHeinzVigerske2009" kindref="member">[2]</ref> for more info. </para>
-+ <para>See knuth79 for more info.</para>
-+ <para>Other references with cross references see Be09 and BertholdHeinzVigerske2009 for more info. </para>
- </detaileddescription>
- </compounddef>
- </doxygen>
diff --git a/gnu/packages/patches/elogind-revert-polkit-detection.patch b/gnu/packages/patches/elogind-revert-polkit-detection.patch
new file mode 100644
index 0000000000..43dd1684b6
--- /dev/null
+++ b/gnu/packages/patches/elogind-revert-polkit-detection.patch
@@ -0,0 +1,41 @@
+From 715ce0a6459e418f92e74c7ce52df3244c18f383 Mon Sep 17 00:00:00 2001
+From: Sven Eden <sven.eden@prydeworx.com>
+Date: Mon, 8 Mar 2021 08:40:08 +0100
+Subject: [PATCH] Revert "Disable polkit support if libpolkit is not installed"
+
+This reverts commit 1194dec4f8f2d1b8bd14e1625f34418ecfce817e.
+
+Removing polkit support with -Dpolkit=auto when libpolkit is not
+installed, removes the whole interface. This makes it impossible to
+add polkit support as a runtime dependency.
+
+Bug: #167
+Closes: #206
+Signed-off-by: Sven Eden <sven.eden@prydeworx.com>
+---
+ meson.build | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 2dd05db3c..f38551f55 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1157,15 +1157,6 @@ if want_polkit != 'false' and not skip_deps
+ message('Old polkit detected, will install pkla files')
+ install_polkit_pkla = true
+ endif
+-#if 1 /// Disable polkit completely if libpolkit is not there. See elogind issue #167
+- if not libpolkit.found()
+- if want_polkit != 'auto'
+- error('Polkit requested but libpolkit was not found.')
+- endif
+- install_polkit = false
+- want_polkit = false
+- endif
+-#endif // 1
+ endif
+ conf.set10('ENABLE_POLKIT', install_polkit)
+
+--
+2.33.1
+
diff --git a/gnu/packages/patches/evolution-CVE-2020-11879.patch b/gnu/packages/patches/evolution-CVE-2020-11879.patch
deleted file mode 100644
index 8c85895aab..0000000000
--- a/gnu/packages/patches/evolution-CVE-2020-11879.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-From 6489f20d6905cc797e2b2581c415e558c457caa7 Mon Sep 17 00:00:00 2001
-From: Milan Crha <mcrha@redhat.com>
-Date: Wed, 12 Feb 2020 18:59:52 +0100
-Subject: [PATCH] I#784 - Warn about and limit what can be attached using
- mailto: URI
-
-Closes https://gitlab.gnome.org/GNOME/evolution/issues/784
----
- src/composer/e-msg-composer.c | 58 +++++++++++++++++++++++++++++------
- src/e-util/e-system.error.xml | 7 ++++-
- 2 files changed, 54 insertions(+), 11 deletions(-)
-
-diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
-index e4c9ac095e..cd3168d882 100644
---- a/src/composer/e-msg-composer.c
-+++ b/src/composer/e-msg-composer.c
-@@ -4761,7 +4761,8 @@ handle_mailto (EMsgComposer *composer,
- gchar *header, *content, *buf;
- gsize nread, nwritten;
- const gchar *p;
-- gint len, clen;
-+ gint len, clen, has_attachments = 0;
-+ gboolean has_blacklisted_attachment = FALSE;
-
- table = e_msg_composer_get_header_table (composer);
- view = e_msg_composer_get_attachment_view (composer);
-@@ -4844,22 +4845,36 @@ handle_mailto (EMsgComposer *composer,
- } else if (!g_ascii_strcasecmp (header, "attach") ||
- !g_ascii_strcasecmp (header, "attachment")) {
- EAttachment *attachment;
-+ GFile *file;
-
- camel_url_decode (content);
-- if (file_is_blacklisted (content))
-- e_alert_submit (
-- E_ALERT_SINK (e_msg_composer_get_editor (composer)),
-- "mail:blacklisted-file",
-- content, NULL);
- if (g_ascii_strncasecmp (content, "file:", 5) == 0)
- attachment = e_attachment_new_for_uri (content);
- else
- attachment = e_attachment_new_for_path (content);
-- e_attachment_store_add_attachment (store, attachment);
-- e_attachment_load_async (
-- attachment, (GAsyncReadyCallback)
-- e_attachment_load_handle_error, composer);
-+ file = e_attachment_ref_file (attachment);
-+ if (!file || !g_file_peek_path (file) ||
-+ !g_file_test (g_file_peek_path (file), G_FILE_TEST_EXISTS) ||
-+ g_file_test (g_file_peek_path (file), G_FILE_TEST_IS_DIR)) {
-+ /* Do nothing, simply ignore the attachment request */
-+ } else {
-+ has_attachments++;
-+
-+ if (file_is_blacklisted (content)) {
-+ has_blacklisted_attachment = TRUE;
-+ e_alert_submit (
-+ E_ALERT_SINK (e_msg_composer_get_editor (composer)),
-+ "mail:blacklisted-file",
-+ content, NULL);
-+ }
-+
-+ e_attachment_store_add_attachment (store, attachment);
-+ e_attachment_load_async (
-+ attachment, (GAsyncReadyCallback)
-+ e_attachment_load_handle_error, composer);
-+ }
- g_object_unref (attachment);
-+ g_clear_object (&file);
- } else if (!g_ascii_strcasecmp (header, "from")) {
- /* Ignore */
- } else if (!g_ascii_strcasecmp (header, "reply-to")) {
-@@ -4883,6 +4898,29 @@ handle_mailto (EMsgComposer *composer,
-
- g_free (buf);
-
-+ if (has_attachments && !has_blacklisted_attachment) {
-+ const gchar *primary;
-+ gchar *secondary;
-+
-+ primary = g_dngettext (GETTEXT_PACKAGE,
-+ "Review attachment before sending.",
-+ "Review attachments before sending.",
-+ has_attachments);
-+
-+ secondary = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
-+ "There had been added %d attachment. Make sure it does not contain any sensitive information before sending the message.",
-+ "There had been added %d attachments. Make sure they do not contain any sensitive information before sending the message.",
-+ has_attachments),
-+ has_attachments);
-+
-+ e_alert_submit (
-+ E_ALERT_SINK (e_msg_composer_get_editor (composer)),
-+ "system:generic-warning",
-+ primary, secondary, NULL);
-+
-+ g_free (secondary);
-+ }
-+
- merge_always_cc_and_bcc (table, to, &cc, &bcc);
-
- tov = destination_list_to_vector (to);
-diff --git a/src/e-util/e-system.error.xml b/src/e-util/e-system.error.xml
-index ddcf989fda..02facb7d26 100644
---- a/src/e-util/e-system.error.xml
-+++ b/src/e-util/e-system.error.xml
-@@ -1,6 +1,11 @@
- <?xml version="1.0"?>
- <error-list domain="system">
-- <error type="error" id="generic-error">
-+ <error id="generic-error" type="error">
-+ <primary>{0}</primary>
-+ <secondary>{1}</secondary>
-+ </error>
-+
-+ <error id="generic-warning" type="warning">
- <primary>{0}</primary>
- <secondary>{1}</secondary>
- </error>
---
-GitLab
-
diff --git a/gnu/packages/patches/evolution-data-server-CVE-2020-14928.patch b/gnu/packages/patches/evolution-data-server-CVE-2020-14928.patch
deleted file mode 100644
index 421f292c9d..0000000000
--- a/gnu/packages/patches/evolution-data-server-CVE-2020-14928.patch
+++ /dev/null
@@ -1,115 +0,0 @@
-From ba82be72cfd427b5d72ff21f929b3a6d8529c4df Mon Sep 17 00:00:00 2001
-From: Milan Crha <mcrha@redhat.com>
-Date: Mon, 22 Jun 2020 13:40:17 +0200
-Subject: [PATCH] I#226 - CVE-2020-14928: Response Injection via STARTTLS in
- SMTP and POP3
-
-Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/226
----
- src/camel/camel-stream-buffer.c | 19 +++++++++++++++++++
- src/camel/camel-stream-buffer.h | 1 +
- src/camel/providers/pop3/camel-pop3-store.c | 2 ++
- src/camel/providers/pop3/camel-pop3-stream.c | 11 +++++++++++
- src/camel/providers/pop3/camel-pop3-stream.h | 1 +
- .../providers/smtp/camel-smtp-transport.c | 2 ++
- 6 files changed, 36 insertions(+)
-
-diff --git a/src/camel/camel-stream-buffer.c b/src/camel/camel-stream-buffer.c
-index 3e2e0dd36..a6f605ae5 100644
---- a/src/camel/camel-stream-buffer.c
-+++ b/src/camel/camel-stream-buffer.c
-@@ -518,3 +518,22 @@ camel_stream_buffer_read_line (CamelStreamBuffer *sbf,
-
- return g_strdup ((gchar *) sbf->priv->linebuf);
- }
-+
-+/**
-+ * camel_stream_buffer_discard_cache:
-+ * @sbf: a #CamelStreamBuffer
-+ *
-+ * Discards any cached data in the @sbf. The next read reads
-+ * from the stream.
-+ *
-+ * Since: 3.38
-+ **/
-+void
-+camel_stream_buffer_discard_cache (CamelStreamBuffer *sbf)
-+{
-+ g_return_if_fail (CAMEL_IS_STREAM_BUFFER (sbf));
-+
-+ sbf->priv->ptr = sbf->priv->buf;
-+ sbf->priv->end = sbf->priv->buf;
-+ sbf->priv->ptr[0] = '\0';
-+}
-diff --git a/src/camel/camel-stream-buffer.h b/src/camel/camel-stream-buffer.h
-index ef92cfd8e..094e9926b 100644
---- a/src/camel/camel-stream-buffer.h
-+++ b/src/camel/camel-stream-buffer.h
-@@ -93,6 +93,7 @@ gint camel_stream_buffer_gets (CamelStreamBuffer *sbf,
- gchar * camel_stream_buffer_read_line (CamelStreamBuffer *sbf,
- GCancellable *cancellable,
- GError **error);
-+void camel_stream_buffer_discard_cache (CamelStreamBuffer *sbf);
-
- G_END_DECLS
-
-diff --git a/src/camel/providers/pop3/camel-pop3-store.c b/src/camel/providers/pop3/camel-pop3-store.c
-index 81c370f0a..5c9eb1eaa 100644
---- a/src/camel/providers/pop3/camel-pop3-store.c
-+++ b/src/camel/providers/pop3/camel-pop3-store.c
-@@ -205,6 +205,8 @@ connect_to_server (CamelService *service,
-
- if (tls_stream != NULL) {
- camel_stream_set_base_stream (stream, tls_stream);
-+ /* Truncate any left cached input from the insecure part of the session */
-+ camel_pop3_stream_discard_cache (pop3_engine->stream);
- g_object_unref (tls_stream);
- } else {
- g_prefix_error (
-diff --git a/src/camel/providers/pop3/camel-pop3-stream.c b/src/camel/providers/pop3/camel-pop3-stream.c
-index 74bb11e61..c485b9bd6 100644
---- a/src/camel/providers/pop3/camel-pop3-stream.c
-+++ b/src/camel/providers/pop3/camel-pop3-stream.c
-@@ -457,3 +457,14 @@ camel_pop3_stream_getd (CamelPOP3Stream *is,
-
- return 1;
- }
-+
-+void
-+camel_pop3_stream_discard_cache (CamelPOP3Stream *is)
-+{
-+ if (is) {
-+ is->ptr = is->end = is->buf;
-+ is->lineptr = is->linebuf;
-+ is->lineend = is->linebuf + CAMEL_POP3_STREAM_LINE_SIZE;
-+ is->ptr[0] = '\n';
-+ }
-+}
-diff --git a/src/camel/providers/pop3/camel-pop3-stream.h b/src/camel/providers/pop3/camel-pop3-stream.h
-index bb6dbb903..128c8c45a 100644
---- a/src/camel/providers/pop3/camel-pop3-stream.h
-+++ b/src/camel/providers/pop3/camel-pop3-stream.h
-@@ -87,6 +87,7 @@ gint camel_pop3_stream_getd (CamelPOP3Stream *is,
- guint *len,
- GCancellable *cancellable,
- GError **error);
-+void camel_pop3_stream_discard_cache (CamelPOP3Stream *is);
-
- G_END_DECLS
-
-diff --git a/src/camel/providers/smtp/camel-smtp-transport.c b/src/camel/providers/smtp/camel-smtp-transport.c
-index 035baf367..1fc0f3206 100644
---- a/src/camel/providers/smtp/camel-smtp-transport.c
-+++ b/src/camel/providers/smtp/camel-smtp-transport.c
-@@ -323,6 +323,8 @@ connect_to_server (CamelService *service,
-
- if (tls_stream != NULL) {
- camel_stream_set_base_stream (stream, tls_stream);
-+ /* Truncate any left cached input from the insecure part of the session */
-+ camel_stream_buffer_discard_cache (transport->istream);
- g_object_unref (tls_stream);
- } else {
- g_prefix_error (
---
-GitLab
-
diff --git a/gnu/packages/patches/evolution-data-server-CVE-2020-16117.patch b/gnu/packages/patches/evolution-data-server-CVE-2020-16117.patch
deleted file mode 100644
index b2c0622a90..0000000000
--- a/gnu/packages/patches/evolution-data-server-CVE-2020-16117.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 2cc39592b532cf0dc994fd3694b8e6bf924c9ab5 Mon Sep 17 00:00:00 2001
-From: Milan Crha <mcrha@redhat.com>
-Date: Mon, 10 Feb 2020 10:00:32 +0100
-Subject: [PATCH] I#189 - Crash on malformed server response with minimal
- capabilities
-
-Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/189
----
- src/camel/providers/imapx/camel-imapx-server.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
-index 3c38fb1e9..3883321ec 100644
---- a/src/camel/providers/imapx/camel-imapx-server.c
-+++ b/src/camel/providers/imapx/camel-imapx-server.c
-@@ -3045,7 +3045,8 @@ connected:
-
- /* See if we got new capabilities
- * in the STARTTLS response. */
-- imapx_free_capability (is->priv->cinfo);
-+ if (is->priv->cinfo)
-+ imapx_free_capability (is->priv->cinfo);
- is->priv->cinfo = NULL;
- if (ic->status->condition == IMAPX_CAPABILITY) {
- is->priv->cinfo = ic->status->u.cinfo;
---
-GitLab
-
diff --git a/gnu/packages/patches/evolution-data-server-libical-compat.patch b/gnu/packages/patches/evolution-data-server-libical-compat.patch
deleted file mode 100644
index da4302d42e..0000000000
--- a/gnu/packages/patches/evolution-data-server-libical-compat.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Prevent test failure and possible data loss due to API change in libical 3.0.7.
-
-https://gitlab.gnome.org/GNOME/evolution-data-server/issues/185
-https://lists.infradead.org/pipermail/libical-devel/2020-January/000907.html
-
-Adapted from upstream:
-
-https://gitlab.gnome.org/GNOME/evolution-data-server/commit/77384ab552c19bf374dbeda53dc37f98d07bd4ec
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index e16b8b225..b3c881967 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -111,7 +111,7 @@ add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
-
- set(gcr_minimum_version 3.4)
- set(libgdata_minimum_version 0.15.1)
--set(libical_glib_minimum_version 3.0.5)
-+set(libical_glib_minimum_version 3.0.7)
- set(libsecret_minimum_version 0.5)
- set(libxml_minimum_version 2.0.0)
- set(sqlite_minimum_version 3.7.17)
-diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c
-index 7501f2a43..93f4806ba 100644
---- a/src/calendar/libedata-cal/e-cal-meta-backend.c
-+++ b/src/calendar/libedata-cal/e-cal-meta-backend.c
-@@ -4067,8 +4067,7 @@ e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
- gchar *base64;
-
- base64 = g_base64_encode ((const guchar *) content, len);
-- new_attach = i_cal_attach_new_from_data (base64, NULL, NULL);
-+ new_attach = i_cal_attach_new_from_data (base64, (GFunc) g_free, NULL);
- g_free (content);
-- g_free (base64);
-
- ecmb_remove_all_but_filename_parameter (prop);
diff --git a/gnu/packages/patches/evolution-data-server-locales.patch b/gnu/packages/patches/evolution-data-server-locales.patch
deleted file mode 100644
index 48baefb0d8..0000000000
--- a/gnu/packages/patches/evolution-data-server-locales.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-This patch fixes locale canonicalization when using newer versions of
-ICU. It comes from the upstream repo, and should appear starting in
-version 3.33.5.
-
-From fe4ac94ce3c14f200e049a5d102fc0e4b811c71e Mon Sep 17 00:00:00 2001
-From: Milan Crha <mcrha@redhat.com>
-Date: Tue, 16 Jul 2019 07:22:07 +0200
-Subject: [PATCH] I#137 - POSIX locale tests fail with ICU 64.x
-
-Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/137
----
- src/libedataserver/e-collator.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/libedataserver/e-collator.c b/src/libedataserver/e-collator.c
-index 718eac5da..ec2cf7951 100644
---- a/src/libedataserver/e-collator.c
-+++ b/src/libedataserver/e-collator.c
-@@ -132,6 +132,11 @@ canonicalize_locale (const gchar *posix_locale,
- gint len;
- const gchar *collation_type = NULL;
-
-+ if (posix_locale && (
-+ g_ascii_strcasecmp (posix_locale, "C") == 0 ||
-+ g_ascii_strcasecmp (posix_locale, "POSIX") == 0))
-+ posix_locale = "en_US_POSIX";
-+
- len = uloc_canonicalize (posix_locale, locale_buffer, LOCALE_BUFFER_LEN, &status);
-
- if (U_FAILURE (status)) {
---
-2.22.0
-
diff --git a/gnu/packages/patches/farstream-gupnp.patch b/gnu/packages/patches/farstream-gupnp.patch
new file mode 100644
index 0000000000..f46170ab26
--- /dev/null
+++ b/gnu/packages/patches/farstream-gupnp.patch
@@ -0,0 +1,140 @@
+From e70dcd0a9f89efbdaa011c20737ad550635ea580 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete@collabora.com>
+Date: Tue, 20 Oct 2020 19:51:22 -0400
+Subject: [PATCH] rawudp-upnp test: Also build against new GUPnP 1.2 library if
+ present
+
+Update the configure test to match
+---
+ configure.ac | 17 +++++++++++++++++
+ tests/check/Makefile.am | 7 +++----
+ tests/check/transmitter/rawudp-upnp.c | 16 ++++++++++++++--
+ tests/check/transmitter/rawudp.c | 4 ++--
+ 4 files changed, 36 insertions(+), 8 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 03afc96b..1efed132 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -370,8 +370,25 @@ fi
+
+ if test "x$HAVE_GUPNP" = "xyes"; then
+ AC_DEFINE(HAVE_GUPNP,,[Have the GUPnP IGD library])
++
++ PKG_CHECK_MODULES(GUPNP_CORE, [ gupnp-1.2 ],
++ [ HAVE_GUPNP_CORE_12=yes ],
++ [ HAVE_GUPNP_CORE_12=no
++ PKG_CHECK_MODULES(GUPNP_CORE, [ gupnp-1.0 ],
++ [ HAVE_GUPNP_CORE_10=yes ],
++ [ HAVE_GUPNP_CORE_10=no ])
++ ])
++
++ if test "x$HAVE_GUPNP_CORE_10" = "xyes"; then
++ AC_DEFINE(HAVE_GUPNP_CORE_10,,[Have the GUPnP 1.0 library])
++ fi
++
++ if test "x$HAVE_GUPNP_CORE_12" = "xyes"; then
++ AC_DEFINE(HAVE_GUPNP_CORE_12,,[Have the GUPnP 1.2 library])
++ fi
+ fi
+
++
+ dnl build static plugins or not
+ AC_MSG_CHECKING([whether to build static plugins or not])
+ AC_ARG_ENABLE(
+diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
+index d50fc264..d21687d7 100644
+--- a/tests/check/Makefile.am
++++ b/tests/check/Makefile.am
+@@ -76,9 +76,9 @@ base_fscodec_SOURCES = \
+
+
+ transmitter_rawudp_CFLAGS = $(AM_CFLAGS) \
+- $(GUPNP_CFLAGS) $(GIO_CFLAGS) $(NICE_CFLAGS)
++ $(GUPNP_CORE_CFLAGS) $(GIO_CFLAGS) $(NICE_CFLAGS)
+ transmitter_rawudp_LDADD = $(LDADD) \
+- $(GUPNP_LIBS) \
++ $(GUPNP_CORE_LIBS) \
+ $(GIO_LIBS) \
+ $(NICE_LIBS)
+ transmitter_rawudp_SOURCES = \
+@@ -113,9 +113,8 @@ transmitter_nice_SOURCES = \
+ transmitter_nice_LDADD = $(LDADD) $(GST_BASE_LIBS)
+
+
+-transmitter_shm_CFLAGS = $(AM_CFLAGS) $(GUPNP_CFLAGS) $(NICE_CFLAGS)
++transmitter_shm_CFLAGS = $(AM_CFLAGS) $(NICE_CFLAGS)
+ transmitter_shm_LDADD = $(LDADD) \
+- $(GUPNP_LIBS) \
+ $(NICE_LIBS)
+ transmitter_shm_SOURCES = \
+ check-threadsafe.h \
+diff --git a/tests/check/transmitter/rawudp-upnp.c b/tests/check/transmitter/rawudp-upnp.c
+index 4818cd28..9ccf85d8 100644
+--- a/tests/check/transmitter/rawudp-upnp.c
++++ b/tests/check/transmitter/rawudp-upnp.c
+@@ -37,7 +37,7 @@ get_vars (gboolean *out_got_address,
+ }
+
+
+-#ifdef HAVE_GUPNP
++#if defined(HAVE_GUPNP_CORE_10) || defined(HAVE_GUPNP_CORE_12)
+
+ #include <libgupnp/gupnp.h>
+
+@@ -126,8 +126,14 @@ start_upnp_server (void)
+ GUPnPDeviceInfo *subdev1;
+ GUPnPDeviceInfo *subdev2;
+ const gchar *upnp_xml_path;
++ GError *gerr = NULL;
+
+- context = gupnp_context_new (NULL, NULL, 0, NULL);
++#ifdef HAVE_GUPNP_CORE_12
++ context = gupnp_context_new (NULL, 0, &gerr);
++#else
++ context = gupnp_context_new (NULL, NULL, 0, &gerr);
++#endif
++ g_assert_no_error (gerr);
+ ts_fail_if (context == NULL, "Can't get gupnp context");
+
+ if (g_getenv ("UPNP_XML_PATH"))
+@@ -137,8 +143,14 @@ start_upnp_server (void)
+
+ gupnp_context_host_path (context, upnp_xml_path, "");
+
++#ifdef HAVE_GUPNP_CORE_12
++ dev = gupnp_root_device_new (context, "InternetGatewayDevice.xml",
++ upnp_xml_path, &gerr);
++ g_assert_no_error (gerr);
++#else
+ dev = gupnp_root_device_new (context, "InternetGatewayDevice.xml",
+ upnp_xml_path);
++#endif
+ ts_fail_if (dev == NULL, "could not get root dev");
+
+ subdev1 = gupnp_device_info_get_device (GUPNP_DEVICE_INFO (dev),
+diff --git a/tests/check/transmitter/rawudp.c b/tests/check/transmitter/rawudp.c
+index e1936ac0..d803f347 100644
+--- a/tests/check/transmitter/rawudp.c
++++ b/tests/check/transmitter/rawudp.c
+@@ -637,7 +637,7 @@ GST_START_TEST (test_rawudptransmitter_stop_stream)
+ }
+ GST_END_TEST;
+
+-#ifdef HAVE_GUPNP
++#if defined(HAVE_GUPNP_CORE_10) || defined (HAVE_GUPNP_CORE_12)
+
+ GST_START_TEST (test_rawudptransmitter_run_upnp_discovery)
+ {
+@@ -967,7 +967,7 @@ rawudptransmitter_suite (void)
+ tcase_add_test (tc_chain, test_rawudptransmitter_stop_stream);
+ suite_add_tcase (s, tc_chain);
+
+-#ifdef HAVE_GUPNP
++#if defined(HAVE_GUPNP_CORE_10) || defined (HAVE_GUPNP_CORE_12)
+ if (g_getenv ("UPNP")) {
+ gchar *multicast_addr;
+
+--
+GitLab
+
diff --git a/gnu/packages/patches/findutils-test-rwlock-threads.patch b/gnu/packages/patches/findutils-test-rwlock-threads.patch
deleted file mode 100644
index 3062577c21..0000000000
--- a/gnu/packages/patches/findutils-test-rwlock-threads.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-Skip "test-rwlock1" when multithreading is disabled, which is the case
-during bootstrapping on architectures not supported by GNU Mes.
-
-Taken from upstream gnulib:
-https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=fdff8bd09a7f053381f8bdb107ab5280b7c95959
-
-diff --git a/gnulib-tests/test-rwlock1.c b/gnulib-tests/test-rwlock1.c
---- a/gnulib-tests/test-rwlock1.c
-+++ b/gnulib-tests/test-rwlock1.c
-@@ -21,6 +21,8 @@
-
- #include <config.h>
-
-+#if USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS
-+
- #include "glthread/lock.h"
-
- #include <errno.h>
-@@ -151,3 +153,18 @@ main ()
- sleep (1);
- }
- }
-+
-+#else
-+
-+/* No multithreading available. */
-+
-+#include <stdio.h>
-+
-+int
-+main ()
-+{
-+ fputs ("Skipping test: multithreading not enabled\n", stderr);
-+ return 77;
-+}
-+
-+#endif
-
diff --git a/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch b/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch
new file mode 100644
index 0000000000..b6e942ee10
--- /dev/null
+++ b/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch
@@ -0,0 +1,15 @@
+Pretend that stat's mtime is broken, so that the fontconfig cache does not
+depend upon modification time to determine if a cache is stale.
+
+diff --git a/src/fcstat.c b/src/fcstat.c
+index 5a2bd7c..d603a96 100644
+--- a/src/fcstat.c
++++ b/src/fcstat.c
+@@ -431,6 +431,7 @@ FcIsFsMmapSafe (int fd)
+ FcBool
+ FcIsFsMtimeBroken (const FcChar8 *dir)
+ {
++ return FcTrue;
+ int fd = FcOpen ((const char *) dir, O_RDONLY);
+
+ if (fd != -1)
diff --git a/gnu/packages/patches/fontconfig-hurd-path-max.patch b/gnu/packages/patches/fontconfig-hurd-path-max.patch
deleted file mode 100644
index f804e6801f..0000000000
--- a/gnu/packages/patches/fontconfig-hurd-path-max.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Avoid usage of PATH_MAX.
-
-Taken from https://salsa.debian.org/freedesktop-team/fontconfig/-/blob/master/debian/patches/path_max.patch
-
-Index: fontconfig-2.13.1/src/fccfg.c
-===================================================================
---- fontconfig-2.13.1.orig/src/fccfg.c
-+++ fontconfig-2.13.1/src/fccfg.c
-@@ -2231,7 +2231,7 @@ FcConfigRealFilename (FcConfig *config,
-
- if (n)
- {
-- FcChar8 buf[PATH_MAX];
-+ FcChar8 buf[FC_PATH_MAX];
- ssize_t len;
-
- if (sysroot)
diff --git a/gnu/packages/patches/freecad-boost-serialization.patch b/gnu/packages/patches/freecad-boost-serialization.patch
new file mode 100644
index 0000000000..374eabc966
--- /dev/null
+++ b/gnu/packages/patches/freecad-boost-serialization.patch
@@ -0,0 +1,27 @@
+Taken from: https://github.com/archlinux/svntogit-community/blob/packages/freecad/trunk/freecad-boost.patch.
+
+Index: FreeCAD-0.19.2/CMakeLists.txt
+===================================================================
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -46,6 +46,7 @@ if(NOT FREECAD_LIBPACK_USE OR FREECAD_LI
+ SetupPCL()
+ SetupPybind11()
+ SetupBoost()
++ set(Boost_LIBRARIES_App ${Boost_LIBRARIES})
+ SetupXercesC()
+ find_package(ZLIB REQUIRED)
+ find_package(PyCXX REQUIRED)
+Index: FreeCAD-0.19.2/src/App/CMakeLists.txt
+===================================================================
+--- a/src/App/CMakeLists.txt
++++ b/src/App/CMakeLists.txt
+@@ -59,7 +59,7 @@ include_directories(
+
+ set(FreeCADApp_LIBS
+ FreeCADBase
+- ${Boost_LIBRARIES}
++ ${Boost_LIBRARIES_App}
+ )
+
+ if (BUILD_QT5)
diff --git a/gnu/packages/patches/freecad-vtk9.patch b/gnu/packages/patches/freecad-vtk9.patch
new file mode 100644
index 0000000000..74568f4318
--- /dev/null
+++ b/gnu/packages/patches/freecad-vtk9.patch
@@ -0,0 +1,827 @@
+From bb9bcbd51df7c3cb76c5823038e4ea0f7e25a9ff Mon Sep 17 00:00:00 2001
+From: wmayer <wmayer@users.sourceforge.net>
+Date: Mon, 12 Oct 2020 17:56:03 +0200
+Subject: [PATCH] Make smesh compile with vtk9
+
+---
+ .../salomesmesh/inc/SMDS_MeshElement.hxx | 9 +++-
+ .../salomesmesh/inc/SMDS_UnstructuredGrid.hxx | 4 ++
+ .../salomesmesh/src/SMDS/SMDS_BallElement.cpp | 9 +++-
+ .../salomesmesh/src/SMDS/SMDS_Downward.cpp | 44 +++++++++----------
+ .../salomesmesh/src/SMDS/SMDS_Mesh.cpp | 6 ++-
+ .../src/SMDS/SMDS_Mesh0DElement.cpp | 12 +++++
+ .../salomesmesh/src/SMDS/SMDS_MeshNode.cpp | 10 ++---
+ .../src/SMDS/SMDS_UnstructuredGrid.cpp | 35 +++++++++++++--
+ .../src/SMDS/SMDS_VtkCellIterator.cpp | 7 +--
+ .../salomesmesh/src/SMDS/SMDS_VtkEdge.cpp | 19 +++++++-
+ .../salomesmesh/src/SMDS/SMDS_VtkFace.cpp | 29 ++++++++++--
+ .../salomesmesh/src/SMDS/SMDS_VtkVolume.cpp | 38 +++++++++++-----
+ .../src/SMESH/SMESH_MeshEditor.cpp | 8 ++--
+ src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp | 7 ++-
+ 14 files changed, 179 insertions(+), 58 deletions(-)
+
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_MeshElement.hxx
+@@ -40,11 +40,16 @@
+
+ #include <vtkType.h>
+ #include <vtkCellType.h>
++#include <vtkCellArray.h>
+
+ //typedef unsigned short UShortType;
+ typedef short ShortType;
+ typedef int LongType;
+-
++#ifdef VTK_CELL_ARRAY_V2
++typedef const vtkIdType* vtkIdTypePtr;
++#else
++typedef vtkIdType* vtkIdTypePtr;
++#endif
+ class SMDS_MeshNode;
+ class SMDS_MeshEdge;
+ class SMDS_MeshFace;
+@@ -192,7 +197,7 @@ protected:
+ //! Element index in vector SMDS_Mesh::myNodes or SMDS_Mesh::myCells
+ int myID;
+ //! index in vtkUnstructuredGrid
+- int myVtkID;
++ vtkIdType myVtkID;
+ //! SMDS_Mesh identification in SMESH
+ ShortType myMeshId;
+ //! SubShape and SubMesh identification in SMESHDS
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/inc/SMDS_UnstructuredGrid.hxx
+@@ -95,7 +95,11 @@ public:
+ std::map<int, std::map<long,int> >& nodeQuadDomains);
+ vtkCellLinks* GetLinks()
+ {
++#ifdef VTK_CELL_ARRAY_V2
++ return static_cast<vtkCellLinks*>(GetCellLinks());
++#else
+ return Links;
++#endif
+ }
+ SMDS_Downward* getDownArray(unsigned char vtkType)
+ {
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_BallElement.cpp
+@@ -67,10 +67,16 @@ void SMDS_BallElement::SetDiameter(doubl
+ bool SMDS_BallElement::ChangeNode (const SMDS_MeshNode * node)
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
++#ifdef VTK_CELL_ARRAY_V2
++ vtkNew<vtkIdList> cellPoints;
++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
++ cellPoints->SetId(0, node->getVtkId());
++#else
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+ pts[0] = node->getVtkId();
++#endif
+ SMDS_Mesh::_meshList[myMeshId]->setMyModified();
+ return true;
+ }
+@@ -83,7 +89,8 @@ void SMDS_BallElement::Print (std::ostre
+ const SMDS_MeshNode* SMDS_BallElement::GetNode (const int ind) const
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+- vtkIdType npts, *pts;
++ vtkIdType npts;
++ vtkIdTypePtr pts;
+ grid->GetCellPoints( myVtkID, npts, pts );
+ return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ 0 ]);
+ }
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Downward.cpp
+@@ -303,7 +303,7 @@ int SMDS_Down1D::getNodeSet(int cellId,
+ void SMDS_Down1D::setNodes(int cellId, int vtkId)
+ {
+ vtkIdType npts = 0;
+- vtkIdType *pts; // will refer to the point id's of the face
++ vtkIdTypePtr pts; // will refer to the point id's of the face
+ _grid->GetCellPoints(vtkId, npts, pts);
+ // MESSAGE(vtkId << " " << npts << " " << _nbDownCells);
+ //ASSERT(npts == _nbDownCells);
+@@ -357,7 +357,7 @@ int SMDS_Down1D::computeVtkCells(int *pt
+ {
+ vtkIdType point = pts[i];
+ int numCells = _grid->GetLinks()->GetNcells(point);
+- vtkIdType *cells = _grid->GetLinks()->GetCells(point);
++ vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point);
+ for (int j = 0; j < numCells; j++)
+ {
+ int vtkCellId = cells[j];
+@@ -532,7 +532,7 @@ int SMDS_Down2D::computeVolumeIds(int ce
+ // --- find point id's of the face
+
+ vtkIdType npts = 0;
+- vtkIdType *pts; // will refer to the point id's of the face
++ vtkIdTypePtr pts; // will refer to the point id's of the face
+ _grid->GetCellPoints(cellId, npts, pts);
+ vector<int> nodes;
+ for (int i = 0; i < npts; i++)
+@@ -577,7 +577,7 @@ int SMDS_Down2D::computeVolumeIdsFromNod
+ vtkIdType point = pts[i];
+ int numCells = _grid->GetLinks()->GetNcells(point);
+ //MESSAGE("cells pour " << i << " " << numCells);
+- vtkIdType *cells = _grid->GetLinks()->GetCells(point);
++ vtkIdTypePtr cells = _grid->GetLinks()->GetCells(point);
+ for (int j = 0; j < numCells; j++)
+ {
+ int vtkCellId = cells[j];
+@@ -627,7 +627,7 @@ int SMDS_Down2D::computeVolumeIdsFromNod
+ void SMDS_Down2D::setTempNodes(int cellId, int vtkId)
+ {
+ vtkIdType npts = 0;
+- vtkIdType *pts; // will refer to the point id's of the face
++ vtkIdTypePtr pts; // will refer to the point id's of the face
+ _grid->GetCellPoints(vtkId, npts, pts);
+ // MESSAGE(vtkId << " " << npts << " " << _nbNodes);
+ //ASSERT(npts == _nbNodes);
+@@ -795,7 +795,7 @@ void SMDS_Down3D::getNodeIds(int cellId,
+ {
+ int vtkId = this->_vtkCellIds[cellId];
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(vtkId, npts, nodes);
+ for (int i = 0; i < npts; i++)
+ nodeSet.insert(nodes[i]);
+@@ -1126,7 +1126,7 @@ void SMDS_DownTetra::getOrderedNodesOfFa
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -1178,7 +1178,7 @@ void SMDS_DownTetra::computeFacesWithNod
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+@@ -1234,7 +1234,7 @@ void SMDS_DownQuadTetra::getOrderedNodes
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -1288,7 +1288,7 @@ void SMDS_DownQuadTetra::computeFacesWit
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+@@ -1357,7 +1357,7 @@ void SMDS_DownPyramid::getOrderedNodesOf
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -1435,7 +1435,7 @@ void SMDS_DownPyramid::computeFacesWithN
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+@@ -1500,7 +1500,7 @@ void SMDS_DownQuadPyramid::getOrderedNod
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -1580,7 +1580,7 @@ void SMDS_DownQuadPyramid::computeFacesW
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+@@ -1660,7 +1660,7 @@ void SMDS_DownPenta::getOrderedNodesOfFa
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -1744,7 +1744,7 @@ void SMDS_DownPenta::computeFacesWithNod
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+@@ -1810,7 +1810,7 @@ void SMDS_DownQuadPenta::getOrderedNodes
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -1896,7 +1896,7 @@ void SMDS_DownQuadPenta::computeFacesWit
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+@@ -1981,7 +1981,7 @@ void SMDS_DownHexa::getOrderedNodesOfFac
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -2036,7 +2036,7 @@ void SMDS_DownHexa::computeFacesWithNode
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+@@ -2112,7 +2112,7 @@ void SMDS_DownQuadHexa::getOrderedNodesO
+ //MESSAGE("cellId = " << cellId);
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
+
+ set<int> tofind;
+@@ -2167,7 +2167,7 @@ void SMDS_DownQuadHexa::computeFacesWith
+ // --- find point id's of the volume
+
+ vtkIdType npts = 0;
+- vtkIdType *nodes; // will refer to the point id's of the volume
++ vtkIdTypePtr nodes; // will refer to the point id's of the volume
+ _grid->GetCellPoints(cellId, npts, nodes);
+
+ // --- create all the ordered list of node id's for each face
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh.cpp
+@@ -4768,7 +4768,11 @@ void SMDS_Mesh::dumpGrid(string ficdump)
+ ficcon << endl;
+ }
+ ficcon << "-------------------------------- connectivity " << nbPoints << endl;
+- vtkCellLinks *links = myGrid->GetCellLinks();
++#ifdef VTK_CELL_ARRAY_V2
++ vtkCellLinks *links = static_cast<vtkCellLinks*>(myGrid->GetCellLinks());
++#else
++ vtkCellLinks *links = myGrid->GetCellLinks();
++#endif
+ for (int i=0; i<nbPoints; i++)
+ {
+ int ncells = links->GetNcells(i);
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_Mesh0DElement.cpp
+@@ -146,6 +146,17 @@ bool SMDS_Mesh0DElement::ChangeNodes(con
+ if ( nbNodes == 1 )
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
++#ifdef VTK_CELL_ARRAY_V2
++ vtkNew<vtkIdList> cellPoints;
++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
++ if (nbNodes != cellPoints->GetNumberOfIds())
++ {
++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
++ return false;
++ }
++ myNode = nodes[0];
++ cellPoints->SetId(0, myNode->getVtkId());
++#else
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+@@ -156,6 +167,7 @@ bool SMDS_Mesh0DElement::ChangeNodes(con
+ }
+ myNode = nodes[0];
+ pts[0] = myNode->getVtkId();
++#endif
+
+ SMDS_Mesh::_meshList[myMeshId]->setMyModified();
+ return true;
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_MeshNode.cpp
+@@ -191,7 +191,7 @@ public:
+ SMDS_ElemIteratorPtr SMDS_MeshNode::
+ GetInverseElementIterator(SMDSAbs_ElementType type) const
+ {
+- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
++ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
+ //MESSAGE("myID " << myID << " ncells " << l.ncells);
+ return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
+ }
+@@ -251,7 +251,7 @@ elementsIterator(SMDSAbs_ElementType typ
+ return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
+ else
+ {
+- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
++ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
+ return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
+ }
+ }
+@@ -350,7 +350,7 @@ void SMDS_MeshNode::AddInverseElement(co
+ const SMDS_MeshCell *cell = dynamic_cast<const SMDS_MeshCell*> (ME);
+ assert(cell);
+ SMDS_UnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+- vtkCellLinks *Links = grid->GetCellLinks();
++ vtkCellLinks *Links = static_cast<vtkCellLinks*>(grid->GetCellLinks());
+ Links->ResizeCellList(myVtkID, 1);
+ Links->AddCellReference(cell->getVtkId(), myVtkID);
+ }
+@@ -366,7 +366,7 @@ void SMDS_MeshNode::ClearInverseElements
+
+ bool SMDS_MeshNode::emptyInverseElements()
+ {
+- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
++ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
+ return (l.ncells == 0);
+ }
+
+@@ -378,7 +378,7 @@ bool SMDS_MeshNode::emptyInverseElements
+
+ int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
+ {
+- vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
++ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks())->GetLink(myVtkID);
+
+ if ( type == SMDSAbs_All )
+ return l.ncells;
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+@@ -139,8 +139,8 @@ int SMDS_UnstructuredGrid::InsertNextLin
+ for (; it != setOfNodes.end(); ++it)
+ {
+ //MESSAGE("reverse link for node " << *it << " cell " << cellid);
+- this->Links->ResizeCellList(*it, 1);
+- this->Links->AddCellReference(cellid, *it);
++ this->GetLinks()->ResizeCellList(*it, 1);
++ this->GetLinks()->AddCellReference(cellid, *it);
+ }
+
+ return cellid;
+@@ -332,9 +332,13 @@ void SMDS_UnstructuredGrid::copyBloc(vtk
+ {
+ newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
+ idCellsOldToNew[j] = alreadyCopied; // old vtkId --> new vtkId
++#ifdef VTK_CELL_ARRAY_V2
++ vtkIdType oldLoc = this->GetCellLocationsArray()->GetValue(j);
++#else
+ vtkIdType oldLoc = this->Locations->GetValue(j);
++#endif
+ vtkIdType nbpts;
+- vtkIdType *oldPtsCell = 0;
++ vtkIdTypePtr oldPtsCell = 0;
+ this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
+ assert(nbpts < NBMAXNODESINCELL);
+ //MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
+@@ -952,6 +956,21 @@ void SMDS_UnstructuredGrid::GetNodeIds(s
+ */
+ void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map<int, int> localClonedNodeIds)
+ {
++#ifdef VTK_CELL_ARRAY_V2
++ vtkNew<vtkIdList> cellPoints;
++ this->GetCellPoints(vtkVolId, cellPoints.GetPointer());
++ for (vtkIdType i = 0; i < cellPoints->GetNumberOfIds(); i++)
++ {
++ if (localClonedNodeIds.count(cellPoints->GetId(i)))
++ {
++ vtkIdType oldpt = cellPoints->GetId(i);
++ cellPoints->SetId(i, localClonedNodeIds[oldpt]);
++ //MESSAGE(oldpt << " --> " << pts[i]);
++ //this->RemoveReferenceToCell(oldpt, vtkVolId);
++ //this->AddReferenceToCell(pts[i], vtkVolId);
++ }
++ }
++#else
+ vtkIdType npts = 0;
+ vtkIdType *pts; // will refer to the point id's of the face
+ this->GetCellPoints(vtkVolId, npts, pts);
+@@ -966,6 +985,7 @@ void SMDS_UnstructuredGrid::ModifyCellNo
+ //this->AddReferenceToCell(pts[i], vtkVolId);
+ }
+ }
++#endif
+ }
+
+ /*! reorder the nodes of a face
+@@ -995,11 +1015,20 @@ void SMDS_UnstructuredGrid::BuildLinks()
+ this->Links->UnRegister(this);
+ }
+
++#ifdef VTK_CELL_ARRAY_V2
++ this->Links = SMDS_CellLinks::New();
++ GetLinks()->Allocate(this->GetNumberOfPoints());
++ GetLinks()->Register(this);
++//FIXME: vtk9
++ GetLinks()->BuildLinks(this);
++ GetLinks()->Delete();
++#else
+ this->Links = SMDS_CellLinks::New();
+ this->Links->Allocate(this->GetNumberOfPoints());
+ this->Links->Register(this);
+ this->Links->BuildLinks(this, this->Connectivity);
+ this->Links->Delete();
++#endif
+ }
+
+ /*! Create a volume (prism or hexahedron) by duplication of a face.
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkCellIterator.cpp
+@@ -33,7 +33,8 @@ SMDS_VtkCellIterator::SMDS_VtkCellIterat
+ }
+ else
+ {
+- vtkIdType npts, *pts;
++ vtkIdType npts;
++ vtkIdTypePtr pts;
+ grid->GetCellPoints( _cellId, npts, pts );
+ _vtkIdList->SetNumberOfIds( _nbNodes = npts );
+ for (int i = 0; i < _nbNodes; i++)
+@@ -67,7 +68,7 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellI
+ //MESSAGE("SMDS_VtkCellInterlacedIterator (UNV)" << _type);
+
+ _vtkIdList = vtkIdList::New();
+- vtkIdType* pts;
++ vtkIdTypePtr pts;
+ vtkIdType npts;
+ vtkUnstructuredGrid* grid = _mesh->getGrid();
+ grid->GetCellPoints((vtkIdType)_cellId, npts, pts);
+@@ -182,7 +183,7 @@ SMDS_VtkCellIteratorPolyH::SMDS_VtkCellI
+ {
+ //MESSAGE("SMDS_VtkCellIterator Polyhedra");
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(_cellId, nFaces, ptIds);
+ int id = 0;
+ _nbNodesInFaces = 0;
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkEdge.cpp
+@@ -67,6 +67,19 @@ bool SMDS_VtkEdge::ChangeNodes(const SMD
+ bool SMDS_VtkEdge::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
++#ifdef VTK_CELL_ARRAY_V2
++ vtkNew<vtkIdList> cellPoints;
++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
++ if (nbNodes != cellPoints->GetNumberOfIds())
++ {
++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
++ return false;
++ }
++ for (int i = 0; i < nbNodes; i++)
++ {
++ cellPoints->SetId(i, nodes[i]->getVtkId());
++ }
++#else
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+@@ -79,6 +92,7 @@ bool SMDS_VtkEdge::ChangeNodes(const SMD
+ {
+ pts[i] = nodes[i]->getVtkId();
+ }
++#endif
+ SMDS_Mesh::_meshList[myMeshId]->setMyModified();
+ return true;
+ }
+@@ -87,7 +101,7 @@ bool SMDS_VtkEdge::IsMediumNode(const SM
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+ vtkIdType npts = 0;
+- vtkIdType* pts = 0;
++ vtkIdTypePtr pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+ //MESSAGE("IsMediumNode " << npts << " " << (node->getVtkId() == pts[npts-1]));
+ return ((npts == 3) && (node->getVtkId() == pts[2]));
+@@ -137,7 +151,8 @@ const SMDS_MeshNode*
+ SMDS_VtkEdge::GetNode(const int ind) const
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+- vtkIdType npts, *pts;
++ vtkIdType npts;
++ vtkIdTypePtr pts;
+ grid->GetCellPoints( this->myVtkID, npts, pts );
+ return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
+ }
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkFace.cpp
+@@ -101,6 +101,19 @@ void SMDS_VtkFace::initQuadPoly(const st
+ bool SMDS_VtkFace::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
++#ifdef VTK_CELL_ARRAY_V2
++ vtkNew<vtkIdList> cellPoints;
++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
++ if (nbNodes != cellPoints->GetNumberOfIds())
++ {
++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
++ return false;
++ }
++ for (int i = 0; i < nbNodes; i++)
++ {
++ cellPoints->SetId(i, nodes[i]->getVtkId());
++ }
++#else
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+@@ -113,6 +126,7 @@ bool SMDS_VtkFace::ChangeNodes(const SMD
+ {
+ pts[i] = nodes[i]->getVtkId();
+ }
++#endif
+ SMDS_Mesh::_meshList[myMeshId]->setMyModified();
+ return true;
+ }
+@@ -173,7 +187,8 @@ const SMDS_MeshNode*
+ SMDS_VtkFace::GetNode(const int ind) const
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+- vtkIdType npts, *pts;
++ vtkIdType npts;
++ vtkIdTypePtr pts;
+ grid->GetCellPoints( this->myVtkID, npts, pts );
+ return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
+ }
+@@ -186,7 +201,8 @@ SMDS_VtkFace::GetNode(const int ind) con
+ int SMDS_VtkFace::GetNodeIndex( const SMDS_MeshNode* node ) const
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+- vtkIdType npts, *pts;
++ vtkIdType npts;
++ vtkIdTypePtr pts;
+ grid->GetCellPoints( this->myVtkID, npts, pts );
+ for ( vtkIdType i = 0; i < npts; ++i )
+ if ( pts[i] == node->getVtkId() )
+@@ -251,7 +267,7 @@ bool SMDS_VtkFace::IsMediumNode(const SM
+ return false;
+ }
+ vtkIdType npts = 0;
+- vtkIdType* pts = 0;
++ vtkIdTypePtr pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+ vtkIdType nodeId = node->getVtkId();
+ for (int rank = 0; rank < npts; rank++)
+@@ -356,11 +372,18 @@ SMDS_NodeIteratorPtr SMDS_VtkFace::inter
+ void SMDS_VtkFace::ChangeApex(SMDS_MeshNode* node)
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
++#ifdef VTK_CELL_ARRAY_V2
++ vtkNew<vtkIdList> cellPoints;
++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
++ grid->RemoveReferenceToCell(cellPoints->GetId(0), myVtkID);
++ cellPoints->SetId(0, node->getVtkId());
++#else
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+ grid->RemoveReferenceToCell(pts[0], myVtkID);
+ pts[0] = node->getVtkId();
++#endif
+ node->AddInverseElement(this),
+ SMDS_Mesh::_meshList[myMeshId]->setMyModified();
+ }
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMDS/SMDS_VtkVolume.cpp
+@@ -133,6 +133,19 @@ void SMDS_VtkVolume::initPoly(const std:
+ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes)
+ {
+ vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
++#ifdef VTK_CELL_ARRAY_V2
++ vtkNew<vtkIdList> cellPoints;
++ grid->GetCellPoints(myVtkID, cellPoints.GetPointer());
++ if (nbNodes != cellPoints->GetNumberOfIds())
++ {
++ MESSAGE("ChangeNodes problem: not the same number of nodes " << cellPoints->GetNumberOfIds() << " -> " << nbNodes);
++ return false;
++ }
++ for (int i = 0; i < nbNodes; i++)
++ {
++ cellPoints->SetId(i, nodes[i]->getVtkId());
++ }
++#else
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+@@ -145,6 +158,7 @@ bool SMDS_VtkVolume::ChangeNodes(const S
+ {
+ pts[i] = nodes[i]->getVtkId();
+ }
++#endif
+ SMDS_Mesh::_meshList[myMeshId]->setMyModified();
+ return true;
+ }
+@@ -207,7 +221,7 @@ int SMDS_VtkVolume::NbFaces() const
+ case VTK_POLYHEDRON:
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ nbFaces = nFaces;
+ break;
+@@ -236,7 +250,7 @@ int SMDS_VtkVolume::NbNodes() const
+ else
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ int id = 0;
+ for (int i = 0; i < nFaces; i++)
+@@ -276,7 +290,7 @@ int SMDS_VtkVolume::NbEdges() const
+ case VTK_POLYHEDRON:
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ nbEdges = 0;
+ int id = 0;
+@@ -312,7 +326,7 @@ int SMDS_VtkVolume::NbFaceNodes(const in
+ if (aVtkType == VTK_POLYHEDRON)
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ int id = 0;
+ for (int i = 0; i < nFaces; i++)
+@@ -342,7 +356,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::Get
+ if (aVtkType == VTK_POLYHEDRON)
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ int id = 0;
+ for (int i = 0; i < nFaces; i++)
+@@ -372,7 +386,7 @@ std::vector<int> SMDS_VtkVolume::GetQuan
+ if (aVtkType == VTK_POLYHEDRON)
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ int id = 0;
+ for (int i = 0; i < nFaces; i++)
+@@ -430,7 +444,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::Get
+ if ( aVtkType == VTK_POLYHEDRON)
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ int id = 0, nbPoints = 0;
+ for (int i = 0; i < nFaces; i++)
+@@ -443,7 +457,8 @@ const SMDS_MeshNode* SMDS_VtkVolume::Get
+ }
+ return 0;
+ }
+- vtkIdType npts, *pts;
++ vtkIdType npts;
++ vtkIdTypePtr pts;
+ grid->GetCellPoints( this->myVtkID, npts, pts );
+ const std::vector<int>& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType ));
+ return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ind]] );
+@@ -460,7 +475,7 @@ int SMDS_VtkVolume::GetNodeIndex( const
+ if ( aVtkType == VTK_POLYHEDRON)
+ {
+ vtkIdType nFaces = 0;
+- vtkIdType* ptIds = 0;
++ vtkIdTypePtr ptIds = 0;
+ grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
+ int id = 0;
+ for (int iF = 0; iF < nFaces; iF++)
+@@ -473,7 +488,8 @@ int SMDS_VtkVolume::GetNodeIndex( const
+ }
+ return -1;
+ }
+- vtkIdType npts, *pts;
++ vtkIdType npts;
++ vtkIdTypePtr pts;
+ grid->GetCellPoints( this->myVtkID, npts, pts );
+ for ( vtkIdType i = 0; i < npts; ++i )
+ if ( pts[i] == node->getVtkId() )
+@@ -534,7 +550,7 @@ bool SMDS_VtkVolume::IsMediumNode(const
+ return false;
+ }
+ vtkIdType npts = 0;
+- vtkIdType* pts = 0;
++ vtkIdTypePtr pts = 0;
+ grid->GetCellPoints(myVtkID, npts, pts);
+ vtkIdType nodeId = node->getVtkId();
+ for (int rank = 0; rank < npts; rank++)
+Index: FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
++++ FreeCAD-0.19.2/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
+@@ -11348,7 +11348,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGrou
+ {
+ int oldId = *itn;
+ //MESSAGE(" node " << oldId);
+- vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
++ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
+ for (int i=0; i<l.ncells; i++)
+ {
+ int vtkId = l.cells[i];
+@@ -11527,7 +11527,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGrou
+ //MESSAGE(" domain " << idom << " volume " << elem->GetID());
+ double values[3];
+ vtkIdType npts = 0;
+- vtkIdType* pts = 0;
++ vtkIdTypePtr pts = 0;
+ grid->GetCellPoints(vtkVolIds[ivol], npts, pts);
+ SMDS_VtkVolume::gravityCenter(grid, pts, npts, values);
+ if (id ==0)
+@@ -11708,7 +11708,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGrou
+ {
+ int oldId = itnod->first;
+ //MESSAGE(" node " << oldId);
+- vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
++ vtkCellLinks::Link l = static_cast<vtkCellLinks*>(grid->GetCellLinks())->GetLink(oldId);
+ for (int i = 0; i < l.ncells; i++)
+ {
+ int vtkId = l.cells[i];
+@@ -12165,7 +12165,7 @@ void SMESH_MeshEditor::CreateHoleSkin(do
+ MESSAGE("volume to check, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ bool volInside = false;
+ vtkIdType npts = 0;
+- vtkIdType* pts = 0;
++ vtkIdTypePtr pts = 0;
+ grid->GetCellPoints(vtkId, npts, pts);
+ for (int i=0; i<npts; i++)
+ {
+Index: FreeCAD-0.19.2/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp
+===================================================================
+--- FreeCAD-0.19.2.orig/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp
++++ FreeCAD-0.19.2/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp
+@@ -20,7 +20,6 @@
+ * *
+ ***************************************************************************/
+
+-
+ #include "PreCompiled.h"
+
+ #ifndef _PreComp_
diff --git a/gnu/packages/patches/freeglut-gcc-compat.patch b/gnu/packages/patches/freeglut-gcc-compat.patch
new file mode 100644
index 0000000000..126bbd89f4
--- /dev/null
+++ b/gnu/packages/patches/freeglut-gcc-compat.patch
@@ -0,0 +1,53 @@
+Fix build failure with GCC 10.
+
+Taken from upstream:
+https://github.com/dcnieho/FreeGLUT/commit/b9998bbc1e1c329f6bf69c24606a2be7a4973b8c
+
+diff --git a/src/fg_gl2.c b/src/fg_gl2.c
+--- a/src/fg_gl2.c
++++ b/src/fg_gl2.c
+@@ -27,6 +27,20 @@
+ #include "fg_internal.h"
+ #include "fg_gl2.h"
+
++#ifndef GL_ES_VERSION_2_0
++/* GLES2 has the corresponding entry points built-in, and these fgh-prefixed
++ * names are defined in fg_gl2.h header to reference them, for any other case,
++ * define them as function pointers here.
++ */
++FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
++FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
++FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
++FGH_PFNGLBUFFERDATAPROC fghBufferData;
++FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
++FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
++FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
++#endif
++
+ void FGAPIENTRY glutSetVertexAttribCoord3(GLint attrib) {
+ if (fgStructure.CurrentWindow != NULL)
+ fgStructure.CurrentWindow->Window.attribute_v_coord = attrib;
+diff --git a/src/fg_gl2.h b/src/fg_gl2.h
+--- a/src/fg_gl2.h
++++ b/src/fg_gl2.h
+@@ -67,13 +67,13 @@ typedef void (APIENTRY *FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+ typedef void (APIENTRY *FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint);
+ typedef void (APIENTRY *FGH_PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+
+-FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
+-FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
+-FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
+-FGH_PFNGLBUFFERDATAPROC fghBufferData;
+-FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
+-FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
+-FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
++extern FGH_PFNGLGENBUFFERSPROC fghGenBuffers;
++extern FGH_PFNGLDELETEBUFFERSPROC fghDeleteBuffers;
++extern FGH_PFNGLBINDBUFFERPROC fghBindBuffer;
++extern FGH_PFNGLBUFFERDATAPROC fghBufferData;
++extern FGH_PFNGLENABLEVERTEXATTRIBARRAYPROC fghEnableVertexAttribArray;
++extern FGH_PFNGLDISABLEVERTEXATTRIBARRAYPROC fghDisableVertexAttribArray;
++extern FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
+
+ # endif
+
diff --git a/gnu/packages/patches/ganeti-preserve-PYTHONPATH.patch b/gnu/packages/patches/ganeti-preserve-PYTHONPATH.patch
deleted file mode 100644
index 1358e30633..0000000000
--- a/gnu/packages/patches/ganeti-preserve-PYTHONPATH.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Do not override PYTHONPATH when calling Python code from the Haskell
-daemons. This is necessary because the Python library dependencies are
-only available through PYTHONPATH.
-
-diff --git a/src/Ganeti/Query/Exec.hs b/src/Ganeti/Query/Exec.hs
---- a/src/Ganeti/Query/Exec.hs
-+++ b/src/Ganeti/Query/Exec.hs
-@@ -99,12 +99,10 @@ spawnJobProcess jid = withErrorLogAt CRITICAL (show jid) $
- do
- use_debug <- isDebugMode
- env_ <- (M.toList . M.insert "GNT_DEBUG" (if use_debug then "1" else "0")
-- . M.insert "PYTHONPATH" AC.pythondir
- . M.fromList)
- `liftM` getEnvironment
- execPy <- P.jqueueExecutorPy
- logDebug $ "Executing " ++ AC.pythonPath ++ " " ++ execPy
-- ++ " with PYTHONPATH=" ++ AC.pythondir
-
- (master, child) <- pipeClient connectConfig
- let (rh, wh) = clientToHandle child
-
diff --git a/gnu/packages/patches/gcc-10-cross-environment-variables.patch b/gnu/packages/patches/gcc-10-cross-environment-variables.patch
new file mode 100644
index 0000000000..414198657d
--- /dev/null
+++ b/gnu/packages/patches/gcc-10-cross-environment-variables.patch
@@ -0,0 +1,51 @@
+Search path environment variables for cross-compilers. See the discussion
+at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
+
+Note: Touch 'C_INCLUDE_PATH' et al. rather than 'CPATH', as discussed
+at <http://bugs.gnu.org/22186>.
+
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -4474,7 +4474,7 @@ process_command (unsigned int decoded_options_count,
+ }
+
+ temp = env.get (LIBRARY_PATH_ENV);
+- if (temp && *cross_compile == '0')
++ if (temp)
+ {
+ const char *startp, *endp;
+ char *nstore = (char *) alloca (strlen (temp) + 3);
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -472,8 +472,8 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
+ int stdinc, int cxx_stdinc, int verbose)
+ {
+ static const char *const lang_env_vars[] =
+- { "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH",
+- "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH" };
++ { "CROSS_C_INCLUDE_PATH", "CROSS_CPLUS_INCLUDE_PATH",
++ "CROSS_OBJC_INCLUDE_PATH", "CROSS_OBJCPLUS_INCLUDE_PATH" };
+ cpp_options *cpp_opts = cpp_get_options (pfile);
+ size_t idx = (cpp_opts->objc ? 2: 0);
+
+@@ -484,7 +484,7 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
+
+ /* CPATH and language-dependent environment variables may add to the
+ include chain. */
+- add_env_var_paths ("CPATH", INC_BRACKET);
++ add_env_var_paths ("CROSS_CPATH", INC_BRACKET);
+ add_env_var_paths (lang_env_vars[idx], INC_SYSTEM);
+
+ target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc);
+diff --git a/gcc/system.h b/gcc/system.h
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -1244,4 +1244,6 @@ void gcc_stablesort (void *, size_t, size_t,
+ of the number. */
+ #define PRsa(n) "%" #n PRIu64 "%c"
+
++#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH"
++
+ #endif /* ! GCC_SYSTEM_H */
diff --git a/gnu/packages/patches/gcc-5-fix-powerpc64le-build.patch b/gnu/packages/patches/gcc-5-fix-powerpc64le-build.patch
new file mode 100644
index 0000000000..289d648875
--- /dev/null
+++ b/gnu/packages/patches/gcc-5-fix-powerpc64le-build.patch
@@ -0,0 +1,64 @@
+From ee6c0081c03330045b3d4cde8421cd1d3a459609 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Fri, 15 Jun 2018 10:51:28 +0200
+Subject: [PATCH] Partial backport r256656
+
+2018-06-15 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2018-01-10 Kelvin Nilsen <kelvin@gcc.gnu.org>
+
+ * lex.c (search_line_fast): Remove illegal coercion of an
+ unaligned pointer value to vector pointer type and replace with
+ use of __builtin_vec_vsx_ld () built-in function, which operates
+ on unaligned pointer values.
+
+From-SVN: r261621
+---
+
+Obtained from:
+
+https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=ee6c0081c03330045b3d4cde8421cd1d3a459609
+
+The libcpp/ChangeLog hunk was modified to apply on top of gcc-5's libcpp/ChangeLog.
+
+ libcpp/ChangeLog | 12 ++++++++++++
+ libcpp/lex.c | 2 +-
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
+index c920a05d438..a63abb04f5e 100644
+--- a/libcpp/ChangeLog
++++ b/libcpp/ChangeLog
+@@ -1,3 +1,15 @@
++2018-06-15 Martin Liska <mliska@suse.cz>
++
++ PR bootstrap/86162
++
++ Backport from mainline
++ 2018-01-10 Kelvin Nilsen <kelvin@gcc.gnu.org>
++
++ * lex.c (search_line_fast): Remove illegal coercion of an
++ unaligned pointer value to vector pointer type and replace with
++ use of __builtin_vec_vsx_ld () built-in function, which operates
++ on unaligned pointer values.
++
+ 2017-10-10 Release Manager
+
+ * GCC 5.5.0 released.
+diff --git a/libcpp/lex.c b/libcpp/lex.c
+index e5a0397f309..b789686f1c4 100644
+--- a/libcpp/lex.c
++++ b/libcpp/lex.c
+@@ -568,7 +568,7 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
+ {
+ vc m_nl, m_cr, m_bs, m_qm;
+
+- data = *((const vc *)s);
++ data = __builtin_vec_vsx_ld (0, s);
+ s += 16;
+
+ m_nl = (vc) __builtin_vec_cmpeq(data, repl_nl);
+--
+2.27.0
+
diff --git a/gnu/packages/patches/gcc-cross-gxx-include-dir.patch b/gnu/packages/patches/gcc-cross-gxx-include-dir.patch
new file mode 100644
index 0000000000..d6c4ffddc4
--- /dev/null
+++ b/gnu/packages/patches/gcc-cross-gxx-include-dir.patch
@@ -0,0 +1,73 @@
+This patch reverts upstream commit b4d3485e4fc1d:
+
+ https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=b4d3485e4fc1d029e620a59deb54b3f4f3f6b209
+
+Otherwise, GCC ends up searching the wrong target directory for cross-headers.
+
+diff --git a/gcc/configure b/gcc/configure
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -3689,11 +3689,6 @@ esac
+ fi
+
+
+-# If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate
+-# the former in the latter and, upon success, compute gcc_gxx_include_dir as
+-# relative to the sysroot.
+-gcc_gxx_include_dir_add_sysroot=0
+-
+ # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
+ if test x${gcc_gxx_include_dir} = x; then
+ if test x${enable_version_specific_runtime_libs} = xyes; then
+@@ -3705,10 +3700,15 @@ if test x${gcc_gxx_include_dir} = x; then
+ fi
+ gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
+ fi
+-elif test "${with_sysroot+set}" = set; then
++fi
++
++gcc_gxx_include_dir_add_sysroot=0
++if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 715fcba0482..88136e232df 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -204,11 +204,6 @@ no) ;;
+ *) gcc_gxx_include_dir=$with_gxx_include_dir ;;
+ esac])
+
+-# If both --with-sysroot and --with-gxx-include-dir are passed, we interpolate
+-# the former in the latter and, upon success, compute gcc_gxx_include_dir as
+-# relative to the sysroot.
+-gcc_gxx_include_dir_add_sysroot=0
+-
+ # This logic must match libstdc++-v3/acinclude.m4:GLIBCXX_EXPORT_INSTALL_INFO.
+ if test x${gcc_gxx_include_dir} = x; then
+ if test x${enable_version_specific_runtime_libs} = xyes; then
+@@ -220,10 +215,15 @@ if test x${gcc_gxx_include_dir} = x; then
+ fi
+ gcc_gxx_include_dir="\$(libsubdir)/\$(libsubdir_to_prefix)$libstdcxx_incdir"
+ fi
+-elif test "${with_sysroot+set}" = set; then
++fi
++
++gcc_gxx_include_dir_add_sysroot=0
++if test "${with_sysroot+set}" = set; then
+ gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'`
+ if test "${gcc_gxx_without_sysroot}"; then
+- gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ if test x${with_sysroot} != x/; then
++ gcc_gxx_include_dir="${gcc_gxx_without_sysroot}"
++ fi
+ gcc_gxx_include_dir_add_sysroot=1
+ fi
+ fi
diff --git a/gnu/packages/patches/gd-Revert-fix-303-gdlib.pc.patch b/gnu/packages/patches/gd-Revert-fix-303-gdlib.pc.patch
new file mode 100644
index 0000000000..6329b129d3
--- /dev/null
+++ b/gnu/packages/patches/gd-Revert-fix-303-gdlib.pc.patch
@@ -0,0 +1,179 @@
+From 9b31dfda73ee2d1b56b3f0dcfd3246c2faa592fe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?L=C3=A9o=20Le=20Bouter?= <lle-bout@zaclys.net>
+Date: Sun, 28 Mar 2021 19:47:25 +0200
+Subject: [PATCH] Revert "fix #303: gdlib.pc: use Requires instead of Libs
+ (#537)"
+
+This reverts commit 28ecfe77c817aff8ce56422d3e4e8533a281bc76.
+---
+ CMakeLists.txt | 12 ------------
+ config/gdlib.pc.cmake | 4 +---
+ config/gdlib.pc.in | 4 +---
+ configure.ac | 11 +----------
+ src/CMakeLists.txt | 6 ------
+ 5 files changed, 3 insertions(+), 34 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 57cd95d..6bd0c73 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -53,8 +53,6 @@ SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
+ "Single Directory for all static libraries."
+ )
+
+-SET(PKG_REQUIRES_PRIVATES "")
+-
+ if (USE_EXT_GD)
+ message("Using GD at: ${USE_EXT_GD}")
+ INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
+@@ -170,13 +168,11 @@ else (USE_EXT_GD)
+ INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS})
+ SET(HAVE_FT2BUILD_H 1)
+ SET(HAVE_LIBFREETYPE 1)
+- LIST(APPEND PKG_REQUIRES_PRIVATES freetype2)
+ ENDIF(FREETYPE_FOUND)
+
+ IF(ZLIB_FOUND)
+ INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
+ SET(HAVE_LIBZ 1)
+- LIST(APPEND PKG_REQUIRES_PRIVATES zlib)
+ ENDIF(ZLIB_FOUND)
+
+ IF(WEBP_FOUND)
+@@ -192,7 +188,6 @@ else (USE_EXT_GD)
+ IF(PNG_FOUND)
+ INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
+ SET(HAVE_LIBPNG 1)
+- LIST(APPEND PKG_REQUIRES_PRIVATES libpng)
+ ENDIF(PNG_FOUND)
+
+ IF(ICONV_FOUND)
+@@ -209,25 +204,21 @@ else (USE_EXT_GD)
+ IF(XPM_FOUND)
+ INCLUDE_DIRECTORIES(${XPM_INCLUDE_DIR})
+ SET(HAVE_LIBXPM 1)
+- LIST(APPEND PKG_REQUIRES_PRIVATES xpm)
+ ENDIF(XPM_FOUND)
+
+ IF(JPEG_FOUND)
+ INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
+ SET(HAVE_LIBJPEG 1)
+- LIST(APPEND PKG_REQUIRES_PRIVATES libjpeg)
+ ENDIF(JPEG_FOUND)
+
+ IF(TIFF_FOUND)
+ INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
+ SET(HAVE_LIBTIFF 1)
+- LIST(APPEND PKG_REQUIRES_PRIVATES libtiff-4)
+ ENDIF(TIFF_FOUND)
+
+ IF(FONTCONFIG_FOUND)
+ INCLUDE_DIRECTORIES(${FONTCONFIG_INCLUDE_DIR})
+ SET(HAVE_LIBFONTCONFIG 1)
+- LIST(APPEND PKG_REQUIRES_PRIVATES fontconfig)
+ ELSE (FONTCONFIG_FOUND)
+ SET(FONTCONFIG_LIBRARY "")
+ SET(FONTCONFIG_INCLUDE_DIR "")
+@@ -236,11 +227,8 @@ else (USE_EXT_GD)
+
+ IF(RAQM_FOUND)
+ INCLUDE_DIRECTORIES(${RAQM_INCLUDE_DIR})
+- SET(HAVE_RAQM 1)
+- LIST(APPEND PKG_REQUIRES_PRIVAES raqm)
+ ENDIF(RAQM_FOUND)
+
+- string(REPLACE ";" ", " PKG_REQUIRES_PRIVATES "${PKG_REQUIRES_PRIVATES}")
+ SET(HAVE_CONFIG_H 1)
+
+ ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+diff --git a/config/gdlib.pc.cmake b/config/gdlib.pc.cmake
+index 5fc8af4..d1a0dda 100644
+--- a/config/gdlib.pc.cmake
++++ b/config/gdlib.pc.cmake
+@@ -6,8 +6,6 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+ Name: gd
+ Description: GD graphics library
+ Version: @GDLIB_VERSION@
+-Requires:
+-Requires.private: @PKG_REQUIRES_PRIVATES@
+ Cflags: -I${includedir}
+-Libs.private: @LIBS_PRIVATES@
++Libs.private: @LIBGD_DEP_LIBS@
+ Libs: -L${libdir} -lgd
+diff --git a/config/gdlib.pc.in b/config/gdlib.pc.in
+index d6bc375..b980a60 100644
+--- a/config/gdlib.pc.in
++++ b/config/gdlib.pc.in
+@@ -6,8 +6,6 @@ includedir=@includedir@
+ Name: gd
+ Description: GD graphics library
+ Version: @VERSION@
+-Requires:
+-Requires.private: @PKG_REQUIRES_PRIVATES@
+ Cflags: -I${includedir}
+-Libs.private: @LIBS_PRIVATES@ @LIBICONV@
++Libs.private: @LIBS@ @LIBICONV@
+ Libs: -L${libdir} -lgd
+diff --git a/configure.ac b/configure.ac
+index 535db68..329c99c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -33,9 +33,6 @@ AC_SUBST(GDLIB_LT_CURRENT)
+ AC_SUBST(GDLIB_LT_REVISION)
+ AC_SUBST(GDLIB_LT_AGE)
+
+-AC_SUBST(LIBS_PRIVATES)
+-AC_SUBST(PKG_REQUIRES_PRIVATES)
+-
+ AM_INIT_AUTOMAKE([1.11 foreign dist-xz -Wall -Werror subdir-objects])
+ AC_CONFIG_HEADERS([src/config.h:src/config.hin])
+
+@@ -133,7 +130,6 @@ m4_define([GD_LIB_CHECK], [dnl
+ AC_MSG_RESULT([$gd_with_lib])
+
+ gd_found_lib=no
+- gd_require_pkg_name=""
+ if test "$gd_with_lib" != "no"; then
+ save_CPPFLAGS=$CPPFLAGS
+ save_LDFLAGS=$LDFLAGS
+@@ -165,11 +161,6 @@ m4_define([GD_LIB_CHECK], [dnl
+ $1][_CFLAGS="$gd_lib_cflags $][$1][_CFLAGS"
+ AS_VAR_APPEND([LIBS], [" $][$1][_LIBS"])
+ AS_VAR_APPEND([CPPFLAGS], [" $][$1][_CFLAGS"])
+- if test -z "$gd_require_pkg_name"; then
+- AS_VAR_APPEND([LIBS_PRIVATES], [" $][$1][_LIBS"])
+- else
+- AS_VAR_APPEND([PKG_REQUIRES_PRIVATES], [" $gd_require_pkg_name"])
+- fi
+ elif test "$gd_with_lib" = "yes"; then
+ AC_MSG_ERROR([$3 requested but not found])
+ else
+@@ -189,7 +180,7 @@ dnl $4 - pkg-config module to look for
+ dnl $5 - fallback test for the feature
+ m4_define([GD_LIB_PKG_CHECK], [dnl
+ GD_LIB_CHECK([$1], [$2], [$3], [dnl
+- PKG_CHECK_MODULES([$1], [$4], [gd_found_lib=yes gd_require_pkg_name="$4"], [$5])
++ PKG_CHECK_MODULES([$1], [$4], [gd_found_lib=yes], [$5])
+ ])
+ ])
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 509c422..49adbd6 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -142,12 +142,6 @@ if (BUILD_STATIC_LIBS)
+ target_link_libraries(${GD_LIB_STATIC} ${LIBGD_DEP_LIBS})
+ endif()
+
+-SET(LIBS_PRIVATES
+- ${ICONV_LIBRARIES}
+- ${LIQ_LIBRARIES}
+- ${WEBP_LIBRARIES}
+-)
+-
+ set(GD_PROGRAMS gdcmpgif)
+
+ if (PNG_FOUND)
+--
+2.31.1
+
diff --git a/gnu/packages/patches/gdb-fix-gnu-nat-build.patch b/gnu/packages/patches/gdb-fix-gnu-nat-build.patch
new file mode 100644
index 0000000000..b0249d9cec
--- /dev/null
+++ b/gnu/packages/patches/gdb-fix-gnu-nat-build.patch
@@ -0,0 +1,254 @@
+Fix build on the Hurd.
+
+Patch #1 taken from upstream
+
+ https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a1700a3199d31910b87cd7db3c394ddd091cfcde
+
+Patch #2 taken from upstream mailing list
+
+ https://sourceware.org/pipermail/gdb/2021-November/049777.html
+
+Patch #3 sent to upstream
+
+ https://sourceware.org/pipermail/gdb/2021-November/049788.html
+
+From 30d89407ad6bb62fafc72fa9c547c2d7ff371401 Mon Sep 17 00:00:00 2001
+From: Simon Marchi <simon.marchi@polymtl.ca>
+Date: Wed, 3 Nov 2021 15:09:19 -0400
+Subject: [PATCH 1/3] gdb: fix gnu-nat build
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+
+When building gnu-nat.c, we get:
+
+ CXX gnu-nat.o
+ gnu-nat.c: In member function 'virtual void gnu_nat_target::create_inferior(const char*, const string&, char**, int)':
+ gnu-nat.c:2117:13: error: 'struct inf' has no member named 'target_is_pushed'
+ 2117 | if (!inf->target_is_pushed (this))
+ | ^~~~~~~~~~~~~~~~
+ gnu-nat.c:2118:10: error: 'struct inf' has no member named 'push_target'
+ 2118 | inf->push_target (this);
+ | ^~~~~~~~~~~
+
+This is because of a confusion between the generic `struct inferior`
+variable and the gnu-nat-specific `struct inf` variable. Fix by
+referring to `inferior`, not `inf`.
+
+Adjust the comment on top of `struct inf` to clarify the purpose of that
+type.
+
+Co-Authored-By: Andrea Monaco <andrea.monaco@autistici.org>
+Change-Id: I2fe2f7f6ef61a38d79860fd262b08835c963fc77
+---
+ gdb/gnu-nat.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
+index 67ce00e9c30..ab539b4d8b4 100644
+--- a/gdb/gnu-nat.c
++++ b/gdb/gnu-nat.c
+@@ -149,7 +149,7 @@ struct inf_wait
+ int suppress; /* Something trivial happened. */
+ };
+
+-/* The state of an inferior. */
++/* Further Hurd-specific state of an inferior. */
+ struct inf
+ {
+ /* Fields describing the current inferior. */
+@@ -2114,8 +2114,8 @@ gnu_nat_target::create_inferior (const char *exec_file,
+
+ inf_debug (inf, "creating inferior");
+
+- if (!inf->target_is_pushed (this))
+- inf->push_target (this);
++ if (!inferior->target_is_pushed (this))
++ inferior->push_target (this);
+
+ pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
+ NULL, NULL, NULL, NULL);
+From ebc0837f4693232f74eb2cc3033515b18a8f0900 Mon Sep 17 00:00:00 2001
+From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
+Date: Mon, 22 Nov 2021 07:47:28 +0100
+Subject: [PATCH 2/3] gdb: gnu-nat.c: port-rights.
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+
+Taken from:
+
+ https://sourceware.org/pipermail/gdb/2021-November/049777.html
+---
+ gdb/gnu-nat.c | 18 ++++++++++--------
+ 1 file changed, 10 insertions(+), 8 deletions(-)
+
+diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
+index ab539b4d8b4..8cd876b21d0 100644
+--- a/gdb/gnu-nat.c
++++ b/gdb/gnu-nat.c
+@@ -3292,15 +3292,17 @@ This is the same as setting `task pause', `exceptions', and\n\
+ _("Show information about the task's send rights."));
+ add_info ("receive-rights", info_recv_rights_cmd,
+ _("Show information about the task's receive rights."));
+- add_info ("port-rights", info_port_rights_cmd,
+- _("Show information about the task's port rights."));
+- add_info ("port-sets", info_port_sets_cmd,
+- _("Show information about the task's port sets."));
++ cmd_list_element *port_rights_cmd =
++ add_info ("port-rights", info_port_rights_cmd,
++ _("Show information about the task's port rights."));
++ cmd_list_element *port_sets_cmd =
++ add_info ("port-sets", info_port_sets_cmd,
++ _("Show information about the task's port sets."));
+ add_info ("dead-names", info_dead_names_cmd,
+- _("Show information about the task's dead names."));
+- add_info_alias ("ports", "port-rights", 1);
+- add_info_alias ("port", "port-rights", 1);
+- add_info_alias ("psets", "port-sets", 1);
++ _("Show information about the task's dead names."));
++ add_info_alias ("ports", port_rights_cmd, 1);
++ add_info_alias ("port", port_rights_cmd, 1);
++ add_info_alias ("psets", port_sets_cmd, 1);
+ }
+
+
+From e8df985cdd95e4808c390e226a0e852d23c502f9 Mon Sep 17 00:00:00 2001
+From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
+Date: Mon, 22 Nov 2021 08:22:15 +0100
+Subject: [PATCH 3/3] gdb: More compile fixes for gnu-nat.c.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+
+This fixes compile errors like
+
+ ../../gdb-11.1/gdb/gnu-nat.c: In function ‘void add_task_commands()’:
+ ../../gdb-11.1/gdb/gnu-nat.c:3204:17: error: no matching function for call to ‘add_cmd(const char [8], command_class, cmd_list_element*&, char*, cmd_list_element**)’
+ 3204 | &setlist);
+ | ^
+ In file included from ../../gdb-11.1/gdb/completer.h:21,
+ from ../../gdb-11.1/gdb/symtab.h:36,
+ from ../../gdb-11.1/gdb/infrun.h:21,
+ from ../../gdb-11.1/gdb/target.h:42,
+ from ../../gdb-11.1/gdb/inf-child.h:23,
+ from ../../gdb-11.1/gdb/gnu-nat.h:38,
+ from ../../gdb-11.1/gdb/gnu-nat.c:24:
+ ../../gdb-11.1/gdb/command.h:160:33: note: candidate: ‘cmd_list_element* add_cmd(const char*, command_class, void (*)(const char*, int), const char*, cmd_list_element**)’
+ 160 | extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+ | ^~~~~~~
+ ../../gdb-11.1/gdb/command.h:161:30: note: no known conversion for argument 3 from ‘cmd_list_element*’ to ‘void (*)(const char*, int)’
+ 161 | cmd_const_cfunc_ftype *fun,
+ | ~~~~~~~~~~~~~~~~~~~~~~~^~~
+ ../../gdb-11.1/gdb/command.h:167:33: note: candidate: ‘cmd_list_element* add_cmd(const char*, command_class, const char*, cmd_list_element**)’
+ 167 | extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+ | ^~~~~~~
+ ../../gdb-11.1/gdb/command.h:167:33: note: candidate expects 4 arguments, 5 provided
+ ../../gdb-11.1/gdb/gnu-nat.c:3210:18: error: no matching function for call to ‘add_cmd(const char [8], command_class, cmd_list_element*&, char*, cmd_list_element**)’
+ 3210 | &showlist);
+ | ^
+
+* gdb/gnu-nat.c (add_task_commands): Use a fresh variable instead of
+shadowing set_signals_cmd etc.
+(add_thread_commands): Likewise.
+---
+ gdb/gnu-nat.c | 33 +++++++++++++++++----------------
+ 1 file changed, 17 insertions(+), 16 deletions(-)
+
+diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
+index 8cd876b21d0..7aecc2295f8 100644
+--- a/gdb/gnu-nat.c
++++ b/gdb/gnu-nat.c
+@@ -3197,31 +3197,31 @@ Show whether new threads are allowed to run (once gdb has noticed them)."),
+ _("Show the default detach-suspend-count value for new threads."),
+ &show_thread_default_cmd_list);
+
+- cmd_list_element *set_signals_cmd
++ cmd_list_element *set_signals_cmd_
+ = add_cmd ("signals", class_run, set_signals_cmd, _("\
+ Set whether the inferior process's signals will be intercepted.\n\
+ Mach exceptions (such as breakpoint traps) are not affected."),
+ &setlist);
+- add_alias_cmd ("sigs", set_signals_cmd, class_run, 1, &setlist);
++ add_alias_cmd ("sigs", set_signals_cmd_, class_run, 1, &setlist);
+
+- cmd_list_element *show_signals_cmd
++ cmd_list_element *show_signals_cmd_
+ = add_cmd ("signals", no_class, show_signals_cmd, _("\
+ Show whether the inferior process's signals will be intercepted."),
+ &showlist);
+- add_alias_cmd ("sigs", show_signals_cmd, no_class, 1, &showlist);
++ add_alias_cmd ("sigs", show_signals_cmd_, no_class, 1, &showlist);
+
+- cmd_list_element *set_signal_thread_cmd
++ cmd_list_element *set_signal_thread_cmd_
+ = add_cmd ("signal-thread", class_run, set_sig_thread_cmd, _("\
+ Set the thread that gdb thinks is the libc signal thread.\n\
+ This thread is run when delivering a signal to a non-stopped process."),
+ &setlist);
+- add_alias_cmd ("sigthread", set_signal_thread_cmd, class_run, 1, &setlist);
++ add_alias_cmd ("sigthread", set_signal_thread_cmd_, class_run, 1, &setlist);
+
+- cmd_list_element *show_signal_thread_cmd
++ cmd_list_element *show_signal_thread_cmd_
+ = add_cmd ("signal-thread", no_class, show_sig_thread_cmd, _("\
+ Set the thread that gdb thinks is the libc signal thread."),
+ &showlist);
+- add_alias_cmd ("sigthread", show_signal_thread_cmd, no_class, 1, &showlist);
++ add_alias_cmd ("sigthread", show_signal_thread_cmd_, no_class, 1, &showlist);
+
+ add_cmd ("stopped", class_run, set_stopped_cmd, _("\
+ Set whether gdb thinks the inferior process is stopped as with SIGSTOP.\n\
+@@ -3231,13 +3231,13 @@ Stopped process will be continued by sending them a signal."),
+ Show whether gdb thinks the inferior process is stopped as with SIGSTOP."),
+ &showlist);
+
+- cmd_list_element *set_exceptions_cmd
++ cmd_list_element *set_exceptions_cmd_
+ = add_cmd ("exceptions", class_run, set_exceptions_cmd, _("\
+ Set whether exceptions in the inferior process will be trapped.\n\
+ When exceptions are turned off, neither breakpoints nor single-stepping\n\
+ will work."), &setlist);
+ /* Allow `set exc' despite conflict with `set exception-port'. */
+- add_alias_cmd ("exc", set_exceptions_cmd, class_run, 1, &setlist);
++ add_alias_cmd ("exc", set_exceptions_cmd_, class_run, 1, &setlist);
+
+ add_cmd ("exceptions", no_class, show_exceptions_cmd, _("\
+ Show whether exceptions in the inferior process will be trapped."),
+@@ -3269,14 +3269,14 @@ used to pause individual threads by default instead."),
+ "on the thread when detaching."),
+ &show_task_cmd_list);
+
+- cmd_list_element *set_task_exception_port_cmd
++ cmd_list_element *set_task_exception_port_cmd_
+ = add_cmd ("exception-port", no_class, set_task_exc_port_cmd, _("\
+ Set the task exception port to which we forward exceptions.\n\
+ The argument should be the value of the send right in the task."),
+ &set_task_cmd_list);
+- add_alias_cmd ("excp", set_task_exception_port_cmd, no_class, 1,
++ add_alias_cmd ("excp", set_task_exception_port_cmd_, no_class, 1,
+ &set_task_cmd_list);
+- add_alias_cmd ("exc-port", set_task_exception_port_cmd, no_class, 1,
++ add_alias_cmd ("exc-port", set_task_exception_port_cmd_, no_class, 1,
+ &set_task_cmd_list);
+
+ /* A convenient way of turning on all options require to noninvasively
+@@ -3464,14 +3464,15 @@ Note that this is relative to suspend count when gdb noticed the thread;\n\
+ use the `thread takeover-suspend-count' to force it to an absolute value."),
+ &show_thread_cmd_list);
+
+- add_cmd ("exception-port", no_class, set_thread_exc_port_cmd, _("\
++ cmd_list_element *set_thread_exception_port_cmd_
++ = add_cmd ("exception-port", no_class, set_thread_exc_port_cmd, _("\
+ Set the thread exception port to which we forward exceptions.\n\
+ This overrides the task exception port.\n\
+ The argument should be the value of the send right in the task."),
+ &set_thread_cmd_list);
+- add_alias_cmd ("excp", set_thread_exception_port_cmd, no_class, 1,
++ add_alias_cmd ("excp", set_thread_exception_port_cmd_, no_class, 1,
+ &set_thread_cmd_list);
+- add_alias_cmd ("exc-port", set_thread_exception_port_cmd, no_class, 1,
++ add_alias_cmd ("exc-port", set_thread_exception_port_cmd_, no_class, 1,
+ &set_thread_cmd_list);
+
+ add_cmd ("takeover-suspend-count", no_class, thread_takeover_sc_cmd, _("\
diff --git a/gnu/packages/patches/gdb-hurd.patch b/gnu/packages/patches/gdb-hurd.patch
deleted file mode 100644
index 0af8d4dc28..0000000000
--- a/gnu/packages/patches/gdb-hurd.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-Taken from upstream, removed ChangeLog.
-
-From 6930bffe3373690b3431d6291f9f7c116d6a1ec4 Mon Sep 17 00:00:00 2001
-From: Samuel Thibault <samuel.thibault@ens-lyon.org>
-Date: Sat, 30 May 2020 18:35:59 +0000
-Subject: [PATCH] hurd: fix gnu_debug_flag type
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Fixes
-
-../../gdb/gnu-nat.c:96:6: error: conflicting declaration ‘bool gnu_debug_flag’
- 96 | bool gnu_debug_flag = false;
-../../gdb/gnu-nat.c: In function ‘void _initialize_gnu_nat()’:
-../../gdb/gnu-nat.c:3511:7: error: cannot
-
-gdb/ChangeLog:
-
- * gnu-nat.h (gnu_debug_flag): Set type to bool.
----
- gdb/ChangeLog | 4 ++++
- gdb/gnu-nat.h | 2 +-
- 2 files changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h
-index 77c57817b2..766f716587 100644
---- a/gdb/gnu-nat.h
-+++ b/gdb/gnu-nat.h
-@@ -111,7 +111,7 @@ extern char *proc_string (struct proc *proc);
- __proc_pid (__proc), __proc->tid, \
- host_address_to_string (__proc) , ##args); } while (0)
-
--extern int gnu_debug_flag;
-+extern bool gnu_debug_flag;
-
- #define debug(msg, args...) \
- do { if (gnu_debug_flag) \
---
-Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
-Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com
-
-commit 366f550a593c7e6bae3699a4b6d65fe937af5603
-Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
-Date: Sat May 30 18:41:30 2020 +0000
-
- hurd: add missing include
-
- Fixes
-
- ../../gdb/gnu-nat.c:2522:14: error: ‘target_gdbarch’ was not declared in this scope; did you mean ‘target_detach’?
- 2522 | paddress (target_gdbarch (), memaddr), pulongest (len),
-
- gdb/Changelog:
-
- * gnu-nat.c: Include "gdbarch.h".
-
-diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
-index 3b438a9a43..9b93488b41 100644
---- a/gdb/gnu-nat.c
-+++ b/gdb/gnu-nat.c
-@@ -64,6 +64,7 @@ extern "C"
- #include "language.h"
- #include "target.h"
- #include "gdbsupport/gdb_wait.h"
-+#include "gdbarch.h"
- #include "gdbcmd.h"
- #include "gdbcore.h"
- #include "gdbthread.h"
diff --git a/gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch b/gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch
deleted file mode 100644
index e6ac4de00b..0000000000
--- a/gnu/packages/patches/gdk-pixbuf-CVE-2020-29385.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-Fix CVE-2020-29385. Note that we omit the binary test file
-tests/test-images/fail/hang_114.gif from the following commit, to avoid
-requiring 'git' to apply the patch.
-
-
-From bdd3acbd48a575d418ba6bf1b32d7bda2fae1c81 Mon Sep 17 00:00:00 2001
-From: Robert Ancell <robert.ancell@canonical.com>
-Date: Mon, 30 Nov 2020 12:26:12 +1300
-Subject: [PATCH] gif: Fix LZW decoder accepting invalid LZW code.
-
-The code value after a reset wasn't being validated, which means we would
-accept invalid codes. This could cause an infinite loop in the decoder.
-
-Fixes CVE-2020-29385
-
-Fixes https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/164
----
- gdk-pixbuf/lzw.c | 13 +++++++------
- tests/test-images/fail/hang_114.gif | Bin 0 -> 5561 bytes
- 2 files changed, 7 insertions(+), 6 deletions(-)
- create mode 100644 tests/test-images/fail/hang_114.gif
-
-diff --git a/gdk-pixbuf/lzw.c b/gdk-pixbuf/lzw.c
-index 9e052a6f7..105daf2b1 100644
---- a/gdk-pixbuf/lzw.c
-+++ b/gdk-pixbuf/lzw.c
-@@ -195,19 +195,20 @@ lzw_decoder_feed (LZWDecoder *self,
- if (self->last_code != self->clear_code && self->code_table_size < MAX_CODES) {
- if (self->code < self->code_table_size)
- add_code (self, self->code);
-- else if (self->code == self->code_table_size)
-+ else
- add_code (self, self->last_code);
-- else {
-- /* Invalid code received - just stop here */
-- self->last_code = self->eoi_code;
-- return output_length;
-- }
-
- /* When table is full increase code size */
- if (self->code_table_size == (1 << self->code_size) && self->code_size < LZW_CODE_MAX)
- self->code_size++;
- }
-
-+ /* Invalid code received - just stop here */
-+ if (self->code >= self->code_table_size) {
-+ self->last_code = self->eoi_code;
-+ return output_length;
-+ }
-+
- /* Convert codeword into indexes */
- n_written += write_indexes (self, output + n_written, output_length - n_written);
- }
diff --git a/gnu/packages/patches/gdm-default-session.patch b/gnu/packages/patches/gdm-default-session.patch
index 9ab2829cdb..3ff8d0da7c 100644
--- a/gnu/packages/patches/gdm-default-session.patch
+++ b/gnu/packages/patches/gdm-default-session.patch
@@ -4,11 +4,9 @@ and not in the directories listed in $XDG_DATA_DIRS. The latter includes
/run/current-system/profile, and only then.
Fixes <https://bugs.gnu.org/37831>.
-
-diff -ur a/daemon/gdm-session.c b/daemon/gdm-session.c
---- a/daemon/gdm-session.c 2019-09-25 10:40:24.000000000 -0400
-+++ b/daemon/gdm-session.c 2020-04-18 18:30:02.671856808 -0400
-@@ -348,24 +348,18 @@
+--- a/daemon/gdm-session.c 2021-07-23 15:16:15.164201000 +0000
++++ b/daemon/gdm-session.c 2021-09-26 08:18:58.730134555 +0000
+@@ -354,13 +354,12 @@
GArray *search_array = NULL;
char **search_dirs;
int i;
@@ -19,22 +17,23 @@ diff -ur a/daemon/gdm-session.c b/daemon/gdm-session.c
DMCONFDIR "/Sessions/",
DATADIR "/gdm/BuiltInSessions/",
- DATADIR "/xsessions/",
-+ "/run/current-system/profile/share/xsessions/"
++ "/run/current-system/profile/share/xsessions/",
};
static const char *wayland_search_dir = DATADIR "/wayland-sessions/";
-
+@@ -368,11 +367,6 @@
search_array = g_array_new (TRUE, TRUE, sizeof (char *));
-- for (i = 0; system_data_dirs[i]; i++) {
-- gchar *dir = g_build_filename (system_data_dirs[i], "xsessions", NULL);
-- g_array_append_val (search_array, dir);
-- }
+ if (type == NULL || g_str_equal (type, "x11")) {
+- for (i = 0; system_data_dirs[i]; i++) {
+- gchar *dir = g_build_filename (system_data_dirs[i], "xsessions", NULL);
+- g_array_append_val (search_array, dir);
+- }
-
- g_array_append_vals (search_array, x_search_dirs, G_N_ELEMENTS (x_search_dirs));
+ g_array_append_vals (search_array, x_search_dirs, G_N_ELEMENTS (x_search_dirs));
+ }
- #ifdef ENABLE_WAYLAND_SUPPORT
-@@ -373,16 +367,7 @@
+@@ -382,16 +376,7 @@
#ifdef ENABLE_USER_DISPLAY_SERVER
g_array_prepend_val (search_array, wayland_search_dir);
diff --git a/gnu/packages/patches/gdm-elogind-support.patch b/gnu/packages/patches/gdm-elogind-support.patch
new file mode 100644
index 0000000000..39cd12dd22
--- /dev/null
+++ b/gnu/packages/patches/gdm-elogind-support.patch
@@ -0,0 +1,211 @@
+https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/113
+
+From 462cc0f5346f5913cf7151044f1c232c5d21c1c3 Mon Sep 17 00:00:00 2001
+From: Dudemanguy <random342@airmail.cc>
+Date: Mon, 5 Oct 2020 18:41:55 -0500
+Subject: [PATCH] meson: allow building with elogind
+
+Currently, the GDM meson build has a hard dependency on systemd.
+However, GDM can function just fine if one is using elogind. This allows
+a user to build GDM against libelogind and also disable the systemd
+system and user units.
+---
+ common/meson.build | 2 +-
+ data/meson.build | 62 ++++++++++++++----------
+ data/pam-arch/gdm-launch-environment.pam | 1 +
+ libgdm/meson.build | 2 +-
+ meson.build | 36 +++++++++-----
+ meson_options.txt | 5 +-
+ 6 files changed, 66 insertions(+), 42 deletions(-)
+
+diff --git a/common/meson.build b/common/meson.build
+index 074dd92e1..bca58f7c4 100644
+--- a/common/meson.build
++++ b/common/meson.build
+@@ -11,7 +11,7 @@ libgdmcommon_src = files(
+ )
+
+ libgdmcommon_deps = [
+- libsystemd_dep,
++ logind_dep,
+ gobject_dep,
+ gio_dep,
+ gio_unix_dep,
+diff --git a/data/meson.build b/data/meson.build
+index 7c5222eaf..403336c31 100644
+--- a/data/meson.build
++++ b/data/meson.build
+@@ -168,41 +168,53 @@ else
+ service_config.set('PLYMOUTH_QUIT_SERVICE', '')
+ endif
+
+-if get_option('systemdsystemunitdir') != ''
+- systemd_systemunitdir = get_option('systemdsystemunitdir')
+-else
+- systemd_systemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
++systemdsystemunitdir = get_option('systemdsystemunitdir')
++if systemdsystemunitdir != 'no'
++ assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd system unit dir or disable it')
++ if get_option('systemdsystemunitdir') != ''
++ systemd_systemunitdir = get_option('systemdsystemunitdir')
++ else
++ systemd_systemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
++ endif
+ endif
+
+-if get_option('systemduserunitdir') != ''
+- systemd_userunitdir = get_option('systemduserunitdir')
+-else
+- systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir',
+- define_variable: ['prefix', get_option('prefix')])
++systemduserunitdir = get_option('systemduserunitdir')
++if systemduserunitdir != 'no'
++ assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
++ if get_option('systemduserunitdir') != ''
++ systemd_userunitdir = get_option('systemduserunitdir')
++ else
++ systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir',
++ define_variable: ['prefix', get_option('prefix')])
++ endif
+ endif
+
+-configure_file(
+- input: 'gdm.service.in',
+- output: '@BASENAME@',
+- configuration: service_config,
+- install_dir: systemd_systemunitdir,
+- format: 'cmake'
+-)
++if systemdsystemunitdir != 'no'
++ configure_file(
++ input: 'gdm.service.in',
++ output: '@BASENAME@',
++ configuration: service_config,
++ install_dir: systemd_systemunitdir,
++ format: 'cmake'
++ )
++endif
+
+ gdm_gnome_session_wanted_targets = []
+ foreach component: gdm_gnome_user_session_wanted_components
+ gdm_gnome_session_wanted_targets += 'Wants=@0@.target'.format(component)
+ endforeach
+
+-configure_file(
+- input: 'session.conf.in',
+- output: 'session.conf',
+- configuration: {
+- 'requires_component': gdm_gnome_shell_component,
+- 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets),
+- },
+- install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d',
+-)
++if systemduserunitdir != 'no'
++ configure_file(
++ input: 'session.conf.in',
++ output: 'session.conf',
++ configuration: {
++ 'requires_component': gdm_gnome_shell_component,
++ 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets),
++ },
++ install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d',
++ )
++endif
+
+ # XSession
+ if get_option('gdm-xsession')
+diff --git a/libgdm/meson.build b/libgdm/meson.build
+index 3f8cafbb7..83e95151b 100644
+--- a/libgdm/meson.build
++++ b/libgdm/meson.build
+@@ -56,7 +56,7 @@ libgdm_deps = [
+ glib_dep,
+ gio_dep,
+ gio_unix_dep,
+- libsystemd_dep,
++ logind_dep,
+ libgdmcommon_dep,
+ ]
+
+diff --git a/meson.build b/meson.build
+index e6fcf4b8b..a86a486b7 100644
+--- a/meson.build
++++ b/meson.build
+@@ -92,21 +92,30 @@ xdmcp_dep = cc.find_library('Xdmcp', required: get_option('xdmcp'))
+ if xdmcp_dep.found() and get_option('tcp-wrappers')
+ libwrap_dep = cc.find_library('libwrap')
+ endif
+-# systemd
+-systemd_dep = dependency('systemd')
+-libsystemd_dep = dependency('libsystemd')
+-if meson.version().version_compare('>= 0.53')
+- systemd_multiseat_x = find_program('systemd-multi-seat-x',
+- required: false,
+- dirs: [
+- systemd_dep.get_pkgconfig_variable('systemdutildir'),
+- '/lib/systemd',
+- '/usr/lib/systemd',
+- ])
++
++logind_provider = get_option('logind-provider')
++systemd_dep = dependency('systemd', required: false)
++if logind_provider == 'systemd'
++ libsystemd_dep = dependency('libsystemd')
++ logind_dep = libsystemd_dep
++ if meson.version().version_compare('>= 0.53')
++ systemd_multiseat_x = find_program('systemd-multi-seat-x',
++ required: false,
++ dirs: [
++ systemd_dep.get_pkgconfig_variable('systemdutildir'),
++ '/lib/systemd',
++ '/usr/lib/systemd',
++ ])
++ else
++ systemd_multiseat_x = find_program('systemd-multi-seat-x', required: false)
++ endif
++ systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x'
+ else
+- systemd_multiseat_x = find_program('systemd-multi-seat-x', required: false)
++ elogind_dep = dependency('libelogind')
++ logind_dep = elogind_dep
++ systemd_x_server = 'disabled'
+ endif
+-systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x'
++
+ # Plymouth
+ plymouth_dep = dependency('ply-boot-client', required: get_option('plymouth'))
+ # Check for Solaris auditing API (ADT)
+@@ -313,6 +322,7 @@ summary({
+ 'PAM Syslog': have_pam_syslog,
+ 'Supports PAM Extensions': pam_extensions_supported,
+ 'SeLinux': libselinux_dep.found(),
++ 'Logind Provider': get_option('logind-provider'),
+ 'Use GDM Xsession': get_option('gdm-xsession'),
+ 'Use UserDisplayServer': get_option('user-display-server'),
+ 'Use SystemdJournal': get_option('systemd-journal'),
+diff --git a/meson_options.txt b/meson_options.txt
+index 14e0b908b..5135d7d66 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -12,6 +12,7 @@ option('initial-vt', type: 'integer', value: 1, description: 'Initial virtual te
+ option('ipv6', type: 'boolean', value: false, description: 'Enables compilation of IPv6 code.')
+ option('lang-file', type: 'string', value: '', description: 'File containing default language settings.')
+ option('libaudit', type: 'feature', value: 'auto', description: 'Add Linux audit support.')
++option('logind-provider', type: 'combo', choices: ['systemd', 'elogind'], value: 'systemd', description: 'Which logind library to use.')
+ option('log-dir', type: 'string', value: '/var/log/gdm', description: 'Log directory.')
+ option('pam-mod-dir', type: 'string', value: '', description: 'Directory to install PAM modules in.')
+ option('pam-prefix', type: 'string', value: '', description: 'Specify where PAM files go.')
+@@ -27,8 +28,8 @@ option('solaris', type: 'boolean', value: false, description: 'Build for Solaris
+ option('split-authentication', type: 'boolean', value: true, description: 'Enable multiple simultaneous PAM conversations during login.')
+ option('sysconfsubdir', type: 'string', value: 'gdm', description: 'Directory name used under sysconfdir.')
+ option('systemd-journal', type: 'boolean', value: true, description: 'Use journald support.')
+-option('systemdsystemunitdir', type: 'string', value: '', description: 'Directory for systemd service files.')
+-option('systemduserunitdir', type: 'string', value: '', description: 'Directory for systemd user service files.')
++option('systemdsystemunitdir', type: 'string', value: '', description: 'Directory for systemd service files, or \'no\' to disable.')
++option('systemduserunitdir', type: 'string', value: '', description: 'Directory for systemd user service files, or \'no\' to disable.')
+ option('tcp-wrappers', type: 'boolean', value: false, description: 'Use TCP wrappers.')
+ option('udev-dir', type: 'string', value: '', description: 'Directory for udev rules file.')
+ option('user', type: 'string', value: 'gdm', description: 'GDM\'s username.')
+--
+GitLab
+
diff --git a/gnu/packages/patches/gdm-pass-gdk-pixbuf-loader-env.patch b/gnu/packages/patches/gdm-pass-gdk-pixbuf-loader-env.patch
new file mode 100644
index 0000000000..4341e3fc30
--- /dev/null
+++ b/gnu/packages/patches/gdm-pass-gdk-pixbuf-loader-env.patch
@@ -0,0 +1,24 @@
+From 444250fce55f916af993bc855930c6809686e4bd Mon Sep 17 00:00:00 2001
+From: Josselin Poiret <dev@jpoiret.xyz>
+Date: Tue, 23 Nov 2021 18:39:39 +0000
+Subject: [PATCH] Make GDM pass GDK_PIXBUF_MODULE_FILE to sessions
+
+---
+ daemon/gdm-launch-environment.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/daemon/gdm-launch-environment.c b/daemon/gdm-launch-environment.c
+index 14ecfac2..3e618321 100644
+--- a/daemon/gdm-launch-environment.c
++++ b/daemon/gdm-launch-environment.c
+@@ -158,6 +158,7 @@ build_launch_environment (GdmLaunchEnvironment *launch_environment,
+ "WINDOWPATH",
+ "XCURSOR_PATH",
+ "XDG_CONFIG_DIRS",
++ "GDK_PIXBUF_MODULE_FILE",
+ NULL
+ };
+ char *system_data_dirs;
+--
+2.33.1
+
diff --git a/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch
new file mode 100644
index 0000000000..366fb91668
--- /dev/null
+++ b/gnu/packages/patches/gdm-remove-hardcoded-xwayland-path.patch
@@ -0,0 +1,22 @@
+Remove check for hardcoded Xwayland path in gdm.
+
+---
+ daemon/gdm-local-display-factory.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
+index da1093bb..37355c06 100644
+--- a/daemon/gdm-local-display-factory.c
++++ b/daemon/gdm-local-display-factory.c
+@@ -203,7 +203,7 @@ gdm_local_display_factory_use_wayland (void)
+ #ifdef ENABLE_WAYLAND_SUPPORT
+ gboolean wayland_enabled = FALSE;
+ if (gdm_settings_direct_get_boolean (GDM_KEY_WAYLAND_ENABLE, &wayland_enabled)) {
+- if (wayland_enabled && g_file_test ("/usr/bin/Xwayland", G_FILE_TEST_IS_EXECUTABLE) )
++ if (wayland_enabled)
+ return TRUE;
+ }
+ #endif
+--
+2.33.0
+
diff --git a/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
new file mode 100644
index 0000000000..44ab6a9471
--- /dev/null
+++ b/gnu/packages/patches/gdm-wayland-session-wrapper-from-env.patch
@@ -0,0 +1,35 @@
+Get wayland-session wrapper from environment.
+
+---
+ daemon/gdm-session.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
+index 4e303e70..1deca4e9 100644
+--- a/daemon/gdm-session.c
++++ b/daemon/gdm-session.c
+@@ -2888,8 +2888,9 @@ gdm_session_start_session (GdmSession *self,
+ allow_remote_connections? "--allow-remote-connections " : "",
+ command);
+ } else {
+- program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
++ program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s %s\"",
+ register_session ? "--register-session " : "",
++ g_getenv ("GDM_WAYLAND_SESSION"),
+ command);
+ }
+ } else if (run_xsession_script) {
+@@ -2942,8 +2942,9 @@
+ register_session ? "--register-session " : "",
+ self->selected_program);
+ } else {
+- program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"dbus-run-session -- %s\"",
++ program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"dbus-run-session -- %s %s\"",
+ register_session ? "--register-session " : "",
++ g_getenv ("GDM_WAYLAND_SESSION"),
+ self->selected_program);
+ }
+ } else {
+--
+2.33.0
+
diff --git a/gnu/packages/patches/geary-CVE-2020-24661.patch b/gnu/packages/patches/geary-CVE-2020-24661.patch
deleted file mode 100644
index 6cbc224786..0000000000
--- a/gnu/packages/patches/geary-CVE-2020-24661.patch
+++ /dev/null
@@ -1,133 +0,0 @@
-From d4e86dc91e1d8a940dc40872fe94ef9ac0fed1b5 Mon Sep 17 00:00:00 2001
-From: Michael Gratton <mike@vee.net>
-Date: Tue, 25 Aug 2020 03:54:09 +0000
-Subject: [PATCH] Merge branch 'mjog/866-self-signed-certificates' into
- 'mainline'
-
-Fix invalid certificate pinning when GCR support is unavailable
-
-Closes #866
-
-See merge request GNOME/geary!529
-
-(cherry picked from commit 423a55b00f1dc6bee9dc17e67c0aea6f42387a77)
-
-5088adfe Application.CertificateManager: Rename some methods for clarity
-0d957559 Application.CertificateManager: Check locally pinned certs for equality
----
- .../application-certificate-manager.vala | 44 +++++++++----------
- 1 file changed, 22 insertions(+), 22 deletions(-)
-
-diff --git a/src/client/application/application-certificate-manager.vala b/src/client/application/application-certificate-manager.vala
-index 4881d73c0..65f6af4fa 100644
---- a/src/client/application/application-certificate-manager.vala
-+++ b/src/client/application/application-certificate-manager.vala
-@@ -381,8 +381,8 @@ private class Application.TlsDatabase : GLib.TlsDatabase {
- GLib.TlsCertificateFlags ret = this.parent.verify_chain(
- chain, purpose, identity, interaction, flags, cancellable
- );
-- if (should_verify(ret, purpose, identity) &&
-- verify(chain, identity, cancellable)) {
-+ if (check_pinned(ret, purpose, identity) &&
-+ is_pinned(chain, identity, cancellable)) {
- ret = 0;
- }
- return ret;
-@@ -399,16 +399,16 @@ private class Application.TlsDatabase : GLib.TlsDatabase {
- GLib.TlsCertificateFlags ret = yield this.parent.verify_chain_async(
- chain, purpose, identity, interaction, flags, cancellable
- );
-- if (should_verify(ret, purpose, identity) &&
-- yield verify_async(chain, identity, cancellable)) {
-+ if (check_pinned(ret, purpose, identity) &&
-+ yield is_pinned_async(chain, identity, cancellable)) {
- ret = 0;
- }
- return ret;
- }
-
-- private inline bool should_verify(GLib.TlsCertificateFlags parent_ret,
-- string purpose,
-- GLib.SocketConnectable? identity) {
-+ private inline bool check_pinned(GLib.TlsCertificateFlags parent_ret,
-+ string purpose,
-+ GLib.SocketConnectable? identity) {
- // If the parent didn't verify, check for a locally pinned
- // cert if it looks like we should, but always reject revoked
- // certs
-@@ -420,22 +420,22 @@ private class Application.TlsDatabase : GLib.TlsDatabase {
- );
- }
-
-- private bool verify(GLib.TlsCertificate chain,
-- GLib.SocketConnectable identity,
-- GLib.Cancellable? cancellable)
-+ private bool is_pinned(GLib.TlsCertificate chain,
-+ GLib.SocketConnectable identity,
-+ GLib.Cancellable? cancellable)
- throws GLib.Error {
-- bool is_verified = false;
-+ bool is_pinned = false;
- string id = to_name(identity);
- TrustContext? context = null;
- lock (this.pinned_certs) {
- context = this.pinned_certs.get(id);
- if (context != null) {
-- is_verified = true;
-+ is_pinned = context.certificate.is_same(chain);
- } else {
- // Cert not found in memory, check with GCR if
- // enabled.
- if (this.use_gcr) {
-- is_verified = gcr_trust_is_certificate_pinned(
-+ is_pinned = gcr_trust_is_certificate_pinned(
- new Gcr.SimpleCertificate(chain.certificate.data),
- GLib.TlsDatabase.PURPOSE_AUTHENTICATE_SERVER,
- id,
-@@ -443,7 +443,7 @@ private class Application.TlsDatabase : GLib.TlsDatabase {
- );
- }
-
-- if (!is_verified) {
-+ if (!is_pinned) {
- // Cert is not pinned in memory or in GCR, so look
- // for it on disk. Do this even if GCR support is
- // enabled, since if the cert was previously saved
-@@ -453,7 +453,7 @@ private class Application.TlsDatabase : GLib.TlsDatabase {
- this.store_dir, id, cancellable
- );
- this.pinned_certs.set(id, context);
-- is_verified = true;
-+ is_pinned = context.certificate.is_same(chain);
- } catch (GLib.IOError.NOT_FOUND err) {
- // Cert was not found saved, so it not pinned
- } catch (GLib.Error err) {
-@@ -465,18 +465,18 @@ private class Application.TlsDatabase : GLib.TlsDatabase {
- }
- }
- }
-- return is_verified;
-+ return is_pinned;
- }
-
-- private async bool verify_async(GLib.TlsCertificate chain,
-- GLib.SocketConnectable identity,
-- GLib.Cancellable? cancellable)
-+ private async bool is_pinned_async(GLib.TlsCertificate chain,
-+ GLib.SocketConnectable identity,
-+ GLib.Cancellable? cancellable)
- throws GLib.Error {
-- bool is_valid = false;
-+ bool pinned = false;
- yield Geary.Nonblocking.Concurrent.global.schedule_async(() => {
-- is_valid = verify(chain, identity, cancellable);
-+ pinned = is_pinned(chain, identity, cancellable);
- }, cancellable);
-- return is_valid;
-+ return pinned;
- }
-
- private TrustContext? lookup_id(string id) {
---
-GitLab
-
diff --git a/gnu/packages/patches/geeqie-clutter.patch b/gnu/packages/patches/geeqie-clutter.patch
new file mode 100644
index 0000000000..ab7cc957d8
--- /dev/null
+++ b/gnu/packages/patches/geeqie-clutter.patch
@@ -0,0 +1,35 @@
+From c99084ac5fc2fb854ff8e8abd4bd3298fb08fb43 Mon Sep 17 00:00:00 2001
+From: Colin Clark <colin.clark@cclark.uk>
+Date: Sat, 9 Jan 2021 11:35:41 +0000
+Subject: [PATCH] Fix #829: segfault with clutter-gtk
+
+https://github.com/BestImageViewer/geeqie/issues/829
+
+This fix might cause other problems which might be cured by calling:
+LIBGL_ALWAYS_INDIRECT=1 geeqie
+
+or, worst case:
+geeqie --disable-clutter
+---
+ src/main.c | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/src/main.c b/src/main.c
+index f497240d..4af654fe 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -904,11 +904,6 @@ gint main(gint argc, gchar *argv[])
+ #ifdef HAVE_GTHREAD
+ #if !GLIB_CHECK_VERSION(2,32,0)
+ g_thread_init(NULL);
+-#endif
+-#ifdef HAVE_CLUTTER
+-/* FIXME: see below */
+- putenv("LIBGL_ALWAYS_INDIRECT=1");
+- XInitThreads();
+ #endif
+ gdk_threads_init();
+ gdk_threads_enter();
+--
+2.34.0
+
diff --git a/gnu/packages/patches/genimage-mke2fs-test.patch b/gnu/packages/patches/genimage-mke2fs-test.patch
index c4a17590f2..5d4fbcfe44 100644
--- a/gnu/packages/patches/genimage-mke2fs-test.patch
+++ b/gnu/packages/patches/genimage-mke2fs-test.patch
@@ -1,8 +1,8 @@
diff --git a/test/mke2fs.dump b/test/mke2fs.dump
index 8e63662..0c25798 100644
---- a/test/mke2fs.dump
-+++ b/test/mke2fs.dump
-@@ -11,7 +11,7 @@ Filesystem OS type: Linux
+--- a/test/mke2fs.0.dump
++++ b/test/mke2fs.0.dump
+@@ -11,7 +11,7 @@
Inode count: 8192
Block count: 32768
Reserved block count: 1638
@@ -11,7 +11,7 @@ index 8e63662..0c25798 100644
Free inodes: 8141
First block: 1
Block size: 1024
-@@ -29,7 +29,7 @@ Mount count: 0
+@@ -29,7 +29,7 @@
Maximum mount count: -1
Last checked: Sat Jan 1 00:00:00 2000
Check interval: 0 (<none>)
@@ -20,7 +20,7 @@ index 8e63662..0c25798 100644
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
-@@ -49,13 +49,13 @@ Journal sequence: 0x00000001
+@@ -51,13 +51,13 @@
Journal start: 0
diff --git a/gnu/packages/patches/ghostscript-CVE-2020-15900.patch b/gnu/packages/patches/ghostscript-CVE-2020-15900.patch
deleted file mode 100644
index b6658d7c7f..0000000000
--- a/gnu/packages/patches/ghostscript-CVE-2020-15900.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fix CVE-2020-15900.
-
-https://cve.circl.lu/cve/CVE-2020-15900
-https://artifex.com/security-advisories/CVE-2020-15900
-
-Taken from upstream:
-https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=5d499272b95a6b890a1397e11d20937de000d31b
-
-diff --git a/psi/zstring.c b/psi/zstring.c
---- a/psi/zstring.c
-+++ b/psi/zstring.c
-@@ -142,13 +142,18 @@ search_impl(i_ctx_t *i_ctx_p, bool forward)
- return 0;
- found:
- op->tas.type_attrs = op1->tas.type_attrs;
-- op->value.bytes = ptr;
-- r_set_size(op, size);
-+ op->value.bytes = ptr; /* match */
-+ op->tas.rsize = size; /* match */
- push(2);
-- op[-1] = *op1;
-- r_set_size(op - 1, ptr - op[-1].value.bytes);
-- op1->value.bytes = ptr + size;
-- r_set_size(op1, count + (!forward ? (size - 1) : 0));
-+ op[-1] = *op1; /* pre */
-+ op[-3].value.bytes = ptr + size; /* post */
-+ if (forward) {
-+ op[-1].tas.rsize = ptr - op[-1].value.bytes; /* pre */
-+ op[-3].tas.rsize = count; /* post */
-+ } else {
-+ op[-1].tas.rsize = count; /* pre */
-+ op[-3].tas.rsize -= count + size; /* post */
-+ }
- make_true(op);
- return 0;
- }
diff --git a/gnu/packages/patches/ghostscript-freetype-compat.patch b/gnu/packages/patches/ghostscript-freetype-compat.patch
deleted file mode 100644
index cc225b5ad6..0000000000
--- a/gnu/packages/patches/ghostscript-freetype-compat.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Fix build with FreeType 2.10.3 and newer.
-
-Taken from upstream:
-https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=41ef9a0bc36b9db7115fbe9623f989bfb47bbade
-
-diff --git a/base/fapi_ft.c b/base/fapi_ft.c
---- a/base/fapi_ft.c
-+++ b/base/fapi_ft.c
-@@ -125,7 +125,7 @@ static void
- delete_inc_int_info(gs_fapi_server * a_server,
- FT_IncrementalRec * a_inc_int_info);
-
--FT_CALLBACK_DEF(void *)
-+static void *
- FF_alloc(FT_Memory memory, long size)
- {
- gs_memory_t *mem = (gs_memory_t *) memory->user;
-@@ -133,7 +133,7 @@ FF_alloc(FT_Memory memory, long size)
- return (gs_malloc(mem, size, 1, "FF_alloc"));
- }
-
--FT_CALLBACK_DEF(void *)
-+static void *
- FF_realloc(FT_Memory memory, long cur_size, long new_size, void *block)
- {
- gs_memory_t *mem = (gs_memory_t *) memory->user;
-@@ -153,7 +153,7 @@ FT_CALLBACK_DEF(void *)
- return (tmp);
- }
-
--FT_CALLBACK_DEF(void)
-+static void
- FF_free(FT_Memory memory, void *block)
- {
- gs_memory_t *mem = (gs_memory_t *) memory->user;
diff --git a/gnu/packages/patches/ghostscript-no-header-creationdate.patch b/gnu/packages/patches/ghostscript-no-header-creationdate.patch
index 92ddbdade0..b19f3ab5d9 100644
--- a/gnu/packages/patches/ghostscript-no-header-creationdate.patch
+++ b/gnu/packages/patches/ghostscript-no-header-creationdate.patch
@@ -20,3 +20,25 @@ index 0fb067e..b342e2c 100644
{
struct tm tms;
time_t t;
+--- orig/gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c
++++ gnu-ghostscript-9.14.0/devices/vector/gdevpdfe.c
+@@ -692,6 +692,9 @@
+ pdf_xml_attribute_name(s, "xmlns:xmp");
+ pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/");
+ pdf_xml_tag_end(s);
++ if (!getenv("GS_GENERATE_UUIDS") ||
++ (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 &&
++ strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
+ {
+ pdf_xml_tag_open_beg(s, "xmp:ModifyDate");
+ pdf_xml_tag_end(s);
+@@ -700,6 +701,9 @@
+ pdf_xml_tag_close(s, "xmp:ModifyDate");
+ pdf_xml_newline(s);
+ }
++ if (!getenv("GS_GENERATE_UUIDS") ||
++ (strcasecmp(getenv("GS_GENERATE_UUIDS"), "0") != 0 &&
++ strcasecmp(getenv("GS_GENERATE_UUIDS"), "no") != 0))
+ {
+ pdf_xml_tag_open_beg(s, "xmp:CreateDate");
+ pdf_xml_tag_end(s);
diff --git a/gnu/packages/patches/glade-gls-set-script-name.patch b/gnu/packages/patches/glade-gls-set-script-name.patch
new file mode 100644
index 0000000000..61fbdf3914
--- /dev/null
+++ b/gnu/packages/patches/glade-gls-set-script-name.patch
@@ -0,0 +1,32 @@
+Taken from upstream:
+https://gitlab.gnome.org/GNOME/glade/-/commit/eb0429d318c017b57b9e59de1d5b3f142a0f455e.
+
+From 6cf1d3e11d4f8035f33c3003d33f6465896025a5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
+Date: Tue, 18 May 2021 19:54:50 +0200
+Subject: [PATCH] plugins: Define an invalid but non-null file path as script
+ path
+
+This is following the gjs applications behaviors, setting a valid string
+as the script path that will be shown in JS stack traces, even though
+won't load a real file through g_file_new_for_commandline_arg()
+---
+ plugins/gjs/glade-gjs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/plugins/gjs/glade-gjs.c b/plugins/gjs/glade-gjs.c
+index e1779665..aeae9906 100644
+--- a/plugins/gjs/glade-gjs.c
++++ b/plugins/gjs/glade-gjs.c
+@@ -93,7 +93,7 @@ glade_gjs_init (const gchar *name)
+
+ /* Importing the module will create all the GTypes so that glade can use them at runtime */
+ retval = gjs_context_eval (gjs_context_get_current (),
+- import_sentence, -1, NULL,
++ import_sentence, -1, "<glade-gjs>",
+ &exit_status,
+ &error);
+ if (!retval && error)
+--
+GitLab
+
diff --git a/gnu/packages/patches/glade-test-widget-null-icon.patch b/gnu/packages/patches/glade-test-widget-null-icon.patch
new file mode 100644
index 0000000000..75668a2f68
--- /dev/null
+++ b/gnu/packages/patches/glade-test-widget-null-icon.patch
@@ -0,0 +1,30 @@
+Taken from upstream:
+https://gitlab.gnome.org/GNOME/glade/-/commit/6cf1d3e11d4f8035f33c3003d33f6465896025a5.
+
+From eb0429d318c017b57b9e59de1d5b3f142a0f455e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
+Date: Wed, 19 May 2021 00:10:29 +0200
+Subject: [PATCH] tests: Do not create a file icon when no filename is provided
+
+This would fail otherwise as GFileIcon requires a GFile parameter on
+construction.
+---
+ tests/create-widgets.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tests/create-widgets.c b/tests/create-widgets.c
+index 2094059d..db8311f8 100644
+--- a/tests/create-widgets.c
++++ b/tests/create-widgets.c
+@@ -106,6 +106,8 @@ main (int argc,
+ if (G_TYPE_IS_INSTANTIATABLE (adaptor_type) && !G_TYPE_IS_ABSTRACT (adaptor_type) &&
+ /* FIXME: can not create a themed icon without a name */
+ !g_type_is_a (adaptor_type, G_TYPE_THEMED_ICON) &&
++ /* FIXME: can not create a file icon without a file name */
++ !g_type_is_a (adaptor_type, G_TYPE_FILE_ICON) &&
+ /* FIXME: GtkPopoverMenu gives a few warnings */
+ !g_type_is_a (adaptor_type, GTK_TYPE_POPOVER_MENU) &&
+ /* FIXME: GtkFileChooserNative is hard to test here */
+--
+GitLab
+
diff --git a/gnu/packages/patches/glib-CVE-2021-27218.patch b/gnu/packages/patches/glib-CVE-2021-27218.patch
deleted file mode 100644
index 00fa5ebf79..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27218.patch
+++ /dev/null
@@ -1,132 +0,0 @@
-Backport of:
-
-From 0f384c88a241bbbd884487b1c40b7b75f1e638d3 Mon Sep 17 00:00:00 2001
-From: Krzesimir Nowak <qdlacz@gmail.com>
-Date: Wed, 10 Feb 2021 23:51:07 +0100
-Subject: [PATCH] gbytearray: Do not accept too large byte arrays
-
-GByteArray uses guint for storing the length of the byte array, but it
-also has a constructor (g_byte_array_new_take) that takes length as a
-gsize. gsize may be larger than guint (64 bits for gsize vs 32 bits
-for guint). It is possible to call the function with a value greater
-than G_MAXUINT, which will result in silent length truncation. This
-may happen as a result of unreffing GBytes into GByteArray, so rather
-be loud about it.
-
-(Test case tweaked by Philip Withnall.)
-
-(Backport 2.66: Add #include gstrfuncsprivate.h in the test case for
-`g_memdup2()`.)
----
- glib/garray.c | 6 ++++++
- glib/gbytes.c | 4 ++++
- glib/tests/bytes.c | 35 ++++++++++++++++++++++++++++++++++-
- 3 files changed, 44 insertions(+), 1 deletion(-)
-
-diff --git a/glib/garray.c b/glib/garray.c
-index 942e74c9f..fb1a42aaf 100644
---- a/glib/garray.c
-+++ b/glib/garray.c
-@@ -2013,6 +2013,10 @@ g_byte_array_new (void)
- * Create byte array containing the data. The data will be owned by the array
- * and will be freed with g_free(), i.e. it could be allocated using g_strdup().
- *
-+ * Do not use it if @len is greater than %G_MAXUINT. #GByteArray
-+ * stores the length of its data in #guint, which may be shorter than
-+ * #gsize.
-+ *
- * Since: 2.32
- *
- * Returns: (transfer full): a new #GByteArray
-@@ -2024,6 +2028,8 @@ g_byte_array_new_take (guint8 *data,
- GByteArray *array;
- GRealArray *real;
-
-+ g_return_val_if_fail (len <= G_MAXUINT, NULL);
-+
- array = g_byte_array_new ();
- real = (GRealArray *)array;
- g_assert (real->data == NULL);
-diff --git a/glib/gbytes.c b/glib/gbytes.c
-index 7b72886e5..d56abe6c3 100644
---- a/glib/gbytes.c
-+++ b/glib/gbytes.c
-@@ -519,6 +519,10 @@ g_bytes_unref_to_data (GBytes *bytes,
- * g_bytes_new(), g_bytes_new_take() or g_byte_array_free_to_bytes(). In all
- * other cases the data is copied.
- *
-+ * Do not use it if @bytes contains more than %G_MAXUINT
-+ * bytes. #GByteArray stores the length of its data in #guint, which
-+ * may be shorter than #gsize, that @bytes is using.
-+ *
- * Returns: (transfer full): a new mutable #GByteArray containing the same byte data
- *
- * Since: 2.32
-diff --git a/glib/tests/bytes.c b/glib/tests/bytes.c
-index 5ea5c2b35..15a6aaad6 100644
---- a/glib/tests/bytes.c
-+++ b/glib/tests/bytes.c
-@@ -10,12 +10,12 @@
- */
-
- #undef G_DISABLE_ASSERT
--#undef G_LOG_DOMAIN
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "glib.h"
-+#include "glib/gstrfuncsprivate.h"
-
- /* Keep in sync with glib/gbytes.c */
- struct _GBytes
-@@ -333,6 +333,38 @@ test_to_array_transferred (void)
- g_byte_array_unref (array);
- }
-
-+static void
-+test_to_array_transferred_oversize (void)
-+{
-+ g_test_message ("g_bytes_unref_to_array() can only take GBytes up to "
-+ "G_MAXUINT in length; test that longer ones are rejected");
-+
-+ if (sizeof (guint) >= sizeof (gsize))
-+ {
-+ g_test_skip ("Skipping test as guint is not smaller than gsize");
-+ }
-+ else if (g_test_undefined ())
-+ {
-+ GByteArray *array = NULL;
-+ GBytes *bytes = NULL;
-+ gpointer data = g_memdup2 (NYAN, N_NYAN);
-+ gsize len = ((gsize) G_MAXUINT) + 1;
-+
-+ bytes = g_bytes_new_take (data, len);
-+ g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
-+ "g_byte_array_new_take: assertion 'len <= G_MAXUINT' failed");
-+ array = g_bytes_unref_to_array (g_steal_pointer (&bytes));
-+ g_test_assert_expected_messages ();
-+ g_assert_null (array);
-+
-+ g_free (data);
-+ }
-+ else
-+ {
-+ g_test_skip ("Skipping test as testing undefined behaviour is disabled");
-+ }
-+}
-+
- static void
- test_to_array_two_refs (void)
- {
-@@ -410,6 +442,7 @@ main (int argc, char *argv[])
- g_test_add_func ("/bytes/to-array/transfered", test_to_array_transferred);
- g_test_add_func ("/bytes/to-array/two-refs", test_to_array_two_refs);
- g_test_add_func ("/bytes/to-array/non-malloc", test_to_array_non_malloc);
-+ g_test_add_func ("/bytes/to-array/transferred/oversize", test_to_array_transferred_oversize);
- g_test_add_func ("/bytes/null", test_null);
-
- return g_test_run ();
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-01.patch b/gnu/packages/patches/glib-CVE-2021-27219-01.patch
deleted file mode 100644
index 5db360d468..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-01.patch
+++ /dev/null
@@ -1,176 +0,0 @@
-Backport of:
-
-From 5e5f75a77e399c638be66d74e5daa8caeb433e00 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 13:30:52 +0000
-Subject: [PATCH 01/11] gstrfuncs: Add internal g_memdup2() function
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This will replace the existing `g_memdup()` function for use within
-GLib. It has an unavoidable security flaw of taking its `byte_size`
-argument as a `guint` rather than as a `gsize`. Most callers will
-expect it to be a `gsize`, and may pass in large values which could
-silently be truncated, resulting in an undersize allocation compared
-to what the caller expects.
-
-This could lead to a classic buffer overflow vulnerability for many
-callers of `g_memdup()`.
-
-`g_memdup2()`, in comparison, takes its `byte_size` as a `gsize`.
-
-Spotted by Kevin Backhouse of GHSL.
-
-In GLib 2.68, `g_memdup2()` will be a new public API. In this version
-for backport to older stable releases, it’s a new `static inline` API
-in a private header, so that use of `g_memdup()` within GLib can be
-fixed without adding a new API in a stable release series.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: GHSL-2021-045
-Helps: #2319
----
- docs/reference/glib/meson.build | 1 +
- glib/gstrfuncsprivate.h | 55 +++++++++++++++++++++++++++++++++
- glib/meson.build | 1 +
- glib/tests/strfuncs.c | 23 ++++++++++++++
- 4 files changed, 80 insertions(+)
- create mode 100644 glib/gstrfuncsprivate.h
-
-diff --git a/docs/reference/glib/meson.build b/docs/reference/glib/meson.build
-index bba7649f0..ee39f6d04 100644
---- a/docs/reference/glib/meson.build
-+++ b/docs/reference/glib/meson.build
-@@ -22,6 +22,7 @@ if get_option('gtk_doc')
- 'gprintfint.h',
- 'gmirroringtable.h',
- 'gscripttable.h',
-+ 'gstrfuncsprivate.h',
- 'glib-mirroring-tab',
- 'gnulib',
- 'pcre',
-diff --git a/glib/gstrfuncsprivate.h b/glib/gstrfuncsprivate.h
-new file mode 100644
-index 000000000..85c88328a
---- /dev/null
-+++ b/glib/gstrfuncsprivate.h
-@@ -0,0 +1,55 @@
-+/* GLIB - Library of useful routines for C programming
-+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
-+ */
-+
-+#include <glib.h>
-+#include <string.h>
-+
-+/*
-+ * g_memdup2:
-+ * @mem: (nullable): the memory to copy.
-+ * @byte_size: the number of bytes to copy.
-+ *
-+ * Allocates @byte_size bytes of memory, and copies @byte_size bytes into it
-+ * from @mem. If @mem is %NULL it returns %NULL.
-+ *
-+ * This replaces g_memdup(), which was prone to integer overflows when
-+ * converting the argument from a #gsize to a #guint.
-+ *
-+ * This static inline version is a backport of the new public API from
-+ * GLib 2.68, kept internal to GLib for backport to older stable releases.
-+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2319.
-+ *
-+ * Returns: (nullable): a pointer to the newly-allocated copy of the memory,
-+ * or %NULL if @mem is %NULL.
-+ * Since: 2.68
-+ */
-+static inline gpointer
-+g_memdup2 (gconstpointer mem,
-+ gsize byte_size)
-+{
-+ gpointer new_mem;
-+
-+ if (mem && byte_size != 0)
-+ {
-+ new_mem = g_malloc (byte_size);
-+ memcpy (new_mem, mem, byte_size);
-+ }
-+ else
-+ new_mem = NULL;
-+
-+ return new_mem;
-+}
-diff --git a/glib/meson.build b/glib/meson.build
-index aaf5f00f5..5a6eea397 100644
---- a/glib/meson.build
-+++ b/glib/meson.build
-@@ -268,6 +268,7 @@ glib_sources = files(
- 'gslist.c',
- 'gstdio.c',
- 'gstrfuncs.c',
-+ 'gstrfuncsprivate.h',
- 'gstring.c',
- 'gstringchunk.c',
- 'gtestutils.c',
-diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c
-index e1f9619c7..d968afff9 100644
---- a/glib/tests/strfuncs.c
-+++ b/glib/tests/strfuncs.c
-@@ -32,6 +32,8 @@
- #include <string.h>
- #include "glib.h"
-
-+#include "gstrfuncsprivate.h"
-+
- #if defined (_MSC_VER) && (_MSC_VER <= 1800)
- #define isnan(x) _isnan(x)
-
-@@ -219,6 +221,26 @@ test_memdup (void)
- g_free (str_dup);
- }
-
-+/* Testing g_memdup2() function with various positive and negative cases */
-+static void
-+test_memdup2 (void)
-+{
-+ gchar *str_dup = NULL;
-+ const gchar *str = "The quick brown fox jumps over the lazy dog";
-+
-+ /* Testing negative cases */
-+ g_assert_null (g_memdup2 (NULL, 1024));
-+ g_assert_null (g_memdup2 (str, 0));
-+ g_assert_null (g_memdup2 (NULL, 0));
-+
-+ /* Testing normal usage cases */
-+ str_dup = g_memdup2 (str, strlen (str) + 1);
-+ g_assert_nonnull (str_dup);
-+ g_assert_cmpstr (str, ==, str_dup);
-+
-+ g_free (str_dup);
-+}
-+
- /* Testing g_strpcpy() function with various positive and negative cases */
- static void
- test_stpcpy (void)
-@@ -2523,6 +2545,7 @@ main (int argc,
- g_test_add_func ("/strfuncs/has-prefix", test_has_prefix);
- g_test_add_func ("/strfuncs/has-suffix", test_has_suffix);
- g_test_add_func ("/strfuncs/memdup", test_memdup);
-+ g_test_add_func ("/strfuncs/memdup2", test_memdup2);
- g_test_add_func ("/strfuncs/stpcpy", test_stpcpy);
- g_test_add_func ("/strfuncs/str_match_string", test_str_match_string);
- g_test_add_func ("/strfuncs/str_tokenize_and_fold", test_str_tokenize_and_fold);
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-02.patch b/gnu/packages/patches/glib-CVE-2021-27219-02.patch
deleted file mode 100644
index 431959fa8f..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-02.patch
+++ /dev/null
@@ -1,264 +0,0 @@
-Backport of:
-
-From be8834340a2d928ece82025463ae23dee2c333d0 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 13:37:56 +0000
-Subject: [PATCH 02/11] gio: Use g_memdup2() instead of g_memdup() in obvious
- places
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Convert all the call sites which use `g_memdup()`’s length argument
-trivially (for example, by passing a `sizeof()`), so that they use
-`g_memdup2()` instead.
-
-In almost all of these cases the use of `g_memdup()` would not have
-caused problems, but it will soon be deprecated, so best port away from
-it.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gio/gdbusconnection.c | 5 +++--
- gio/gdbusinterfaceskeleton.c | 3 ++-
- gio/gfile.c | 7 ++++---
- gio/gsettingsschema.c | 5 +++--
- gio/gwin32registrykey.c | 8 +++++---
- gio/tests/async-close-output-stream.c | 6 ++++--
- gio/tests/gdbus-export.c | 5 +++--
- gio/win32/gwinhttpfile.c | 9 +++++----
- 8 files changed, 29 insertions(+), 19 deletions(-)
-
-diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
-index f1f0921d4..d56453486 100644
---- a/gio/gdbusconnection.c
-+++ b/gio/gdbusconnection.c
-@@ -110,6 +110,7 @@
- #include "gasyncinitable.h"
- #include "giostream.h"
- #include "gasyncresult.h"
-+#include "gstrfuncsprivate.h"
- #include "gtask.h"
- #include "gmarshal-internal.h"
-
-@@ -3997,7 +3998,7 @@ _g_dbus_interface_vtable_copy (const GDBusInterfaceVTable *vtable)
- /* Don't waste memory by copying padding - remember to update this
- * when changing struct _GDBusInterfaceVTable in gdbusconnection.h
- */
-- return g_memdup ((gconstpointer) vtable, 3 * sizeof (gpointer));
-+ return g_memdup2 ((gconstpointer) vtable, 3 * sizeof (gpointer));
- }
-
- static void
-@@ -4014,7 +4015,7 @@ _g_dbus_subtree_vtable_copy (const GDBusSubtreeVTable *vtable)
- /* Don't waste memory by copying padding - remember to update this
- * when changing struct _GDBusSubtreeVTable in gdbusconnection.h
- */
-- return g_memdup ((gconstpointer) vtable, 3 * sizeof (gpointer));
-+ return g_memdup2 ((gconstpointer) vtable, 3 * sizeof (gpointer));
- }
-
- static void
-diff --git a/gio/gdbusinterfaceskeleton.c b/gio/gdbusinterfaceskeleton.c
-index 4a06516c1..4a4b719a5 100644
---- a/gio/gdbusinterfaceskeleton.c
-+++ b/gio/gdbusinterfaceskeleton.c
-@@ -28,6 +28,7 @@
- #include "gdbusmethodinvocation.h"
- #include "gdbusconnection.h"
- #include "gmarshal-internal.h"
-+#include "gstrfuncsprivate.h"
- #include "gtask.h"
- #include "gioerror.h"
-
-@@ -701,7 +702,7 @@ add_connection_locked (GDBusInterfaceSkeleton *interface_,
- * properly before building the hooked_vtable, so we create it
- * once at the last minute.
- */
-- interface_->priv->hooked_vtable = g_memdup (g_dbus_interface_skeleton_get_vtable (interface_), sizeof (GDBusInterfaceVTable));
-+ interface_->priv->hooked_vtable = g_memdup2 (g_dbus_interface_skeleton_get_vtable (interface_), sizeof (GDBusInterfaceVTable));
- interface_->priv->hooked_vtable->method_call = skeleton_intercept_handle_method_call;
- }
-
-diff --git a/gio/gfile.c b/gio/gfile.c
-index ba93f7c75..88b341e7d 100644
---- a/gio/gfile.c
-+++ b/gio/gfile.c
-@@ -60,6 +60,7 @@
- #include "gasyncresult.h"
- #include "gioerror.h"
- #include "glibintl.h"
-+#include "gstrfuncsprivate.h"
-
-
- /**
-@@ -7884,7 +7885,7 @@ measure_disk_usage_progress (gboolean reporting,
- g_main_context_invoke_full (g_task_get_context (task),
- g_task_get_priority (task),
- measure_disk_usage_invoke_progress,
-- g_memdup (&progress, sizeof progress),
-+ g_memdup2 (&progress, sizeof progress),
- g_free);
- }
-
-@@ -7902,7 +7903,7 @@ measure_disk_usage_thread (GTask *task,
- data->progress_callback ? measure_disk_usage_progress : NULL, task,
- &result.disk_usage, &result.num_dirs, &result.num_files,
- &error))
-- g_task_return_pointer (task, g_memdup (&result, sizeof result), g_free);
-+ g_task_return_pointer (task, g_memdup2 (&result, sizeof result), g_free);
- else
- g_task_return_error (task, error);
- }
-@@ -7926,7 +7927,7 @@ g_file_real_measure_disk_usage_async (GFile *file,
-
- task = g_task_new (file, cancellable, callback, user_data);
- g_task_set_source_tag (task, g_file_real_measure_disk_usage_async);
-- g_task_set_task_data (task, g_memdup (&data, sizeof data), g_free);
-+ g_task_set_task_data (task, g_memdup2 (&data, sizeof data), g_free);
- g_task_set_priority (task, io_priority);
-
- g_task_run_in_thread (task, measure_disk_usage_thread);
-diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
-index 3a60b8c64..dded9b1ca 100644
---- a/gio/gsettingsschema.c
-+++ b/gio/gsettingsschema.c
-@@ -20,6 +20,7 @@
-
- #include "gsettingsschema-internal.h"
- #include "gsettings.h"
-+#include "gstrfuncsprivate.h"
-
- #include "gvdb/gvdb-reader.h"
- #include "strinfo.c"
-@@ -1058,9 +1059,9 @@ g_settings_schema_list_children (GSettingsSchema *schema)
-
- if (g_str_has_suffix (key, "/"))
- {
-- gint length = strlen (key);
-+ gsize length = strlen (key);
-
-- strv[j] = g_memdup (key, length);
-+ strv[j] = g_memdup2 (key, length);
- strv[j][length - 1] = '\0';
- j++;
- }
-diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c
-index c19fede4e..619fd48af 100644
---- a/gio/gwin32registrykey.c
-+++ b/gio/gwin32registrykey.c
-@@ -28,6 +28,8 @@
- #include <ntstatus.h>
- #include <winternl.h>
-
-+#include "gstrfuncsprivate.h"
-+
- #ifndef _WDMDDK_
- typedef enum _KEY_INFORMATION_CLASS {
- KeyBasicInformation,
-@@ -247,7 +249,7 @@ g_win32_registry_value_iter_copy (const GWin32RegistryValueIter *iter)
- new_iter->value_name_size = iter->value_name_size;
-
- if (iter->value_data != NULL)
-- new_iter->value_data = g_memdup (iter->value_data, iter->value_data_size);
-+ new_iter->value_data = g_memdup2 (iter->value_data, iter->value_data_size);
-
- new_iter->value_data_size = iter->value_data_size;
-
-@@ -268,8 +270,8 @@ g_win32_registry_value_iter_copy (const GWin32RegistryValueIter *iter)
- new_iter->value_data_expanded_charsize = iter->value_data_expanded_charsize;
-
- if (iter->value_data_expanded_u8 != NULL)
-- new_iter->value_data_expanded_u8 = g_memdup (iter->value_data_expanded_u8,
-- iter->value_data_expanded_charsize);
-+ new_iter->value_data_expanded_u8 = g_memdup2 (iter->value_data_expanded_u8,
-+ iter->value_data_expanded_charsize);
-
- new_iter->value_data_expanded_u8_size = iter->value_data_expanded_charsize;
-
-diff --git a/gio/tests/async-close-output-stream.c b/gio/tests/async-close-output-stream.c
-index 5f6620275..d3f97a119 100644
---- a/gio/tests/async-close-output-stream.c
-+++ b/gio/tests/async-close-output-stream.c
-@@ -24,6 +24,8 @@
- #include <stdlib.h>
- #include <string.h>
-
-+#include "gstrfuncsprivate.h"
-+
- #define DATA_TO_WRITE "Hello world\n"
-
- typedef struct
-@@ -147,9 +149,9 @@ prepare_data (SetupData *data,
-
- data->expected_size = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (data->data_stream));
-
-- g_assert_cmpint (data->expected_size, >, 0);
-+ g_assert_cmpuint (data->expected_size, >, 0);
-
-- data->expected_output = g_memdup (written, (guint)data->expected_size);
-+ data->expected_output = g_memdup2 (written, data->expected_size);
-
- /* then recreate the streams and prepare them for the asynchronous close */
- destroy_streams (data);
-diff --git a/gio/tests/gdbus-export.c b/gio/tests/gdbus-export.c
-index 506c7458a..5513306f8 100644
---- a/gio/tests/gdbus-export.c
-+++ b/gio/tests/gdbus-export.c
-@@ -23,6 +23,7 @@
- #include <string.h>
-
- #include "gdbus-tests.h"
-+#include "gstrfuncsprivate.h"
-
- /* all tests rely on a shared mainloop */
- static GMainLoop *loop = NULL;
-@@ -671,7 +672,7 @@ subtree_introspect (GDBusConnection *connection,
- g_assert_not_reached ();
- }
-
-- return g_memdup (interfaces, 2 * sizeof (void *));
-+ return g_memdup2 (interfaces, 2 * sizeof (void *));
- }
-
- static const GDBusInterfaceVTable *
-@@ -727,7 +728,7 @@ dynamic_subtree_introspect (GDBusConnection *connection,
- {
- const GDBusInterfaceInfo *interfaces[2] = { &dyna_interface_info, NULL };
-
-- return g_memdup (interfaces, 2 * sizeof (void *));
-+ return g_memdup2 (interfaces, 2 * sizeof (void *));
- }
-
- static const GDBusInterfaceVTable *
-diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c
-index cf5eed31d..040ee8564 100644
---- a/gio/win32/gwinhttpfile.c
-+++ b/gio/win32/gwinhttpfile.c
-@@ -29,6 +29,7 @@
- #include "gio/gfile.h"
- #include "gio/gfileattribute.h"
- #include "gio/gfileinfo.h"
-+#include "gstrfuncsprivate.h"
- #include "gwinhttpfile.h"
- #include "gwinhttpfileinputstream.h"
- #include "gwinhttpfileoutputstream.h"
-@@ -393,10 +394,10 @@ g_winhttp_file_resolve_relative_path (GFile *file,
- child = g_object_new (G_TYPE_WINHTTP_FILE, NULL);
- child->vfs = winhttp_file->vfs;
- child->url = winhttp_file->url;
-- child->url.lpszScheme = g_memdup (winhttp_file->url.lpszScheme, (winhttp_file->url.dwSchemeLength+1)*2);
-- child->url.lpszHostName = g_memdup (winhttp_file->url.lpszHostName, (winhttp_file->url.dwHostNameLength+1)*2);
-- child->url.lpszUserName = g_memdup (winhttp_file->url.lpszUserName, (winhttp_file->url.dwUserNameLength+1)*2);
-- child->url.lpszPassword = g_memdup (winhttp_file->url.lpszPassword, (winhttp_file->url.dwPasswordLength+1)*2);
-+ child->url.lpszScheme = g_memdup2 (winhttp_file->url.lpszScheme, (winhttp_file->url.dwSchemeLength+1)*2);
-+ child->url.lpszHostName = g_memdup2 (winhttp_file->url.lpszHostName, (winhttp_file->url.dwHostNameLength+1)*2);
-+ child->url.lpszUserName = g_memdup2 (winhttp_file->url.lpszUserName, (winhttp_file->url.dwUserNameLength+1)*2);
-+ child->url.lpszPassword = g_memdup2 (winhttp_file->url.lpszPassword, (winhttp_file->url.dwPasswordLength+1)*2);
- child->url.lpszUrlPath = wnew_path;
- child->url.dwUrlPathLength = wcslen (wnew_path);
- child->url.lpszExtraInfo = NULL;
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-03.patch b/gnu/packages/patches/glib-CVE-2021-27219-03.patch
deleted file mode 100644
index 99e849c43c..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-03.patch
+++ /dev/null
@@ -1,136 +0,0 @@
-From 6110caea45b235420b98cd41d845cc92238f6781 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 13:39:25 +0000
-Subject: [PATCH 03/11] gobject: Use g_memdup2() instead of g_memdup() in
- obvious places
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Convert all the call sites which use `g_memdup()`’s length argument
-trivially (for example, by passing a `sizeof()`), so that they use
-`g_memdup2()` instead.
-
-In almost all of these cases the use of `g_memdup()` would not have
-caused problems, but it will soon be deprecated, so best port away from
-it.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gobject/gsignal.c | 3 ++-
- gobject/gtype.c | 9 +++++----
- gobject/gtypemodule.c | 3 ++-
- gobject/tests/param.c | 4 +++-
- 4 files changed, 12 insertions(+), 7 deletions(-)
-
-diff --git a/gobject/gsignal.c b/gobject/gsignal.c
-index 77d8f211e..41c54ab57 100644
---- a/gobject/gsignal.c
-+++ b/gobject/gsignal.c
-@@ -28,6 +28,7 @@
- #include <signal.h>
-
- #include "gsignal.h"
-+#include "gstrfuncsprivate.h"
- #include "gtype-private.h"
- #include "gbsearcharray.h"
- #include "gvaluecollector.h"
-@@ -1730,7 +1731,7 @@ g_signal_newv (const gchar *signal_name,
- node->single_va_closure_is_valid = FALSE;
- node->flags = signal_flags & G_SIGNAL_FLAGS_MASK;
- node->n_params = n_params;
-- node->param_types = g_memdup (param_types, sizeof (GType) * n_params);
-+ node->param_types = g_memdup2 (param_types, sizeof (GType) * n_params);
- node->return_type = return_type;
- node->class_closure_bsa = NULL;
- if (accumulator)
-diff --git a/gobject/gtype.c b/gobject/gtype.c
-index 7d3789400..8441b90e9 100644
---- a/gobject/gtype.c
-+++ b/gobject/gtype.c
-@@ -33,6 +33,7 @@
-
- #include "glib-private.h"
- #include "gconstructor.h"
-+#include "gstrfuncsprivate.h"
-
- #ifdef G_OS_WIN32
- #include <windows.h>
-@@ -1470,7 +1471,7 @@ type_add_interface_Wm (TypeNode *node,
- iholder->next = iface_node_get_holders_L (iface);
- iface_node_set_holders_W (iface, iholder);
- iholder->instance_type = NODE_TYPE (node);
-- iholder->info = info ? g_memdup (info, sizeof (*info)) : NULL;
-+ iholder->info = info ? g_memdup2 (info, sizeof (*info)) : NULL;
- iholder->plugin = plugin;
-
- /* create an iface entry for this type */
-@@ -1731,7 +1732,7 @@ type_iface_retrieve_holder_info_Wm (TypeNode *iface,
- INVALID_RECURSION ("g_type_plugin_*", iholder->plugin, NODE_NAME (iface));
-
- check_interface_info_I (iface, instance_type, &tmp_info);
-- iholder->info = g_memdup (&tmp_info, sizeof (tmp_info));
-+ iholder->info = g_memdup2 (&tmp_info, sizeof (tmp_info));
- }
-
- return iholder; /* we don't modify write lock upon returning NULL */
-@@ -2016,10 +2017,10 @@ type_iface_vtable_base_init_Wm (TypeNode *iface,
- IFaceEntry *pentry = type_lookup_iface_entry_L (pnode, iface);
-
- if (pentry)
-- vtable = g_memdup (pentry->vtable, iface->data->iface.vtable_size);
-+ vtable = g_memdup2 (pentry->vtable, iface->data->iface.vtable_size);
- }
- if (!vtable)
-- vtable = g_memdup (iface->data->iface.dflt_vtable, iface->data->iface.vtable_size);
-+ vtable = g_memdup2 (iface->data->iface.dflt_vtable, iface->data->iface.vtable_size);
- entry->vtable = vtable;
- vtable->g_type = NODE_TYPE (iface);
- vtable->g_instance_type = NODE_TYPE (node);
-diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c
-index 4ecaf8c88..20911fafd 100644
---- a/gobject/gtypemodule.c
-+++ b/gobject/gtypemodule.c
-@@ -19,6 +19,7 @@
-
- #include <stdlib.h>
-
-+#include "gstrfuncsprivate.h"
- #include "gtypeplugin.h"
- #include "gtypemodule.h"
-
-@@ -436,7 +437,7 @@ g_type_module_register_type (GTypeModule *module,
- module_type_info->loaded = TRUE;
- module_type_info->info = *type_info;
- if (type_info->value_table)
-- module_type_info->info.value_table = g_memdup (type_info->value_table,
-+ module_type_info->info.value_table = g_memdup2 (type_info->value_table,
- sizeof (GTypeValueTable));
-
- return module_type_info->type;
-diff --git a/gobject/tests/param.c b/gobject/tests/param.c
-index 758289bf8..971cff162 100644
---- a/gobject/tests/param.c
-+++ b/gobject/tests/param.c
-@@ -2,6 +2,8 @@
- #include <glib-object.h>
- #include <stdlib.h>
-
-+#include "gstrfuncsprivate.h"
-+
- static void
- test_param_value (void)
- {
-@@ -851,7 +853,7 @@ main (int argc, char *argv[])
- test_path = g_strdup_printf ("/param/implement/subprocess/%d-%d-%d-%d",
- data.change_this_flag, data.change_this_type,
- data.use_this_flag, data.use_this_type);
-- test_data = g_memdup (&data, sizeof (TestParamImplementData));
-+ test_data = g_memdup2 (&data, sizeof (TestParamImplementData));
- g_test_add_data_func_full (test_path, test_data, test_param_implement_child, g_free);
- g_free (test_path);
- }
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-04.patch b/gnu/packages/patches/glib-CVE-2021-27219-04.patch
deleted file mode 100644
index 3ae01f34b1..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-04.patch
+++ /dev/null
@@ -1,308 +0,0 @@
-Backport of:
-
-From 0736b7c1e7cf4232c5d7eb2b0fbfe9be81bd3baa Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 13:41:21 +0000
-Subject: [PATCH 04/11] glib: Use g_memdup2() instead of g_memdup() in obvious
- places
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Convert all the call sites which use `g_memdup()`’s length argument
-trivially (for example, by passing a `sizeof()` or an existing `gsize`
-variable), so that they use `g_memdup2()` instead.
-
-In almost all of these cases the use of `g_memdup()` would not have
-caused problems, but it will soon be deprecated, so best port away from
-it
-
-In particular, this fixes an overflow within `g_bytes_new()`, identified
-as GHSL-2021-045 by GHSL team member Kevin Backhouse.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Fixes: GHSL-2021-045
-Helps: #2319
----
- glib/gbytes.c | 6 ++++--
- glib/gdir.c | 3 ++-
- glib/ghash.c | 7 ++++---
- glib/giochannel.c | 3 ++-
- glib/gslice.c | 3 ++-
- glib/gtestutils.c | 3 ++-
- glib/gvariant.c | 7 ++++---
- glib/gvarianttype.c | 3 ++-
- glib/tests/array-test.c | 4 +++-
- glib/tests/option-context.c | 6 ++++--
- 10 files changed, 29 insertions(+), 16 deletions(-)
-
-diff --git a/glib/gbytes.c b/glib/gbytes.c
-index d56abe6c3..dee494820 100644
---- a/glib/gbytes.c
-+++ b/glib/gbytes.c
-@@ -34,6 +34,8 @@
-
- #include <string.h>
-
-+#include "gstrfuncsprivate.h"
-+
- /**
- * GBytes:
- *
-@@ -95,7 +97,7 @@ g_bytes_new (gconstpointer data,
- {
- g_return_val_if_fail (data != NULL || size == 0, NULL);
-
-- return g_bytes_new_take (g_memdup (data, size), size);
-+ return g_bytes_new_take (g_memdup2 (data, size), size);
- }
-
- /**
-@@ -499,7 +501,7 @@ g_bytes_unref_to_data (GBytes *bytes,
- * Copy: Non g_malloc (or compatible) allocator, or static memory,
- * so we have to copy, and then unref.
- */
-- result = g_memdup (bytes->data, bytes->size);
-+ result = g_memdup2 (bytes->data, bytes->size);
- *size = bytes->size;
- g_bytes_unref (bytes);
- }
-diff --git a/glib/gdir.c b/glib/gdir.c
-index 6b85e99c8..6747a8c6f 100644
---- a/glib/gdir.c
-+++ b/glib/gdir.c
-@@ -37,6 +37,7 @@
- #include "gconvert.h"
- #include "gfileutils.h"
- #include "gstrfuncs.h"
-+#include "gstrfuncsprivate.h"
- #include "gtestutils.h"
- #include "glibintl.h"
-
-@@ -112,7 +113,7 @@ g_dir_open_with_errno (const gchar *path,
- return NULL;
- #endif
-
-- return g_memdup (&dir, sizeof dir);
-+ return g_memdup2 (&dir, sizeof dir);
- }
-
- /**
-diff --git a/glib/ghash.c b/glib/ghash.c
-index e61b03788..26f26062b 100644
---- a/glib/ghash.c
-+++ b/glib/ghash.c
-@@ -34,6 +34,7 @@
- #include "gmacros.h"
- #include "glib-private.h"
- #include "gstrfuncs.h"
-+#include "gstrfuncsprivate.h"
- #include "gatomic.h"
- #include "gtestutils.h"
- #include "gslice.h"
-@@ -964,7 +965,7 @@ g_hash_table_ensure_keyval_fits (GHashTable *hash_table, gpointer key, gpointer
- if (hash_table->have_big_keys)
- {
- if (key != value)
-- hash_table->values = g_memdup (hash_table->keys, sizeof (gpointer) * hash_table->size);
-+ hash_table->values = g_memdup2 (hash_table->keys, sizeof (gpointer) * hash_table->size);
- /* Keys and values are both big now, so no need for further checks */
- return;
- }
-@@ -972,7 +973,7 @@ g_hash_table_ensure_keyval_fits (GHashTable *hash_table, gpointer key, gpointer
- {
- if (key != value)
- {
-- hash_table->values = g_memdup (hash_table->keys, sizeof (guint) * hash_table->size);
-+ hash_table->values = g_memdup2 (hash_table->keys, sizeof (guint) * hash_table->size);
- is_a_set = FALSE;
- }
- }
-@@ -1000,7 +1001,7 @@ g_hash_table_ensure_keyval_fits (GHashTable *hash_table, gpointer key, gpointer
-
- /* Just split if necessary */
- if (is_a_set && key != value)
-- hash_table->values = g_memdup (hash_table->keys, sizeof (gpointer) * hash_table->size);
-+ hash_table->values = g_memdup2 (hash_table->keys, sizeof (gpointer) * hash_table->size);
-
- #endif
- }
-diff --git a/glib/giochannel.c b/glib/giochannel.c
-index 1956e9dc6..15927c391 100644
---- a/glib/giochannel.c
-+++ b/glib/giochannel.c
-@@ -37,6 +37,7 @@
- #include "giochannel.h"
-
- #include "gstrfuncs.h"
-+#include "gstrfuncsprivate.h"
- #include "gtestutils.h"
- #include "glibintl.h"
-
-@@ -892,7 +893,7 @@ g_io_channel_set_line_term (GIOChannel *channel,
- length = strlen (line_term);
-
- g_free (channel->line_term);
-- channel->line_term = line_term ? g_memdup (line_term, length) : NULL;
-+ channel->line_term = line_term ? g_memdup2 (line_term, length) : NULL;
- channel->line_term_len = length;
- }
-
-diff --git a/glib/gslice.c b/glib/gslice.c
-index 4c758c3be..bcdbb8853 100644
---- a/glib/gslice.c
-+++ b/glib/gslice.c
-@@ -41,6 +41,7 @@
- #include "gmain.h"
- #include "gmem.h" /* gslice.h */
- #include "gstrfuncs.h"
-+#include "gstrfuncsprivate.h"
- #include "gutils.h"
- #include "gtrashstack.h"
- #include "gtestutils.h"
-@@ -350,7 +351,7 @@ g_slice_get_config_state (GSliceConfig ckey,
- array[i++] = allocator->contention_counters[address];
- array[i++] = allocator_get_magazine_threshold (allocator, address);
- *n_values = i;
-- return g_memdup (array, sizeof (array[0]) * *n_values);
-+ return g_memdup2 (array, sizeof (array[0]) * *n_values);
- default:
- return NULL;
- }
-diff --git a/glib/gtestutils.c b/glib/gtestutils.c
-index dd789482f..5887ecc36 100644
---- a/glib/gtestutils.c
-+++ b/glib/gtestutils.c
-@@ -49,6 +49,7 @@
- #include "gpattern.h"
- #include "grand.h"
- #include "gstrfuncs.h"
-+#include "gstrfuncsprivate.h"
- #include "gtimer.h"
- #include "gslice.h"
- #include "gspawn.h"
-@@ -3798,7 +3799,7 @@ g_test_log_extract (GTestLogBuffer *tbuffer)
- if (p <= tbuffer->data->str + mlength)
- {
- g_string_erase (tbuffer->data, 0, mlength);
-- tbuffer->msgs = g_slist_prepend (tbuffer->msgs, g_memdup (&msg, sizeof (msg)));
-+ tbuffer->msgs = g_slist_prepend (tbuffer->msgs, g_memdup2 (&msg, sizeof (msg)));
- return TRUE;
- }
-
-diff --git a/glib/gvariant.c b/glib/gvariant.c
-index b61bf7278..d6f68a9ea 100644
---- a/glib/gvariant.c
-+++ b/glib/gvariant.c
-@@ -33,6 +33,7 @@
-
- #include <string.h>
-
-+#include "gstrfuncsprivate.h"
-
- /**
- * SECTION:gvariant
-@@ -725,7 +726,7 @@ g_variant_new_variant (GVariant *value)
- g_variant_ref_sink (value);
-
- return g_variant_new_from_children (G_VARIANT_TYPE_VARIANT,
-- g_memdup (&value, sizeof value),
-+ g_memdup2 (&value, sizeof value),
- 1, g_variant_is_trusted (value));
- }
-
-@@ -1229,7 +1230,7 @@ g_variant_new_fixed_array (const GVariantType *element_type,
- return NULL;
- }
-
-- data = g_memdup (elements, n_elements * element_size);
-+ data = g_memdup2 (elements, n_elements * element_size);
- value = g_variant_new_from_data (array_type, data,
- n_elements * element_size,
- FALSE, g_free, data);
-@@ -1908,7 +1909,7 @@ g_variant_dup_bytestring (GVariant *value,
- if (length)
- *length = size;
-
-- return g_memdup (original, size + 1);
-+ return g_memdup2 (original, size + 1);
- }
-
- /**
-diff --git a/glib/gvarianttype.c b/glib/gvarianttype.c
-index 1a228f73b..07659ff12 100644
---- a/glib/gvarianttype.c
-+++ b/glib/gvarianttype.c
-@@ -28,6 +28,7 @@
-
- #include <string.h>
-
-+#include "gstrfuncsprivate.h"
-
- /**
- * SECTION:gvarianttype
-@@ -1181,7 +1182,7 @@ g_variant_type_new_tuple (const GVariantType * const *items,
- g_assert (offset < sizeof buffer);
- buffer[offset++] = ')';
-
-- return (GVariantType *) g_memdup (buffer, offset);
-+ return (GVariantType *) g_memdup2 (buffer, offset);
- }
-
- /**
-diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c
-index 3fcf1136a..11982f822 100644
---- a/glib/tests/array-test.c
-+++ b/glib/tests/array-test.c
-@@ -29,6 +29,8 @@
- #include <string.h>
- #include "glib.h"
-
-+#include "gstrfuncsprivate.h"
-+
- /* Test data to be passed to any function which calls g_array_new(), providing
- * the parameters for that call. Most #GArray tests should be repeated for all
- * possible values of #ArrayTestData. */
-@@ -1642,7 +1644,7 @@ byte_array_new_take (void)
- GByteArray *gbarray;
- guint8 *data;
-
-- data = g_memdup ("woooweeewow", 11);
-+ data = g_memdup2 ("woooweeewow", 11);
- gbarray = g_byte_array_new_take (data, 11);
- g_assert (gbarray->data == data);
- g_assert_cmpuint (gbarray->len, ==, 11);
-diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c
-index 149d22353..88d2b80d1 100644
---- a/glib/tests/option-context.c
-+++ b/glib/tests/option-context.c
-@@ -27,6 +27,8 @@
- #include <string.h>
- #include <locale.h>
-
-+#include "gstrfuncsprivate.h"
-+
- static GOptionEntry main_entries[] = {
- { "main-switch", 0, 0,
- G_OPTION_ARG_NONE, NULL,
-@@ -256,7 +258,7 @@ join_stringv (int argc, char **argv)
- static char **
- copy_stringv (char **argv, int argc)
- {
-- return g_memdup (argv, sizeof (char *) * (argc + 1));
-+ return g_memdup2 (argv, sizeof (char *) * (argc + 1));
- }
-
- static void
-@@ -2323,7 +2325,7 @@ test_group_parse (void)
- g_option_context_add_group (context, group);
-
- argv = split_string ("program --test arg1 -f arg2 --group-test arg3 --frob arg4 -z arg5", &argc);
-- orig_argv = g_memdup (argv, (argc + 1) * sizeof (char *));
-+ orig_argv = g_memdup2 (argv, (argc + 1) * sizeof (char *));
-
- retval = g_option_context_parse (context, &argc, &argv, &error);
-
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-05.patch b/gnu/packages/patches/glib-CVE-2021-27219-05.patch
deleted file mode 100644
index 62bce1b188..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-05.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 0cbad673215ec8a049b7fe2ff44b0beed31b376e Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 16:12:24 +0000
-Subject: [PATCH 05/11] gwinhttpfile: Avoid arithmetic overflow when
- calculating a size
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The members of `URL_COMPONENTS` (`winhttp_file->url`) are `DWORD`s, i.e.
-32-bit unsigned integers. Adding to and multiplying them may cause them
-to overflow the unsigned integer bounds, even if the result is passed to
-`g_memdup2()` which accepts a `gsize`.
-
-Cast the `URL_COMPONENTS` members to `gsize` first to ensure that the
-arithmetic is done in terms of `gsize`s rather than unsigned integers.
-
-Spotted by Sebastian Dröge.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gio/win32/gwinhttpfile.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/gio/win32/gwinhttpfile.c b/gio/win32/gwinhttpfile.c
-index 040ee8564..246ec0578 100644
---- a/gio/win32/gwinhttpfile.c
-+++ b/gio/win32/gwinhttpfile.c
-@@ -394,10 +394,10 @@ g_winhttp_file_resolve_relative_path (GFile *file,
- child = g_object_new (G_TYPE_WINHTTP_FILE, NULL);
- child->vfs = winhttp_file->vfs;
- child->url = winhttp_file->url;
-- child->url.lpszScheme = g_memdup2 (winhttp_file->url.lpszScheme, (winhttp_file->url.dwSchemeLength+1)*2);
-- child->url.lpszHostName = g_memdup2 (winhttp_file->url.lpszHostName, (winhttp_file->url.dwHostNameLength+1)*2);
-- child->url.lpszUserName = g_memdup2 (winhttp_file->url.lpszUserName, (winhttp_file->url.dwUserNameLength+1)*2);
-- child->url.lpszPassword = g_memdup2 (winhttp_file->url.lpszPassword, (winhttp_file->url.dwPasswordLength+1)*2);
-+ child->url.lpszScheme = g_memdup2 (winhttp_file->url.lpszScheme, ((gsize) winhttp_file->url.dwSchemeLength + 1) * 2);
-+ child->url.lpszHostName = g_memdup2 (winhttp_file->url.lpszHostName, ((gsize) winhttp_file->url.dwHostNameLength + 1) * 2);
-+ child->url.lpszUserName = g_memdup2 (winhttp_file->url.lpszUserName, ((gsize) winhttp_file->url.dwUserNameLength + 1) * 2);
-+ child->url.lpszPassword = g_memdup2 (winhttp_file->url.lpszPassword, ((gsize) winhttp_file->url.dwPasswordLength + 1) * 2);
- child->url.lpszUrlPath = wnew_path;
- child->url.dwUrlPathLength = wcslen (wnew_path);
- child->url.lpszExtraInfo = NULL;
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-06.patch b/gnu/packages/patches/glib-CVE-2021-27219-06.patch
deleted file mode 100644
index 4e2435f5fd..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-06.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From f9ee2275cbc312c0b4cdbc338a4fbb76eb36fb9a Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 13:49:00 +0000
-Subject: [PATCH 06/11] gdatainputstream: Handle stop_chars_len internally as
- gsize
-
-Previously it was handled as a `gssize`, which meant that if the
-`stop_chars` string was longer than `G_MAXSSIZE` there would be an
-overflow.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gio/gdatainputstream.c | 25 +++++++++++++++++--------
- 1 file changed, 17 insertions(+), 8 deletions(-)
-
-diff --git a/gio/gdatainputstream.c b/gio/gdatainputstream.c
-index 2e7750cb5..2cdcbda19 100644
---- a/gio/gdatainputstream.c
-+++ b/gio/gdatainputstream.c
-@@ -27,6 +27,7 @@
- #include "gioenumtypes.h"
- #include "gioerror.h"
- #include "glibintl.h"
-+#include "gstrfuncsprivate.h"
-
- #include <string.h>
-
-@@ -856,7 +857,7 @@ static gssize
- scan_for_chars (GDataInputStream *stream,
- gsize *checked_out,
- const char *stop_chars,
-- gssize stop_chars_len)
-+ gsize stop_chars_len)
- {
- GBufferedInputStream *bstream;
- const char *buffer;
-@@ -952,7 +953,7 @@ typedef struct
- gsize checked;
-
- gchar *stop_chars;
-- gssize stop_chars_len;
-+ gsize stop_chars_len;
- gsize length;
- } GDataInputStreamReadData;
-
-@@ -1078,12 +1079,17 @@ g_data_input_stream_read_async (GDataInputStream *stream,
- {
- GDataInputStreamReadData *data;
- GTask *task;
-+ gsize stop_chars_len_unsigned;
-
- data = g_slice_new0 (GDataInputStreamReadData);
-- if (stop_chars_len == -1)
-- stop_chars_len = strlen (stop_chars);
-- data->stop_chars = g_memdup (stop_chars, stop_chars_len);
-- data->stop_chars_len = stop_chars_len;
-+
-+ if (stop_chars_len < 0)
-+ stop_chars_len_unsigned = strlen (stop_chars);
-+ else
-+ stop_chars_len_unsigned = (gsize) stop_chars_len;
-+
-+ data->stop_chars = g_memdup2 (stop_chars, stop_chars_len_unsigned);
-+ data->stop_chars_len = stop_chars_len_unsigned;
- data->last_saw_cr = FALSE;
-
- task = g_task_new (stream, cancellable, callback, user_data);
-@@ -1338,17 +1344,20 @@ g_data_input_stream_read_upto (GDataInputStream *stream,
- gssize found_pos;
- gssize res;
- char *data_until;
-+ gsize stop_chars_len_unsigned;
-
- g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), NULL);
-
- if (stop_chars_len < 0)
-- stop_chars_len = strlen (stop_chars);
-+ stop_chars_len_unsigned = strlen (stop_chars);
-+ else
-+ stop_chars_len_unsigned = (gsize) stop_chars_len;
-
- bstream = G_BUFFERED_INPUT_STREAM (stream);
-
- checked = 0;
-
-- while ((found_pos = scan_for_chars (stream, &checked, stop_chars, stop_chars_len)) == -1)
-+ while ((found_pos = scan_for_chars (stream, &checked, stop_chars, stop_chars_len_unsigned)) == -1)
- {
- if (g_buffered_input_stream_get_available (bstream) ==
- g_buffered_input_stream_get_buffer_size (bstream))
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-07.patch b/gnu/packages/patches/glib-CVE-2021-27219-07.patch
deleted file mode 100644
index dad3d285f4..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-07.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-Backport of:
-
-From 2aaf593a9eb96d84fe3be740aca2810a97d95592 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 13:50:37 +0000
-Subject: [PATCH 07/11] gwin32: Use gsize internally in g_wcsdup()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This allows it to handle strings up to length `G_MAXSIZE` — previously
-it would overflow with such strings.
-
-Update the several copies of it identically.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gio/gwin32appinfo.c | 33 ++++++++++++++++++++++++++-------
- gio/gwin32registrykey.c | 34 ++++++++++++++++++++++++++--------
- 2 files changed, 52 insertions(+), 15 deletions(-)
-
-diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c
-index 9f335b370..dd7a96a4a 100644
---- a/gio/gwin32appinfo.c
-+++ b/gio/gwin32appinfo.c
-@@ -464,15 +464,34 @@ static GWin32RegistryKey *applications_key;
- /* Watch this key */
- static GWin32RegistryKey *classes_root_key;
-
-+static gsize
-+g_utf16_len (const gunichar2 *str)
-+{
-+ gsize result;
-+
-+ for (result = 0; str[0] != 0; str++, result++)
-+ ;
-+
-+ return result;
-+}
-+
- static gunichar2 *
--g_wcsdup (const gunichar2 *str, gssize str_size)
-+g_wcsdup (const gunichar2 *str, gssize str_len)
- {
-- if (str_size == -1)
-- {
-- str_size = wcslen (str) + 1;
-- str_size *= sizeof (gunichar2);
-- }
-- return g_memdup (str, str_size);
-+ gsize str_len_unsigned;
-+ gsize str_size;
-+
-+ g_return_val_if_fail (str != NULL, NULL);
-+
-+ if (str_len < 0)
-+ str_len_unsigned = g_utf16_len (str);
-+ else
-+ str_len_unsigned = (gsize) str_len;
-+
-+ g_assert (str_len_unsigned <= G_MAXSIZE / sizeof (gunichar2) - 1);
-+ str_size = (str_len_unsigned + 1) * sizeof (gunichar2);
-+
-+ return g_memdup2 (str, str_size);
- }
-
- #define URL_ASSOCIATIONS L"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\"
-diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c
-index 619fd48af..fbd65311a 100644
---- a/gio/gwin32registrykey.c
-+++ b/gio/gwin32registrykey.c
-@@ -127,16 +127,34 @@ typedef enum
- G_WIN32_REGISTRY_UPDATED_PATH = 1,
- } GWin32RegistryKeyUpdateFlag;
-
-+static gsize
-+g_utf16_len (const gunichar2 *str)
-+{
-+ gsize result;
-+
-+ for (result = 0; str[0] != 0; str++, result++)
-+ ;
-+
-+ return result;
-+}
-+
- static gunichar2 *
--g_wcsdup (const gunichar2 *str,
-- gssize str_size)
-+g_wcsdup (const gunichar2 *str, gssize str_len)
- {
-- if (str_size == -1)
-- {
-- str_size = wcslen (str) + 1;
-- str_size *= sizeof (gunichar2);
-- }
-- return g_memdup (str, str_size);
-+ gsize str_len_unsigned;
-+ gsize str_size;
-+
-+ g_return_val_if_fail (str != NULL, NULL);
-+
-+ if (str_len < 0)
-+ str_len_unsigned = g_utf16_len (str);
-+ else
-+ str_len_unsigned = (gsize) str_len;
-+
-+ g_assert (str_len_unsigned <= G_MAXSIZE / sizeof (gunichar2) - 1);
-+ str_size = (str_len_unsigned + 1) * sizeof (gunichar2);
-+
-+ return g_memdup2 (str, str_size);
- }
-
- /**
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-08.patch b/gnu/packages/patches/glib-CVE-2021-27219-08.patch
deleted file mode 100644
index 2c021ad317..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-08.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From ba8ca443051f93a74c0d03d62e70402036f967a5 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 13:58:32 +0000
-Subject: [PATCH 08/11] gkeyfilesettingsbackend: Handle long keys when
- converting paths
-
-Previously, the code in `convert_path()` could not handle keys longer
-than `G_MAXINT`, and would overflow if that was exceeded.
-
-Convert the code to use `gsize` and `g_memdup2()` throughout, and
-change from identifying the position of the final slash in the string
-using a signed offset `i`, to using a pointer to the character (and
-`strrchr()`). This allows the slash to be at any position in a
-`G_MAXSIZE`-long string, without sacrificing a bit of the offset for
-indicating whether a slash was found.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gio/gkeyfilesettingsbackend.c | 21 ++++++++++-----------
- 1 file changed, 10 insertions(+), 11 deletions(-)
-
-diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
-index cd5765afd..25b057672 100644
---- a/gio/gkeyfilesettingsbackend.c
-+++ b/gio/gkeyfilesettingsbackend.c
-@@ -33,6 +33,7 @@
- #include "gfilemonitor.h"
- #include "gsimplepermission.h"
- #include "gsettingsbackendinternal.h"
-+#include "gstrfuncsprivate.h"
- #include "giomodule-priv.h"
- #include "gportalsupport.h"
-
-@@ -145,8 +146,8 @@ convert_path (GKeyfileSettingsBackend *kfsb,
- gchar **group,
- gchar **basename)
- {
-- gint key_len = strlen (key);
-- gint i;
-+ gsize key_len = strlen (key);
-+ const gchar *last_slash;
-
- if (key_len < kfsb->prefix_len ||
- memcmp (key, kfsb->prefix, kfsb->prefix_len) != 0)
-@@ -155,38 +156,36 @@ convert_path (GKeyfileSettingsBackend *kfsb,
- key_len -= kfsb->prefix_len;
- key += kfsb->prefix_len;
-
-- for (i = key_len; i >= 0; i--)
-- if (key[i] == '/')
-- break;
-+ last_slash = strrchr (key, '/');
-
- if (kfsb->root_group)
- {
- /* if a root_group was specified, make sure the user hasn't given
- * a path that ghosts that group name
- */
-- if (i == kfsb->root_group_len && memcmp (key, kfsb->root_group, i) == 0)
-+ if (last_slash != NULL && (last_slash - key) == kfsb->root_group_len && memcmp (key, kfsb->root_group, last_slash - key) == 0)
- return FALSE;
- }
- else
- {
- /* if no root_group was given, ensure that the user gave a path */
-- if (i == -1)
-+ if (last_slash == NULL)
- return FALSE;
- }
-
- if (group)
- {
-- if (i >= 0)
-+ if (last_slash != NULL)
- {
-- *group = g_memdup (key, i + 1);
-- (*group)[i] = '\0';
-+ *group = g_memdup2 (key, (last_slash - key) + 1);
-+ (*group)[(last_slash - key)] = '\0';
- }
- else
- *group = g_strdup (kfsb->root_group);
- }
-
- if (basename)
-- *basename = g_memdup (key + i + 1, key_len - i);
-+ *basename = g_memdup2 (last_slash + 1, key_len - (last_slash - key));
-
- return TRUE;
- }
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-09.patch b/gnu/packages/patches/glib-CVE-2021-27219-09.patch
deleted file mode 100644
index 4de0c1b349..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-09.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-From 65ec7f4d6e8832c481f6e00e2eb007b9a60024ce Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 14:00:53 +0000
-Subject: [PATCH 09/11] gsocket: Use gsize to track native sockaddr's size
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Don’t use an `int`, that’s potentially too small. In practical terms,
-this is not a problem, since no socket address is going to be that big.
-
-By making these changes we can use `g_memdup2()` without warnings,
-though. Fewer warnings is good.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gio/gsocket.c | 16 ++++++++++------
- 1 file changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/gio/gsocket.c b/gio/gsocket.c
-index 66073af83..a3af149e8 100644
---- a/gio/gsocket.c
-+++ b/gio/gsocket.c
-@@ -75,6 +75,7 @@
- #include "gcredentialsprivate.h"
- #include "glibintl.h"
- #include "gioprivate.h"
-+#include "gstrfuncsprivate.h"
-
- #ifdef G_OS_WIN32
- /* For Windows XP runtime compatibility, but use the system's if_nametoindex() if available */
-@@ -174,7 +175,7 @@ static gboolean g_socket_datagram_based_condition_wait (GDatagramBased
- GError **error);
-
- static GSocketAddress *
--cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len);
-+cache_recv_address (GSocket *socket, struct sockaddr *native, size_t native_len);
-
- static gssize
- g_socket_receive_message_with_timeout (GSocket *socket,
-@@ -260,7 +261,7 @@ struct _GSocketPrivate
- struct {
- GSocketAddress *addr;
- struct sockaddr *native;
-- gint native_len;
-+ gsize native_len;
- guint64 last_used;
- } recv_addr_cache[RECV_ADDR_CACHE_SIZE];
- };
-@@ -5211,14 +5212,14 @@ g_socket_send_messages_with_timeout (GSocket *socket,
- }
-
- static GSocketAddress *
--cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
-+cache_recv_address (GSocket *socket, struct sockaddr *native, size_t native_len)
- {
- GSocketAddress *saddr;
- gint i;
- guint64 oldest_time = G_MAXUINT64;
- gint oldest_index = 0;
-
-- if (native_len <= 0)
-+ if (native_len == 0)
- return NULL;
-
- saddr = NULL;
-@@ -5226,7 +5227,7 @@ cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
- {
- GSocketAddress *tmp = socket->priv->recv_addr_cache[i].addr;
- gpointer tmp_native = socket->priv->recv_addr_cache[i].native;
-- gint tmp_native_len = socket->priv->recv_addr_cache[i].native_len;
-+ gsize tmp_native_len = socket->priv->recv_addr_cache[i].native_len;
-
- if (!tmp)
- continue;
-@@ -5256,7 +5257,7 @@ cache_recv_address (GSocket *socket, struct sockaddr *native, int native_len)
- g_free (socket->priv->recv_addr_cache[oldest_index].native);
- }
-
-- socket->priv->recv_addr_cache[oldest_index].native = g_memdup (native, native_len);
-+ socket->priv->recv_addr_cache[oldest_index].native = g_memdup2 (native, native_len);
- socket->priv->recv_addr_cache[oldest_index].native_len = native_len;
- socket->priv->recv_addr_cache[oldest_index].addr = g_object_ref (saddr);
- socket->priv->recv_addr_cache[oldest_index].last_used = g_get_monotonic_time ();
-@@ -5404,6 +5405,9 @@ g_socket_receive_message_with_timeout (GSocket *socket,
- /* do it */
- while (1)
- {
-+ /* addrlen has to be of type int because that’s how WSARecvFrom() is defined */
-+ G_STATIC_ASSERT (sizeof addr <= G_MAXINT);
-+
- addrlen = sizeof addr;
- if (address)
- result = WSARecvFrom (socket->priv->fd,
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-10.patch b/gnu/packages/patches/glib-CVE-2021-27219-10.patch
deleted file mode 100644
index 36198b8eef..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-10.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 777b95a88f006d39d9fe6d3321db17e7b0d4b9a4 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 14:07:39 +0000
-Subject: [PATCH 10/11] gtlspassword: Forbid very long TLS passwords
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The public API `g_tls_password_set_value_full()` (and the vfunc it
-invokes) can only accept a `gssize` length. Ensure that nul-terminated
-strings passed to `g_tls_password_set_value()` can’t exceed that length.
-Use `g_memdup2()` to avoid an overflow if they’re longer than
-`G_MAXUINT` similarly.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- gio/gtlspassword.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/gio/gtlspassword.c b/gio/gtlspassword.c
-index 1e437a7b6..dbcec41a8 100644
---- a/gio/gtlspassword.c
-+++ b/gio/gtlspassword.c
-@@ -23,6 +23,7 @@
- #include "glibintl.h"
-
- #include "gioenumtypes.h"
-+#include "gstrfuncsprivate.h"
- #include "gtlspassword.h"
-
- #include <string.h>
-@@ -287,9 +288,14 @@ g_tls_password_set_value (GTlsPassword *password,
- g_return_if_fail (G_IS_TLS_PASSWORD (password));
-
- if (length < 0)
-- length = strlen ((gchar *)value);
-+ {
-+ /* FIXME: g_tls_password_set_value_full() doesn’t support unsigned gsize */
-+ gsize length_unsigned = strlen ((gchar *) value);
-+ g_return_if_fail (length_unsigned > G_MAXSSIZE);
-+ length = (gssize) length_unsigned;
-+ }
-
-- g_tls_password_set_value_full (password, g_memdup (value, length), length, g_free);
-+ g_tls_password_set_value_full (password, g_memdup2 (value, (gsize) length), length, g_free);
- }
-
- /**
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-11.patch b/gnu/packages/patches/glib-CVE-2021-27219-11.patch
deleted file mode 100644
index 4413cb9827..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-11.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From ecdf91400e9a538695a0895b95ad7e8abcdf1749 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Thu, 4 Feb 2021 14:09:40 +0000
-Subject: [PATCH 11/11] giochannel: Forbid very long line terminator strings
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The public API `GIOChannel.line_term_len` is only a `guint`. Ensure that
-nul-terminated strings passed to `g_io_channel_set_line_term()` can’t
-exceed that length. Use `g_memdup2()` to avoid a warning (`g_memdup()`
-is due to be deprecated), but not to avoid a bug, since it’s also
-limited to `G_MAXUINT`.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-Helps: #2319
----
- glib/giochannel.c | 17 +++++++++++++----
- 1 file changed, 13 insertions(+), 4 deletions(-)
-
-diff --git a/glib/giochannel.c b/glib/giochannel.c
-index 15927c391..66c6591f0 100644
---- a/glib/giochannel.c
-+++ b/glib/giochannel.c
-@@ -884,16 +884,25 @@ g_io_channel_set_line_term (GIOChannel *channel,
- const gchar *line_term,
- gint length)
- {
-+ guint length_unsigned;
-+
- g_return_if_fail (channel != NULL);
- g_return_if_fail (line_term == NULL || length != 0); /* Disallow "" */
-
- if (line_term == NULL)
-- length = 0;
-- else if (length < 0)
-- length = strlen (line_term);
-+ length_unsigned = 0;
-+ else if (length >= 0)
-+ length_unsigned = (guint) length;
-+ else
-+ {
-+ /* FIXME: We’re constrained by line_term_len being a guint here */
-+ gsize length_size = strlen (line_term);
-+ g_return_if_fail (length_size > G_MAXUINT);
-+ length_unsigned = (guint) length_size;
-+ }
-
- g_free (channel->line_term);
-- channel->line_term = line_term ? g_memdup2 (line_term, length) : NULL;
-+ channel->line_term = line_term ? g_memdup2 (line_term, length_unsigned) : NULL;
- channel->line_term_len = length;
- }
-
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-12.patch b/gnu/packages/patches/glib-CVE-2021-27219-12.patch
deleted file mode 100644
index 4fdbb81750..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-12.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From f8273b9aded135fe07094faebd527e43851aaf6e Mon Sep 17 00:00:00 2001
-From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
-Date: Sun, 7 Feb 2021 23:32:40 +0100
-Subject: [PATCH 1/5] giochannel: Fix length_size bounds check
-
-The inverted condition is an obvious error introduced by ecdf91400e9a.
-
-Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2323
-
-(cherry picked from commit a149bf2f9030168051942124536e303af8ba6176)
----
- glib/giochannel.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/glib/giochannel.c b/glib/giochannel.c
-index 66c6591f0..0d9d5f223 100644
---- a/glib/giochannel.c
-+++ b/glib/giochannel.c
-@@ -897,7 +897,7 @@ g_io_channel_set_line_term (GIOChannel *channel,
- {
- /* FIXME: We’re constrained by line_term_len being a guint here */
- gsize length_size = strlen (line_term);
-- g_return_if_fail (length_size > G_MAXUINT);
-+ g_return_if_fail (length_size <= G_MAXUINT);
- length_unsigned = (guint) length_size;
- }
-
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-13.patch b/gnu/packages/patches/glib-CVE-2021-27219-13.patch
deleted file mode 100644
index 6a287cc3a2..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-13.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From e069c50467712e6d607822afd6b6c15c2c343dff Mon Sep 17 00:00:00 2001
-From: Simon McVittie <smcv@collabora.com>
-Date: Mon, 8 Feb 2021 10:34:50 +0000
-Subject: [PATCH 2/5] giochannel: Don't store negative line_term_len in
- GIOChannel struct
-
-Adding test coverage indicated that this was another bug in 0cc11f74.
-
-Fixes: 0cc11f74 "giochannel: Forbid very long line terminator strings"
-Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2323
-Signed-off-by: Simon McVittie <smcv@collabora.com>
-(cherry picked from commit 5dc8b0014c03e7491d93b90275ab442e888a9628)
----
- glib/giochannel.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/glib/giochannel.c b/glib/giochannel.c
-index 0d9d5f223..4c39b9dc0 100644
---- a/glib/giochannel.c
-+++ b/glib/giochannel.c
-@@ -903,7 +903,7 @@ g_io_channel_set_line_term (GIOChannel *channel,
-
- g_free (channel->line_term);
- channel->line_term = line_term ? g_memdup2 (line_term, length_unsigned) : NULL;
-- channel->line_term_len = length;
-+ channel->line_term_len = length_unsigned;
- }
-
- /**
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-14.patch b/gnu/packages/patches/glib-CVE-2021-27219-14.patch
deleted file mode 100644
index 78de2846da..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-14.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 4506d1859a863087598c8d122740bae25b65b099 Mon Sep 17 00:00:00 2001
-From: Simon McVittie <smcv@collabora.com>
-Date: Mon, 8 Feb 2021 10:04:48 +0000
-Subject: [PATCH 4/5] gtlspassword: Fix inverted assertion
-
-The intention here was to assert that the length of the password fits
-in a gssize. Passwords more than half the size of virtual memory are
-probably excessive.
-
-Fixes: a8b204ff "gtlspassword: Forbid very long TLS passwords"
-Signed-off-by: Simon McVittie <smcv@collabora.com>
-(cherry picked from commit 61bb52ec42de1082bfb06ce1c737fc295bfe60b8)
----
- gio/gtlspassword.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gio/gtlspassword.c b/gio/gtlspassword.c
-index dbcec41a8..bd86a6dfe 100644
---- a/gio/gtlspassword.c
-+++ b/gio/gtlspassword.c
-@@ -291,7 +291,7 @@ g_tls_password_set_value (GTlsPassword *password,
- {
- /* FIXME: g_tls_password_set_value_full() doesn’t support unsigned gsize */
- gsize length_unsigned = strlen ((gchar *) value);
-- g_return_if_fail (length_unsigned > G_MAXSSIZE);
-+ g_return_if_fail (length_unsigned <= G_MAXSSIZE);
- length = (gssize) length_unsigned;
- }
-
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-15.patch b/gnu/packages/patches/glib-CVE-2021-27219-15.patch
deleted file mode 100644
index 37ef85b4fa..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-15.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From 3d1550354c3c6a8491c39881752d51cb7515f2c2 Mon Sep 17 00:00:00 2001
-From: Simon McVittie <smcv@collabora.com>
-Date: Mon, 8 Feb 2021 10:22:39 +0000
-Subject: [PATCH 5/5] tls-interaction: Add test coverage for various ways to
- set the password
-
-Signed-off-by: Simon McVittie <smcv@collabora.com>
-(cherry picked from commit df4501316ca3903072400504a5ea76498db19538)
----
- gio/tests/tls-interaction.c | 55 +++++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
-
-diff --git a/gio/tests/tls-interaction.c b/gio/tests/tls-interaction.c
-index 4f0737d7e..5661e8e0d 100644
---- a/gio/tests/tls-interaction.c
-+++ b/gio/tests/tls-interaction.c
-@@ -174,6 +174,38 @@ test_interaction_ask_password_finish_failure (GTlsInteraction *interaction,
- }
-
-
-+/* Return a copy of @str that is allocated in a silly way, to exercise
-+ * custom free-functions. The returned pointer points to a copy of @str
-+ * in a buffer of the form "BEFORE \0 str \0 AFTER". */
-+static guchar *
-+special_dup (const char *str)
-+{
-+ GString *buf = g_string_new ("BEFORE");
-+ guchar *ret;
-+
-+ g_string_append_c (buf, '\0');
-+ g_string_append (buf, str);
-+ g_string_append_c (buf, '\0');
-+ g_string_append (buf, "AFTER");
-+ ret = (guchar *) g_string_free (buf, FALSE);
-+ return ret + strlen ("BEFORE") + 1;
-+}
-+
-+
-+/* Free a copy of @str that was made with special_dup(), after asserting
-+ * that it has not been corrupted. */
-+static void
-+special_free (gpointer p)
-+{
-+ gchar *s = p;
-+ gchar *buf = s - strlen ("BEFORE") - 1;
-+
-+ g_assert_cmpstr (buf, ==, "BEFORE");
-+ g_assert_cmpstr (s + strlen (s) + 1, ==, "AFTER");
-+ g_free (buf);
-+}
-+
-+
- static GTlsInteractionResult
- test_interaction_ask_password_sync_success (GTlsInteraction *interaction,
- GTlsPassword *password,
-@@ -181,6 +213,8 @@ test_interaction_ask_password_sync_success (GTlsInteraction *interaction,
- GError **error)
- {
- TestInteraction *self;
-+ const guchar *value;
-+ gsize len;
-
- g_assert (TEST_IS_INTERACTION (interaction));
- self = TEST_INTERACTION (interaction);
-@@ -192,6 +226,27 @@ test_interaction_ask_password_sync_success (GTlsInteraction *interaction,
- g_assert (error != NULL);
- g_assert (*error == NULL);
-
-+ /* Exercise different ways to set the value */
-+ g_tls_password_set_value (password, (const guchar *) "foo", 4);
-+ len = 0;
-+ value = g_tls_password_get_value (password, &len);
-+ g_assert_cmpmem (value, len, "foo", 4);
-+
-+ g_tls_password_set_value (password, (const guchar *) "bar", -1);
-+ len = 0;
-+ value = g_tls_password_get_value (password, &len);
-+ g_assert_cmpmem (value, len, "bar", 3);
-+
-+ g_tls_password_set_value_full (password, special_dup ("baa"), 4, special_free);
-+ len = 0;
-+ value = g_tls_password_get_value (password, &len);
-+ g_assert_cmpmem (value, len, "baa", 4);
-+
-+ g_tls_password_set_value_full (password, special_dup ("baz"), -1, special_free);
-+ len = 0;
-+ value = g_tls_password_get_value (password, &len);
-+ g_assert_cmpmem (value, len, "baz", 3);
-+
- /* Don't do this in real life. Include a null terminator for testing */
- g_tls_password_set_value (password, (const guchar *)"the password", 13);
- return G_TLS_INTERACTION_HANDLED;
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-16.patch b/gnu/packages/patches/glib-CVE-2021-27219-16.patch
deleted file mode 100644
index 43635e72ed..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-16.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From cb9ee701ef46c1819eed4e2a4dc181682bdfc176 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Wed, 10 Feb 2021 21:16:39 +0000
-Subject: [PATCH 1/3] gkeyfilesettingsbackend: Fix basename handling when group
- is unset
-
-Fix an effective regression in commit
-7781a9cbd2fd0aa84bee0f4eee88470640ff6706, which happens when
-`convert_path()` is called with a `key` which contains no slashes. In
-that case, the `key` is entirely the `basename`.
-
-Prior to commit 7781a9cb, the code worked through a fluke of `i == -1`
-cancelling out with the various additions in the `g_memdup()` call, and
-effectively resulting in `g_strdup (key)`.
-
-Spotted by Guido Berhoerster.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
----
- gio/gkeyfilesettingsbackend.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
-index 25b057672..861c3a661 100644
---- a/gio/gkeyfilesettingsbackend.c
-+++ b/gio/gkeyfilesettingsbackend.c
-@@ -185,7 +185,12 @@ convert_path (GKeyfileSettingsBackend *kfsb,
- }
-
- if (basename)
-- *basename = g_memdup2 (last_slash + 1, key_len - (last_slash - key));
-+ {
-+ if (last_slash != NULL)
-+ *basename = g_memdup2 (last_slash + 1, key_len - (last_slash - key));
-+ else
-+ *basename = g_strdup (key);
-+ }
-
- return TRUE;
- }
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-17.patch b/gnu/packages/patches/glib-CVE-2021-27219-17.patch
deleted file mode 100644
index 3153979071..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-17.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 31e0d403ba635dbbacbfbff74295e5db02558d76 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Wed, 10 Feb 2021 21:19:30 +0000
-Subject: [PATCH 2/3] gkeyfilesettingsbackend: Disallow empty key or group
- names
-
-These should never have been allowed; they will result in precondition
-failures from the `GKeyFile` later on in the code.
-
-A test will be added for this shortly.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
----
- gio/gkeyfilesettingsbackend.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
-index 861c3a661..de216e615 100644
---- a/gio/gkeyfilesettingsbackend.c
-+++ b/gio/gkeyfilesettingsbackend.c
-@@ -158,6 +158,13 @@ convert_path (GKeyfileSettingsBackend *kfsb,
-
- last_slash = strrchr (key, '/');
-
-+ /* Disallow empty group names or key names */
-+ if (key_len == 0 ||
-+ (last_slash != NULL &&
-+ (*(last_slash + 1) == '\0' ||
-+ last_slash == key)))
-+ return FALSE;
-+
- if (kfsb->root_group)
- {
- /* if a root_group was specified, make sure the user hasn't given
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-27219-18.patch b/gnu/packages/patches/glib-CVE-2021-27219-18.patch
deleted file mode 100644
index c18d44ddeb..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-27219-18.patch
+++ /dev/null
@@ -1,232 +0,0 @@
-Backport of:
-
-From 221c26685354dea2b2732df94404e8e5e77a1591 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Wed, 10 Feb 2021 21:21:36 +0000
-Subject: [PATCH 3/3] tests: Add tests for key name handling in the keyfile
- backend
-
-This tests the two recent commits.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
----
- gio/tests/gsettings.c | 171 +++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 170 insertions(+), 1 deletion(-)
-
-diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
-index baadca8f5..afe594a23 100644
---- a/gio/tests/gsettings.c
-+++ b/gio/tests/gsettings.c
-@@ -1,3 +1,4 @@
-+#include <errno.h>
- #include <stdlib.h>
- #include <locale.h>
- #include <libintl.h>
-@@ -1740,6 +1741,14 @@ key_changed_cb (GSettings *settings, const gchar *key, gpointer data)
- (*b) = TRUE;
- }
-
-+typedef struct
-+{
-+ const gchar *path;
-+ const gchar *root_group;
-+ const gchar *keyfile_group;
-+ const gchar *root_path;
-+} KeyfileTestData;
-+
- /*
- * Test that using a keyfile works
- */
-@@ -1834,7 +1843,11 @@ test_keyfile (Fixture *fixture,
- g_free (str);
-
- g_settings_set (settings, "farewell", "s", "cheerio");
--
-+
-+ /* Check that empty keys/groups are not allowed. */
-+ g_assert_false (g_settings_is_writable (settings, ""));
-+ g_assert_false (g_settings_is_writable (settings, "/"));
-+
- /* When executing as root, changing the mode of the keyfile will have
- * no effect on the writability of the settings.
- */
-@@ -1866,6 +1879,149 @@ test_keyfile (Fixture *fixture,
- g_free (keyfile_path);
- }
-
-+/*
-+ * Test that using a keyfile works with a schema with no path set.
-+ */
-+static void
-+test_keyfile_no_path (Fixture *fixture,
-+ gconstpointer user_data)
-+{
-+ const KeyfileTestData *test_data = user_data;
-+ GSettingsBackend *kf_backend;
-+ GSettings *settings;
-+ GKeyFile *keyfile;
-+ gboolean writable;
-+ gchar *key = NULL;
-+ GError *error = NULL;
-+ gchar *keyfile_path = NULL, *store_path = NULL;
-+
-+ keyfile_path = g_build_filename (fixture->tmp_dir, "keyfile", NULL);
-+ store_path = g_build_filename (keyfile_path, "gsettings.store", NULL);
-+ kf_backend = g_keyfile_settings_backend_new (store_path, test_data->root_path, test_data->root_group);
-+ settings = g_settings_new_with_backend_and_path ("org.gtk.test.no-path", kf_backend, test_data->path);
-+ g_object_unref (kf_backend);
-+
-+ g_settings_reset (settings, "test-boolean");
-+ g_assert_true (g_settings_get_boolean (settings, "test-boolean"));
-+
-+ writable = g_settings_is_writable (settings, "test-boolean");
-+ g_assert_true (writable);
-+ g_settings_set (settings, "test-boolean", "b", FALSE);
-+
-+ g_assert_false (g_settings_get_boolean (settings, "test-boolean"));
-+
-+ g_settings_delay (settings);
-+ g_settings_set (settings, "test-boolean", "b", TRUE);
-+ g_settings_apply (settings);
-+
-+ keyfile = g_key_file_new ();
-+ g_assert_true (g_key_file_load_from_file (keyfile, store_path, 0, NULL));
-+
-+ g_assert_true (g_key_file_get_boolean (keyfile, test_data->keyfile_group, "test-boolean", NULL));
-+
-+ g_key_file_free (keyfile);
-+
-+ g_settings_reset (settings, "test-boolean");
-+ g_settings_apply (settings);
-+ keyfile = g_key_file_new ();
-+ g_assert_true (g_key_file_load_from_file (keyfile, store_path, 0, NULL));
-+
-+ g_assert_false (g_key_file_get_string (keyfile, test_data->keyfile_group, "test-boolean", &error));
-+ g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND);
-+ g_clear_error (&error);
-+
-+ /* Check that empty keys/groups are not allowed. */
-+ g_assert_false (g_settings_is_writable (settings, ""));
-+ g_assert_false (g_settings_is_writable (settings, "/"));
-+
-+ /* Keys which ghost the root group name are not allowed. This can only be
-+ * tested when the path is `/` as otherwise it acts as a prefix and prevents
-+ * any ghosting. */
-+ if (g_str_equal (test_data->path, "/"))
-+ {
-+ key = g_strdup_printf ("%s/%s", test_data->root_group, "");
-+ g_assert_false (g_settings_is_writable (settings, key));
-+ g_free (key);
-+
-+ key = g_strdup_printf ("%s/%s", test_data->root_group, "/");
-+ g_assert_false (g_settings_is_writable (settings, key));
-+ g_free (key);
-+
-+ key = g_strdup_printf ("%s/%s", test_data->root_group, "test-boolean");
-+ g_assert_false (g_settings_is_writable (settings, key));
-+ g_free (key);
-+ }
-+
-+ g_key_file_free (keyfile);
-+ g_object_unref (settings);
-+
-+ /* Clean up the temporary directory. */
-+ g_assert_cmpint (g_chmod (keyfile_path, 0777) == 0 ? 0 : errno, ==, 0);
-+ g_assert_cmpint (g_remove (store_path) == 0 ? 0 : errno, ==, 0);
-+ g_assert_cmpint (g_rmdir (keyfile_path) == 0 ? 0 : errno, ==, 0);
-+ g_free (store_path);
-+ g_free (keyfile_path);
-+}
-+
-+/*
-+ * Test that a keyfile rejects writes to keys outside its root path.
-+ */
-+static void
-+test_keyfile_outside_root_path (Fixture *fixture,
-+ gconstpointer user_data)
-+{
-+ GSettingsBackend *kf_backend;
-+ GSettings *settings;
-+ gchar *keyfile_path = NULL, *store_path = NULL;
-+
-+ keyfile_path = g_build_filename (fixture->tmp_dir, "keyfile", NULL);
-+ store_path = g_build_filename (keyfile_path, "gsettings.store", NULL);
-+ kf_backend = g_keyfile_settings_backend_new (store_path, "/tests/basic-types/", "root");
-+ settings = g_settings_new_with_backend_and_path ("org.gtk.test.no-path", kf_backend, "/tests/");
-+ g_object_unref (kf_backend);
-+
-+ g_assert_false (g_settings_is_writable (settings, "test-boolean"));
-+
-+ g_object_unref (settings);
-+
-+ /* Clean up the temporary directory. The keyfile probably doesn’t exist, so
-+ * don’t error on failure. */
-+ g_remove (store_path);
-+ g_assert_cmpint (g_rmdir (keyfile_path) == 0 ? 0 : errno, ==, 0);
-+ g_free (store_path);
-+ g_free (keyfile_path);
-+}
-+
-+/*
-+ * Test that a keyfile rejects writes to keys in the root if no root group is set.
-+ */
-+static void
-+test_keyfile_no_root_group (Fixture *fixture,
-+ gconstpointer user_data)
-+{
-+ GSettingsBackend *kf_backend;
-+ GSettings *settings;
-+ gchar *keyfile_path = NULL, *store_path = NULL;
-+
-+ keyfile_path = g_build_filename (fixture->tmp_dir, "keyfile", NULL);
-+ store_path = g_build_filename (keyfile_path, "gsettings.store", NULL);
-+ kf_backend = g_keyfile_settings_backend_new (store_path, "/", NULL);
-+ settings = g_settings_new_with_backend_and_path ("org.gtk.test.no-path", kf_backend, "/");
-+ g_object_unref (kf_backend);
-+
-+ g_assert_false (g_settings_is_writable (settings, "test-boolean"));
-+ g_assert_true (g_settings_is_writable (settings, "child/test-boolean"));
-+
-+ g_object_unref (settings);
-+
-+ /* Clean up the temporary directory. The keyfile probably doesn’t exist, so
-+ * don’t error on failure. */
-+ g_remove (store_path);
-+ g_assert_cmpint (g_rmdir (keyfile_path) == 0 ? 0 : errno, ==, 0);
-+ g_free (store_path);
-+ g_free (keyfile_path);
-+}
-+
- /* Test that getting child schemas works
- */
- static void
-@@ -2844,6 +3000,14 @@ main (int argc, char *argv[])
- gchar *override_text;
- gchar *enums;
- gint result;
-+ const KeyfileTestData keyfile_test_data_explicit_path = { "/tests/", "root", "tests", "/" };
-+ const KeyfileTestData keyfile_test_data_empty_path = { "/", "root", "root", "/" };
-+ const KeyfileTestData keyfile_test_data_long_path = {
-+ "/tests/path/is/very/long/and/this/makes/some/comparisons/take/a/different/branch/",
-+ "root",
-+ "tests/path/is/very/long/and/this/makes/some/comparisons/take/a/different/branch",
-+ "/"
-+ };
-
- /* Meson build sets this */
- #ifdef TEST_LOCALE_PATH
-@@ -2967,6 +3131,11 @@ main (int argc, char *argv[])
- }
-
- g_test_add ("/gsettings/keyfile", Fixture, NULL, setup, test_keyfile, teardown);
-+ g_test_add ("/gsettings/keyfile/explicit-path", Fixture, &keyfile_test_data_explicit_path, setup, test_keyfile_no_path, teardown);
-+ g_test_add ("/gsettings/keyfile/empty-path", Fixture, &keyfile_test_data_empty_path, setup, test_keyfile_no_path, teardown);
-+ g_test_add ("/gsettings/keyfile/long-path", Fixture, &keyfile_test_data_long_path, setup, test_keyfile_no_path, teardown);
-+ g_test_add ("/gsettings/keyfile/outside-root-path", Fixture, NULL, setup, test_keyfile_outside_root_path, teardown);
-+ g_test_add ("/gsettings/keyfile/no-root-group", Fixture, NULL, setup, test_keyfile_no_root_group, teardown);
- g_test_add_func ("/gsettings/child-schema", test_child_schema);
- g_test_add_func ("/gsettings/strinfo", test_strinfo);
- g_test_add_func ("/gsettings/enums", test_enums);
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-CVE-2021-28153.patch b/gnu/packages/patches/glib-CVE-2021-28153.patch
deleted file mode 100644
index 54443186d9..0000000000
--- a/gnu/packages/patches/glib-CVE-2021-28153.patch
+++ /dev/null
@@ -1,283 +0,0 @@
-Backport of:
-
-From 317b3b587058a05dca95d56dac26568c5b098d33 Mon Sep 17 00:00:00 2001
-From: Philip Withnall <pwithnall@endlessos.org>
-Date: Wed, 24 Feb 2021 17:35:40 +0000
-Subject: [PATCH] glocalfileoutputstream: Fix CREATE_REPLACE_DESTINATION
- with symlinks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The `G_FILE_CREATE_REPLACE_DESTINATION` flag is equivalent to unlinking
-the destination file and re-creating it from scratch. That did
-previously work, but in the process the code would call `open(O_CREAT)`
-on the file. If the file was a dangling symlink, this would create the
-destination file (empty). That’s not an intended side-effect, and has
-security implications if the symlink is controlled by a lower-privileged
-process.
-
-Fix that by not opening the destination file if it’s a symlink, and
-adjusting the rest of the code to cope with
- - the fact that `fd == -1` is not an error iff `is_symlink` is true,
- - and that `original_stat` will contain the `lstat()` results for the
- symlink now, rather than the `stat()` results for its target (again,
- iff `is_symlink` is true).
-
-This means that the target of the dangling symlink is no longer created,
-which was the bug. The symlink itself continues to be replaced (as
-before) with the new file — this is the intended behaviour of
-`g_file_replace()`.
-
-The behaviour for non-symlink cases, or cases where the symlink was not
-dangling, should be unchanged.
-
-Includes a unit test.
-
-Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-
-Fixes: #2325
----
- gio/glocalfileoutputstream.c | 70 ++++++++++++++++-------
- gio/tests/file.c | 108 +++++++++++++++++++++++++++++++++++
- 2 files changed, 158 insertions(+), 20 deletions(-)
-
-diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
-index a3dd62172..553fcbbae 100644
---- a/gio/glocalfileoutputstream.c
-+++ b/gio/glocalfileoutputstream.c
-@@ -874,16 +874,22 @@ handle_overwrite_open (const char *filename,
- /* Could be a symlink, or it could be a regular ELOOP error,
- * but then the next open will fail too. */
- is_symlink = TRUE;
-- fd = g_open (filename, open_flags, mode);
-+ if (!(flags & G_FILE_CREATE_REPLACE_DESTINATION))
-+ fd = g_open (filename, open_flags, mode);
- }
--#else
-- fd = g_open (filename, open_flags, mode);
-- errsv = errno;
-+#else /* if !O_NOFOLLOW */
- /* This is racy, but we do it as soon as possible to minimize the race */
- is_symlink = g_file_test (filename, G_FILE_TEST_IS_SYMLINK);
-+
-+ if (!is_symlink || !(flags & G_FILE_CREATE_REPLACE_DESTINATION))
-+ {
-+ fd = g_open (filename, open_flags, mode);
-+ errsv = errno;
-+ }
- #endif
-
-- if (fd == -1)
-+ if (fd == -1 &&
-+ (!is_symlink || !(flags & G_FILE_CREATE_REPLACE_DESTINATION)))
- {
- char *display_name = g_filename_display_name (filename);
- g_set_error (error, G_IO_ERROR,
-@@ -893,13 +899,25 @@ handle_overwrite_open (const char *filename,
- g_free (display_name);
- return -1;
- }
--
-+
-+ if (!is_symlink)
-+ {
- #ifdef G_OS_WIN32
-- res = GLIB_PRIVATE_CALL (g_win32_fstat) (fd, &original_stat);
-+ res = GLIB_PRIVATE_CALL (g_win32_fstat) (fd, &original_stat);
- #else
-- res = fstat (fd, &original_stat);
-+ res = fstat (fd, &original_stat);
- #endif
-- errsv = errno;
-+ errsv = errno;
-+ }
-+ else
-+ {
-+#ifdef G_OS_WIN32
-+ res = GLIB_PRIVATE_CALL (g_win32_lstat_utf8) (filename, &original_stat);
-+#else
-+ res = g_lstat (filename, &original_stat);
-+#endif
-+ errsv = errno;
-+ }
-
- if (res != 0)
- {
-@@ -916,16 +934,27 @@ handle_overwrite_open (const char *filename,
- if (!S_ISREG (original_stat.st_mode))
- {
- if (S_ISDIR (original_stat.st_mode))
-- g_set_error_literal (error,
-- G_IO_ERROR,
-- G_IO_ERROR_IS_DIRECTORY,
-- _("Target file is a directory"));
-- else
-- g_set_error_literal (error,
-- G_IO_ERROR,
-- G_IO_ERROR_NOT_REGULAR_FILE,
-- _("Target file is not a regular file"));
-- goto err_out;
-+ {
-+ g_set_error_literal (error,
-+ G_IO_ERROR,
-+ G_IO_ERROR_IS_DIRECTORY,
-+ _("Target file is a directory"));
-+ goto err_out;
-+ }
-+ else if (!is_symlink ||
-+#ifdef S_ISLNK
-+ !S_ISLNK (original_stat.st_mode)
-+#else
-+ FALSE
-+#endif
-+ )
-+ {
-+ g_set_error_literal (error,
-+ G_IO_ERROR,
-+ G_IO_ERROR_NOT_REGULAR_FILE,
-+ _("Target file is not a regular file"));
-+ goto err_out;
-+ }
- }
-
- if (etag != NULL)
-@@ -1006,7 +1035,8 @@ handle_overwrite_open (const char *filename,
- }
- }
-
-- g_close (fd, NULL);
-+ if (fd >= 0)
-+ g_close (fd, NULL);
- *temp_filename = tmp_filename;
- return tmpfd;
- }
-diff --git a/gio/tests/file.c b/gio/tests/file.c
-index efb2eaadd..bc55f3af4 100644
---- a/gio/tests/file.c
-+++ b/gio/tests/file.c
-@@ -804,6 +804,113 @@ test_replace_cancel (void)
- g_object_unref (tmpdir);
- }
-
-+static void
-+test_replace_symlink (void)
-+{
-+#ifdef G_OS_UNIX
-+ gchar *tmpdir_path = NULL;
-+ GFile *tmpdir = NULL, *source_file = NULL, *target_file = NULL;
-+ GFileOutputStream *stream = NULL;
-+ const gchar *new_contents = "this is a test message which should be written to source and not target";
-+ gsize n_written;
-+ GFileEnumerator *enumerator = NULL;
-+ GFileInfo *info = NULL;
-+ gchar *contents = NULL;
-+ gsize length = 0;
-+ GError *local_error = NULL;
-+
-+ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/2325");
-+ g_test_summary ("Test that G_FILE_CREATE_REPLACE_DESTINATION doesn’t follow symlinks");
-+
-+ /* Create a fresh, empty working directory. */
-+ tmpdir_path = g_dir_make_tmp ("g_file_replace_symlink_XXXXXX", &local_error);
-+ g_assert_no_error (local_error);
-+ tmpdir = g_file_new_for_path (tmpdir_path);
-+
-+ g_test_message ("Using temporary directory %s", tmpdir_path);
-+ g_free (tmpdir_path);
-+
-+ /* Create symlink `source` which points to `target`. */
-+ source_file = g_file_get_child (tmpdir, "source");
-+ target_file = g_file_get_child (tmpdir, "target");
-+ g_file_make_symbolic_link (source_file, "target", NULL, &local_error);
-+ g_assert_no_error (local_error);
-+
-+ /* Ensure that `target` doesn’t exist */
-+ g_assert_false (g_file_query_exists (target_file, NULL));
-+
-+ /* Replace the `source` symlink with a regular file using
-+ * %G_FILE_CREATE_REPLACE_DESTINATION, which should replace it *without*
-+ * following the symlink */
-+ stream = g_file_replace (source_file, NULL, FALSE /* no backup */,
-+ G_FILE_CREATE_REPLACE_DESTINATION, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+
-+ g_output_stream_write_all (G_OUTPUT_STREAM (stream), new_contents, strlen (new_contents),
-+ &n_written, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+ g_assert_cmpint (n_written, ==, strlen (new_contents));
-+
-+ g_output_stream_close (G_OUTPUT_STREAM (stream), NULL, &local_error);
-+ g_assert_no_error (local_error);
-+
-+ g_clear_object (&stream);
-+
-+ /* At this point, there should still only be one file: `source`. It should
-+ * now be a regular file. `target` should not exist. */
-+ enumerator = g_file_enumerate_children (tmpdir,
-+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
-+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
-+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+
-+ info = g_file_enumerator_next_file (enumerator, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+ g_assert_nonnull (info);
-+
-+ g_assert_cmpstr (g_file_info_get_name (info), ==, "source");
-+ g_assert_cmpint (g_file_info_get_file_type (info), ==, G_FILE_TYPE_REGULAR);
-+
-+ g_clear_object (&info);
-+
-+ info = g_file_enumerator_next_file (enumerator, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+ g_assert_null (info);
-+
-+ g_file_enumerator_close (enumerator, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+ g_clear_object (&enumerator);
-+
-+ /* Double-check that `target` doesn’t exist */
-+ g_assert_false (g_file_query_exists (target_file, NULL));
-+
-+ /* Check the content of `source`. */
-+ g_file_load_contents (source_file,
-+ NULL,
-+ &contents,
-+ &length,
-+ NULL,
-+ &local_error);
-+ g_assert_no_error (local_error);
-+ g_assert_cmpstr (contents, ==, new_contents);
-+ g_assert_cmpuint (length, ==, strlen (new_contents));
-+ g_free (contents);
-+
-+ /* Tidy up. */
-+ g_file_delete (source_file, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+
-+ g_file_delete (tmpdir, NULL, &local_error);
-+ g_assert_no_error (local_error);
-+
-+ g_clear_object (&target_file);
-+ g_clear_object (&source_file);
-+ g_clear_object (&tmpdir);
-+#else /* if !G_OS_UNIX */
-+ g_test_skip ("Symlink replacement tests can only be run on Unix")
-+#endif
-+}
-+
- static void
- on_file_deleted (GObject *object,
- GAsyncResult *result,
-@@ -1754,6 +1861,7 @@ main (int argc, char *argv[])
- g_test_add_data_func ("/file/async-create-delete/4096", GINT_TO_POINTER (4096), test_create_delete);
- g_test_add_func ("/file/replace-load", test_replace_load);
- g_test_add_func ("/file/replace-cancel", test_replace_cancel);
-+ g_test_add_func ("/file/replace-symlink", test_replace_symlink);
- g_test_add_func ("/file/async-delete", test_async_delete);
- #ifdef G_OS_UNIX
- g_test_add_func ("/file/copy-preserve-mode", test_copy_preserve_mode);
---
-2.30.1
-
diff --git a/gnu/packages/patches/glib-networking-32-bit-time.patch b/gnu/packages/patches/glib-networking-32-bit-time.patch
new file mode 100644
index 0000000000..a437310270
--- /dev/null
+++ b/gnu/packages/patches/glib-networking-32-bit-time.patch
@@ -0,0 +1,61 @@
+Work around a year-2038 issue when building with a 32-bit 'time_t'
+on 32-bit platforms:
+
+ https://gitlab.gnome.org/GNOME/glib-networking/-/issues/172
+
+From 4f8ca86a0e460794188c3355f0c7cc11fdbe4229 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <simon.mcvittie@collabora.co.uk>
+Date: Tue, 21 Sep 2021 17:07:44 +0000
+Subject: [PATCH] tests: Accept GNUTLS' workaround for limited size of time_t
+
+---
+ tls/tests/certificate.c | 15 +++++++++++++++
+ tls/tests/meson.build | 1 +
+ 2 files changed, 16 insertions(+)
+
+diff --git a/tls/tests/certificate.c b/tls/tests/certificate.c
+index c0100d30..d216c710 100644
+--- a/tls/tests/certificate.c
++++ b/tls/tests/certificate.c
+@@ -672,6 +672,12 @@ test_certificate_not_valid_before (void)
+ g_object_unref (cert);
+ }
+
++/* On 32-bit, GNUTLS caps expiry times at 2037-12-31 23:23:23 to avoid
++ * overflowing time_t. Hopefully by 2037, either 32-bit will finally have
++ * died out, or GNUTLS will rethink its approach to
++ * https://gitlab.com/gnutls/gnutls/-/issues/370 */
++#define GNUTLS_32_BIT_NOT_VALID_AFTER_MAX 2145914603
++
+ static void
+ test_certificate_not_valid_after (void)
+ {
+@@ -686,7 +692,16 @@ test_certificate_not_valid_after (void)
+ actual = g_tls_certificate_get_not_valid_after (cert);
+ g_assert_nonnull (actual);
+ actual_str = g_date_time_format_iso8601 (actual);
++
++#if SIZEOF_TIME_T <= 4
++ if (g_date_time_to_unix (actual) == GNUTLS_32_BIT_NOT_VALID_AFTER_MAX)
++ g_test_incomplete ("not-valid-after date not representable on 32-bit");
++ else
++ g_assert_cmpstr (actual_str, ==, EXPECTED_NOT_VALID_AFTER);
++#else
+ g_assert_cmpstr (actual_str, ==, EXPECTED_NOT_VALID_AFTER);
++#endif
++
+ g_free (actual_str);
+ g_date_time_unref (actual);
+ g_object_unref (cert);
+diff --git a/tls/tests/meson.build b/tls/tests/meson.build
+index e9c7d8c6..7415f913 100644
+--- a/tls/tests/meson.build
++++ b/tls/tests/meson.build
+@@ -69,6 +69,7 @@ foreach backend: backends
+ test_cflags = cflags + [
+ '-DBACKEND="@0@"'.format(backend),
+ '-DBACKEND_IS_' + backend.to_upper(),
++ '-DSIZEOF_TIME_T=@0@'.format(cc.sizeof('time_t', prefix: '#include <time.h>')),
+ ]
+
+ if backend == 'openssl'
diff --git a/gnu/packages/patches/glib-networking-gnutls-binding.patch b/gnu/packages/patches/glib-networking-gnutls-binding.patch
new file mode 100644
index 0000000000..91d0743056
--- /dev/null
+++ b/gnu/packages/patches/glib-networking-gnutls-binding.patch
@@ -0,0 +1,21 @@
+Skip failing test in 'test_connection_binding_match_tls_unique'
+in 'tls/tests/connection.c' when building glib-networking against
+GnuTLS 3.7.2. The failure stems from the fact that
+'gnutls_session_channel_binding' returns GNUTLS_E_INVALID_REQUEST
+is known upstream:
+
+ https://gitlab.gnome.org/GNOME/glib-networking/-/issues/164
+
+diff --git a/tls/tests/connection.c b/tls/tests/connection.c
+index 036df04..347c7a4 100644
+--- a/tls/tests/connection.c
++++ b/tls/tests/connection.c
+@@ -3037,8 +3037,6 @@ main (int argc,
+ setup_connection, test_connection_missing_server_identity, teardown_connection);
+ g_test_add ("/tls/" BACKEND "/connection/peer-certificate-notify", TestConnection, NULL,
+ setup_connection, test_peer_certificate_notify, teardown_connection);
+- g_test_add ("/tls/" BACKEND "/connection/binding/match-tls-unique", TestConnection, NULL,
+- setup_connection, test_connection_binding_match_tls_unique, teardown_connection);
+ g_test_add ("/tls/" BACKEND "/connection/binding/match-tls-server-end-point", TestConnection, NULL,
+ setup_connection, test_connection_binding_match_tls_server_end_point, teardown_connection);
+ g_test_add ("/tls/" BACKEND "/connection/binding/match-tls-exporter", TestConnection, NULL,
diff --git a/gnu/packages/patches/glib-skip-failing-test.patch b/gnu/packages/patches/glib-skip-failing-test.patch
new file mode 100644
index 0000000000..c7706aaa74
--- /dev/null
+++ b/gnu/packages/patches/glib-skip-failing-test.patch
@@ -0,0 +1,27 @@
+This test timed out on powerpc-linux even after extending the
+test_timeout_slow to 1800 seconds. Previously we tried to work around
+this test by extending test_timeout_slow by 1.5 its previous value.
+
+---
+ gio/tests/meson.build | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/gio/tests/meson.build b/gio/tests/meson.build
+index a926ae0..4fdbe7a 100644
+--- a/gio/tests/meson.build
++++ b/gio/tests/meson.build
+@@ -317,10 +317,6 @@ if host_machine.system() != 'windows'
+ 'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
+ 'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32'],
+ },
+- 'gdbus-threading' : {
+- 'extra_sources' : extra_sources,
+- 'suite' : ['slow'],
+- },
+ 'gmenumodel' : {
+ 'extra_sources' : extra_sources,
+ 'suite' : ['slow'],
+
+--
+2.31.1
+
diff --git a/gnu/packages/patches/glib-tests-timer.patch b/gnu/packages/patches/glib-tests-timer.patch
deleted file mode 100644
index e37425c0c8..0000000000
--- a/gnu/packages/patches/glib-tests-timer.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-* On i686 floating-point roundoff errors could sometimes cause this check to
- fail depending on the elapsed microseconds. Improve rounding by adding a
- fractional bit.
-
---- glib-2.40.0/glib/tests/timer.c 2014-03-05 08:05:42.000000000 -0600
-+++ glib-2.40.0/glib/tests/timer.c 2014-07-10 16:33:12.746862822 -0500
-@@ -35,7 +35,7 @@
- elapsed = g_timer_elapsed (timer, &micros);
-
- g_assert_cmpfloat (elapsed, <, 1.0);
-- g_assert_cmpuint (micros, ==, ((guint64)(elapsed * 1e6)) % 1000000);
-+ g_assert_cmpuint (micros, ==, ((guint64)(elapsed * 1e6 + 0.5)) % 1000000);
-
- g_timer_destroy (timer);
- }
diff --git a/gnu/packages/patches/glibc-2.27-git-fixes.patch b/gnu/packages/patches/glibc-2.27-git-fixes.patch
deleted file mode 100644
index 4ed67c7c25..0000000000
--- a/gnu/packages/patches/glibc-2.27-git-fixes.patch
+++ /dev/null
@@ -1,702 +0,0 @@
-These commits are cherry-picked from the "release/2.27/master" branch.
-
-https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.27/master
-
-Currently, we have the following (with NEWS and ChangeLog entries omitted).
-
-56170e064e2b21ce204f0817733e92f1730541ea
-516fa6080481a1433c173320b1c1432868e1e38a
-f36553bf6a4f69070f99badbdab5802b43e6e211
-7c6304182b9f422b782ace1cdd3efbde056aec36
-78a90c2f74a2012dd3eff302189e47ff6779a757
-1e52d8e65a58c49a48549053a1b89c06240e0c6c
-55ad82e45c313454de657931898e974a7a036cad
-
-From 56170e064e2b21ce204f0817733e92f1730541ea Mon Sep 17 00:00:00 2001
-From: Igor Gnatenko <ignatenko@redhat.com>
-Date: Wed, 7 Feb 2018 13:53:10 +0100
-Subject: [PATCH] Linux: use reserved name __key in pkey_get [BZ #22797]
-
-_key is not reserved name and we should avoid using that. It seems that
-it was simple typo when pkey_* was implemented.
-
-(cherry picked from commit 388ff7bd0d57d7061fdd39a2f26f65687e8058da)
-
-diff --git a/sysdeps/unix/sysv/linux/bits/mman-shared.h b/sysdeps/unix/sysv/linux/bits/mman-shared.h
-index 7715e680ca..d15ba95c9d 100644
---- a/sysdeps/unix/sysv/linux/bits/mman-shared.h
-+++ b/sysdeps/unix/sysv/linux/bits/mman-shared.h
-@@ -61,7 +61,7 @@ int pkey_set (int __key, unsigned int __access_rights) __THROW;
-
- /* Return the access rights for the current thread for KEY, which must
- have been allocated using pkey_alloc. */
--int pkey_get (int _key) __THROW;
-+int pkey_get (int __key) __THROW;
-
- /* Free an allocated protection key, which must have been allocated
- using pkey_alloc. */
-
-From 516fa6080481a1433c173320b1c1432868e1e38a Mon Sep 17 00:00:00 2001
-From: "Dmitry V. Levin" <ldv@altlinux.org>
-Date: Fri, 29 Dec 2017 23:19:32 +0000
-Subject: [PATCH] linux/aarch64: sync sys/ptrace.h with Linux 4.15 [BZ #22433]
-
-Remove compat-specific constants that were never exported by kernel
-headers under these names. Before linux commit v3.7-rc1~16^2~1 they
-were exported with COMPAT_ prefix, and since that commit they are not
-exported at all.
-
-* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_request):
-Remove arm-specific PTRACE_GET_THREAD_AREA, PTRACE_GETHBPREGS,
-and PTRACE_SETHBPREGS.
-
-(cherry picked from commit 2fd4bbaa1446f1be700e10c526cf585a796c4991)
-
-diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h b/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
-index 4be45b95ff..444edbb702 100644
---- a/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
-+++ b/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
-@@ -78,18 +78,10 @@ enum __ptrace_request
- PTRACE_DETACH = 17,
- #define PT_DETACH PTRACE_DETACH
-
-- PTRACE_GET_THREAD_AREA = 22,
--
- /* Continue and stop at the next entry to or return from syscall. */
- PTRACE_SYSCALL = 24,
- #define PT_SYSCALL PTRACE_SYSCALL
-
-- /* Get all hardware breakpoint registers. */
-- PTRACE_GETHBPREGS = 29,
--
-- /* Set all hardware breakpoint registers. */
-- PTRACE_SETHBPREGS = 30,
--
- /* Set ptrace filter options. */
- PTRACE_SETOPTIONS = 0x4200,
- #define PT_SETOPTIONS PTRACE_SETOPTIONS
-
-From f36553bf6a4f69070f99badbdab5802b43e6e211 Mon Sep 17 00:00:00 2001
-From: Mike FABIAN <mfabian@redhat.com>
-Date: Mon, 19 Feb 2018 21:59:30 +0100
-Subject: [PATCH] =?UTF-8?q?Add=20missing=20=E2=80=9Creorder-end=E2=80=9D?=
- =?UTF-8?q?=20in=20LC=5FCOLLATE=20of=20et=5FEE=20[BZ=20#22517]?=
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
- [BZ #22517]
- * localedata/locales/et_EE (LC_COLLATE): add missing “reorder-end”
-
-(cherry picked from commit 7ec5f9465e732e668d0dc94ac078ba68056d6d0a)
-
-diff --git a/localedata/locales/et_EE b/localedata/locales/et_EE
-index 9cb55b568f..bab7493c98 100644
---- a/localedata/locales/et_EE
-+++ b/localedata/locales/et_EE
-@@ -103,6 +103,8 @@ reorder-after <w>
- <U00FC> <u-diaresis>;<BAS>;<MIN>;IGNORE % ü
- <U00DC> <u-diaresis>;<BAS>;<CAP>;IGNORE % Ü
-
-+reorder-end
-+
- END LC_COLLATE
-
- LC_CTYPE
-
-From 7c6304182b9f422b782ace1cdd3efbde056aec36 Mon Sep 17 00:00:00 2001
-From: DJ Delorie <dj@redhat.com>
-Date: Thu, 1 Mar 2018 23:20:45 -0500
-Subject: [PATCH] [BZ #22342] Fix netgroup cache keys.
-
-Unlike other nscd caches, the netgroup cache contains two types of
-records - those for "iterate through a netgroup" (i.e. setnetgrent())
-and those for "is this user in this netgroup" (i.e. innetgr()),
-i.e. full and partial records. The timeout code assumes these records
-have the same key for the group name, so that the collection of records
-that is "this netgroup" can be expired as a unit.
-
-However, the keys are not the same, as the in-netgroup key is generated
-by nscd rather than being passed to it from elsewhere, and is generated
-without the trailing NUL. All other keys have the trailing NUL, and as
-noted in the linked BZ, debug statements confirm that two keys for the
-same netgroup are added to the cache with two different lengths.
-
-The result of this is that as records in the cache expire, the purge
-code only cleans out one of the two types of entries, resulting in
-stale, possibly incorrect, and possibly inconsistent cache data.
-
-The patch simply includes the existing NUL in the computation for the
-key length ('key' points to the char after the NUL, and 'group' to the
-first char of the group, so 'key-group' includes the first char to the
-NUL, inclusive).
-
- [BZ #22342]
- * nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
- key value.
-
-Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-(cherry picked from commit 1c81d55fc4b07b51adf68558ba74ce975153e580)
-
-diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
-index b832c9315f..2f187b208c 100644
---- a/nscd/netgroupcache.c
-+++ b/nscd/netgroupcache.c
-@@ -480,7 +480,7 @@ addinnetgrX (struct database_dyn *db, int fd, request_header *req,
- {
- const char *group = key;
- key = (char *) rawmemchr (key, '\0') + 1;
-- size_t group_len = key - group - 1;
-+ size_t group_len = key - group;
- const char *host = *key++ ? key : NULL;
- if (host != NULL)
- key = (char *) rawmemchr (key, '\0') + 1;
-
-From 78a90c2f74a2012dd3eff302189e47ff6779a757 Mon Sep 17 00:00:00 2001
-From: Andreas Schwab <schwab@linux-m68k.org>
-Date: Fri, 2 Mar 2018 23:07:14 +0100
-Subject: [PATCH] Fix multiple definitions of __nss_*_database (bug 22918)
-
-(cherry picked from commit eaf6753f8aac33a36deb98c1031d1bad7b593d2d)
-
-diff --git a/nscd/gai.c b/nscd/gai.c
-index d081747797..576fd0045b 100644
---- a/nscd/gai.c
-+++ b/nscd/gai.c
-@@ -45,3 +45,6 @@
- #ifdef HAVE_LIBIDN
- # include <libidn/idn-stub.c>
- #endif
-+
-+/* Some variables normally defined in libc. */
-+service_user *__nss_hosts_database attribute_hidden;
-diff --git a/nss/nsswitch.c b/nss/nsswitch.c
-index d5e655974f..b0f0c11a3e 100644
---- a/nss/nsswitch.c
-+++ b/nss/nsswitch.c
-@@ -62,7 +62,7 @@ static service_library *nss_new_service (name_database *database,
-
- /* Declare external database variables. */
- #define DEFINE_DATABASE(name) \
-- extern service_user *__nss_##name##_database attribute_hidden; \
-+ service_user *__nss_##name##_database attribute_hidden; \
- weak_extern (__nss_##name##_database)
- #include "databases.def"
- #undef DEFINE_DATABASE
-diff --git a/nss/nsswitch.h b/nss/nsswitch.h
-index eccb535ef5..63573b9ebc 100644
---- a/nss/nsswitch.h
-+++ b/nss/nsswitch.h
-@@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits_dots)
- #define MAX_NR_ADDRS 48
-
- /* Prototypes for __nss_*_lookup2 functions. */
--#define DEFINE_DATABASE(arg) \
-- service_user *__nss_##arg##_database attribute_hidden; \
-- int __nss_##arg##_lookup2 (service_user **, const char *, \
-- const char *, void **); \
-+#define DEFINE_DATABASE(arg) \
-+ extern service_user *__nss_##arg##_database attribute_hidden; \
-+ int __nss_##arg##_lookup2 (service_user **, const char *, \
-+ const char *, void **); \
- libc_hidden_proto (__nss_##arg##_lookup2)
- #include "databases.def"
- #undef DEFINE_DATABASE
-diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
-index f509534ca9..8c64ac59ff 100644
---- a/posix/tst-rfc3484-2.c
-+++ b/posix/tst-rfc3484-2.c
-@@ -58,6 +58,7 @@ _res_hconf_init (void)
- #undef USE_NSCD
- #include "../sysdeps/posix/getaddrinfo.c"
-
-+service_user *__nss_hosts_database attribute_hidden;
-
- /* This is the beginning of the real test code. The above defines
- (among other things) the function rfc3484_sort. */
-diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c
-index ae44087a10..1c61aaf844 100644
---- a/posix/tst-rfc3484-3.c
-+++ b/posix/tst-rfc3484-3.c
-@@ -58,6 +58,7 @@ _res_hconf_init (void)
- #undef USE_NSCD
- #include "../sysdeps/posix/getaddrinfo.c"
-
-+service_user *__nss_hosts_database attribute_hidden;
-
- /* This is the beginning of the real test code. The above defines
- (among other things) the function rfc3484_sort. */
-diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
-index 7f191abbbc..8f45848e44 100644
---- a/posix/tst-rfc3484.c
-+++ b/posix/tst-rfc3484.c
-@@ -58,6 +58,7 @@ _res_hconf_init (void)
- #undef USE_NSCD
- #include "../sysdeps/posix/getaddrinfo.c"
-
-+service_user *__nss_hosts_database attribute_hidden;
-
- /* This is the beginning of the real test code. The above defines
- (among other things) the function rfc3484_sort. */
-
-From 1e52d8e65a58c49a48549053a1b89c06240e0c6c Mon Sep 17 00:00:00 2001
-From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
-Date: Fri, 17 Nov 2017 16:04:29 -0200
-Subject: [PATCH] i386: Fix i386 sigaction sa_restorer initialization
- (BZ#21269)
-
-This patch fixes the i386 sa_restorer field initialization for sigaction
-syscall for kernel with vDSO. As described in bug report, i386 Linux
-(and compat on x86_64) interprets SA_RESTORER clear with nonzero
-sa_restorer as a request for stack switching if the SS segment is 'funny'.
-This means that anything that tries to mix glibc's signal handling with
-segmentation (for instance through modify_ldt syscall) is randomly broken
-depending on what values lands in sa_restorer.
-
-The testcase added is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
-more specifically in do_multicpu_tests function. The main changes are:
-
- - C11 atomics instead of plain access.
-
- - Remove x86_64 support which simplifies the syscall handling and fallbacks.
-
- - Replicate only the test required to trigger the issue.
-
-Checked on i686-linux-gnu.
-
- [BZ #21269]
- * sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269.
- * sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear
- sa_restorer for vDSO case.
- * sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file.
-
-(cherry picked from commit 68448be208ee06e76665918b37b0a57e3e00c8b4)
-
-diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
-index 4080b8c966..da716e2c1b 100644
---- a/sysdeps/unix/sysv/linux/i386/Makefile
-+++ b/sysdeps/unix/sysv/linux/i386/Makefile
-@@ -3,6 +3,9 @@ default-abi := 32
-
- ifeq ($(subdir),misc)
- sysdep_routines += ioperm iopl vm86
-+
-+tests += tst-bz21269
-+$(objpfx)tst-bz21269: $(shared-thread-library)
- endif
-
- ifeq ($(subdir),elf)
-diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
-index a5eb9e0d3e..177ff60ee6 100644
---- a/sysdeps/unix/sysv/linux/i386/sigaction.c
-+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
-@@ -42,7 +42,6 @@ extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
- #endif
- extern void restore (void) asm ("__restore") attribute_hidden;
-
--
- /* If ACT is not NULL, change the action for SIG to *ACT.
- If OACT is not NULL, put the old action for SIG in *OACT. */
- int
-@@ -65,6 +64,8 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
- kact.sa_restorer = ((act->sa_flags & SA_SIGINFO)
- ? &restore_rt : &restore);
- }
-+ else
-+ kact.sa_restorer = NULL;
- }
-
- /* XXX The size argument hopefully will have to be changed to the
-diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
-new file mode 100644
-index 0000000000..353e36507d
---- /dev/null
-+++ b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
-@@ -0,0 +1,233 @@
-+/* Test for i386 sigaction sa_restorer handling (BZ#21269)
-+ Copyright (C) 2017 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+/* This is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
-+ more specifically in do_multicpu_tests function. The main changes
-+ are:
-+
-+ - C11 atomics instead of plain access.
-+ - Remove x86_64 support which simplifies the syscall handling
-+ and fallbacks.
-+ - Replicate only the test required to trigger the issue for the
-+ BZ#21269. */
-+
-+#include <stdatomic.h>
-+
-+#include <asm/ldt.h>
-+#include <linux/futex.h>
-+
-+#include <setjmp.h>
-+#include <signal.h>
-+#include <errno.h>
-+#include <sys/syscall.h>
-+#include <sys/mman.h>
-+
-+#include <support/xunistd.h>
-+#include <support/check.h>
-+#include <support/xthread.h>
-+
-+static int
-+xset_thread_area (struct user_desc *u_info)
-+{
-+ long ret = syscall (SYS_set_thread_area, u_info);
-+ TEST_VERIFY_EXIT (ret == 0);
-+ return ret;
-+}
-+
-+static void
-+xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
-+{
-+ TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, 1, ptr, bytecount) == 0);
-+}
-+
-+static int
-+futex (int *uaddr, int futex_op, int val, void *timeout, int *uaddr2,
-+ int val3)
-+{
-+ return syscall (SYS_futex, uaddr, futex_op, val, timeout, uaddr2, val3);
-+}
-+
-+static void
-+xsethandler (int sig, void (*handler)(int, siginfo_t *, void *), int flags)
-+{
-+ struct sigaction sa = { 0 };
-+ sa.sa_sigaction = handler;
-+ sa.sa_flags = SA_SIGINFO | flags;
-+ TEST_VERIFY_EXIT (sigemptyset (&sa.sa_mask) == 0);
-+ TEST_VERIFY_EXIT (sigaction (sig, &sa, 0) == 0);
-+}
-+
-+static jmp_buf jmpbuf;
-+
-+static void
-+sigsegv_handler (int sig, siginfo_t *info, void *ctx_void)
-+{
-+ siglongjmp (jmpbuf, 1);
-+}
-+
-+/* Points to an array of 1024 ints, each holding its own index. */
-+static const unsigned int *counter_page;
-+static struct user_desc *low_user_desc;
-+static struct user_desc *low_user_desc_clear; /* Used to delete GDT entry. */
-+static int gdt_entry_num;
-+
-+static void
-+setup_counter_page (void)
-+{
-+ long page_size = sysconf (_SC_PAGE_SIZE);
-+ TEST_VERIFY_EXIT (page_size > 0);
-+ unsigned int *page = xmmap (NULL, page_size, PROT_READ | PROT_WRITE,
-+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1);
-+ for (int i = 0; i < (page_size / sizeof (unsigned int)); i++)
-+ page[i] = i;
-+ counter_page = page;
-+}
-+
-+static void
-+setup_low_user_desc (void)
-+{
-+ low_user_desc = xmmap (NULL, 2 * sizeof (struct user_desc),
-+ PROT_READ | PROT_WRITE,
-+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1);
-+
-+ low_user_desc->entry_number = -1;
-+ low_user_desc->base_addr = (unsigned long) &counter_page[1];
-+ low_user_desc->limit = 0xffff;
-+ low_user_desc->seg_32bit = 1;
-+ low_user_desc->contents = 0;
-+ low_user_desc->read_exec_only = 0;
-+ low_user_desc->limit_in_pages = 1;
-+ low_user_desc->seg_not_present = 0;
-+ low_user_desc->useable = 0;
-+
-+ xset_thread_area (low_user_desc);
-+
-+ low_user_desc_clear = low_user_desc + 1;
-+ low_user_desc_clear->entry_number = gdt_entry_num;
-+ low_user_desc_clear->read_exec_only = 1;
-+ low_user_desc_clear->seg_not_present = 1;
-+}
-+
-+/* Possible values of futex:
-+ 0: thread is idle.
-+ 1: thread armed.
-+ 2: thread should clear LDT entry 0.
-+ 3: thread should exit. */
-+static atomic_uint ftx;
-+
-+static void *
-+threadproc (void *ctx)
-+{
-+ while (1)
-+ {
-+ futex ((int *) &ftx, FUTEX_WAIT, 1, NULL, NULL, 0);
-+ while (atomic_load (&ftx) != 2)
-+ {
-+ if (atomic_load (&ftx) >= 3)
-+ return NULL;
-+ }
-+
-+ /* clear LDT entry 0. */
-+ const struct user_desc desc = { 0 };
-+ xmodify_ldt (1, &desc, sizeof (desc));
-+
-+ /* If ftx == 2, set it to zero, If ftx == 100, quit. */
-+ if (atomic_fetch_add (&ftx, -2) != 2)
-+ return NULL;
-+ }
-+}
-+
-+
-+/* As described in testcase, for historical reasons x86_32 Linux (and compat
-+ on x86_64) interprets SA_RESTORER clear with nonzero sa_restorer as a
-+ request for stack switching if the SS segment is 'funny' (this is default
-+ scenario for vDSO system). This means that anything that tries to mix
-+ signal handling with segmentation should explicit clear the sa_restorer.
-+
-+ This testcase check if sigaction in fact does it by changing the local
-+ descriptor table (LDT) through the modify_ldt syscall and triggering
-+ a synchronous segfault on iret fault by trying to install an invalid
-+ segment. With a correct zeroed sa_restorer it should not trigger an
-+ 'real' SEGSEGV and allows the siglongjmp in signal handler. */
-+
-+static int
-+do_test (void)
-+{
-+ setup_counter_page ();
-+ setup_low_user_desc ();
-+
-+ pthread_t thread;
-+ unsigned short orig_ss;
-+
-+ xsethandler (SIGSEGV, sigsegv_handler, 0);
-+ /* 32-bit kernels send SIGILL instead of SIGSEGV on IRET faults. */
-+ xsethandler (SIGILL, sigsegv_handler, 0);
-+
-+ thread = xpthread_create (0, threadproc, 0);
-+
-+ asm volatile ("mov %%ss, %0" : "=rm" (orig_ss));
-+
-+ for (int i = 0; i < 5; i++)
-+ {
-+ if (sigsetjmp (jmpbuf, 1) != 0)
-+ continue;
-+
-+ /* Make sure the thread is ready after the last test. */
-+ while (atomic_load (&ftx) != 0)
-+ ;
-+
-+ struct user_desc desc = {
-+ .entry_number = 0,
-+ .base_addr = 0,
-+ .limit = 0xffff,
-+ .seg_32bit = 1,
-+ .contents = 0,
-+ .read_exec_only = 0,
-+ .limit_in_pages = 1,
-+ .seg_not_present = 0,
-+ .useable = 0
-+ };
-+
-+ xmodify_ldt (0x11, &desc, sizeof (desc));
-+
-+ /* Arm the thread. */
-+ ftx = 1;
-+ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0);
-+
-+ asm volatile ("mov %0, %%ss" : : "r" (0x7));
-+
-+ /* Fire up thread modify_ldt call. */
-+ atomic_store (&ftx, 2);
-+
-+ while (atomic_load (&ftx) != 0)
-+ ;
-+
-+ /* On success, modify_ldt will segfault us synchronously and we will
-+ escape via siglongjmp. */
-+ support_record_failure ();
-+ }
-+
-+ atomic_store (&ftx, 100);
-+ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0);
-+
-+ xpthread_join (thread);
-+
-+ return 0;
-+}
-+
-+#include <support/test-driver.c>
-
-From 55ad82e45c313454de657931898e974a7a036cad Mon Sep 17 00:00:00 2001
-From: Andrew Senkevich <andrew.n.senkevich@gmail.com>
-Date: Fri, 23 Mar 2018 16:19:45 +0100
-Subject: [PATCH] Fix i386 memmove issue (bug 22644).
-
- [BZ #22644]
- * sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed
- branch conditions.
- * string/test-memmove.c (do_test2): New testcase.
-
-(cherry picked from commit cd66c0e584c6d692bc8347b5e72723d02b8a8ada)
-
-diff --git a/string/test-memmove.c b/string/test-memmove.c
-index edc7a4c3bf..64e3651ba4 100644
---- a/string/test-memmove.c
-+++ b/string/test-memmove.c
-@@ -24,6 +24,7 @@
- # define TEST_NAME "memmove"
- #endif
- #include "test-string.h"
-+#include <support/test-driver.h>
-
- char *simple_memmove (char *, const char *, size_t);
-
-@@ -245,6 +246,60 @@ do_random_tests (void)
- }
- }
-
-+static void
-+do_test2 (void)
-+{
-+ size_t size = 0x20000000;
-+ uint32_t * large_buf;
-+
-+ large_buf = mmap ((void*) 0x70000000, size, PROT_READ | PROT_WRITE,
-+ MAP_PRIVATE | MAP_ANON, -1, 0);
-+
-+ if (large_buf == MAP_FAILED)
-+ error (EXIT_UNSUPPORTED, errno, "Large mmap failed");
-+
-+ if ((uintptr_t) large_buf > 0x80000000 - 128
-+ || 0x80000000 - (uintptr_t) large_buf > 0x20000000)
-+ {
-+ error (0, 0, "Large mmap allocated improperly");
-+ ret = EXIT_UNSUPPORTED;
-+ munmap ((void *) large_buf, size);
-+ return;
-+ }
-+
-+ size_t bytes_move = 0x80000000 - (uintptr_t) large_buf;
-+ size_t arr_size = bytes_move / sizeof (uint32_t);
-+ size_t i;
-+
-+ FOR_EACH_IMPL (impl, 0)
-+ {
-+ for (i = 0; i < arr_size; i++)
-+ large_buf[i] = (uint32_t) i;
-+
-+ uint32_t * dst = &large_buf[33];
-+
-+#ifdef TEST_BCOPY
-+ CALL (impl, (char *) large_buf, (char *) dst, bytes_move);
-+#else
-+ CALL (impl, (char *) dst, (char *) large_buf, bytes_move);
-+#endif
-+
-+ for (i = 0; i < arr_size; i++)
-+ {
-+ if (dst[i] != (uint32_t) i)
-+ {
-+ error (0, 0,
-+ "Wrong result in function %s dst \"%p\" src \"%p\" offset \"%zd\"",
-+ impl->name, dst, large_buf, i);
-+ ret = 1;
-+ break;
-+ }
-+ }
-+ }
-+
-+ munmap ((void *) large_buf, size);
-+}
-+
- int
- test_main (void)
- {
-@@ -284,6 +339,9 @@ test_main (void)
- }
-
- do_random_tests ();
-+
-+ do_test2 ();
-+
- return ret;
- }
-
-diff --git a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
-index 9c3bbe7e17..9aa17de99c 100644
---- a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
-+++ b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
-@@ -72,7 +72,7 @@ ENTRY (MEMCPY)
- cmp %edx, %eax
-
- # ifdef USE_AS_MEMMOVE
-- jg L(check_forward)
-+ ja L(check_forward)
-
- L(mm_len_0_or_more_backward):
- /* Now do checks for lengths. We do [0..16], [16..32], [32..64], [64..128]
-@@ -81,7 +81,7 @@ L(mm_len_0_or_more_backward):
- jbe L(mm_len_0_16_bytes_backward)
-
- cmpl $32, %ecx
-- jg L(mm_len_32_or_more_backward)
-+ ja L(mm_len_32_or_more_backward)
-
- /* Copy [0..32] and return. */
- movdqu (%eax), %xmm0
-@@ -92,7 +92,7 @@ L(mm_len_0_or_more_backward):
-
- L(mm_len_32_or_more_backward):
- cmpl $64, %ecx
-- jg L(mm_len_64_or_more_backward)
-+ ja L(mm_len_64_or_more_backward)
-
- /* Copy [0..64] and return. */
- movdqu (%eax), %xmm0
-@@ -107,7 +107,7 @@ L(mm_len_32_or_more_backward):
-
- L(mm_len_64_or_more_backward):
- cmpl $128, %ecx
-- jg L(mm_len_128_or_more_backward)
-+ ja L(mm_len_128_or_more_backward)
-
- /* Copy [0..128] and return. */
- movdqu (%eax), %xmm0
-@@ -132,7 +132,7 @@ L(mm_len_128_or_more_backward):
- add %ecx, %eax
- cmp %edx, %eax
- movl SRC(%esp), %eax
-- jle L(forward)
-+ jbe L(forward)
- PUSH (%esi)
- PUSH (%edi)
- PUSH (%ebx)
-@@ -269,7 +269,7 @@ L(check_forward):
- add %edx, %ecx
- cmp %eax, %ecx
- movl LEN(%esp), %ecx
-- jle L(forward)
-+ jbe L(forward)
-
- /* Now do checks for lengths. We do [0..16], [0..32], [0..64], [0..128]
- separately. */
diff --git a/gnu/packages/patches/glibc-2.27-supported-locales.patch b/gnu/packages/patches/glibc-2.27-supported-locales.patch
deleted file mode 100644
index 2888052bb8..0000000000
--- a/gnu/packages/patches/glibc-2.27-supported-locales.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-This patch is taken from debian's glibc package (generate-supported.mk).
-It install the localedata/SUPPORTED file of the glibc. This file lists
-all the supported locales of the glibc.
-
-diff --git a/localedata/Makefile.old b/localedata/Makefile
-index 34877c0..a61d9b9 100644
---- a/localedata/Makefile.old
-+++ b/localedata/Makefile
-@@ -91,7 +91,8 @@ endif
- # Files to install.
- install-others := $(addprefix $(inst_i18ndir)/, \
- $(addsuffix .gz, $(charmaps)) \
-- $(locales))
-+ $(locales)) \
-+ $(inst_i18ndir)/SUPPORTED
-
- tests: $(objdir)/iconvdata/gconv-modules
-
-@@ -195,6 +196,14 @@ endif
-
- include SUPPORTED
-
-+$(inst_i18ndir)/SUPPORTED: SUPPORTED $(+force)
-+ for locale in $(SUPPORTED-LOCALES); do \
-+ [ $$locale = true ] && continue; \
-+ echo $$locale | sed 's,/, ,' >> LOCALES; \
-+ done
-+ $(make-target-directory)
-+ $(INSTALL_DATA) LOCALES $@
-+
- INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
-
- # Sometimes the whole collection of locale files should be installed.
diff --git a/gnu/packages/patches/glibc-2.28-git-fixes.patch b/gnu/packages/patches/glibc-2.28-git-fixes.patch
deleted file mode 100644
index 7e370ef0b1..0000000000
--- a/gnu/packages/patches/glibc-2.28-git-fixes.patch
+++ /dev/null
@@ -1,248 +0,0 @@
-This file contains fixes from the "release/2.28/master" branch:
-https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.28/master
-
-Currently we have these commits (sans tests and ChangeLog updates):
-7f11842e7483da7aa9fa3031be122021978ef600
-726e1554ce4db5e35af41cb0110c54c5e1232054
-4b25485f03158959cff45379eecc1d73c7dcdd11
-d05b05d1570ba3ae354a2f5a3cfeefb373b09979
-bfcfa22589f2b4277a65e60c6b736b6bbfbd87d0
-2f498f3d140ab5152bd784df2be7af7d9c5e63ed
-
-diff --git a/htl/Versions b/htl/Versions
-index 6a63a1b8a1..c5a616da10 100644
---- a/htl/Versions
-+++ b/htl/Versions
-@@ -150,6 +150,8 @@ libpthread {
- __cthread_keycreate;
- __cthread_getspecific;
- __cthread_setspecific;
-+ __pthread_getspecific;
-+ __pthread_setspecific;
- __pthread_getattr_np;
- __pthread_attr_getstack;
- }
-
-diff --git a/sysdeps/htl/pt-getspecific.c b/sysdeps/htl/pt-getspecific.c
-index a0227a67f6..64ddf9551a 100644
---- a/sysdeps/htl/pt-getspecific.c
-+++ b/sysdeps/htl/pt-getspecific.c
-@@ -36,3 +36,4 @@ __pthread_getspecific (pthread_key_t key)
- return self->thread_specifics[key];
- }
- strong_alias (__pthread_getspecific, pthread_getspecific);
-+hidden_def (__pthread_getspecific)
-diff --git a/sysdeps/htl/pt-setspecific.c b/sysdeps/htl/pt-setspecific.c
-index a46a12f157..02aff417ef 100644
---- a/sysdeps/htl/pt-setspecific.c
-+++ b/sysdeps/htl/pt-setspecific.c
-@@ -48,3 +48,4 @@ __pthread_setspecific (pthread_key_t key, const void *value)
- return 0;
- }
- strong_alias (__pthread_setspecific, pthread_setspecific);
-+hidden_def (__pthread_setspecific)
-diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
-index 132ac1718e..71c2fcd9c6 100644
---- a/sysdeps/htl/pthreadP.h
-+++ b/sysdeps/htl/pthreadP.h
-@@ -68,6 +68,8 @@ struct __pthread_cancelation_handler **___pthread_get_cleanup_stack (void) attri
-
- #if IS_IN (libpthread)
- hidden_proto (__pthread_key_create)
-+hidden_proto (__pthread_getspecific)
-+hidden_proto (__pthread_setspecific)
- hidden_proto (_pthread_mutex_init)
- #endif
-
-diff --git a/sysdeps/unix/sysv/linux/getdents64.c b/sysdeps/unix/sysv/linux/getdents64.c
-index 3bde0cf4f0..bc140b5a7f 100644
---- a/sysdeps/unix/sysv/linux/getdents64.c
-+++ b/sysdeps/unix/sysv/linux/getdents64.c
-@@ -33,41 +33,80 @@ strong_alias (__getdents64, __getdents)
- # include <shlib-compat.h>
-
- # if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
--# include <olddirent.h>
-+# include <olddirent.h>
-+# include <unistd.h>
-
--/* kernel definition of as of 3.2. */
--struct compat_linux_dirent
-+static ssize_t
-+handle_overflow (int fd, __off64_t offset, ssize_t count)
- {
-- /* Both d_ino and d_off are compat_ulong_t which are defined in all
-- architectures as 'u32'. */
-- uint32_t d_ino;
-- uint32_t d_off;
-- unsigned short d_reclen;
-- char d_name[1];
--};
-+ /* If this is the first entry in the buffer, we can report the
-+ error. */
-+ if (count == 0)
-+ {
-+ __set_errno (EOVERFLOW);
-+ return -1;
-+ }
-+
-+ /* Otherwise, seek to the overflowing entry, so that the next call
-+ will report the error, and return the data read so far.. */
-+ if (__lseek64 (fd, offset, SEEK_SET) != 0)
-+ return -1;
-+ return count;
-+}
-
- ssize_t
- __old_getdents64 (int fd, char *buf, size_t nbytes)
- {
-- ssize_t retval = INLINE_SYSCALL_CALL (getdents, fd, buf, nbytes);
-+ /* We do not move the individual directory entries. This is only
-+ possible if the target type (struct __old_dirent64) is smaller
-+ than the source type. */
-+ _Static_assert (offsetof (struct __old_dirent64, d_name)
-+ <= offsetof (struct dirent64, d_name),
-+ "__old_dirent64 is larger than dirent64");
-+ _Static_assert (__alignof__ (struct __old_dirent64)
-+ <= __alignof__ (struct dirent64),
-+ "alignment of __old_dirent64 is larger than dirent64");
-
-- /* The kernel added the d_type value after the name. Change this now. */
-- if (retval != -1)
-+ ssize_t retval = INLINE_SYSCALL_CALL (getdents64, fd, buf, nbytes);
-+ if (retval > 0)
- {
-- union
-- {
-- struct compat_linux_dirent k;
-- struct dirent u;
-- } *kbuf = (void *) buf;
--
-- while ((char *) kbuf < buf + retval)
-+ char *p = buf;
-+ char *end = buf + retval;
-+ while (p < end)
- {
-- char d_type = *((char *) kbuf + kbuf->k.d_reclen - 1);
-- memmove (kbuf->u.d_name, kbuf->k.d_name,
-- strlen (kbuf->k.d_name) + 1);
-- kbuf->u.d_type = d_type;
-+ struct dirent64 *source = (struct dirent64 *) p;
-+
-+ /* Copy out the fixed-size data. */
-+ __ino_t ino = source->d_ino;
-+ __off64_t offset = source->d_off;
-+ unsigned int reclen = source->d_reclen;
-+ unsigned char type = source->d_type;
-+
-+ /* Check for ino_t overflow. */
-+ if (__glibc_unlikely (ino != source->d_ino))
-+ return handle_overflow (fd, offset, p - buf);
-+
-+ /* Convert to the target layout. Use a separate struct and
-+ memcpy to side-step aliasing issues. */
-+ struct __old_dirent64 result;
-+ result.d_ino = ino;
-+ result.d_off = offset;
-+ result.d_reclen = reclen;
-+ result.d_type = type;
-+
-+ /* Write the fixed-sized part of the result to the
-+ buffer. */
-+ size_t result_name_offset = offsetof (struct __old_dirent64, d_name);
-+ memcpy (p, &result, result_name_offset);
-+
-+ /* Adjust the position of the name if necessary. Copy
-+ everything until the end of the record, including the
-+ terminating NUL byte. */
-+ if (result_name_offset != offsetof (struct dirent64, d_name))
-+ memmove (p + result_name_offset, source->d_name,
-+ reclen - offsetof (struct dirent64, d_name));
-
-- kbuf = (void *) ((char *) kbuf + kbuf->k.d_reclen);
-+ p += reclen;
- }
- }
- return retval;
-
-diff --git a/misc/error.c b/misc/error.c
-index b4e8b6c938..03378e2f2a 100644
---- a/misc/error.c
-+++ b/misc/error.c
-@@ -319,6 +319,7 @@ error (int status, int errnum, const char *message, ...)
-
- va_start (args, message);
- error_tail (status, errnum, message, args);
-+ va_end (args);
-
- #ifdef _LIBC
- _IO_funlockfile (stderr);
-@@ -390,6 +391,7 @@ error_at_line (int status, int errnum, const char *file_name,
-
- va_start (args, message);
- error_tail (status, errnum, message, args);
-+ va_end (args);
-
- #ifdef _LIBC
- _IO_funlockfile (stderr);
-
-diff --git a/nscd/nscd_conf.c b/nscd/nscd_conf.c
-index 265a02434d..7293b795b6 100644
---- a/nscd/nscd_conf.c
-+++ b/nscd/nscd_conf.c
-@@ -190,7 +190,10 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb])
- if (!arg1)
- error (0, 0, _("Must specify user name for server-user option"));
- else
-- server_user = xstrdup (arg1);
-+ {
-+ free ((char *) server_user);
-+ server_user = xstrdup (arg1);
-+ }
- }
- else if (strcmp (entry, "stat-user") == 0)
- {
-@@ -198,6 +201,7 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb])
- error (0, 0, _("Must specify user name for stat-user option"));
- else
- {
-+ free ((char *) stat_user);
- stat_user = xstrdup (arg1);
-
- struct passwd *pw = getpwnam (stat_user);
-
-diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
-index cfd34b66b9..35b0bfc5d2 100644
---- a/nss/nss_files/files-alias.c
-+++ b/nss/nss_files/files-alias.c
-@@ -221,6 +221,13 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
- {
- while (! feof_unlocked (listfile))
- {
-+ if (room_left < 2)
-+ {
-+ free (old_line);
-+ fclose (listfile);
-+ goto no_more_room;
-+ }
-+
- first_unused[room_left - 1] = '\xff';
- line = fgets_unlocked (first_unused, room_left,
- listfile);
-@@ -229,6 +236,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
- if (first_unused[room_left - 1] != '\xff')
- {
- free (old_line);
-+ fclose (listfile);
- goto no_more_room;
- }
-
-@@ -256,6 +264,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
- + __alignof__ (char *)))
- {
- free (old_line);
-+ fclose (listfile);
- goto no_more_room;
- }
- room_left -= ((first_unused - cp)
-
diff --git a/gnu/packages/patches/glibc-2.28-supported-locales.patch b/gnu/packages/patches/glibc-2.28-supported-locales.patch
deleted file mode 100644
index 2888052bb8..0000000000
--- a/gnu/packages/patches/glibc-2.28-supported-locales.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-This patch is taken from debian's glibc package (generate-supported.mk).
-It install the localedata/SUPPORTED file of the glibc. This file lists
-all the supported locales of the glibc.
-
-diff --git a/localedata/Makefile.old b/localedata/Makefile
-index 34877c0..a61d9b9 100644
---- a/localedata/Makefile.old
-+++ b/localedata/Makefile
-@@ -91,7 +91,8 @@ endif
- # Files to install.
- install-others := $(addprefix $(inst_i18ndir)/, \
- $(addsuffix .gz, $(charmaps)) \
-- $(locales))
-+ $(locales)) \
-+ $(inst_i18ndir)/SUPPORTED
-
- tests: $(objdir)/iconvdata/gconv-modules
-
-@@ -195,6 +196,14 @@ endif
-
- include SUPPORTED
-
-+$(inst_i18ndir)/SUPPORTED: SUPPORTED $(+force)
-+ for locale in $(SUPPORTED-LOCALES); do \
-+ [ $$locale = true ] && continue; \
-+ echo $$locale | sed 's,/, ,' >> LOCALES; \
-+ done
-+ $(make-target-directory)
-+ $(INSTALL_DATA) LOCALES $@
-+
- INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
-
- # Sometimes the whole collection of locale files should be installed.
diff --git a/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch b/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch
new file mode 100644
index 0000000000..1c3fe427f9
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch
@@ -0,0 +1,84 @@
+This is needed to run Python on the Hurd, especially during the build of
+python-boot0.
+
+Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/debian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff
+
+Use the realtime clock for the monotonic clock. This is of course not a proper
+implementation (which is being done in Mach), but will permit to fix at least
+the iceweasel stack.
+
+vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
+_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the
+former.
+
+From 0aa1dfd580cf9ad7b812c307b128decb782b825f Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Mon, 2 Mar 2020 18:59:04 +0100
+Subject: [PATCH 2/2] Use realtime clock for the monotonic clock.
+
+---
+ sysdeps/mach/clock_gettime.c | 2 +-
+ sysdeps/mach/hurd/bits/posix_opt.h | 6 +++---
+ sysdeps/posix/clock_getres.c | 1 +
+ sysdeps/pthread/timer_create.c | 2 +-
+ 4 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
+index ac3547df3c..af8681ba4e 100644
+--- a/sysdeps/mach/clock_gettime.c
++++ b/sysdeps/mach/clock_gettime.c
+@@ -25,7 +25,7 @@
+ int
+ __clock_gettime (clockid_t clock_id, struct timespec *ts)
+ {
+- if (clock_id != CLOCK_REALTIME)
++ if (clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_REALTIME)
+ {
+ errno = EINVAL;
+ return -1;
+diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
+index 0050151332..27b3a28ab7 100644
+--- a/sysdeps/mach/hurd/bits/posix_opt.h
++++ b/sysdeps/mach/hurd/bits/posix_opt.h
+@@ -163,10 +163,10 @@
+ #define _POSIX_THREAD_PROCESS_SHARED -1
+
+ /* The monotonic clock might be available. */
+-#define _POSIX_MONOTONIC_CLOCK 0
++#define _POSIX_MONOTONIC_CLOCK 200809L
+
+-/* The clock selection interfaces are available. */
+-#define _POSIX_CLOCK_SELECTION 200809L
++/* The clock selection interfaces are not really available yet. */
++#define _POSIX_CLOCK_SELECTION -1
+
+ /* Advisory information interfaces could be available in future. */
+ #define _POSIX_ADVISORY_INFO 0
+diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
+index fcd79fd554..1dd02aa449 100644
+--- a/sysdeps/posix/clock_getres.c
++++ b/sysdeps/posix/clock_getres.c
+@@ -52,6 +52,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
+ switch (clock_id)
+ {
+ case CLOCK_REALTIME:
++ case CLOCK_MONOTONIC:
+ retval = realtime_getres (res);
+ break;
+
+diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create.c
+index 9d8a9ea8ae..3430582c09 100644
+--- a/sysdeps/pthread/timer_create.c
++++ b/sysdeps/pthread/timer_create.c
+@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
+ return -1;
+ }
+
+- if (clock_id != CLOCK_REALTIME)
++ if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC)
+ {
+ __set_errno (EINVAL);
+ return -1;
+--
+2.24.0
+
diff --git a/gnu/packages/patches/glibc-bootstrap-system.patch b/gnu/packages/patches/glibc-bootstrap-system.patch
index db6457e939..9c0fac3ff5 100644
--- a/gnu/packages/patches/glibc-bootstrap-system.patch
+++ b/gnu/packages/patches/glibc-bootstrap-system.patch
@@ -3,17 +3,10 @@ and popen(3) need to be tweaked to use the right shell. For the bootstrap
glibc, we just use whatever `sh' can be found in $PATH. The final glibc
instead uses the hard-coded absolute file name of `bash'.
---- a/sysdeps/posix/system.c
-+++ b/sysdeps/posix/system.c
-@@ -140,7 +140,7 @@ do_system (const char *line)
- __posix_spawnattr_setflags (&spawn_attr,
- POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK);
-
-- status = __posix_spawn (&pid, SHELL_PATH, 0, &spawn_attr,
-+ status = __posix_spawnp (&pid, SHELL_NAME, 0, &spawn_attr,
- (char *const[]){ (char*) SHELL_NAME,
- (char*) "-c",
- (char *) line, NULL },
+In addition, status should be initialized to 0 and not -1.
+
+diff --git a/libio/iopopen.c b/libio/iopopen.c
+index ebc381ed7c..e0d3ed1bc3 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -85,7 +85,7 @@ spawn_process (posix_spawn_file_actions_t *fa, FILE *fp, const char *command,
@@ -25,6 +18,28 @@ instead uses the hard-coded absolute file name of `bash'.
(char *const[]){ (char*) "sh", (char*) "-c",
(char *) command, NULL }, __environ) != 0)
return false;
+diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c
+index a03f478fc7..94da6facf3 100644
+--- a/sysdeps/posix/system.c
++++ b/sysdeps/posix/system.c
+@@ -101,7 +101,7 @@ cancel_handler (void *arg)
+ static int
+ do_system (const char *line)
+ {
+- int status = -1;
++ int status = 0;
+ int ret;
+ pid_t pid;
+ struct sigaction sa;
+@@ -145,7 +145,7 @@ do_system (const char *line)
+ __posix_spawnattr_setflags (&spawn_attr,
+ POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK);
+
+- ret = __posix_spawn (&pid, SHELL_PATH, 0, &spawn_attr,
++ ret = __posix_spawnp (&pid, SHELL_NAME, 0, &spawn_attr,
+ (char *const[]){ (char *) SHELL_NAME,
+ (char *) "-c",
+ (char *) line, NULL },
--- a/include/spawn.h
+++ b/include/spawn.h
diff --git a/gnu/packages/patches/glibc-cross-objcopy.patch b/gnu/packages/patches/glibc-cross-objcopy.patch
new file mode 100644
index 0000000000..e4c693aa44
--- /dev/null
+++ b/gnu/packages/patches/glibc-cross-objcopy.patch
@@ -0,0 +1,159 @@
+Use 'powerpc64le-linux-gnu-objcopy' rather than 'objcopy' when cross-compiling
+to powerpc64le-linux-gnu: <https://issues.guix.gnu.org/49417>.
+
+Patch submitted:
+ <https://sourceware.org/pipermail/libc-alpha/2021-July/128333.html>
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 13a791ffde..5b370c07a2 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -118,8 +118,6 @@ AS=`$CC -print-prog-name=as`
+ LD=`$CC -print-prog-name=ld`
+ AR=`$CC -print-prog-name=ar`
+ AC_SUBST(AR)
+-OBJCOPY=`$CC -print-prog-name=objcopy`
+-AC_SUBST(OBJCOPY)
+ GPROF=`$CC -print-prog-name=gprof`
+ AC_SUBST(GPROF)
+
+diff --git a/configure b/configure
+index fe0eda1cd5..3a08270734 100755
+--- a/configure
++++ b/configure
+@@ -654,7 +654,6 @@ MAKE
+ LD
+ AS
+ GPROF
+-OBJCOPY
+ AR
+ LN_S
+ INSTALL_DATA
+@@ -689,6 +688,7 @@ sysheaders
+ ac_ct_CXX
+ CXXFLAGS
+ CXX
++OBJCOPY
+ OBJDUMP
+ READELF
+ CPP
+@@ -3054,6 +3054,98 @@ else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+ fi
+
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args.
++set dummy ${ac_tool_prefix}objcopy; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_OBJCOPY+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$OBJCOPY"; then
++ ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ ac_cv_prog_OBJCOPY="${ac_tool_prefix}objcopy"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++fi
++fi
++OBJCOPY=$ac_cv_prog_OBJCOPY
++if test -n "$OBJCOPY"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCOPY" >&5
++$as_echo "$OBJCOPY" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OBJCOPY"; then
++ ac_ct_OBJCOPY=$OBJCOPY
++ # Extract the first word of "objcopy", so it can be a program name with args.
++set dummy objcopy; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_OBJCOPY+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_OBJCOPY"; then
++ ac_cv_prog_ac_ct_OBJCOPY="$ac_ct_OBJCOPY" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ ac_cv_prog_ac_ct_OBJCOPY="objcopy"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_OBJCOPY=$ac_cv_prog_ac_ct_OBJCOPY
++if test -n "$ac_ct_OBJCOPY"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJCOPY" >&5
++$as_echo "$ac_ct_OBJCOPY" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_OBJCOPY" = x; then
++ OBJCOPY="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ OBJCOPY=$ac_ct_OBJCOPY
++ fi
++else
++ OBJCOPY="$ac_cv_prog_OBJCOPY"
++fi
++
+
+ # We need the C++ compiler only for testing.
+ ac_ext=cpp
+@@ -4645,8 +4737,6 @@ AS=`$CC -print-prog-name=as`
+ LD=`$CC -print-prog-name=ld`
+ AR=`$CC -print-prog-name=ar`
+
+-OBJCOPY=`$CC -print-prog-name=objcopy`
+-
+ GPROF=`$CC -print-prog-name=gprof`
+
+
+diff --git a/configure.ac b/configure.ac
+index 924af12738..2148cd2ec8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -53,6 +53,7 @@ AC_SUBST(cross_compiling)
+ AC_PROG_CPP
+ AC_CHECK_TOOL(READELF, readelf, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
++AC_CHECK_TOOL(OBJCOPY, objcopy, false)
+
+ # We need the C++ compiler only for testing.
+ AC_PROG_CXX
diff --git a/gnu/packages/patches/glibc-cross-objdump.patch b/gnu/packages/patches/glibc-cross-objdump.patch
new file mode 100644
index 0000000000..1660d915f7
--- /dev/null
+++ b/gnu/packages/patches/glibc-cross-objdump.patch
@@ -0,0 +1,159 @@
+Arrange so that glibc uses 'TRIPLET-objdump -f' rather than 'objdump -f'
+to determine the 'OUTPUT_FORMAT' value in libc.so when cross-compiling.
+
+Patch submitted upstream:
+ <https://sourceware.org/pipermail/libc-alpha/2021-July/128333.html>.
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index c195c4db56..13a791ffde 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -118,8 +118,6 @@ AS=`$CC -print-prog-name=as`
+ LD=`$CC -print-prog-name=ld`
+ AR=`$CC -print-prog-name=ar`
+ AC_SUBST(AR)
+-OBJDUMP=`$CC -print-prog-name=objdump`
+-AC_SUBST(OBJDUMP)
+ OBJCOPY=`$CC -print-prog-name=objcopy`
+ AC_SUBST(OBJCOPY)
+ GPROF=`$CC -print-prog-name=gprof`
+diff --git a/configure b/configure
+index 9619c10991..fe0eda1cd5 100755
+--- a/configure
++++ b/configure
+@@ -655,7 +655,6 @@ LD
+ AS
+ GPROF
+ OBJCOPY
+-OBJDUMP
+ AR
+ LN_S
+ INSTALL_DATA
+@@ -690,6 +689,7 @@ sysheaders
+ ac_ct_CXX
+ CXXFLAGS
+ CXX
++OBJDUMP
+ READELF
+ CPP
+ cross_compiling
+@@ -2962,6 +2962,98 @@ else
+ READELF="$ac_cv_prog_READELF"
+ fi
+
++if test -n "$ac_tool_prefix"; then
++ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
++set dummy ${ac_tool_prefix}objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_OBJDUMP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$OBJDUMP"; then
++ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++fi
++fi
++OBJDUMP=$ac_cv_prog_OBJDUMP
++if test -n "$OBJDUMP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
++$as_echo "$OBJDUMP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_prog_OBJDUMP"; then
++ ac_ct_OBJDUMP=$OBJDUMP
++ # Extract the first word of "objdump", so it can be a program name with args.
++set dummy objdump; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ if test -n "$ac_ct_OBJDUMP"; then
++ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
++else
++as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
++do
++ IFS=$as_save_IFS
++ test -z "$as_dir" && as_dir=.
++ for ac_exec_ext in '' $ac_executable_extensions; do
++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ ac_cv_prog_ac_ct_OBJDUMP="objdump"
++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++ break 2
++ fi
++done
++ done
++IFS=$as_save_IFS
++
++fi
++fi
++ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
++if test -n "$ac_ct_OBJDUMP"; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
++$as_echo "$ac_ct_OBJDUMP" >&6; }
++else
++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++ if test "x$ac_ct_OBJDUMP" = x; then
++ OBJDUMP="false"
++ else
++ case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++ OBJDUMP=$ac_ct_OBJDUMP
++ fi
++else
++ OBJDUMP="$ac_cv_prog_OBJDUMP"
++fi
++
+
+ # We need the C++ compiler only for testing.
+ ac_ext=cpp
+@@ -4553,8 +4645,6 @@ AS=`$CC -print-prog-name=as`
+ LD=`$CC -print-prog-name=ld`
+ AR=`$CC -print-prog-name=ar`
+
+-OBJDUMP=`$CC -print-prog-name=objdump`
+-
+ OBJCOPY=`$CC -print-prog-name=objcopy`
+
+ GPROF=`$CC -print-prog-name=gprof`
+diff --git a/configure.ac b/configure.ac
+index 34ecbba540..924af12738 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -52,6 +52,7 @@ fi
+ AC_SUBST(cross_compiling)
+ AC_PROG_CPP
+ AC_CHECK_TOOL(READELF, readelf, false)
++AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+ # We need the C++ compiler only for testing.
+ AC_PROG_CXX
diff --git a/gnu/packages/patches/glibc-dl-cache.patch b/gnu/packages/patches/glibc-dl-cache.patch
new file mode 100644
index 0000000000..68c3a94846
--- /dev/null
+++ b/gnu/packages/patches/glibc-dl-cache.patch
@@ -0,0 +1,140 @@
+Read the shared library cache relative to $ORIGIN instead of reading
+from /etc/ld.so.cache. Also arrange so that this cache takes
+precedence over RUNPATH.
+
+diff --git a/elf/dl-cache.c b/elf/dl-cache.c
+index 93d185e788..e0760a1f40 100644
+--- a/elf/dl-cache.c
++++ b/elf/dl-cache.c
+@@ -171,6 +171,51 @@ _dl_cache_libcmp (const char *p1, const char *p2)
+ return *p1 - *p2;
+ }
+
++/* Special value representing the lack of an ld.so cache. */
++static const char ld_so_cache_lacking[] = "/ld.so cache is lacking";
++
++/* Return the per-application ld.so cache, relative to $ORIGIN, or NULL if
++ that fails for some reason. Do not return the system-wide LD_SO_CACHE
++ since on a foreign distro it would contain invalid information. */
++static const char *
++ld_so_cache (void)
++{
++ static const char *loader_cache;
++
++ if (loader_cache == NULL)
++ {
++ static const char store[] = @STORE_DIRECTORY@;
++ const char *origin = _dl_get_origin ();
++
++ /* Check whether ORIGIN is something like "/gnu/store/…-foo/bin". */
++ if (strncmp (store, origin, strlen (store)) == 0
++ && origin[sizeof store - 1] == '/')
++ {
++ char *store_item_end = strchr (origin + sizeof store, '/');
++
++ if (store_item_end != NULL)
++ {
++ static const char suffix[] = "/etc/ld.so.cache";
++ size_t store_item_len = store_item_end - origin;
++
++ /* Note: We can't use 'malloc' because it can be interposed.
++ Likewise, 'strncpy' is not available. */
++ char *cache = alloca (strlen (origin) + sizeof suffix);
++
++ strcpy (cache, origin);
++ strcpy (cache + store_item_len, suffix);
++
++ loader_cache = __strdup (cache) ?: ld_so_cache_lacking;
++ }
++ else
++ loader_cache = ld_so_cache_lacking;
++ }
++ else
++ loader_cache = ld_so_cache_lacking;
++ }
++
++ return loader_cache;
++}
+
+ /* Look up NAME in ld.so.cache and return the file name stored there, or null
+ if none is found. The cache is loaded if it was not already. If loading
+@@ -190,12 +235,15 @@ _dl_load_cache_lookup (const char *name)
+
+ /* Print a message if the loading of libs is traced. */
+ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
+- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
++ _dl_debug_printf (" search cache=%s\n", ld_so_cache ());
++
++ if (__glibc_unlikely (ld_so_cache () == ld_so_cache_lacking))
++ return NULL;
+
+ if (cache == NULL)
+ {
+ /* Read the contents of the file. */
+- void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize,
++ void *file = _dl_sysdep_read_whole_file (ld_so_cache (), &cachesize,
+ PROT_READ);
+
+ /* We can handle three different cache file formats here:
+diff --git a/elf/dl-load.c b/elf/dl-load.c
+index f3201e7c14..a69aec3428 100644
+--- a/elf/dl-load.c
++++ b/elf/dl-load.c
+@@ -2152,28 +2152,6 @@ _dl_map_object (struct link_map *loader, const char *name,
+ loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded,
+ LA_SER_LIBPATH, &found_other_class);
+
+- /* Look at the RUNPATH information for this binary. */
+- if (fd == -1 && loader != NULL
+- && cache_rpath (loader, &loader->l_runpath_dirs,
+- DT_RUNPATH, "RUNPATH"))
+- fd = open_path (name, namelen, mode,
+- &loader->l_runpath_dirs, &realname, &fb, loader,
+- LA_SER_RUNPATH, &found_other_class);
+-
+- if (fd == -1)
+- {
+- realname = _dl_sysdep_open_object (name, namelen, &fd);
+- if (realname != NULL)
+- {
+- fd = open_verify (realname, fd,
+- &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
+- LA_SER_CONFIG, mode, &found_other_class,
+- false);
+- if (fd == -1)
+- free (realname);
+- }
+- }
+-
+ #ifdef USE_LDCONFIG
+ if (fd == -1
+ && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
+@@ -2232,6 +2210,28 @@ _dl_map_object (struct link_map *loader, const char *name,
+ }
+ #endif
+
++ /* Look at the RUNPATH information for this binary. */
++ if (fd == -1 && loader != NULL
++ && cache_rpath (loader, &loader->l_runpath_dirs,
++ DT_RUNPATH, "RUNPATH"))
++ fd = open_path (name, namelen, mode,
++ &loader->l_runpath_dirs, &realname, &fb, loader,
++ LA_SER_RUNPATH, &found_other_class);
++
++ if (fd == -1)
++ {
++ realname = _dl_sysdep_open_object (name, namelen, &fd);
++ if (realname != NULL)
++ {
++ fd = open_verify (realname, fd,
++ &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
++ LA_SER_CONFIG, mode, &found_other_class,
++ false);
++ if (fd == -1)
++ free (realname);
++ }
++ }
++
+ /* Finally, try the default path. */
+ if (fd == -1
+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
diff --git a/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
index 1c3fe427f9..e31f99a1ce 100644
--- a/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
+++ b/gnu/packages/patches/glibc-hurd-clock_gettime_monotonic.patch
@@ -24,18 +24,17 @@ Subject: [PATCH 2/2] Use realtime clock for the monotonic clock.
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
-index ac3547df3c..af8681ba4e 100644
+index 6862fc8c..be1449bf 100644
--- a/sysdeps/mach/clock_gettime.c
+++ b/sysdeps/mach/clock_gettime.c
-@@ -25,7 +25,7 @@
- int
- __clock_gettime (clockid_t clock_id, struct timespec *ts)
- {
-- if (clock_id != CLOCK_REALTIME)
-+ if (clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_REALTIME)
- {
- errno = EINVAL;
- return -1;
+@@ -32,6 +32,7 @@ __clock_gettime (clockid_t clock_id, struct timespec *ts)
+ switch (clock_id) {
+
+ case CLOCK_REALTIME:
++ case CLOCK_MONOTONIC:
+ {
+ /* __host_get_time can only fail if passed an invalid host_t.
+ __mach_host_self could theoretically fail (producing an
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 0050151332..27b3a28ab7 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
diff --git a/gnu/packages/patches/glibc-skip-c++.patch b/gnu/packages/patches/glibc-skip-c++.patch
new file mode 100644
index 0000000000..b2cbe76d3b
--- /dev/null
+++ b/gnu/packages/patches/glibc-skip-c++.patch
@@ -0,0 +1,31 @@
+When building, say, glibc 2.31 using a compiler that's itself linked
+against 2.33, linking fails with:
+
+ gcc -Wl,-rpath-link=/tmp/guix-build-glibc-2.31.drv-0/build:/tmp/guix-build-glibc-2.31.drv-0/build/math:/tmp/guix-build-glibc-2.31.drv-0/build/elf:/tmp/guix-build-glibc-2.31.drv-0/build/dlfcn:/tmp/guix-build-glibc-2.31.drv-0/build/nss:/tmp/guix-build-glibc-2.31.drv-0/build/nis:/tmp/guix-build-glibc-2.31.drv-0/build/rt:/tmp/guix-build-glibc-2.31.drv-0/build/resolv:/tmp/guix-build-glibc-2.31.drv-0/build/mathvec:/tmp/guix-build-glibc-2.31.drv-0/build/support:/tmp/guix-build-glibc-2.31.drv-0/build/crypt:/tmp/guix-build-glibc-2.31.drv-0/build/nptl -nostdlib -nostartfiles -o /tmp/guix-build-glibc-2.31.drv-0/build/support/links-dso-program -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both /tmp/guix-build-glibc-2.31.drv-0/build/csu/crt1.o /tmp/guix-build-glibc-2.31.drv-0/build/csu/crti.o `gcc --print-file-name=crtbegin.o` /tmp/guix-build-glibc-2.31.drv-0/build/support/links-dso-program.o -lstdc++ -lgcc -lgcc_s -Wl,-dynamic-linker=/gnu/store/...-glibc-2.31/lib/ld-linux-x86-64.so.2 /tmp/guix-build-glibc-2.31.drv-0/build/libc.so.6 /tmp/guix-build-glibc-2.31.drv-0/build/libc_nonshared.a -Wl,--as-needed /tmp/guix-build-glibc-2.31.drv-0/build/elf/ld.so -Wl,--no-as-needed -lgcc `gcc --print-file-name=crtend.o` /tmp/guix-build-glibc-2.31.drv-0/build/csu/crtn.o
+ ld: /gnu/store/...-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../../libstdc++.so: undefined reference to `fstat64@GLIBC_2.33'
+ ld: /gnu/store/...-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../../libstdc++.so: undefined reference to `lstat@GLIBC_2.33'
+ ld: /gnu/store/...-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../../libstdc++.so: undefined reference to `stat@GLIBC_2.33'
+ collect2: error: ld returned 1 exit status
+
+This is unsurprising given that libstdc++.so here is linked against 2.33,
+whereas libc.so.6 here is 2.31.
+
+This patch works around it by not building the offending program.
+
+diff --git a/support/Makefile b/support/Makefile
+index bb9889ef..6614943b 100644
+--- a/support/Makefile
++++ b/support/Makefile
+@@ -210,12 +210,7 @@ CFLAGS-support_paths.c = \
+ # -fexcess-precision=standard.
+ CFLAGS-timespec.c += -fexcess-precision=standard
+
+-ifeq (,$(CXX))
+ LINKS_DSO_PROGRAM = links-dso-program-c
+-else
+-LINKS_DSO_PROGRAM = links-dso-program
+-LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
+-endif
+
+ ifeq (yes,$(have-selinux))
+ LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux
diff --git a/gnu/packages/patches/glibc-static-nss.patch b/gnu/packages/patches/glibc-static-nss.patch
new file mode 100644
index 0000000000..1a9db616cc
--- /dev/null
+++ b/gnu/packages/patches/glibc-static-nss.patch
@@ -0,0 +1,1244 @@
+This patch reinstates support for static NSS, which glibc 2.33 broke:
+
+ https://sourceware.org/bugzilla/show_bug.cgi?id=27959
+
+Patch obtained by running:
+
+ git diff f0c28504a9877be5da3ed1215f2da2d5914bbb0b..f9c8b11ed7726b858cd7b7cea0d3d7c5233d78cf
+ git diff 5e1ce61e3e71fb7ffe53f58fe96e67cb15f94854{^,}
+ git diff 135425a1dd50cbe2b9db0628d6c2b36c7889f30b{^,}
+
+It corresponds to these changes:
+
+ f9c8b11ed7 * nss: Access nss_files through direct references
+ 6212bb67f4 * nss_files: Move into libc
+ 36861a968a * nss_files: Add generic code for set*ent, end*ent and file open
+ f0c28504a9 * nss_files: Allocate nscd file registration data on the heap
+ 5e1ce61e3e * nss: Fix NSS_DECLARE_MODULE_FUNCTIONS handling of _nss_*_endnetgrent
+ 135425a1dd * nss: Fix build error with --disable-nscd
+
+... plus a manual fix in 'files-network.c' to address this compilation error:
+
+ nss_files/files-network.c: In function ‘_nss_files_parse_netent’:
+ nss_files/files-network.c:72:20: error: implicit declaration of function ‘__inet_network’; did you mean ‘inet_network’? [-Werror=implicit-function-declaration]
+ 72 | result->n_net = __inet_network (addr);
+ | ^~~~~~~~~~~~~~
+ nss_files/files-parse.c:106:3: note: in definition of macro ‘LINE_PARSER’
+ 106 | BODY; \
+ | ^~~~
+
+diff --git a/include/libc-symbols.h b/include/libc-symbols.h
+index 127ea656c2..d41ecf4384 100644
+--- a/include/libc-symbols.h
++++ b/include/libc-symbols.h
+@@ -798,29 +798,6 @@ for linking")
+ # define libdl_hidden_data_ver(local, name)
+ #endif
+
+-#if IS_IN (libnss_files)
+-# define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+-# define libnss_files_hidden_tls_proto(name, attrs...) \
+- hidden_tls_proto (name, ##attrs)
+-# define libnss_files_hidden_def(name) hidden_def (name)
+-# define libnss_files_hidden_weak(name) hidden_weak (name)
+-# define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
+-# define libnss_files_hidden_data_def(name) hidden_data_def (name)
+-# define libnss_files_hidden_tls_def(name) hidden_tls_def (name)
+-# define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
+-# define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
+-#else
+-# define libnss_files_hidden_proto(name, attrs...)
+-# define libnss_files_hidden_tls_proto(name, attrs...)
+-# define libnss_files_hidden_def(name)
+-# define libnss_files_hidden_weak(name)
+-# define libnss_files_hidden_ver(local, name)
+-# define libnss_files_hidden_data_def(name)
+-# define libnss_files_hidden_tls_def(name)
+-# define libnss_files_hidden_data_weak(name)
+-# define libnss_files_hidden_data_ver(local, name)
+-#endif
+-
+ #if IS_IN (libnsl)
+ # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+ # define libnsl_hidden_tls_proto(name, attrs...) \
+diff --git a/include/netdb.h b/include/netdb.h
+index 82e102ff76..4dcdbb8cd4 100644
+--- a/include/netdb.h
++++ b/include/netdb.h
+@@ -217,7 +217,7 @@ extern enum nss_status _nss_netgroup_parseline (char **cursor,
+ struct __netgrent *result,
+ char *buffer, size_t buflen,
+ int *errnop);
+-libnss_files_hidden_proto (_nss_netgroup_parseline)
++libc_hidden_proto (_nss_netgroup_parseline)
+
+ #define DECLARE_NSS_PROTOTYPES(service) \
+ extern enum nss_status _nss_ ## service ## _setprotoent (int); \
+diff --git a/include/nss_files.h b/include/nss_files.h
+index 6a0dcdb85b..6190cac6be 100644
+--- a/include/nss_files.h
++++ b/include/nss_files.h
+@@ -19,7 +19,11 @@
+ #ifndef _NSS_FILES_H
+ #define _NSS_FILES_H
+
++#include <nss.h>
+ #include <stdio.h>
++#if IS_IN (libc)
++#include <libc-lock.h>
++#endif
+
+ /* Open PATH for reading, as a data source for nss_files. */
+ FILE *__nss_files_fopen (const char *path);
+@@ -47,6 +51,63 @@ int __nss_readline_seek (FILE *fp, off64_t offset) attribute_hidden;
+ int __nss_parse_line_result (FILE *fp, off64_t offset, int parse_line_result);
+ libc_hidden_proto (__nss_parse_line_result)
+
++/* Per-file data. Used by the *ent functions that need to preserve
++ state across calls. */
++struct nss_files_per_file_data
++{
++ FILE *stream;
++#if IS_IN (libc)
++ /* The size of locks changes between libc and nss_files, so this
++ member must be last and is only available in libc. */
++ __libc_lock_define (, lock);
++#endif
++};
++
++/* File index for __nss_files_data_get. */
++enum nss_files_file
++ {
++ nss_file_aliasent,
++ nss_file_etherent,
++ nss_file_grent,
++ nss_file_hostent,
++ nss_file_netent,
++ nss_file_protoent,
++ nss_file_pwent,
++ nss_file_rpcent,
++ nss_file_servent,
++ nss_file_sgent,
++ nss_file_spent,
++
++ nss_file_count
++ };
++
++/* Obtains a pointer to the per-file data for FILE, which is written
++ to *PDATA, and tries to open the file at PATH for it. On success,
++ returns NSS_STATUS_SUCCESS, and the caller must later call
++ __nss_files_data_put. On failure, NSS_STATUS_TRYAGAIN is returned,
++ and *ERRNOP and *HERRNOP are updated if these pointers are not
++ null. */
++enum nss_status __nss_files_data_open (struct nss_files_per_file_data **pdata,
++ enum nss_files_file file,
++ const char *path,
++ int *errnop, int *herrnop);
++libc_hidden_proto (__nss_files_data_open)
++
++/* Unlock the per-file data, previously obtained by
++ __nss_files_data_open. */
++void __nss_files_data_put (struct nss_files_per_file_data *data);
++libc_hidden_proto (__nss_files_data_put)
++
++/* Performs the set*ent operation for FILE. PATH is the file to
++ open. */
++enum nss_status __nss_files_data_setent (enum nss_files_file file,
++ const char *path);
++libc_hidden_proto (__nss_files_data_setent)
++
++/* Performs the end*ent operation for FILE. */
++enum nss_status __nss_files_data_endent (enum nss_files_file file);
++libc_hidden_proto (__nss_files_data_endent)
++
+ struct parser_data;
+
+ /* Instances of the parse_line function from
+@@ -64,16 +125,25 @@ extern nss_files_parse_line _nss_files_parse_servent;
+ extern nss_files_parse_line _nss_files_parse_sgent;
+ extern nss_files_parse_line _nss_files_parse_spent;
+
+-libnss_files_hidden_proto (_nss_files_parse_etherent)
++libc_hidden_proto (_nss_files_parse_etherent)
+ libc_hidden_proto (_nss_files_parse_grent)
+-libnss_files_hidden_proto (_nss_files_parse_netent)
+-libnss_files_hidden_proto (_nss_files_parse_protoent)
++libc_hidden_proto (_nss_files_parse_netent)
++libc_hidden_proto (_nss_files_parse_protoent)
+ libc_hidden_proto (_nss_files_parse_pwent)
+-libnss_files_hidden_proto (_nss_files_parse_rpcent)
+-libnss_files_hidden_proto (_nss_files_parse_servent)
++libc_hidden_proto (_nss_files_parse_rpcent)
++libc_hidden_proto (_nss_files_parse_servent)
+ libc_hidden_proto (_nss_files_parse_sgent)
+ libc_hidden_proto (_nss_files_parse_spent)
+
++NSS_DECLARE_MODULE_FUNCTIONS (files)
++#undef DEFINE_NSS_FUNCTION
++#define DEFINE_NSS_FUNCTION(x) libc_hidden_proto (_nss_files_##x)
++#include <nss/function.def>
++#undef DEFINE_NSS_FUNCTION
++
++void _nss_files_init (void (*cb) (size_t, struct traced_file *));
++libc_hidden_proto (_nss_files_init)
++
+ /* Generic implementation of fget*ent_r. Reads lines from FP until
+ EOF or a successful parse into *RESULT using PARSER. Returns 0 on
+ success, ENOENT on EOF, ERANGE on too-small buffer. */
+diff --git a/nss/Makefile b/nss/Makefile
+index 9682a31e20..63a386af18 100644
+--- a/nss/Makefile
++++ b/nss/Makefile
+@@ -31,7 +31,8 @@ routines = nsswitch getnssent getnssent_r digits_dots \
+ compat-lookup nss_hash nss_files_fopen \
+ nss_readline nss_parse_line_result \
+ nss_fgetent_r nss_module nss_action \
+- nss_action_parse nss_database
++ nss_action_parse nss_database nss_files_data \
++ nss_files_functions
+
+ # These are the databases that go through nss dispatch.
+ # Caution: if you add a database here, you must add its real name
+@@ -98,9 +99,11 @@ subdir-dirs = $(services:%=nss_%)
+ vpath %.c $(subdir-dirs) ../locale/programs ../intl
+
+
+-libnss_files-routines := $(addprefix files-, \
+- $(filter-out key, $(databases))) \
+- files-initgroups files-init
++routines += \
++ $(addprefix files-, $(filter-out key, $(databases))) \
++ files-init \
++ files-initgroups \
++ # routines
+
+ libnss_db-dbs := $(addprefix db-,\
+ $(filter-out hosts network key alias,\
+@@ -116,12 +119,9 @@ libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups) \
+ install-others += $(inst_vardbdir)/Makefile
+
+ # Build static module into libc if requested
+-libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
+ libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
+ libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
+ ifeq ($(build-static-nss),yes)
+-routines += $(libnss_files-routines)
+-static-only-routines += $(libnss_files-routines)
+ tests-static += tst-nss-static
+ endif
+ extra-test-objs += nss_test1.os nss_test2.os
+@@ -138,8 +138,6 @@ libnss-libc = $(common-objpfx)linkobj/libc.so
+ # for new links:
+ $(services:%=$(objpfx)libnss_%.so): libc-for-link = $(libnss-libc)
+
+-$(objpfx)libnss_db.so: $(objpfx)libnss_files.so
+-
+ $(libnss_db-dbs:%=$(objpfx)%.c): $(objpfx)db-%.c: nss_files/files-%.c
+ @rm -f $@.new
+ (echo '#define EXTERN_PARSER';\
+diff --git a/nss/Versions b/nss/Versions
+index fdddea104c..e551524aa9 100644
+--- a/nss/Versions
++++ b/nss/Versions
+@@ -19,11 +19,12 @@ libc {
+ __nss_services_lookup2; __nss_next2; __nss_lookup;
+ __nss_hash; __nss_database_get;
+ __nss_files_fopen; __nss_readline; __nss_parse_line_result;
+- }
+-}
++ __nss_files_data_endent;
++ __nss_files_data_open;
++ __nss_files_data_put;
++ __nss_files_data_setent;
+
+-libnss_files {
+- GLIBC_PRIVATE {
++ # Routines formerly in libnss_files.so.2.
+ _nss_files_setaliasent;
+ _nss_files_endaliasent;
+ _nss_files_getaliasbyname_r;
+@@ -109,6 +110,14 @@ libnss_files {
+ }
+ }
+
++libnss_files {
++ GLIBC_PRIVATE {
++ # Keep a version node (with a synthesized local: * directive) so that
++ # __bss_* symbols are hidden on targets that need it.
++ __libnss_files_version_placeholder;
++ }
++}
++
+ libnss_db {
+ GLIBC_PRIVATE {
+ _nss_db_setetherent;
+diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
+index b4b989d9bb..c158a891bd 100644
+--- a/nss/nss_files/files-XXX.c
++++ b/nss/nss_files/files-XXX.c
+@@ -45,10 +45,12 @@
+ # include <netdb.h>
+ # define H_ERRNO_PROTO , int *herrnop
+ # define H_ERRNO_ARG , herrnop
++# define H_ERRNO_ARG_OR_NULL herrnop
+ # define H_ERRNO_SET(val) (*herrnop = (val))
+ #else
+ # define H_ERRNO_PROTO
+ # define H_ERRNO_ARG
++# define H_ERRNO_ARG_OR_NULL NULL
+ # define H_ERRNO_SET(val) ((void) 0)
+ #endif
+
+@@ -58,15 +60,11 @@
+ # define EXTRA_ARGS_VALUE
+ #endif
+
+-/* Locks the static variables in this file. */
+-__libc_lock_define_initialized (static, lock)
+
+ /* Maintenance of the stream open on the database file. For getXXent
+ operations the stream needs to be held open across calls, the other
+ getXXbyYY operations all use their own stream. */
+
+-static FILE *stream;
+-
+ /* Open database file if not already opened. */
+ static enum nss_status
+ internal_setent (FILE **stream)
+@@ -91,42 +89,16 @@ internal_setent (FILE **stream)
+ enum nss_status
+ CONCAT(_nss_files_set,ENTNAME) (int stayopen)
+ {
+- enum nss_status status;
+-
+- __libc_lock_lock (lock);
+-
+- status = internal_setent (&stream);
+-
+- __libc_lock_unlock (lock);
+-
+- return status;
++ return __nss_files_data_setent (CONCAT (nss_file_, ENTNAME), DATAFILE);
+ }
++libc_hidden_def (CONCAT (_nss_files_set,ENTNAME))
+
+-
+-/* Close the database file. */
+-static void
+-internal_endent (FILE **stream)
+-{
+- if (*stream != NULL)
+- {
+- fclose (*stream);
+- *stream = NULL;
+- }
+-}
+-
+-
+-/* Thread-safe, exported version of that. */
+ enum nss_status
+ CONCAT(_nss_files_end,ENTNAME) (void)
+ {
+- __libc_lock_lock (lock);
+-
+- internal_endent (&stream);
+-
+- __libc_lock_unlock (lock);
+-
+- return NSS_STATUS_SUCCESS;
++ return __nss_files_data_endent (CONCAT (nss_file_, ENTNAME));
+ }
++libc_hidden_def (CONCAT (_nss_files_end,ENTNAME))
+
+
+ /* Parsing the database file into `struct STRUCTURE' data structures. */
+@@ -194,28 +166,22 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
+ size_t buflen, int *errnop H_ERRNO_PROTO)
+ {
+ /* Return next entry in host file. */
+- enum nss_status status = NSS_STATUS_SUCCESS;
+-
+- __libc_lock_lock (lock);
+
+- /* Be prepared that the set*ent function was not called before. */
+- if (stream == NULL)
+- {
+- int save_errno = errno;
+-
+- status = internal_setent (&stream);
+-
+- __set_errno (save_errno);
+- }
+-
+- if (status == NSS_STATUS_SUCCESS)
+- status = internal_getent (stream, result, buffer, buflen, errnop
+- H_ERRNO_ARG EXTRA_ARGS_VALUE);
++ struct nss_files_per_file_data *data;
++ enum nss_status status = __nss_files_data_open (&data,
++ CONCAT (nss_file_, ENTNAME),
++ DATAFILE,
++ errnop, H_ERRNO_ARG_OR_NULL);
++ if (status != NSS_STATUS_SUCCESS)
++ return status;
+
+- __libc_lock_unlock (lock);
++ status = internal_getent (data->stream, result, buffer, buflen, errnop
++ H_ERRNO_ARG EXTRA_ARGS_VALUE);
+
++ __nss_files_data_put (data);
+ return status;
+ }
++libc_hidden_def (CONCAT (_nss_files_get,ENTNAME_r))
+
+ /* Macro for defining lookup functions for this file-based database.
+
+@@ -248,8 +214,9 @@ _nss_files_get##name##_r (proto, \
+ == NSS_STATUS_SUCCESS) \
+ { break_if_match } \
+ \
+- internal_endent (&stream); \
++ fclose (stream); \
+ } \
+ \
+ return status; \
+-}
++} \
++libc_hidden_def (_nss_files_get##name##_r)
+diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
+index 30971bfe56..8c6e176ff6 100644
+--- a/nss/nss_files/files-alias.c
++++ b/nss/nss_files/files-alias.c
+@@ -31,18 +31,11 @@
+ #include "nsswitch.h"
+ #include <nss_files.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+-/* Locks the static variables in this file. */
+-__libc_lock_define_initialized (static, lock)
+
+ /* Maintenance of the stream open on the database file. For getXXent
+ operations the stream needs to be held open across calls, the other
+ getXXbyYY operations all use their own stream. */
+
+-static FILE *stream;
+-
+-
+ static enum nss_status
+ internal_setent (FILE **stream)
+ {
+@@ -66,42 +59,16 @@ internal_setent (FILE **stream)
+ enum nss_status
+ _nss_files_setaliasent (void)
+ {
+- enum nss_status status;
+-
+- __libc_lock_lock (lock);
+-
+- status = internal_setent (&stream);
+-
+- __libc_lock_unlock (lock);
+-
+- return status;
++ return __nss_files_data_setent (nss_file_aliasent, "/etc/aliases");
+ }
++libc_hidden_def (_nss_files_setaliasent)
+
+-
+-/* Close the database file. */
+-static void
+-internal_endent (FILE **stream)
+-{
+- if (*stream != NULL)
+- {
+- fclose (*stream);
+- *stream = NULL;
+- }
+-}
+-
+-
+-/* Thread-safe, exported version of that. */
+ enum nss_status
+ _nss_files_endaliasent (void)
+ {
+- __libc_lock_lock (lock);
+-
+- internal_endent (&stream);
+-
+- __libc_lock_unlock (lock);
+-
+- return NSS_STATUS_SUCCESS;
++ return __nss_files_data_endent (nss_file_aliasent);
+ }
++libc_hidden_def (_nss_files_endaliasent)
+
+ /* Parsing the database file into `struct aliasent' data structures. */
+ static enum nss_status
+@@ -131,7 +98,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
+ /* Read the first line. It must contain the alias name and
+ possibly some alias names. */
+ first_unused[room_left - 1] = '\xff';
+- line = fgets_unlocked (first_unused, room_left, stream);
++ line = __fgets_unlocked (first_unused, room_left, stream);
+ if (line == NULL)
+ /* Nothing to read. */
+ break;
+@@ -220,7 +187,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
+ /* If the file does not exist we simply ignore
+ the statement. */
+ if (listfile != NULL
+- && (old_line = strdup (line)) != NULL)
++ && (old_line = __strdup (line)) != NULL)
+ {
+ while (! feof_unlocked (listfile))
+ {
+@@ -232,8 +199,8 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
+ }
+
+ first_unused[room_left - 1] = '\xff';
+- line = fgets_unlocked (first_unused, room_left,
+- listfile);
++ line = __fgets_unlocked (first_unused, room_left,
++ listfile);
+ if (line == NULL)
+ break;
+ if (first_unused[room_left - 1] != '\xff')
+@@ -335,7 +302,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
+ /* The just read character is a white space and so
+ can be ignored. */
+ first_unused[room_left - 1] = '\xff';
+- line = fgets_unlocked (first_unused, room_left, stream);
++ line = __fgets_unlocked (first_unused, room_left, stream);
+ if (line == NULL)
+ {
+ /* Continuation line without any data and
+@@ -369,29 +336,25 @@ _nss_files_getaliasent_r (struct aliasent *result, char *buffer, size_t buflen,
+ int *errnop)
+ {
+ /* Return next entry in host file. */
+- enum nss_status status = NSS_STATUS_SUCCESS;
+
+- __libc_lock_lock (lock);
+-
+- /* Be prepared that the set*ent function was not called before. */
+- if (stream == NULL)
+- status = internal_setent (&stream);
+-
+- if (status == NSS_STATUS_SUCCESS)
+- {
+- result->alias_local = 1;
++ struct nss_files_per_file_data *data;
++ enum nss_status status = __nss_files_data_open (&data, nss_file_aliasent,
++ "/etc/aliases", errnop, NULL);
++ if (status != NSS_STATUS_SUCCESS)
++ return status;
+
+- /* Read lines until we get a definite result. */
+- do
+- status = get_next_alias (stream, NULL, result, buffer, buflen, errnop);
+- while (status == NSS_STATUS_RETURN);
+- }
++ result->alias_local = 1;
+
+- __libc_lock_unlock (lock);
++ /* Read lines until we get a definite result. */
++ do
++ status = get_next_alias (data->stream, NULL, result, buffer, buflen,
++ errnop);
++ while (status == NSS_STATUS_RETURN);
+
++ __nss_files_data_put (data);
+ return status;
+ }
+-
++libc_hidden_def (_nss_files_getaliasent_r)
+
+ enum nss_status
+ _nss_files_getaliasbyname_r (const char *name, struct aliasent *result,
+@@ -418,9 +381,10 @@ _nss_files_getaliasbyname_r (const char *name, struct aliasent *result,
+ do
+ status = get_next_alias (stream, name, result, buffer, buflen, errnop);
+ while (status == NSS_STATUS_RETURN);
+- }
+
+- internal_endent (&stream);
++ fclose (stream);
++ }
+
+ return status;
+ }
++libc_hidden_def (_nss_files_getaliasbyname_r)
+diff --git a/nss/nss_files/files-ethers.c b/nss/nss_files/files-ethers.c
+index 2fe7f81e4b..7c2c2b9833 100644
+--- a/nss/nss_files/files-ethers.c
++++ b/nss/nss_files/files-ethers.c
+@@ -20,8 +20,6 @@
+ #include <netinet/if_ether.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ struct etherent_data {};
+
+ #define ENTNAME etherent
+diff --git a/nss/nss_files/files-grp.c b/nss/nss_files/files-grp.c
+index 49be38e8b1..a716d948e2 100644
+--- a/nss/nss_files/files-grp.c
++++ b/nss/nss_files/files-grp.c
+@@ -19,8 +19,6 @@
+ #include <grp.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define STRUCTURE group
+ #define ENTNAME grent
+ #define DATABASE "group"
+diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
+index 2b47ec3e53..d54d91d038 100644
+--- a/nss/nss_files/files-hosts.c
++++ b/nss/nss_files/files-hosts.c
+@@ -26,8 +26,6 @@
+ #include <alloc_buffer.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ /* Get implementation for some internal functions. */
+ #include "../resolv/res_hconf.h"
+
+@@ -57,12 +55,13 @@ LINE_PARSER
+ STRING_FIELD (addr, isspace, 1);
+
+ /* Parse address. */
+- if (inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr)
++ if (__inet_pton (af == AF_UNSPEC ? AF_INET : af, addr, entdata->host_addr)
+ > 0)
+ af = af == AF_UNSPEC ? AF_INET : af;
+ else
+ {
+- if (af == AF_INET && inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
++ if (af == AF_INET
++ && __inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
+ {
+ if (IN6_IS_ADDR_V4MAPPED (entdata->host_addr))
+ memcpy (entdata->host_addr, entdata->host_addr + 12, INADDRSZ);
+@@ -76,7 +75,7 @@ LINE_PARSER
+ return 0;
+ }
+ else if (af == AF_UNSPEC
+- && inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
++ && __inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
+ af = AF_INET6;
+ else
+ /* Illegal address: ignore line. */
+@@ -349,7 +348,7 @@ _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
+ status = gethostbyname3_multi
+ (stream, name, af, result, buffer, buflen, errnop, herrnop);
+
+- internal_endent (&stream);
++ fclose (stream);
+ }
+
+ if (canonp && status == NSS_STATUS_SUCCESS)
+@@ -357,6 +356,7 @@ _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
+
+ return status;
+ }
++libc_hidden_def (_nss_files_gethostbyname3_r)
+
+ enum nss_status
+ _nss_files_gethostbyname_r (const char *name, struct hostent *result,
+@@ -366,6 +366,7 @@ _nss_files_gethostbyname_r (const char *name, struct hostent *result,
+ return _nss_files_gethostbyname3_r (name, AF_INET, result, buffer, buflen,
+ errnop, herrnop, NULL, NULL);
+ }
++libc_hidden_def (_nss_files_gethostbyname_r)
+
+ enum nss_status
+ _nss_files_gethostbyname2_r (const char *name, int af, struct hostent *result,
+@@ -375,6 +376,7 @@ _nss_files_gethostbyname2_r (const char *name, int af, struct hostent *result,
+ return _nss_files_gethostbyname3_r (name, af, result, buffer, buflen,
+ errnop, herrnop, NULL, NULL);
+ }
++libc_hidden_def (_nss_files_gethostbyname2_r)
+
+ enum nss_status
+ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
+@@ -475,7 +477,7 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
+ status = NSS_STATUS_SUCCESS;
+ }
+
+- internal_endent (&stream);
++ fclose (stream);
+ }
+ else if (status == NSS_STATUS_TRYAGAIN)
+ {
+@@ -490,3 +492,4 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
+
+ return status;
+ }
++libc_hidden_def (_nss_files_gethostbyname4_r)
+diff --git a/nss/nss_files/files-init.c b/nss/nss_files/files-init.c
+index 717c9fd334..18ed288d04 100644
+--- a/nss/nss_files/files-init.c
++++ b/nss/nss_files/files-init.c
+@@ -21,8 +21,7 @@
+ #include <string.h>
+ #include <nscd/nscd.h>
+ #include <nss.h>
+-
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
++#include <nss_files.h>
+
+ static void
+ register_file (void (*cb) (size_t, struct traced_file *),
+@@ -49,5 +48,6 @@ _nss_files_init (void (*cb) (size_t, struct traced_file *))
+ register_file (cb, servdb, "/etc/services", 0);
+ register_file (cb, netgrdb, "/etc/netgroup", 0);
+ }
++libc_hidden_def (_nss_files_init)
+
+ #endif
+diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c
+index 6fcea40b55..b44211e50b 100644
+--- a/nss/nss_files/files-initgroups.c
++++ b/nss/nss_files/files-initgroups.c
+@@ -28,8 +28,6 @@
+ #include <nss.h>
+ #include <nss_files.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ enum nss_status
+ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
+ long int *size, gid_t **groupsp, long int limit,
+@@ -129,3 +127,4 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start,
+
+ return status == NSS_STATUS_SUCCESS && !any ? NSS_STATUS_NOTFOUND : status;
+ }
++libc_hidden_def (_nss_files_initgroups_dyn)
+diff --git a/nss/nss_files/files-netgrp.c b/nss/nss_files/files-netgrp.c
+index f8c821c2f0..75bfbd9e44 100644
+--- a/nss/nss_files/files-netgrp.c
++++ b/nss/nss_files/files-netgrp.c
+@@ -28,11 +28,9 @@
+ #include "netgroup.h"
+ #include <nss_files.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define DATAFILE "/etc/netgroup"
+
+-libnss_files_hidden_proto (_nss_files_endnetgrent)
++libc_hidden_proto (_nss_files_endnetgrent)
+
+ #define EXPAND(needed) \
+ do \
+@@ -152,7 +150,7 @@ _nss_files_setnetgrent (const char *group, struct __netgrent *result)
+
+ return status;
+ }
+-
++libc_hidden_def (_nss_files_setnetgrent)
+
+ enum nss_status
+ _nss_files_endnetgrent (struct __netgrent *result)
+@@ -164,7 +162,7 @@ _nss_files_endnetgrent (struct __netgrent *result)
+ result->cursor = NULL;
+ return NSS_STATUS_SUCCESS;
+ }
+-libnss_files_hidden_def (_nss_files_endnetgrent)
++libc_hidden_def (_nss_files_endnetgrent)
+
+ static char *
+ strip_whitespace (char *str)
+@@ -279,7 +277,7 @@ _nss_netgroup_parseline (char **cursor, struct __netgrent *result,
+
+ return status;
+ }
+-libnss_files_hidden_def (_nss_netgroup_parseline)
++libc_hidden_def (_nss_netgroup_parseline)
+
+
+ enum nss_status
+@@ -293,3 +291,4 @@ _nss_files_getnetgrent_r (struct __netgrent *result, char *buffer,
+
+ return status;
+ }
++libc_hidden_def (_nss_files_getnetgrent_r)
+diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c
+index 9cd7d7dc79..217ed78609 100644
+--- a/nss/nss_files/files-network.c
++++ b/nss/nss_files/files-network.c
+@@ -22,8 +22,6 @@
+ #include <stdint.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define ENTNAME netent
+ #define DATABASE "networks"
+ #define NEED_H_ERRNO
+@@ -71,7 +69,7 @@ LINE_PARSER
+ *cp = '\0';
+ addr = newp;
+ }
+- result->n_net = inet_network (addr);
++ result->n_net = inet_network (addr);
+ result->n_addrtype = AF_INET;
+
+ })
+diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c
+index 68c51c7cbf..997eac573a 100644
+--- a/nss/nss_files/files-parse.c
++++ b/nss/nss_files/files-parse.c
+@@ -74,13 +74,7 @@ struct parser_data
+ /* Export the line parser function so it can be used in nss_db. */
+ # define parser_stclass /* Global */
+ # define parse_line CONCAT(_nss_files_parse_,ENTNAME)
+-# if IS_IN (libc)
+-/* We are defining one of the functions that actually lives in libc
+- because it is used to implement fget*ent and suchlike. */
+-# define nss_files_parse_hidden_def(name) libc_hidden_def (name)
+-# else
+-# define nss_files_parse_hidden_def(name) libnss_files_hidden_def (name)
+-# endif
++# define nss_files_parse_hidden_def(name) libc_hidden_def (name)
+ #endif
+
+
+diff --git a/nss/nss_files/files-proto.c b/nss/nss_files/files-proto.c
+index 98d082c642..13072692c1 100644
+--- a/nss/nss_files/files-proto.c
++++ b/nss/nss_files/files-proto.c
+@@ -19,8 +19,6 @@
+ #include <netdb.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define ENTNAME protoent
+ #define DATABASE "protocols"
+
+diff --git a/nss/nss_files/files-pwd.c b/nss/nss_files/files-pwd.c
+index b04165ddde..5c74c6da9b 100644
+--- a/nss/nss_files/files-pwd.c
++++ b/nss/nss_files/files-pwd.c
+@@ -19,8 +19,6 @@
+ #include <pwd.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define STRUCTURE passwd
+ #define ENTNAME pwent
+ #define DATABASE "passwd"
+diff --git a/nss/nss_files/files-rpc.c b/nss/nss_files/files-rpc.c
+index eeb2725d2c..3dea8f18f2 100644
+--- a/nss/nss_files/files-rpc.c
++++ b/nss/nss_files/files-rpc.c
+@@ -19,8 +19,6 @@
+ #include <rpc/netdb.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define ENTNAME rpcent
+ #define DATABASE "rpc"
+
+diff --git a/nss/nss_files/files-service.c b/nss/nss_files/files-service.c
+index f4f0985377..a8d83e094e 100644
+--- a/nss/nss_files/files-service.c
++++ b/nss/nss_files/files-service.c
+@@ -20,8 +20,6 @@
+ #include <netdb.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define ENTNAME servent
+ #define DATABASE "services"
+
+diff --git a/nss/nss_files/files-sgrp.c b/nss/nss_files/files-sgrp.c
+index 6b1c9eac02..213a408e7b 100644
+--- a/nss/nss_files/files-sgrp.c
++++ b/nss/nss_files/files-sgrp.c
+@@ -19,8 +19,6 @@
+ #include <gshadow.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define STRUCTURE sgrp
+ #define ENTNAME sgent
+ #define DATABASE "gshadow"
+diff --git a/nss/nss_files/files-spwd.c b/nss/nss_files/files-spwd.c
+index 976deaf918..d031257a20 100644
+--- a/nss/nss_files/files-spwd.c
++++ b/nss/nss_files/files-spwd.c
+@@ -19,8 +19,6 @@
+ #include <shadow.h>
+ #include <nss.h>
+
+-NSS_DECLARE_MODULE_FUNCTIONS (files)
+-
+ #define STRUCTURE spwd
+ #define ENTNAME spent
+ #define DATABASE "shadow"
+diff --git a/nss/nss_files_data.c b/nss/nss_files_data.c
+new file mode 100644
+index 0000000000..80fbfe5fff
+--- /dev/null
++++ b/nss/nss_files_data.c
+@@ -0,0 +1,161 @@
++/* Returns a pointer to the global nss_files data structure.
++ Copyright (C) 2021 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <https://www.gnu.org/licenses/>. */
++
++#include <nss_files.h>
++
++#include <allocate_once.h>
++#include <errno.h>
++#include <netdb.h>
++#include <nss.h>
++#include <stdlib.h>
++
++/* This collects all per file-data. */
++struct nss_files_data
++{
++ struct nss_files_per_file_data files[nss_file_count];
++};
++
++/* For use with allocate_once. */
++static void *nss_files_global;
++static void *
++nss_files_global_allocate (void *closure)
++{
++ struct nss_files_data *result = malloc (sizeof (*result));
++ if (result != NULL)
++ {
++ for (int i = 0; i < nss_file_count; ++i)
++ {
++ result->files[i].stream = NULL;
++ __libc_lock_init (result->files[i].lock);
++ }
++ }
++ return result;
++}
++/* Like __nss_files_data_open, but does not perform the open call. */
++static enum nss_status
++__nss_files_data_get (struct nss_files_per_file_data **pdata,
++ enum nss_files_file file, int *errnop, int *herrnop)
++{
++ struct nss_files_data *data = allocate_once (&nss_files_global,
++ nss_files_global_allocate,
++ NULL, NULL);
++ if (data == NULL)
++ {
++ if (errnop != NULL)
++ *errnop = errno;
++ if (herrnop != NULL)
++ {
++ __set_h_errno (NETDB_INTERNAL);
++ *herrnop = NETDB_INTERNAL;
++ }
++ return NSS_STATUS_TRYAGAIN;
++ }
++
++ *pdata = &data->files[file];
++ __libc_lock_lock ((*pdata)->lock);
++ return NSS_STATUS_SUCCESS;
++}
++
++/* Helper function for opening the backing file at PATH. */
++static enum nss_status
++__nss_files_data_internal_open (struct nss_files_per_file_data *data,
++ const char *path)
++{
++ enum nss_status status = NSS_STATUS_SUCCESS;
++
++ if (data->stream == NULL)
++ {
++ data->stream = __nss_files_fopen (path);
++
++ if (data->stream == NULL)
++ status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
++ }
++
++ return status;
++}
++
++
++enum nss_status
++__nss_files_data_open (struct nss_files_per_file_data **pdata,
++ enum nss_files_file file, const char *path,
++ int *errnop, int *herrnop)
++{
++ enum nss_status status = __nss_files_data_get (pdata, file, errnop, herrnop);
++ if (status != NSS_STATUS_SUCCESS)
++ return status;
++
++ /* Be prepared that the set*ent function was not called before. */
++ if ((*pdata)->stream == NULL)
++ {
++ int saved_errno = errno;
++ status = __nss_files_data_internal_open (*pdata, path);
++ __set_errno (saved_errno);
++ if (status != NSS_STATUS_SUCCESS)
++ __nss_files_data_put (*pdata);
++ }
++
++ return status;
++}
++
++libc_hidden_def (__nss_files_data_open)
++
++void
++__nss_files_data_put (struct nss_files_per_file_data *data)
++{
++ __libc_lock_unlock (data->lock);
++}
++libc_hidden_def (__nss_files_data_put)
++
++enum nss_status
++__nss_files_data_setent (enum nss_files_file file, const char *path)
++{
++ struct nss_files_per_file_data *data;
++ enum nss_status status = __nss_files_data_get (&data, file, NULL, NULL);
++ if (status != NSS_STATUS_SUCCESS)
++ return status;
++
++ if (data->stream == NULL)
++ status = __nss_files_data_internal_open (data, path);
++ else
++ rewind (data->stream);
++
++ __nss_files_data_put (data);
++ return status;
++}
++libc_hidden_def (__nss_files_data_setent)
++
++enum nss_status
++__nss_files_data_endent (enum nss_files_file file)
++{
++ /* No cleanup is necessary if not initialized. */
++ struct nss_files_data *data = atomic_load_acquire (&nss_files_global);
++ if (data == NULL)
++ return NSS_STATUS_SUCCESS;
++
++ struct nss_files_per_file_data *fdata = &data->files[file];
++ __libc_lock_lock (fdata->lock);
++ if (fdata->stream != NULL)
++ {
++ fclose (fdata->stream);
++ fdata->stream = NULL;
++ }
++ __libc_lock_unlock (fdata->lock);
++
++ return NSS_STATUS_SUCCESS;
++}
++libc_hidden_def (__nss_files_data_endent)
+diff --git a/nss/nss_files_functions.c b/nss/nss_files_functions.c
+new file mode 100644
+index 0000000000..85720b4311
+--- /dev/null
++++ b/nss/nss_files_functions.c
+@@ -0,0 +1,43 @@
++/* Direct access for nss_files functions for NSS module loading.
++ Copyright (C) 2021 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <https://www.gnu.org/licenses/>. */
++
++#include <nss_module.h>
++#include <nss_files.h>
++
++void
++__nss_files_functions (nss_module_functions_untyped pointers)
++{
++ void **fptr = pointers;
++
++ /* Functions which are not implemented. */
++#define _nss_files_getcanonname_r NULL
++#define _nss_files_gethostbyaddr2_r NULL
++#define _nss_files_getpublickey NULL
++#define _nss_files_getsecretkey NULL
++#define _nss_files_netname2user NULL
++
++#undef DEFINE_NSS_FUNCTION
++#define DEFINE_NSS_FUNCTION(x) *fptr++ = _nss_files_##x;
++#include "function.def"
++
++#ifdef PTR_MANGLE
++ void **end = fptr;
++ for (fptr = pointers; fptr != end; ++fptr)
++ PTR_MANGLE (*fptr);
++#endif
++}
+diff --git a/nss/nss_module.c b/nss/nss_module.c
+index 60c070c851..7b42c585a4 100644
+--- a/nss/nss_module.c
++++ b/nss/nss_module.c
+@@ -30,6 +30,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <nss_files.h>
+
+ /* Suffix after .so of NSS service modules. This is a bit of magic,
+ but we assume LIBNSS_FILES_SO looks like "libnss_files.so.2" and we
+@@ -110,10 +111,45 @@ static const function_name nss_function_name_array[] =
+ #include "function.def"
+ };
+
++static bool
++module_load_nss_files (struct nss_module *module)
++{
++ if (is_nscd)
++ {
++ void (*cb) (size_t, struct traced_file *) = nscd_init_cb;
++# ifdef PTR_DEMANGLE
++ PTR_DEMANGLE (cb);
++# endif
++ _nss_files_init (cb);
++ }
++
++ /* Initialize the function pointers, following the double-checked
++ locking idiom. */
++ __libc_lock_lock (nss_module_list_lock);
++ switch ((enum nss_module_state) atomic_load_acquire (&module->state))
++ {
++ case nss_module_uninitialized:
++ case nss_module_failed:
++ __nss_files_functions (module->functions.untyped);
++ module->handle = NULL;
++ /* Synchronizes with unlocked __nss_module_load atomic_load_acquire. */
++ atomic_store_release (&module->state, nss_module_loaded);
++ break;
++ case nss_module_loaded:
++ /* Nothing to clean up. */
++ break;
++ }
++ __libc_lock_unlock (nss_module_list_lock);
++ return true;
++}
++
+ /* Internal implementation of __nss_module_load. */
+ static bool
+ module_load (struct nss_module *module)
+ {
++ if (strcmp (module->name, "files") == 0)
++ return module_load_nss_files (module);
++
+ void *handle;
+ {
+ char *shlib_name;
+@@ -360,7 +396,7 @@ __nss_module_freeres (void)
+ struct nss_module *current = nss_module_list;
+ while (current != NULL)
+ {
+- if (current->state == nss_module_loaded)
++ if (current->state == nss_module_loaded && current->handle != NULL)
+ __libc_dlclose (current->handle);
+
+ struct nss_module *next = current->next;
+diff --git a/nss/nss_module.h b/nss/nss_module.h
+index 05c4791d11..c1a1d90b60 100644
+--- a/nss/nss_module.h
++++ b/nss/nss_module.h
+@@ -38,6 +38,10 @@ struct nss_module_functions
+ typedef void *nss_module_functions_untyped[sizeof (struct nss_module_functions)
+ / sizeof (void *)];
+
++/* Locate the nss_files functions, as if by dlopen/dlsym. */
++void __nss_files_functions (nss_module_functions_untyped pointers)
++ attribute_hidden;
++
+ /* Initialization state of a NSS module. */
+ enum nss_module_state
+ {
+diff --git a/nss/nss_readline.c b/nss/nss_readline.c
+index 4b3ecbccc8..a2f397a11f 100644
+--- a/nss/nss_readline.c
++++ b/nss/nss_readline.c
+@@ -40,7 +40,7 @@ __nss_readline (FILE *fp, char *buf, size_t len, off64_t *poffset)
+ *poffset = __ftello64 (fp);
+
+ buf[len - 1] = '\xff'; /* Marker to recognize truncation. */
+- if (fgets_unlocked (buf, len, fp) == NULL)
++ if (__fgets_unlocked (buf, len, fp) == NULL)
+ {
+ if (feof_unlocked (fp))
+ {
+@@ -61,7 +61,7 @@ __nss_readline (FILE *fp, char *buf, size_t len, off64_t *poffset)
+ line on the next call. */
+ return __nss_readline_seek (fp, *poffset);
+
+- /* fgets_unlocked succeeded. */
++ /* __fgets_unlocked succeeded. */
+
+ /* Remove leading whitespace. */
+ char *p = buf;
+diff --git a/nss/nss.h b/nss/nss.h
+index ae213f9a6c..c6d62adc0f 100644
+--- a/nss/nss.h
++++ b/nss/nss.h
+@@ -196,7 +196,7 @@ typedef enum nss_status nss_setspent (int);
+ extern nss_endgrent _nss_##module##_endgrent; \
+ extern nss_endhostent _nss_##module##_endhostent; \
+ extern nss_endnetent _nss_##module##_endnetent; \
+- extern nss_endnetgrent _nss_##module##__endnetgrent; \
++ extern nss_endnetgrent _nss_##module##_endnetgrent; \
+ extern nss_endprotoent _nss_##module##_endprotoent; \
+ extern nss_endpwent _nss_##module##_endpwent; \
+ extern nss_endrpcent _nss_##module##_endrpcent; \
+diff --git a/nss/nss_module.c b/nss/nss_module.c
+index 7b42c585a4..7ea5ad9887 100644
+--- a/nss/nss_module.c
++++ b/nss/nss_module.c
+@@ -114,14 +114,16 @@ static const function_name nss_function_name_array[] =
+ static bool
+ module_load_nss_files (struct nss_module *module)
+ {
++#ifdef USE_NSCD
+ if (is_nscd)
+ {
+ void (*cb) (size_t, struct traced_file *) = nscd_init_cb;
+-# ifdef PTR_DEMANGLE
++# ifdef PTR_DEMANGLE
+ PTR_DEMANGLE (cb);
+-# endif
++# endif
+ _nss_files_init (cb);
+ }
++#endif
+
+ /* Initialize the function pointers, following the double-checked
+ locking idiom. */
diff --git a/gnu/packages/patches/gnome-boxes-add-guix-logo.patch b/gnu/packages/patches/gnome-boxes-add-guix-logo.patch
new file mode 100644
index 0000000000..e570675083
--- /dev/null
+++ b/gnu/packages/patches/gnome-boxes-add-guix-logo.patch
@@ -0,0 +1,32 @@
+Taken from upstream commit: 9091c6849652fa083297bc12645d8c57a962874a.
+
+diff --git a/data/osinfo/guix-1.3.xml b/data/osinfo/guix-1.3.xml
+new file mode 100644
+index 00000000..d4e1c167
+--- /dev/null
++++ b/data/osinfo/guix-1.3.xml
+@@ -0,0 +1,9 @@
++<libosinfo version="0.0.1">
++
++ <!-- Please read README.logos for any questions about usage of product logos in Boxes. !-->
++
++ <os id="http://guix.gnu.org/guix/1.3">
++ <logo>https://gitlab.gnome.org/GNOME/gnome-boxes-logos/-/raw/master/logos/guix.svg</logo>
++ </os>
++
++</libosinfo>
+diff --git a/data/osinfo/meson.build b/data/osinfo/meson.build
+index 46ff1570..d5531e60 100644
+--- a/data/osinfo/meson.build
++++ b/data/osinfo/meson.build
+@@ -7,6 +7,7 @@ osinfo_db = [
+ ['freedos-1.2.xml', 'gnome-boxes/osinfo/os/freedos.org'],
+ ['gnome-nightly.xml', 'gnome-boxes/osinfo/os/gnome.org'],
+ ['gnome-3.38.xml', 'gnome-boxes/osinfo/os/gnome.org'],
++ ['guix-1.3.xml', 'gnome-boxes/osinfo/os/guix.gnu.org'],
+ ['manjaro-19.0.xml', 'gnome-boxes/osinfo/os/manjaro.org'],
+ ['nixos-20.03.xml', 'gnome-boxes/osinfo/os/nixos.org'],
+ ['opensuse-10.2.xml', 'gnome-boxes/osinfo/os/opensuse.org'],
+--
+2.34.0
+
diff --git a/gnu/packages/patches/gnome-online-miners-tracker-3.patch b/gnu/packages/patches/gnome-online-miners-tracker-3.patch
new file mode 100644
index 0000000000..0f89c56695
--- /dev/null
+++ b/gnu/packages/patches/gnome-online-miners-tracker-3.patch
@@ -0,0 +1,1505 @@
+Apply the following merge requests:
+
+https://gitlab.gnome.org/GNOME/gnome-online-miners/-/merge_requests/3
+https://gitlab.gnome.org/GNOME/gnome-online-miners/-/merge_requests/4
+
+to add tracker 3 support and fix a use after free error.
+
+diff --git a/src/gom-miner.c b/src/gom-miner.c
+index 7147b33..4fb4d80 100644
+--- a/src/gom-miner.c
++++ b/src/gom-miner.c
+@@ -221,6 +221,7 @@ gom_miner_check_pending_jobs (GTask *task)
+ return;
+
+ g_task_return_boolean (task, TRUE);
++ g_clear_object (&cleanup_job->self);
+ g_slice_free (CleanupJob, cleanup_job);
+ }
+
+@@ -461,7 +462,9 @@ miner_job_process_ready_cb (GObject *source,
+ cleanup_job->pending_jobs = g_list_remove (cleanup_job->pending_jobs,
+ account_miner_job);
+
++ /* This will free the cleanup job data if there are no more pending jobs. */
+ gom_miner_check_pending_jobs (account_miner_job->parent_task);
++
+ gom_account_miner_job_free (account_miner_job);
+ }
+
+@@ -520,10 +523,9 @@ cleanup_old_accounts_done (gpointer data)
+ job->old_datasources = NULL;
+ }
+
++ /* This will free the task data if there are no more pending jobs */
+ gom_miner_check_pending_jobs (task);
+
+- g_clear_object (&job->self);
+-
+ return FALSE;
+ }
+
+@@ -690,6 +692,8 @@ gom_miner_cleanup_old_accounts (GomMiner *self,
+ {
+ CleanupJob *job = g_slice_new0 (CleanupJob);
+
++ g_return_if_fail (GOM_IS_MINER (self));
++
+ job->self = g_object_ref (self);
+ job->content_objects = content_objects;
+ job->acc_objects = acc_objects;
+
+diff --git a/src/gom-application.c b/src/gom-application.c
+index fadd388..9e558f5 100644
+--- a/src/gom-application.c
++++ b/src/gom-application.c
+@@ -229,10 +229,16 @@ gom_application_constructed (GObject *object)
+ {
+ GomApplication *self = GOM_APPLICATION (object);
+ const gchar *display_name;
++ GError *error = NULL;
+
+ G_OBJECT_CLASS (gom_application_parent_class)->constructed (object);
+
+- self->miner = g_object_new (self->miner_type, NULL);
++ self->miner = g_initable_new (self->miner_type, NULL, &error, NULL);
++
++ if (self->miner == NULL) {
++ g_error (error->message);
++ }
++
+ display_name = gom_miner_get_display_name (self->miner);
+ gom_dbus_set_display_name (self->skeleton, display_name);
+ }
+diff --git a/src/gom-miner.c b/src/gom-miner.c
+index 7147b33..1dd9bb8 100644
+--- a/src/gom-miner.c
++++ b/src/gom-miner.c
+@@ -28,7 +28,11 @@
+
+ #include "gom-miner.h"
+
+-G_DEFINE_TYPE (GomMiner, gom_miner, G_TYPE_OBJECT)
++static void gom_miner_initable_interface_init (GInitableIface *iface);
++
++G_DEFINE_TYPE_WITH_CODE (GomMiner, gom_miner, G_TYPE_OBJECT,
++ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gom_miner_initable_interface_init))
++
+
+ struct _GomMinerPrivate {
+ GoaClient *client;
+@@ -132,20 +136,21 @@ gom_miner_dispose (GObject *object)
+ }
+
+ static void
+-gom_miner_init_goa (GomMiner *self)
++gom_miner_init_goa (GomMiner *self,
++ GError **error)
+ {
+ GoaAccount *account;
+ GoaObject *object;
+ const gchar *provider_type;
+ GList *accounts, *l;
+ GomMinerClass *miner_class = GOM_MINER_GET_CLASS (self);
++ GError *inner_error = NULL;
+
+- self->priv->client = goa_client_new_sync (NULL, &self->priv->client_error);
++ self->priv->client = goa_client_new_sync (NULL, &inner_error);
+
+- if (self->priv->client_error != NULL)
++ if (inner_error)
+ {
+- g_critical ("Unable to create GoaClient: %s - indexing for %s will not work",
+- self->priv->client_error->message, miner_class->goa_provider_type);
++ g_propagate_error (error, inner_error);
+ return;
+ }
+
+@@ -170,16 +175,34 @@ gom_miner_init_goa (GomMiner *self)
+ g_list_free_full (accounts, g_object_unref);
+ }
+
+-static void
+-gom_miner_constructed (GObject *obj)
++static gboolean
++gom_miner_initable_init (GInitable *initable,
++ GCancellable *cancellable,
++ GError **error)
+ {
+- GomMiner *self = GOM_MINER (obj);
++ GError *inner_error = NULL;
++ GomMiner *self;
+
+- G_OBJECT_CLASS (gom_miner_parent_class)->constructed (obj);
++ self = GOM_MINER (initable);
+
+- gom_miner_init_goa (self);
++ self->priv->connection = tracker_sparql_connection_get (cancellable, &inner_error);
++ if (inner_error)
++ {
++ g_propagate_prefixed_error (error, inner_error, "Unable to connect to Tracker store: ");
++ return FALSE;
++ }
++
++ gom_miner_init_goa (self, &inner_error);
++ if (inner_error)
++ {
++ g_propagate_prefixed_error (error, inner_error, "Unable to connect to GNOME Online Accounts: ");
++ return FALSE;
++ }
++
++ return TRUE;
+ }
+
++
+ static void
+ gom_miner_init (GomMiner *self)
+ {
+@@ -187,14 +210,12 @@ gom_miner_init (GomMiner *self)
+
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GOM_TYPE_MINER, GomMinerPrivate);
+ self->priv->display_name = g_strdup ("");
++}
+
+- self->priv->connection = tracker_sparql_connection_get (NULL, &self->priv->connection_error);
+- if (self->priv->connection_error != NULL)
+- {
+- g_critical ("Unable to create TrackerSparqlConnection: %s - indexing for %s will not work",
+- self->priv->connection_error->message,
+- klass->goa_provider_type);
+- }
++static void
++gom_miner_initable_interface_init (GInitableIface *iface)
++{
++ iface->init = gom_miner_initable_init;
+ }
+
+ static void
+@@ -202,7 +223,6 @@ gom_miner_class_init (GomMinerClass *klass)
+ {
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+- oclass->constructed = gom_miner_constructed;
+ oclass->dispose = gom_miner_dispose;
+
+ cleanup_pool = g_thread_pool_new (cleanup_job, NULL, 1, FALSE, NULL);
+diff --git a/configure.ac b/configure.ac
+index 06cba71..6c61247 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -21,7 +21,7 @@ AC_HEADER_STDC
+
+ GDATA_MIN_VERSION=0.15.2
+ GFBGRAPH_MIN_VERSION=0.2.2
+-GLIB_MIN_VERSION=2.35.1
++GLIB_MIN_VERSION=2.56.0
+ GOA_MIN_VERSION=3.13.3
+ GRILO_MIN_VERSION=0.3.0
+ ZAPOJIT_MIN_VERSION=0.0.2
+@@ -36,7 +36,7 @@ PKG_CHECK_MODULES(GIO, [gio-2.0 gio-unix-2.0])
+ PKG_CHECK_MODULES(GOA, [goa-1.0 >= $GOA_MIN_VERSION])
+ AC_DEFINE([GOA_API_IS_SUBJECT_TO_CHANGE], [], [We are aware that GOA's API can change])
+
+-PKG_CHECK_MODULES(TRACKER, [tracker-miner-2.0 tracker-sparql-2.0])
++PKG_CHECK_MODULES(TRACKER, [tracker-sparql-3.0])
+
+ # Facebook
+ AC_ARG_ENABLE([facebook], [AS_HELP_STRING([--enable-facebook], [Enable Facebook miner])], [], [enable_facebook=yes])
+diff --git a/src/gom-application.c b/src/gom-application.c
+index 9e558f5..b435e26 100644
+--- a/src/gom-application.c
++++ b/src/gom-application.c
+@@ -233,7 +233,9 @@ gom_application_constructed (GObject *object)
+
+ G_OBJECT_CLASS (gom_application_parent_class)->constructed (object);
+
+- self->miner = g_initable_new (self->miner_type, NULL, &error, NULL);
++ self->miner = g_initable_new (self->miner_type, NULL, &error,
++ "bus-name", g_application_get_application_id (G_APPLICATION (self)),
++ NULL);
+
+ if (self->miner == NULL) {
+ g_error (error->message);
+diff --git a/src/gom-miner.c b/src/gom-miner.c
+index 1dd9bb8..ba76ebb 100644
+--- a/src/gom-miner.c
++++ b/src/gom-miner.c
+@@ -33,12 +33,13 @@ static void gom_miner_initable_interface_init (GInitableIface *iface);
+ G_DEFINE_TYPE_WITH_CODE (GomMiner, gom_miner, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gom_miner_initable_interface_init))
+
+-
+ struct _GomMinerPrivate {
+ GoaClient *client;
+ GError *client_error;
+
++ gchar *bus_name;
+ TrackerSparqlConnection *connection;
++ TrackerEndpointDBus *endpoint;
+ GError *connection_error;
+
+ gchar *display_name;
+@@ -62,6 +63,14 @@ typedef struct {
+ gpointer service;
+ } InsertSharedContentData;
+
++typedef enum
++{
++ PROP_BUS_NAME = 1,
++ N_PROPERTIES
++} GomMinerProperty;
++
++static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
++
+ static GThreadPool *cleanup_pool;
+
+ static void cleanup_job (gpointer data, gpointer user_data);
+@@ -135,6 +144,58 @@ gom_miner_dispose (GObject *object)
+ G_OBJECT_CLASS (gom_miner_parent_class)->dispose (object);
+ }
+
++static void
++gom_miner_init_database (GomMiner *self,
++ GCancellable *cancellable,
++ GError **error)
++{
++ TrackerSparqlConnectionFlags flags;
++ g_autoptr (GFile) store_path = NULL;
++ g_autoptr (GDBusConnection) bus = NULL;
++ GError *inner_error = NULL;
++
++ flags = TRACKER_SPARQL_CONNECTION_FLAGS_FTS_ENABLE_STEMMER |
++ TRACKER_SPARQL_CONNECTION_FLAGS_FTS_ENABLE_UNACCENT |
++ TRACKER_SPARQL_CONNECTION_FLAGS_FTS_ENABLE_STOP_WORDS |
++ TRACKER_SPARQL_CONNECTION_FLAGS_FTS_IGNORE_NUMBERS;
++
++ store_path = g_file_new_build_filename (g_get_user_cache_dir (),
++ "gnome-online-miners",
++ self->priv->bus_name,
++ NULL);
++
++ self->priv->connection = tracker_sparql_connection_new (flags,
++ store_path,
++ tracker_sparql_get_ontology_nepomuk (),
++ cancellable,
++ &inner_error);
++
++ if (inner_error)
++ {
++ g_propagate_error (error, inner_error);
++ return;
++ }
++
++ bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &inner_error);
++
++ if (inner_error)
++ {
++ g_propagate_error (error, inner_error);
++ return;
++ }
++
++ self->priv->endpoint = tracker_endpoint_dbus_new (self->priv->connection,
++ bus,
++ NULL, /* object path */
++ cancellable,
++ &inner_error);
++ if (inner_error)
++ {
++ g_propagate_error (error, inner_error);
++ return;
++ }
++}
++
+ static void
+ gom_miner_init_goa (GomMiner *self,
+ GError **error)
+@@ -185,10 +246,10 @@ gom_miner_initable_init (GInitable *initable,
+
+ self = GOM_MINER (initable);
+
+- self->priv->connection = tracker_sparql_connection_get (cancellable, &inner_error);
++ gom_miner_init_database (self, cancellable, &inner_error);
+ if (inner_error)
+ {
+- g_propagate_prefixed_error (error, inner_error, "Unable to connect to Tracker store: ");
++ g_propagate_prefixed_error (error, inner_error, "Unable to set up Tracker database: ");
+ return FALSE;
+ }
+
+@@ -212,6 +273,47 @@ gom_miner_init (GomMiner *self)
+ self->priv->display_name = g_strdup ("");
+ }
+
++static void
++gom_miner_set_property (GObject *object,
++ guint property_id,
++ const GValue *value,
++ GParamSpec *pspec)
++{
++ GomMiner *self = GOM_MINER (object);
++
++ switch ((GomMinerProperty) property_id)
++ {
++ case PROP_BUS_NAME:
++ g_free (self->priv->bus_name);
++ self->priv->bus_name = g_value_dup_string (value);
++ break;
++
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
++ break;
++ }
++}
++
++static void
++gom_miner_get_property (GObject *object,
++ guint property_id,
++ GValue *value,
++ GParamSpec *pspec)
++{
++ GomMiner *self = GOM_MINER (object);
++
++ switch ((GomMinerProperty) property_id)
++ {
++ case PROP_BUS_NAME:
++ g_value_set_string (value, self->priv->bus_name);
++ break;
++
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
++ break;
++ }
++}
++
+ static void
+ gom_miner_initable_interface_init (GInitableIface *iface)
+ {
+@@ -224,6 +326,19 @@ gom_miner_class_init (GomMinerClass *klass)
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+ oclass->dispose = gom_miner_dispose;
++ oclass->set_property = gom_miner_set_property;
++ oclass->get_property = gom_miner_get_property;
++
++ obj_properties[PROP_BUS_NAME] = g_param_spec_string ("bus-name",
++ "Bus Name",
++ "D-Bus name of the miner",
++ NULL /* default value */,
++ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
++ G_PARAM_STATIC_STRINGS);
++
++ g_object_class_install_properties (oclass,
++ N_PROPERTIES,
++ obj_properties);
+
+ cleanup_pool = g_thread_pool_new (cleanup_job, NULL, 1, FALSE, NULL);
+
+diff --git a/src/gom-miner.h b/src/gom-miner.h
+index 8f83139..5dcfc8d 100644
+--- a/src/gom-miner.h
++++ b/src/gom-miner.h
+@@ -61,6 +61,7 @@ typedef struct _GomMinerPrivate GomMinerPrivate;
+ typedef struct {
+ GomMiner *miner;
+ TrackerSparqlConnection *connection;
++ gchar *bus_name;
+
+ GoaAccount *account;
+ GHashTable *services;
+diff --git a/src/gom-tracker.c b/src/gom-tracker.c
+index 68818c4..5666c16 100644
+--- a/src/gom-tracker.c
++++ b/src/gom-tracker.c
+@@ -408,7 +408,7 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection
+ gchar *retval = NULL;
+ gchar *select = NULL;
+
+- g_return_val_if_fail (TRACKER_SPARQL_IS_CONNECTION (connection), NULL);
++ g_return_val_if_fail (TRACKER_IS_SPARQL_CONNECTION (connection), NULL);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+ g_return_val_if_fail (make != NULL || model != NULL, NULL);
+
+diff --git a/src/gom-tracker.c b/src/gom-tracker.c
+index 5666c16..63a4c29 100644
+--- a/src/gom-tracker.c
++++ b/src/gom-tracker.c
+@@ -208,6 +208,6 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection
+ insert = g_string_new (NULL);
+ g_string_append_printf
+ (insert,
+- "INSERT OR REPLACE %s { <%s> a nie:InformationElement ; %s %s }",
++ "INSERT OR REPLACE %s { <%s> a nie:InformationElement, nie:DataObject ; %s %s }",
+ graph_str, resource, property_name, quoted);
+ g_free (quoted);
+
+diff --git a/src/gom-facebook-miner.c b/src/gom-facebook-miner.c
+index ff42ca5..fc89096 100644
+--- a/src/gom-facebook-miner.c
++++ b/src/gom-facebook-miner.c
+@@ -70,7 +70,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_PICTURES_GRAPH, identifier,
+ "nfo:RemoteDataObject", class, NULL);
+
+ if (*error != NULL)
+@@ -239,7 +239,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:url", album_link);
+
+ if (*error != NULL)
+@@ -248,7 +248,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:description", album_description);
+
+ if (*error != NULL)
+@@ -257,7 +257,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:title", album_name);
+
+ if (*error != NULL)
+@@ -274,7 +274,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nco:creator", contact_resource);
+ g_free (contact_resource);
+
+@@ -284,7 +284,7 @@ account_miner_job_process_album (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:contentCreated", album_created_time);
+
+ if (*error != NULL)
+
+diff --git a/src/gom-flickr-miner.c b/src/gom-flickr-miner.c
+index 9ac338e..dc7349e 100644
+--- a/src/gom-flickr-miner.c
++++ b/src/gom-flickr-miner.c
+@@ -143,14 +143,14 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_PICTURES_GRAPH, identifier,
+ "nfo:RemoteDataObject", class, NULL);
+
+ if (*error != NULL)
+ goto out;
+
+ gom_tracker_update_datasource (connection, datasource_urn,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -166,7 +166,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
+ (connection, cancellable, error,
+ NULL,
+- datasource_urn, parent_identifier,
++ TRACKER_PICTURES_GRAPH, parent_identifier,
+ "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
+ g_free (parent_identifier);
+
+@@ -176,7 +176,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:isPartOf", parent_resource_urn);
+ g_free (parent_resource_urn);
+
+@@ -187,7 +187,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:title", grl_media_get_title (entry->media));
+
+ if (*error != NULL)
+@@ -202,7 +202,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ created_time = modification_date = grl_media_get_creation_date (entry->media);
+ new_mtime = g_date_time_to_unix (modification_date);
+ mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -221,7 +221,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:contentCreated", date);
+ g_free (date);
+ }
+@@ -233,7 +233,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:url", url);
+
+ if (*error != NULL)
+@@ -242,7 +242,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:description", grl_media_get_description (entry->media));
+
+ if (*error != NULL)
+@@ -254,7 +254,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:mimeType", mime);
+ g_free (mime);
+
+@@ -265,7 +265,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ contact_resource = gom_tracker_utils_ensure_contact_resource
+ (connection,
+ cancellable, error,
+- datasource_urn, grl_media_get_author (entry->media));
++ TRACKER_PICTURES_GRAPH, grl_media_get_author (entry->media));
+
+ if (*error != NULL)
+ goto out;
+@@ -273,7 +273,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nco:creator", contact_resource);
+ g_free (contact_resource);
+
+diff --git a/src/gom-gdata-miner.c b/src/gom-gdata-miner.c
+index 7872431..d0deb80 100644
+--- a/src/gom-gdata-miner.c
++++ b/src/gom-gdata-miner.c
+@@ -120,7 +120,7 @@ account_miner_job_process_entry (TrackerSparqlConnection *connection,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_DOCUMENTS_GRAPH, identifier,
+ "nfo:RemoteDataObject", class, NULL);
+
+ if (*error != NULL)
+@@ -187,7 +187,7 @@ account_miner_job_process_entry (TrackerSparqlConnection *connection,
+ parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
+ (connection, cancellable, error,
+ NULL,
+- datasource_urn, parent_resource_id,
++ GOM_GRAPH, parent_resource_id,
+ "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
+ g_free (parent_resource_id);
+
+@@ -219,7 +219,7 @@ account_miner_job_process_entry (TrackerSparqlConnection *connection,
+ gom_tracker_sparql_connection_toggle_favorite
+ (connection,
+ cancellable, error,
+- resource, starred);
++ TRACKER_PICTURES_GRAPH, resource, starred);
+
+ if (*error != NULL)
+ goto out;
+@@ -400,14 +400,14 @@ account_miner_job_process_photo (TrackerSparqlConnection *connection,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_PICTURES_GRAPH, identifier,
+ "nfo:RemoteDataObject", "nmm:Photo", NULL);
+
+ if (*error != NULL)
+ goto out;
+
+ gom_tracker_update_datasource (connection, datasource_urn,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+ if (*error != NULL)
+ goto out;
+@@ -566,6 +566,7 @@ account_miner_job_process_photo (TrackerSparqlConnection *connection,
+ equipment_resource = gom_tracker_utils_ensure_equipment_resource (connection,
+ cancellable,
+ error,
++ TRACKER_PICTURES_GRAPH,
+ make,
+ model);
+
+@@ -665,7 +666,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_PICTURES_GRAPH, identifier,
+ "nfo:RemoteDataObject", "nfo:DataContainer",
+ NULL);
+
+@@ -674,7 +675,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+
+ gom_tracker_update_datasource
+ (connection, datasource_urn,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -685,7 +686,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+ */
+ new_mtime = gdata_entry_get_updated (GDATA_ENTRY (album));
+ mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -703,7 +704,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:url", alternate_uri);
+
+ if (*error != NULL)
+@@ -713,7 +714,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:description", summary);
+
+ if (*error != NULL)
+@@ -723,7 +724,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:title", title);
+
+ if (*error != NULL)
+@@ -743,7 +744,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nco:creator", contact_resource);
+ g_free (contact_resource);
+
+@@ -755,7 +756,7 @@ account_miner_job_process_album (TrackerSparqlConnection *connection,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:contentCreated", date);
+ g_free (date);
+
+@@ -865,7 +866,7 @@ insert_shared_content_photos (TrackerSparqlConnection *connection,
+ if (!gom_tracker_sparql_connection_insert_or_replace_triple (connection,
+ cancellable,
+ &local_error,
+- datasource_urn,
++ TRACKER_PICTURES_GRAPH,
+ source_urn,
+ "nie:relatedTo",
+ photo_resource_urn))
+@@ -878,7 +879,7 @@ insert_shared_content_photos (TrackerSparqlConnection *connection,
+ if (!gom_tracker_sparql_connection_insert_or_replace_triple (connection,
+ cancellable,
+ &local_error,
+- datasource_urn,
++ TRACKER_PICTURES_GRAPH,
+ photo_resource_urn,
+ "nie:links",
+ source_urn))
+
+diff --git a/src/gom-media-server-miner.c b/src/gom-media-server-miner.c
+index 490869e..32e08c6 100644
+--- a/src/gom-media-server-miner.c
++++ b/src/gom-media-server-miner.c
+@@ -65,14 +65,14 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_PICTURES_GRAPH, identifier,
+ "nfo:RemoteDataObject", class, NULL);
+
+ if (*error != NULL)
+ goto out;
+
+ gom_tracker_update_datasource (connection, datasource_urn,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+ if (*error != NULL)
+ goto out;
+@@ -81,7 +81,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:url", photo->url);
+
+ if (*error != NULL)
+@@ -90,7 +90,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:mimeType", photo->mimetype);
+
+ if (*error != NULL)
+@@ -99,7 +99,7 @@ account_miner_job_process_photo (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:title", photo->name);
+
+ if (*error != NULL)
+
+diff --git a/src/gom-miner.c b/src/gom-miner.c
+index ba76ebb..40b111d 100644
+--- a/src/gom-miner.c
++++ b/src/gom-miner.c
+@@ -375,7 +375,7 @@ gom_miner_ensure_datasource (GomMiner *self,
+ " <%s> a nie:DataSource ; nao:identifier \"%s\" . "
+ " <%s> a nie:InformationElement ; nie:rootElementOf <%s> ; nie:version \"%d\""
+ "}",
+- datasource_urn,
++ GOM_GRAPH,
+ datasource_urn, klass->miner_identifier,
+ root_element_urn, datasource_urn, klass->version);
+
+@@ -400,8 +400,8 @@ gom_account_miner_job_query_existing (GomAccountMinerJob *job,
+
+ select = g_string_new (NULL);
+ g_string_append_printf (select,
+- "SELECT ?urn nao:identifier(?urn) WHERE { ?urn nie:dataSource <%s> }",
+- job->datasource_urn);
++ "SELECT ?urn ?id WHERE { GRAPH <%s> { ?urn nie:dataSource <%s> ; nao:identifier ?id . } }",
++ GOM_GRAPH, job->datasource_urn);
+
+ cursor = tracker_sparql_connection_query (job->connection,
+ select->str,
+@@ -414,9 +414,21 @@ gom_account_miner_job_query_existing (GomAccountMinerJob *job,
+
+ while (tracker_sparql_cursor_next (cursor, cancellable, error))
+ {
+- g_hash_table_insert (job->previous_resources,
+- g_strdup (tracker_sparql_cursor_get_string (cursor, 1, NULL)),
+- g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL)));
++ const gchar *urn, *identifier;
++
++ urn = tracker_sparql_cursor_get_string (cursor, 0, NULL);
++ identifier = tracker_sparql_cursor_get_string (cursor, 1, NULL);
++
++ if (identifier != NULL)
++ {
++ g_hash_table_insert (job->previous_resources,
++ g_strdup (identifier),
++ g_strdup (urn));
++ }
++ else
++ {
++ g_warning ("Missing identifier for urn %s", urn);
++ }
+ }
+
+ g_object_unref (cursor);
+@@ -488,16 +500,19 @@ gom_account_miner_job (GTask *task,
+ if (error != NULL)
+ goto out;
+
++ g_debug ("account miner: Querying existing accounts stored in database");
+ gom_account_miner_job_query_existing (job, &error);
+
+ if (error != NULL)
+ goto out;
+
++ g_debug ("account miner: Querying remote server");
+ gom_account_miner_job_query (job, &error);
+
+ if (error != NULL)
+ goto out;
+
++ g_debug ("account miner: Removing stale accounts");
+ gom_account_miner_job_cleanup_previous (job, &error);
+
+ if (error != NULL)
+@@ -751,10 +766,15 @@ cleanup_job (gpointer data,
+
+ /* find all our datasources in the tracker DB */
+ select = g_string_new (NULL);
+- g_string_append_printf (select, "SELECT ?datasource nie:version(?root) WHERE { "
+- "?datasource a nie:DataSource . "
+- "?datasource nao:identifier \"%s\" . "
+- "OPTIONAL { ?root nie:rootElementOf ?datasource } }",
++ g_string_append_printf (select,
++ "SELECT ?datasource nie:version(?root) WHERE { "
++ " GRAPH <%s> { "
++ " ?datasource a nie:DataSource . "
++ " ?datasource nao:identifier \"%s\" . "
++ " OPTIONAL { ?root nie:rootElementOf ?datasource } "
++ " }"
++ "}",
++ GOM_GRAPH,
+ klass->miner_identifier);
+
+ cursor = tracker_sparql_connection_query (self->priv->connection,
+
+diff --git a/src/gom-miner.h b/src/gom-miner.h
+index 5dcfc8d..8f83139 100644
+--- a/src/gom-miner.h
++++ b/src/gom-miner.h
+@@ -61,7 +61,6 @@ typedef struct _GomMinerPrivate GomMinerPrivate;
+ typedef struct {
+ GomMiner *miner;
+ TrackerSparqlConnection *connection;
+- gchar *bus_name;
+
+ GoaAccount *account;
+ GHashTable *services;
+
+diff --git a/src/gom-owncloud-miner.c b/src/gom-owncloud-miner.c
+index 34d303b..623f2e1 100644
+--- a/src/gom-owncloud-miner.c
++++ b/src/gom-owncloud-miner.c
+@@ -100,14 +100,14 @@ account_miner_job_process_file (GomAccountMinerJob *job,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_DOCUMENTS_GRAPH, identifier,
+ "nfo:RemoteDataObject", class, NULL);
+
+ if (*error != NULL)
+ goto out;
+
+ gom_tracker_update_datasource (connection, datasource_urn,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_DOCUMENTS_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -117,7 +117,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
+ modification_time = g_date_time_new_from_timeval_local (&tv);
+ new_mtime = g_date_time_to_unix (modification_time);
+ mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_DOCUMENTS_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -133,7 +133,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_DOCUMENTS_GRAPH, resource,
+ "nie:url", uri);
+
+ if (*error != NULL)
+@@ -156,7 +156,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
+ parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
+ (connection, cancellable, error,
+ NULL,
+- datasource_urn, parent_identifier,
++ GOM_GRAPH, parent_identifier,
+ "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
+ g_checksum_reset (checksum);
+ g_free (parent_identifier);
+@@ -168,7 +168,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_DOCUMENTS_GRAPH, resource,
+ "nie:isPartOf", parent_resource_urn);
+ g_free (parent_resource_urn);
+
+@@ -182,7 +182,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_DOCUMENTS_GRAPH, resource,
+ "nie:mimeType", mime);
+
+ if (*error != NULL)
+@@ -194,7 +194,7 @@ account_miner_job_process_file (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_DOCUMENTS_GRAPH, resource,
+ "nfo:fileName", display_name);
+
+ if (*error != NULL)
+@@ -416,6 +416,11 @@ query_owncloud (GomAccountMinerJob *job,
+ mount = g_volume_get_mount (volume);
+ if (mount == NULL)
+ {
++ g_autofree gchar *volume_name;
++
++ volume_name = g_volume_get_name (volume);
++ g_debug ("Mounting Online Account volume %s", volume_name);
++
+ data.error = error;
+
+ context = g_main_context_new ();
+@@ -436,6 +441,7 @@ query_owncloud (GomAccountMinerJob *job,
+ }
+
+ root = g_mount_get_root (mount);
++ g_debug ("Got volume from gnome-online-accounts: root is %s", g_file_peek_path (root));
+ account_miner_job_traverse_dir (job, connection, previous_resources, datasource_urn, root, TRUE, cancellable, error);
+
+ g_object_unref (root);
+
+diff --git a/src/gom-tracker.c b/src/gom-tracker.c
+index 63a4c29..469583e 100644
+--- a/src/gom-tracker.c
++++ b/src/gom-tracker.c
+@@ -26,16 +26,11 @@
+ #include "gom-tracker.h"
+ #include "gom-utils.h"
+
+-static gchar *
+-_tracker_utils_format_into_graph (const gchar *graph)
+-{
+- return (graph != NULL) ? g_strdup_printf ("INTO <%s> ", graph) : g_strdup ("");
+-}
+-
+ static gboolean
+ gom_tracker_sparql_connection_get_string_attribute (TrackerSparqlConnection *connection,
+ GCancellable *cancellable,
+ GError **error,
++ const gchar *graph,
+ const gchar *resource,
+ const gchar *attribute,
+ gchar **value)
+@@ -45,8 +40,8 @@ gom_tracker_sparql_connection_get_string_attribute (TrackerSparqlConnection *con
+ const gchar *string_value = NULL;
+ gboolean res;
+
+- g_string_append_printf (select, "SELECT ?val { <%s> %s ?val }",
+- resource, attribute);
++ g_string_append_printf (select, "SELECT ?val { GRAPH <%s> { <%s> %s ?val } }",
++ graph, resource, attribute);
+ cursor = tracker_sparql_connection_query (connection,
+ select->str,
+ cancellable, error);
+@@ -86,7 +81,8 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti
+ const gchar *class,
+ ...)
+ {
+- GString *select, *insert, *inner;
++ GString *select, *inner;
++ gchar *insert;
+ va_list args;
+ const gchar *arg;
+ TrackerSparqlCursor *cursor;
+@@ -98,6 +94,8 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti
+ gchar *key = NULL, *val = NULL;
+ gboolean exists = FALSE;
+
++ g_return_val_if_fail (graph != NULL, NULL);
++
+ /* build the inner query with all the classes */
+ va_start (args, class);
+ inner = g_string_new (NULL);
+@@ -112,7 +110,7 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti
+ /* query if such a resource is already in the DB */
+ select = g_string_new (NULL);
+ g_string_append_printf (select,
+- "SELECT ?urn WHERE { ?urn %s }", inner->str);
++ "SELECT ?urn WHERE { GRAPH <%s> { ?urn %s } }", graph, inner->str);
+
+ cursor = tracker_sparql_connection_query (connection,
+ select->str,
+@@ -138,19 +136,12 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti
+ }
+
+ /* not found, create the resource */
+- insert = g_string_new (NULL);
+- graph_str = _tracker_utils_format_into_graph (graph);
+-
+- g_string_append_printf (insert, "INSERT %s { _:res %s }",
+- graph_str, inner->str);
+- g_free (graph_str);
+- g_string_free (inner, TRUE);
+-
++ insert = g_strdup_printf ("INSERT INTO <%s> { _:res %s }",
++ graph, inner->str);
+ insert_res =
+- tracker_sparql_connection_update_blank (connection, insert->str,
++ tracker_sparql_connection_update_blank (connection, insert,
+ G_PRIORITY_DEFAULT, NULL, error);
+-
+- g_string_free (insert, TRUE);
++ g_free (insert);
+
+ if (*error != NULL)
+ goto out;
+@@ -194,10 +185,10 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection
+ const gchar *property_value)
+ {
+ GString *insert;
+- gchar *graph_str, *quoted;
++ gchar *quoted;
+ gboolean retval = TRUE;
+
+- graph_str = _tracker_utils_format_into_graph (graph);
++ g_return_val_if_fail (graph != NULL, FALSE);
+
+ /* the "null" value must not be quoted */
+ if (property_value == NULL)
+@@ -208,8 +199,8 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection
+ insert = g_string_new (NULL);
+ g_string_append_printf
+ (insert,
+- "INSERT OR REPLACE %s { <%s> a nie:InformationElement, nie:DataObject ; %s %s }",
+- graph_str, resource, property_name, quoted);
++ "INSERT OR REPLACE INTO <%s> { <%s> a nie:InformationElement, nie:DataObject ; %s %s }",
++ graph, resource, property_name, quoted);
+ g_free (quoted);
+
+ g_debug ("Insert or replace triple: query %s", insert->str);
+@@ -223,8 +214,6 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection
+ if (*error != NULL)
+ retval = FALSE;
+
+- g_free (graph_str);
+-
+ return retval;
+ }
+
+@@ -271,6 +260,7 @@ gboolean
+ gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connection,
+ GCancellable *cancellable,
+ GError **error,
++ const gchar *graph,
+ const gchar *resource,
+ gboolean favorite)
+ {
+@@ -279,15 +269,15 @@ gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connecti
+ gboolean retval = TRUE;
+
+ if (favorite)
+- op_str = "INSERT OR REPLACE";
++ op_str = "INSERT OR REPLACE INTO";
+ else
+- op_str = "DELETE";
++ op_str = "DELETE FROM";
+
+ update = g_string_new (NULL);
+ g_string_append_printf
+ (update,
+- "%s { <%s> nao:hasTag nao:predefined-tag-favorite }",
+- op_str, resource);
++ "%s <%s> { <%s> nao:hasTag nao:predefined-tag-favorite }",
++ op_str, graph, resource);
+
+ g_debug ("Toggle favorite: query %s", update->str);
+
+@@ -321,9 +311,13 @@ gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection,
+ mail_uri = g_strconcat ("mailto:", email, NULL);
+ select = g_string_new (NULL);
+ g_string_append_printf (select,
+- "SELECT ?urn WHERE { ?urn a nco:Contact . "
+- "?urn nco:hasEmailAddress ?mail . "
+- "FILTER (fn:contains(?mail, \"%s\" )) }", mail_uri);
++ "SELECT ?urn WHERE { "
++ " GRAPH <%s> { "
++ " ?urn a nco:Contact . "
++ " ?urn nco:hasEmailAddress ?mail . "
++ " FILTER (fn:contains(?mail, \"%s\" )) "
++ " }"
++ "}", TRACKER_CONTACTS_GRAPH, mail_uri);
+
+ cursor = tracker_sparql_connection_query (connection,
+ select->str,
+@@ -351,8 +345,9 @@ gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection,
+ insert = g_string_new (NULL);
+
+ g_string_append_printf (insert,
+- "INSERT { <%s> a nco:EmailAddress ; nco:emailAddress \"%s\" . "
++ "INSERT INTO <%s> { <%s> a nco:EmailAddress ; nco:emailAddress \"%s\" . "
+ "_:res a nco:Contact ; nco:hasEmailAddress <%s> ; nco:fullname \"%s\" . }",
++ TRACKER_CONTACTS_GRAPH,
+ mail_uri, email,
+ mail_uri, fullname);
+
+@@ -397,6 +392,7 @@ gchar *
+ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection,
+ GCancellable *cancellable,
+ GError **error,
++ const gchar *graph,
+ const gchar *make,
+ const gchar *model)
+ {
+@@ -416,7 +412,7 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection
+ equip_uri = tracker_sparql_escape_uri_printf ("urn:equipment:%s:%s:",
+ make != NULL ? make : "",
+ model != NULL ? model : "");
+- select = g_strdup_printf ("SELECT <%s> WHERE { }", equip_uri);
++ select = g_strdup_printf ("SELECT <%s> WHERE { GRAPH <%s> { } }", equip_uri, graph);
+
+ local_error = NULL;
+ cursor = tracker_sparql_connection_query (connection, select, cancellable, &local_error);
+@@ -449,7 +445,8 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection
+ }
+
+ /* not found, create the resource */
+- insert = g_strdup_printf ("INSERT { <%s> a nfo:Equipment ; nfo:manufacturer \"%s\" ; nfo:model \"%s\" }",
++ insert = g_strdup_printf ("INSERT INTO <%s> { <%s> a nfo:Equipment ; nfo:manufacturer \"%s\" ; nfo:model \"%s\" }",
++ graph,
+ equip_uri,
+ make,
+ model);
+@@ -480,7 +477,7 @@ void
+ gom_tracker_update_datasource (TrackerSparqlConnection *connection,
+ const gchar *datasource_urn,
+ gboolean resource_exists,
+- const gchar *identifier,
++ const gchar *graph,
+ const gchar *resource,
+ GCancellable *cancellable,
+ GError **error)
+@@ -498,7 +495,7 @@ gom_tracker_update_datasource (TrackerSparqlConnection *connection,
+
+ res = gom_tracker_sparql_connection_get_string_attribute
+ (connection, cancellable, error,
+- resource, "nie:dataSource", &old_value);
++ graph, resource, "nie:dataSource", &old_value);
+ g_clear_error (error);
+
+ if (res)
+@@ -514,7 +511,7 @@ gom_tracker_update_datasource (TrackerSparqlConnection *connection,
+ if (set_datasource)
+ gom_tracker_sparql_connection_set_triple
+ (connection, cancellable, error,
+- identifier, resource,
++ graph, resource,
+ "nie:dataSource", datasource_urn);
+ }
+
+@@ -522,7 +519,7 @@ gboolean
+ gom_tracker_update_mtime (TrackerSparqlConnection *connection,
+ gint64 new_mtime,
+ gboolean resource_exists,
+- const gchar *identifier,
++ const gchar *graph,
+ const gchar *resource,
+ GCancellable *cancellable,
+ GError **error)
+@@ -536,7 +533,7 @@ gom_tracker_update_mtime (TrackerSparqlConnection *connection,
+ {
+ res = gom_tracker_sparql_connection_get_string_attribute
+ (connection, cancellable, error,
+- resource, "nie:contentLastModified", &old_value);
++ graph, resource, "nie:contentLastModified", &old_value);
+ g_clear_error (error);
+
+ if (res)
+@@ -552,7 +549,7 @@ gom_tracker_update_mtime (TrackerSparqlConnection *connection,
+ date = gom_iso8601_from_timestamp (new_mtime);
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection, cancellable, error,
+- identifier, resource,
++ graph, resource,
+ "nie:contentLastModified", date);
+ g_free (date);
+
+diff --git a/src/gom-tracker.h b/src/gom-tracker.h
+index 94a39e8..a5ae6fd 100644
+--- a/src/gom-tracker.h
++++ b/src/gom-tracker.h
+@@ -29,6 +29,14 @@
+
+ G_BEGIN_DECLS
+
++/* The graph where we store account meta information */
++#define GOM_GRAPH "tracker.api.gnome.org/ontology/v3/gnome-online-miners"
++
++/* Graphs where we store content information */
++#define TRACKER_CONTACTS_GRAPH "http://tracker.api.gnome.org/ontology/v3/tracker#Contacts"
++#define TRACKER_DOCUMENTS_GRAPH "http://tracker.api.gnome.org/ontology/v3/tracker#Documents"
++#define TRACKER_PICTURES_GRAPH "http://tracker.api.gnome.org/ontology/v3/tracker#Pictures"
++
+ gchar *gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connection,
+ GCancellable *cancellable,
+ GError **error,
+@@ -57,6 +65,7 @@ gboolean gom_tracker_sparql_connection_set_triple (TrackerSparqlConnection *conn
+ gboolean gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connection,
+ GCancellable *cancellable,
+ GError **error,
++ const gchar *graph,
+ const gchar *resource,
+ gboolean favorite);
+
+@@ -69,20 +78,21 @@ gchar* gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *conne
+ gchar *gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection,
+ GCancellable *cancellable,
+ GError **error,
++ const gchar *graph,
+ const gchar *make,
+ const gchar *model);
+
+ void gom_tracker_update_datasource (TrackerSparqlConnection *connection,
+ const gchar *datasource_urn,
+ gboolean resource_exists,
+- const gchar *identifier,
++ const gchar *graph,
+ const gchar *resource,
+ GCancellable *cancellable,
+ GError **error);
+ gboolean gom_tracker_update_mtime (TrackerSparqlConnection *connection,
+ gint64 new_mtime,
+ gboolean resource_exists,
+- const gchar *identifier,
++ const gchar *graph,
+ const gchar *resource,
+ GCancellable *cancellable,
+ GError **error);
+diff --git a/src/gom-zpj-miner.c b/src/gom-zpj-miner.c
+index 6dff947..1372de5 100644
+--- a/src/gom-zpj-miner.c
++++ b/src/gom-zpj-miner.c
+@@ -70,14 +70,14 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ (connection,
+ cancellable, error,
+ &resource_exists,
+- datasource_urn, identifier,
++ TRACKER_PICTURES_GRAPH, identifier,
+ "nfo:RemoteDataObject", class, NULL);
+
+ if (*error != NULL)
+ goto out;
+
+ gom_tracker_update_datasource (connection, datasource_urn,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -86,7 +86,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ updated_time = zpj_skydrive_entry_get_updated_time (entry);
+ new_mtime = g_date_time_to_unix (updated_time);
+ mtime_changed = gom_tracker_update_mtime (connection, new_mtime,
+- resource_exists, identifier, resource,
++ resource_exists, TRACKER_PICTURES_GRAPH, resource,
+ cancellable, error);
+
+ if (*error != NULL)
+@@ -102,7 +102,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:url", identifier);
+
+ if (*error != NULL)
+@@ -119,7 +119,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ parent_resource_urn = gom_tracker_sparql_connection_ensure_resource
+ (connection, cancellable, error,
+ NULL,
+- datasource_urn, parent_identifier,
++ TRACKER_PICTURES_GRAPH, parent_identifier,
+ "nfo:RemoteDataObject", "nfo:DataContainer", NULL);
+ g_free (parent_identifier);
+
+@@ -129,7 +129,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:isPartOf", parent_resource_urn);
+ g_free (parent_resource_urn);
+
+@@ -142,7 +142,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:mimeType", mime);
+ g_free (mime);
+
+@@ -154,7 +154,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:description", zpj_skydrive_entry_get_description (entry));
+
+ if (*error != NULL)
+@@ -163,7 +163,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nfo:fileName", name);
+
+ if (*error != NULL)
+@@ -180,7 +180,7 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nco:creator", contact_resource);
+ g_free (contact_resource);
+
+@@ -192,6 +192,6 @@ account_miner_job_process_entry (GomAccountMinerJob *job,
+ gom_tracker_sparql_connection_insert_or_replace_triple
+ (connection,
+ cancellable, error,
+- datasource_urn, resource,
++ TRACKER_PICTURES_GRAPH, resource,
+ "nie:contentCreated", date);
+ g_free (date);
+
+diff --git a/src/gom-miner.c b/src/gom-miner.c
+index 40b111d..f9e4be0 100644
+--- a/src/gom-miner.c
++++ b/src/gom-miner.c
+@@ -381,7 +381,6 @@ gom_miner_ensure_datasource (GomMiner *self,
+
+ tracker_sparql_connection_update (self->priv->connection,
+ datasource_insert->str,
+- G_PRIORITY_DEFAULT,
+ cancellable,
+ error);
+
+@@ -468,7 +467,6 @@ gom_account_miner_job_cleanup_previous (GomAccountMinerJob *job,
+
+ tracker_sparql_connection_update (job->connection,
+ delete->str,
+- G_PRIORITY_DEFAULT,
+ cancellable,
+ error);
+
+@@ -708,7 +706,6 @@ cleanup_job_do_cleanup (CleanupJob *job, GCancellable *cancellable)
+
+ tracker_sparql_connection_update (self->priv->connection,
+ update->str,
+- G_PRIORITY_DEFAULT,
+ cancellable,
+ &error);
+ g_string_free (update, TRUE);
+
+diff --git a/src/gom-tracker.c b/src/gom-tracker.c
+index 469583e..716fc14 100644
+--- a/src/gom-tracker.c
++++ b/src/gom-tracker.c
+@@ -138,9 +138,7 @@ gom_tracker_sparql_connection_ensure_resource (TrackerSparqlConnection *connecti
+ /* not found, create the resource */
+ insert = g_strdup_printf ("INSERT INTO <%s> { _:res %s }",
+ graph, inner->str);
+- insert_res =
+- tracker_sparql_connection_update_blank (connection, insert,
+- G_PRIORITY_DEFAULT, NULL, error);
++ insert_res = tracker_sparql_connection_update_blank (connection, insert, NULL, error);
+ g_free (insert);
+
+ if (*error != NULL)
+@@ -205,9 +203,7 @@ gom_tracker_sparql_connection_insert_or_replace_triple (TrackerSparqlConnection
+
+ g_debug ("Insert or replace triple: query %s", insert->str);
+
+- tracker_sparql_connection_update (connection, insert->str,
+- G_PRIORITY_DEFAULT, cancellable,
+- error);
++ tracker_sparql_connection_update (connection, insert->str, cancellable, error);
+
+ g_string_free (insert, TRUE);
+
+@@ -235,9 +231,7 @@ gom_tracker_sparql_connection_set_triple (TrackerSparqlConnection *connection,
+ "DELETE { <%s> %s ?val } WHERE { <%s> %s ?val }", resource,
+ property_name, resource, property_name);
+
+- tracker_sparql_connection_update (connection, delete->str,
+- G_PRIORITY_DEFAULT, cancellable,
+- error);
++ tracker_sparql_connection_update (connection, delete->str, cancellable, error);
+
+ g_string_free (delete, TRUE);
+ if (*error != NULL)
+@@ -281,9 +275,7 @@ gom_tracker_sparql_connection_toggle_favorite (TrackerSparqlConnection *connecti
+
+ g_debug ("Toggle favorite: query %s", update->str);
+
+- tracker_sparql_connection_update (connection, update->str,
+- G_PRIORITY_DEFAULT, cancellable,
+- error);
++ tracker_sparql_connection_update (connection, update->str, cancellable, error);
+
+ g_string_free (update, TRUE);
+
+@@ -351,9 +343,7 @@ gom_tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection,
+ mail_uri, email,
+ mail_uri, fullname);
+
+- insert_res =
+- tracker_sparql_connection_update_blank (connection, insert->str,
+- G_PRIORITY_DEFAULT, cancellable, error);
++ insert_res = tracker_sparql_connection_update_blank (connection, insert->str, cancellable, error);
+
+ g_string_free (insert, TRUE);
+
+@@ -452,7 +442,7 @@ gom_tracker_utils_ensure_equipment_resource (TrackerSparqlConnection *connection
+ model);
+
+ local_error = NULL;
+- tracker_sparql_connection_update (connection, insert, G_PRIORITY_DEFAULT, cancellable, &local_error);
++ tracker_sparql_connection_update (connection, insert, cancellable, &local_error);
+ if (local_error != NULL)
+ {
+ g_propagate_error (error, local_error);
diff --git a/gnu/packages/patches/gnome-screenshot-meson-0.60.patch b/gnu/packages/patches/gnome-screenshot-meson-0.60.patch
new file mode 100644
index 0000000000..c80ce9d6a3
--- /dev/null
+++ b/gnu/packages/patches/gnome-screenshot-meson-0.60.patch
@@ -0,0 +1,39 @@
+Fixes build issue with Meson 0.60.0. Taken from upstream
+https://gitlab.gnome.org/GNOME/gnome-screenshot/-/merge_requests/57
+
+From b60dad3c2536c17bd201f74ad8e40eb74385ed9f Mon Sep 17 00:00:00 2001
+From: Jack Hill <jackhill@jackhill.us>
+Date: Thu, 18 Nov 2021 00:46:58 -0500
+Subject: [PATCH] meson: remove extraneous positional argument
+
+* data/meson.build (desktop_file)
+ (metainfo_file): Remove extraneous positional argument.
+
+Closes #186
+---
+ data/meson.build | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/data/meson.build b/data/meson.build
+index fd570b3..4e2e2e8 100644
+--- a/data/meson.build
++++ b/data/meson.build
+@@ -1,7 +1,6 @@
+ gnome = import('gnome')
+
+ desktop_file = i18n.merge_file(
+- 'desktop',
+ type: 'desktop',
+ input: 'org.gnome.Screenshot.desktop.in',
+ output: 'org.gnome.Screenshot.desktop',
+@@ -23,7 +22,6 @@ if desktop_file_validate.found()
+ endif
+
+ metainfo_file = i18n.merge_file(
+- 'appdata',
+ input: 'org.gnome.Screenshot.metainfo.xml.in',
+ output: 'org.gnome.Screenshot.metainfo.xml',
+ po_dir: join_paths(meson.current_source_dir(), '../po'),
+--
+2.33.1
+
diff --git a/gnu/packages/patches/gnome-session-support-elogind.patch b/gnu/packages/patches/gnome-session-support-elogind.patch
new file mode 100644
index 0000000000..b52b4c6855
--- /dev/null
+++ b/gnu/packages/patches/gnome-session-support-elogind.patch
@@ -0,0 +1,73 @@
+This patch, borrowed from Gentoo, allows configuring gnome-sesssion with
+elogind support.
+
+https://gitweb.gentoo.org/repo/gentoo.git/plain/gnome-base/gnome-session/files/gnome-session-3.38.0-meson-Support-elogind.patch?id=5f7fe88af5f888aff58fa0c069c3fe07973c7cd2
+
+From 4454f2a63394b69fba2c900151165ad8b5742f31 Mon Sep 17 00:00:00 2001
+From: Mart Raudsepp <leio@gentoo.org>
+Date: Sun, 15 Mar 2020 14:34:39 +0200
+Subject: [PATCH] meson: Support elogind
+
+---
+ meson.build | 12 +++++++++---
+ meson_options.txt | 1 +
+ 2 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index ef5132c6..7f68aaae 100644
+--- a/meson.build
++++ b/meson.build
+@@ -124,8 +124,10 @@ enable_systemd = get_option('systemd')
+ enable_systemd_session = get_option('systemd_session') != 'disable'
+ use_systemd_session = get_option('systemd_session') == 'default'
+ enable_systemd_journal = get_option('systemd_journal')
++enable_elogind = get_option('elogind')
+ enable_consolekit = get_option('consolekit')
+-if enable_systemd or enable_consolekit
++assert(not (enable_systemd and enable_elogind), 'Can not support systemd and elogind at once')
++if enable_systemd or enable_elogind or enable_consolekit
+ session_bin_deps += dependency('gio-unix-2.0', version: glib_req_version)
+
+ # Check for systemd
+@@ -152,6 +154,10 @@ if enable_systemd or enable_consolekit
+ endif
+
+ session_tracking = 'systemd'
++ elif enable_elogind
++ libelogind_dep = dependency('libelogind', version: '>= 239.4')
++ session_bin_deps += libelogind_dep
++ session_tracking = 'elogind'
+ endif
+
+ # Check for ConsoleKit
+@@ -161,7 +167,7 @@ if enable_systemd or enable_consolekit
+
+ session_bin_deps += dbus_glib_dep
+
+- if enable_systemd
++ if enable_systemd or enable_elogind
+ session_tracking += ' (with fallback to ConsoleKit)'
+ else
+ session_tracking = 'ConsoleKit'
+@@ -171,7 +177,7 @@ endif
+ if enable_systemd_session
+ assert(enable_systemd, 'Systemd support must be enabled when using systemd session management')
+ endif
+-config_h.set('HAVE_SYSTEMD', enable_systemd)
++config_h.set('HAVE_SYSTEMD', enable_systemd or enable_elogind)
+ config_h.set('ENABLE_SYSTEMD_SESSION', enable_systemd_session)
+ config_h.set('ENABLE_SYSTEMD_JOURNAL', enable_systemd_journal)
+ config_h.set('HAVE_CONSOLEKIT', enable_consolekit)
+diff --git a/meson_options.txt b/meson_options.txt
+index 4c05dc6e..512d1528 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,4 +1,5 @@
+ option('deprecation_flags', type: 'boolean', value: false, description: 'use *_DISABLE_DEPRECATED flags')
++option('elogind', type: 'boolean', value: true, description: 'Use elogind')
+ option('session_selector', type: 'boolean', value: false, description: 'enable building a custom session selector dialog')
+ option('systemd', type: 'boolean', value: true, description: 'Use systemd')
+ option('systemd_session', type: 'combo', choices: ['disable', 'enable', 'default'], value: 'default', description: 'Whether to include systemd session support and use it by default')
+--
+2.26.2
+
diff --git a/gnu/packages/patches/gnome-shell-CVE-2020-17489.patch b/gnu/packages/patches/gnome-shell-CVE-2020-17489.patch
deleted file mode 100644
index 4b7748950e..0000000000
--- a/gnu/packages/patches/gnome-shell-CVE-2020-17489.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 05b7aec747282f62212b605249d518280ff80059 Mon Sep 17 00:00:00 2001
-From: Ray Strode <rstrode@redhat.com>
-Date: Mon, 27 Jul 2020 10:58:22 -0400
-Subject: [PATCH] loginDialog: Reset auth prompt on vt switch before fade in
-
-At the moment, if a user switches to the login screen vt,
-the login screen fades in whatever was on screen prior, and
-then does a reset.
-
-It makes more sense to reset first, so we fade in what the
-user is going to interact with instead of what they interacted
-with before.
-
-Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2997
----
- js/gdm/loginDialog.js | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
-diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
-index c3f90dc58..6b35ebb16 100644
---- a/js/gdm/loginDialog.js
-+++ b/js/gdm/loginDialog.js
-@@ -920,16 +920,15 @@ var LoginDialog = GObject.registerClass({
- if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
- return;
-
-+ if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
-+ this._authPrompt.reset();
-+
- this._bindOpacity();
- this.ease({
- opacity: 255,
- duration: _FADE_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-- onComplete: () => {
-- if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
-- this._authPrompt.reset();
-- this._unbindOpacity();
-- }
-+ onComplete: () => this._unbindOpacity(),
- });
- }
-
---
-2.30.1
-
diff --git a/gnu/packages/patches/gnome-shell-disable-test.patch b/gnu/packages/patches/gnome-shell-disable-test.patch
deleted file mode 100644
index b4c7e73cd7..0000000000
--- a/gnu/packages/patches/gnome-shell-disable-test.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-This test seems to require a D-Bus connection not available in the build
-environment.
-
-diff -ur /tmp/guix-build-gnome-shell-3.34.2.drv-0/gnome-shell-3.34.2/src/st/meson.build b/src/st/meson.build
---- /tmp/guix-build-gnome-shell-3.34.2.drv-0/gnome-shell-3.34.2/src/st/meson.build 1969-12-31 19:00:00.000000000 -0500
-+++ b/src/st/meson.build 2019-12-23 00:46:14.721198022 -0500
-@@ -132,18 +132,6 @@
- sources: st_enums[1]
- )
-
--test_theme = executable('test-theme',
-- sources: 'test-theme.c',
-- c_args: st_cflags,
-- dependencies: [mutter_dep, gtk_dep],
-- build_rpath: mutter_typelibdir,
-- link_with: libst
--)
--
--test('CSS styling support', test_theme,
-- workdir: meson.current_source_dir()
--)
--
- libst_gir = gnome.generate_gir(libst,
- sources: st_gir_sources,
- nsversion: '1.0',
diff --git a/gnu/packages/patches/gnome-shell-theme.patch b/gnu/packages/patches/gnome-shell-theme.patch
deleted file mode 100644
index 3fa0670c43..0000000000
--- a/gnu/packages/patches/gnome-shell-theme.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-Adjust GNOME-Shell so that it uses a Guix theme by default.
-
-Patch by Ludovic Courtès <ludo@gnu.org>.
-
-diff -ur a/data/gnome-shell-theme.gresource.xml b/data/gnome-shell-theme.gresource.xml
---- a/data/gnome-shell-theme.gresource.xml 2019-12-11 15:06:31.000000000 -0500
-+++ b/data/gnome-shell-theme.gresource.xml 2019-12-21 00:31:55.895866241 -0500
-@@ -19,6 +19,8 @@
- <file>no-events.svg</file>
- <file>no-notifications.svg</file>
- <file>noise-texture.png</file>
-+ <file>guix-background.png</file>
-+ <file>guix-logo.png</file>
- <file>pad-osd.css</file>
- <file alias="icons/pointer-double-click-symbolic.svg">pointer-double-click-symbolic.svg</file>
- <file alias="icons/pointer-drag-symbolic.svg">pointer-drag-symbolic.svg</file>
-diff -ur a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
---- a/data/theme/gnome-shell-sass/_common.scss 2019-12-11 15:06:31.000000000 -0500
-+++ b/data/theme/gnome-shell-sass/_common.scss 2019-12-21 00:33:49.495832135 -0500
-@@ -1994,7 +1994,16 @@
- }
- }
-
-- .login-dialog-logo-bin { padding: 24px 0px; }
-+ .login-dialog-logo-bin {
-+ /* Make it a bit narrower than .login-dialog-user-list. */
-+ width: 12em;
-+ height: 8em;
-+ background: url(resource:///org/gnome/shell/theme/guix-logo.png);
-+ background-color: transparent;
-+ background-repeat: no-repeat;
-+ background-size: contain;
-+ background-position: center; }
-+
- .login-dialog-banner { color: darken($osd_fg_color,10%); }
- .login-dialog-button-box { spacing: 5px; }
- .login-dialog-message-warning { color: $warning_color; }
-@@ -2143,9 +2152,10 @@
- }
-
- #lockDialogGroup {
-- background: lighten(#2e3436, 8%) url(resource:///org/gnome/shell/theme/noise-texture.png);
-- background-repeat: repeat;
--}
-+ background: lighten(#2e3436, 8%) url(resource:///org/gnome/shell/theme/guix-background.png);
-+ background-repeat: no-repeat;
-+ background-size: cover;
-+ background-position: center; }
-
- #screenShieldNotifications {
- StButton#vhandle, StButton#hhandle {
diff --git a/gnu/packages/patches/gnome-todo-delete-esource-duplicate.patch b/gnu/packages/patches/gnome-todo-delete-esource-duplicate.patch
deleted file mode 100644
index c680e86495..0000000000
--- a/gnu/packages/patches/gnome-todo-delete-esource-duplicate.patch
+++ /dev/null
@@ -1,10 +0,0 @@
-From: Emmanuele Bassi <ebassi@gnome.org>
-
-See also: https://gitlab.gnome.org/GNOME/gnome-todo/commit/6cdabc4dd0c6c804a093b94c269461ce376fed4f
---- gnome-todo-3.28.1/plugins/eds/gtd-eds-autoptr.h.orig 2020-05-06 14:20:49.589902539 +0200
-+++ gnome-todo-3.28.1/plugins/eds/gtd-eds-autoptr.h 2020-05-06 14:20:54.593919721 +0200
-@@ -25,4 +25,3 @@
- G_DEFINE_AUTOPTR_CLEANUP_FUNC (ECalComponent, g_object_unref);
- G_DEFINE_AUTOPTR_CLEANUP_FUNC (ECalComponentId, e_cal_component_free_id);
- G_DEFINE_AUTOPTR_CLEANUP_FUNC (ECalClient, g_object_unref);
--G_DEFINE_AUTOPTR_CLEANUP_FUNC (ESource, g_object_unref);
diff --git a/gnu/packages/patches/gnupg-1-build-with-gcc10.patch b/gnu/packages/patches/gnupg-1-build-with-gcc10.patch
new file mode 100644
index 0000000000..40b2aff98e
--- /dev/null
+++ b/gnu/packages/patches/gnupg-1-build-with-gcc10.patch
@@ -0,0 +1,64 @@
+Borrowed from Debian
+https://sources.debian.org/src/gnupg1/1.4.23-1.1/debian/patches/0006-fix-for-gcc10.patch/
+
+Subject: Fix build with gcc-10
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2021-01-04
+Bug: https://dev.gnupg.org/T5215
+Bug-Debian: https://bugs.debian.org/957293
+
+--- a/g10/options.h
++++ b/g10/options.h
+@@ -29,6 +29,8 @@
+ /* Norcraft can't cope with common symbols */
+ #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+ #define EXTERN_UNLESS_MAIN_MODULE extern
++#elif defined (__GNUC__) && __GNUC__ >= 10
++#define EXTERN_UNLESS_MAIN_MODULE __attribute__((__common__))
+ #else
+ #define EXTERN_UNLESS_MAIN_MODULE
+ #endif
+--- a/include/cipher.h
++++ b/include/cipher.h
+@@ -117,6 +117,8 @@
+ #ifndef EXTERN_UNLESS_MAIN_MODULE
+ #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+ #define EXTERN_UNLESS_MAIN_MODULE extern
++#elif defined (__GNUC__) && __GNUC__ >= 10
++#define EXTERN_UNLESS_MAIN_MODULE __attribute__((__common__))
+ #else
+ #define EXTERN_UNLESS_MAIN_MODULE
+ #endif
+--- a/include/iobuf.h
++++ b/include/iobuf.h
+@@ -72,6 +72,8 @@
+ #ifndef EXTERN_UNLESS_MAIN_MODULE
+ #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+ #define EXTERN_UNLESS_MAIN_MODULE extern
++#elif defined (__GNUC__) && __GNUC__ >= 10
++#define EXTERN_UNLESS_MAIN_MODULE __attribute__((__common__))
+ #else
+ #define EXTERN_UNLESS_MAIN_MODULE
+ #endif
+--- a/include/memory.h
++++ b/include/memory.h
+@@ -93,6 +93,8 @@
+ #ifndef EXTERN_UNLESS_MAIN_MODULE
+ #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+ #define EXTERN_UNLESS_MAIN_MODULE extern
++#elif defined (__GNUC__) && __GNUC__ >= 10
++#define EXTERN_UNLESS_MAIN_MODULE __attribute__((__common__))
+ #else
+ #define EXTERN_UNLESS_MAIN_MODULE
+ #endif
+--- a/include/mpi.h
++++ b/include/mpi.h
+@@ -38,6 +38,8 @@
+ #ifndef EXTERN_UNLESS_MAIN_MODULE
+ #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+ #define EXTERN_UNLESS_MAIN_MODULE extern
++#elif defined (__GNUC__) && __GNUC__ >= 10
++#define EXTERN_UNLESS_MAIN_MODULE __attribute__((__common__))
+ #else
+ #define EXTERN_UNLESS_MAIN_MODULE
+ #endif
diff --git a/gnu/packages/patches/gnutls-CVE-2021-20231.patch b/gnu/packages/patches/gnutls-CVE-2021-20231.patch
deleted file mode 100644
index 5186522eee..0000000000
--- a/gnu/packages/patches/gnutls-CVE-2021-20231.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 15beb4b193b2714d88107e7dffca781798684e7e Mon Sep 17 00:00:00 2001
-From: Daiki Ueno <ueno@gnu.org>
-Date: Fri, 29 Jan 2021 14:06:05 +0100
-Subject: [PATCH 1/2] key_share: avoid use-after-free around realloc
-
-Signed-off-by: Daiki Ueno <ueno@gnu.org>
----
- lib/ext/key_share.c | 12 +++++-------
- 1 file changed, 5 insertions(+), 7 deletions(-)
-
-diff --git a/lib/ext/key_share.c b/lib/ext/key_share.c
-index ab8abf8fe..a8c4bb5cf 100644
---- a/lib/ext/key_share.c
-+++ b/lib/ext/key_share.c
-@@ -664,14 +664,14 @@ key_share_send_params(gnutls_session_t session,
- {
- unsigned i;
- int ret;
-- unsigned char *lengthp;
-- unsigned int cur_length;
- unsigned int generated = 0;
- const gnutls_group_entry_st *group;
- const version_entry_st *ver;
-
- /* this extension is only being sent on client side */
- if (session->security_parameters.entity == GNUTLS_CLIENT) {
-+ unsigned int length_pos;
-+
- ver = _gnutls_version_max(session);
- if (unlikely(ver == NULL || ver->key_shares == 0))
- return 0;
-@@ -679,16 +679,13 @@ key_share_send_params(gnutls_session_t session,
- if (!have_creds_for_tls13(session))
- return 0;
-
-- /* write the total length later */
-- lengthp = &extdata->data[extdata->length];
-+ length_pos = extdata->length;
-
- ret =
- _gnutls_buffer_append_prefix(extdata, 16, 0);
- if (ret < 0)
- return gnutls_assert_val(ret);
-
-- cur_length = extdata->length;
--
- if (session->internals.hsk_flags & HSK_HRR_RECEIVED) { /* we know the group */
- group = get_group(session);
- if (unlikely(group == NULL))
-@@ -736,7 +733,8 @@ key_share_send_params(gnutls_session_t session,
- }
-
- /* copy actual length */
-- _gnutls_write_uint16(extdata->length - cur_length, lengthp);
-+ _gnutls_write_uint16(extdata->length - length_pos - 2,
-+ &extdata->data[length_pos]);
-
- } else { /* server */
- ver = get_version(session);
---
-2.30.2
-
diff --git a/gnu/packages/patches/gnutls-CVE-2021-20232.patch b/gnu/packages/patches/gnutls-CVE-2021-20232.patch
deleted file mode 100644
index dc3a0be690..0000000000
--- a/gnu/packages/patches/gnutls-CVE-2021-20232.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 75a937d97f4fefc6f9b08e3791f151445f551cb3 Mon Sep 17 00:00:00 2001
-From: Daiki Ueno <ueno@gnu.org>
-Date: Fri, 29 Jan 2021 14:06:23 +0100
-Subject: [PATCH 2/2] pre_shared_key: avoid use-after-free around realloc
-
-Signed-off-by: Daiki Ueno <ueno@gnu.org>
----
- lib/ext/pre_shared_key.c | 15 ++++++++++++---
- 1 file changed, 12 insertions(+), 3 deletions(-)
-
-diff --git a/lib/ext/pre_shared_key.c b/lib/ext/pre_shared_key.c
-index a042c6488..380bf39ed 100644
---- a/lib/ext/pre_shared_key.c
-+++ b/lib/ext/pre_shared_key.c
-@@ -267,7 +267,7 @@ client_send_params(gnutls_session_t session,
- size_t spos;
- gnutls_datum_t username = {NULL, 0};
- gnutls_datum_t user_key = {NULL, 0}, rkey = {NULL, 0};
-- gnutls_datum_t client_hello;
-+ unsigned client_hello_len;
- unsigned next_idx;
- const mac_entry_st *prf_res = NULL;
- const mac_entry_st *prf_psk = NULL;
-@@ -428,8 +428,7 @@ client_send_params(gnutls_session_t session,
- assert(extdata->length >= sizeof(mbuffer_st));
- assert(ext_offset >= (ssize_t)sizeof(mbuffer_st));
- ext_offset -= sizeof(mbuffer_st);
-- client_hello.data = extdata->data+sizeof(mbuffer_st);
-- client_hello.size = extdata->length-sizeof(mbuffer_st);
-+ client_hello_len = extdata->length-sizeof(mbuffer_st);
-
- next_idx = 0;
-
-@@ -440,6 +439,11 @@ client_send_params(gnutls_session_t session,
- }
-
- if (prf_res && rkey.size > 0) {
-+ gnutls_datum_t client_hello;
-+
-+ client_hello.data = extdata->data+sizeof(mbuffer_st);
-+ client_hello.size = client_hello_len;
-+
- ret = compute_psk_binder(session, prf_res,
- binders_len, binders_pos,
- ext_offset, &rkey, &client_hello, 1,
-@@ -474,6 +478,11 @@ client_send_params(gnutls_session_t session,
- }
-
- if (prf_psk && user_key.size > 0 && info) {
-+ gnutls_datum_t client_hello;
-+
-+ client_hello.data = extdata->data+sizeof(mbuffer_st);
-+ client_hello.size = client_hello_len;
-+
- ret = compute_psk_binder(session, prf_psk,
- binders_len, binders_pos,
- ext_offset, &user_key, &client_hello, 0,
---
-2.30.2
-
diff --git a/gnu/packages/patches/gnutls-guile-eintr-eagain.patch b/gnu/packages/patches/gnutls-guile-eintr-eagain.patch
new file mode 100644
index 0000000000..e04c945158
--- /dev/null
+++ b/gnu/packages/patches/gnutls-guile-eintr-eagain.patch
@@ -0,0 +1,56 @@
+Fixes <https://issues.guix.gnu.org/47867>.
+
+This fix was merged upstream
+in <https://gitlab.com/gnutls/gnutls/-/merge_requests/1417> and will
+be in GnuTLS 3.7.3. Upstream commit:
+
+commit 110e2172dbef1fbdf7399dab1e80780847b61c0c
+Author: Ludovic Courtès <ludo@gnu.org>
+Date: Sat Apr 24 22:02:14 2021 +0200
+
+ guile: Writes to record ports handle EAGAIN/EINTR transparently.
+
+diff --git a/guile/src/core.c b/guile/src/core.c
+index a13670fc7b..0926dc8a97 100644
+--- a/guile/src/core.c
++++ b/guile/src/core.c
+@@ -985,7 +985,10 @@ write_to_session_record_port (SCM port, const void *data, size_t size)
+ c_result = gnutls_record_send (c_session, (char *) data + c_sent,
+ size - c_sent);
+ if (EXPECT_FALSE (c_result < 0))
+- scm_gnutls_error (c_result, FUNC_NAME);
++ {
++ if (c_result != GNUTLS_E_AGAIN && c_result != GNUTLS_E_INTERRUPTED)
++ scm_gnutls_error (c_result, FUNC_NAME);
++ }
+ else
+ c_sent += c_result;
+ }
+@@ -1069,7 +1072,8 @@ read_from_session_record_port (SCM port, SCM dst, size_t start, size_t count)
+ #undef FUNC_NAME
+
+ /* Return the file descriptor that backs PORT. This function is called upon a
+- blocking read--i.e., 'read_from_session_record_port' returned -1. */
++ blocking read--i.e., 'read_from_session_record_port' or
++ 'write_to_session_record_port' returned -1. */
+ static int
+ session_record_port_fd (SCM port)
+ {
+@@ -1097,7 +1101,16 @@ write_to_session_record_port (SCM port, SCM src, size_t start, size_t count)
+ c_session = scm_to_gnutls_session (session, 1, FUNC_NAME);
+ data = (char *) SCM_BYTEVECTOR_CONTENTS (src) + start;
+
+- result = gnutls_record_send (c_session, data, count);
++ do
++ result = gnutls_record_send (c_session, data, count);
++ while (result == GNUTLS_E_INTERRUPTED
++ || (result == GNUTLS_E_AGAIN
++ && !SCM_GNUTLS_SESSION_TRANSPORT_IS_FD (c_session)));
++
++ if (result == GNUTLS_E_AGAIN
++ && SCM_GNUTLS_SESSION_TRANSPORT_IS_FD (c_session))
++ /* Tell Guile that reading would block. */
++ return (size_t) -1;
+
+ if (EXPECT_FALSE (result < 0))
+ scm_gnutls_error (result, FUNC_NAME);
diff --git a/gnu/packages/patches/graphviz-CVE-2020-18032.patch b/gnu/packages/patches/graphviz-CVE-2020-18032.patch
deleted file mode 100644
index 4cf94a9a36..0000000000
--- a/gnu/packages/patches/graphviz-CVE-2020-18032.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Fix CVE-2020-18032:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=2020-18032
-https://gitlab.com/graphviz/graphviz/-/issues/1700
-
-Patch copied from upstream source repository:
-
-https://gitlab.com/graphviz/graphviz/-/commit/784411ca3655c80da0f6025ab20634b2a6ff696b
-
-From 784411ca3655c80da0f6025ab20634b2a6ff696b Mon Sep 17 00:00:00 2001
-From: Matthew Fernandez <matthew.fernandez@gmail.com>
-Date: Sat, 25 Jul 2020 19:31:01 -0700
-Subject: [PATCH] fix: out-of-bounds write on invalid label
-
-When the label for a node cannot be parsed (due to it being malformed), it falls
-back on the symbol name of the node itself. I.e. the default label the node
-would have had if it had no label attribute at all. However, this is applied by
-dynamically altering the node's label to "\N", a shortcut for the symbol name of
-the node. All of this is fine, however if the hand written label itself is
-shorter than the literal string "\N", not enough memory would have been
-allocated to write "\N" into the label text.
-
-Here we account for the possibility of error during label parsing, and assume
-that the label text may need to be overwritten with "\N" after the fact. Fixes
-issue #1700.
----
- lib/common/shapes.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/lib/common/shapes.c b/lib/common/shapes.c
-index 0a0635fc3..9dca9ba6e 100644
---- a/lib/common/shapes.c
-+++ b/lib/common/shapes.c
-@@ -3546,9 +3546,10 @@ static void record_init(node_t * n)
- reclblp = ND_label(n)->text;
- len = strlen(reclblp);
- /* For some forgotten reason, an empty label is parsed into a space, so
-- * we need at least two bytes in textbuf.
-+ * we need at least two bytes in textbuf, as well as accounting for the
-+ * error path involving "\\N" below.
- */
-- len = MAX(len, 1);
-+ len = MAX(MAX(len, 1), (int)strlen("\\N"));
- textbuf = N_NEW(len + 1, char);
- if (!(info = parse_reclbl(n, flip, TRUE, textbuf))) {
- agerr(AGERR, "bad label format %s\n", ND_label(n)->text);
---
-2.31.1
-
diff --git a/gnu/packages/patches/gst-libav-64channels-stack-corruption.patch b/gnu/packages/patches/gst-libav-64channels-stack-corruption.patch
deleted file mode 100644
index cc174e618d..0000000000
--- a/gnu/packages/patches/gst-libav-64channels-stack-corruption.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Fix a stack corruption when handling files with more than 64 audio
-channels:
-
-https://gstreamer.freedesktop.org/security/sa-2021-0005.html
-
-Patch copied from upstream source repository:
-
-https://gitlab.freedesktop.org/gstreamer/gst-libav/-/commit/dcea8baa14a5fc3b796d876baaf2f238546ba2b1
-
-diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c
-index b5be4bb7a5f2712f78383da9319754a8849e3307..be22f22cf5c7c7b22b13e44b10999adaacbcca2b 100644
---- a/ext/libav/gstavcodecmap.c
-+++ b/ext/libav/gstavcodecmap.c
-@@ -102,7 +102,7 @@ gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
- guint nchannels = 0;
- gboolean none_layout = FALSE;
-
-- if (channel_layout == 0) {
-+ if (channel_layout == 0 || channels > 64) {
- nchannels = channels;
- none_layout = TRUE;
- } else {
-@@ -163,7 +163,7 @@ gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
- } else {
- guint i;
-
-- for (i = 0; i < nchannels; i++)
-+ for (i = 0; i < nchannels && i < 64; i++)
- pos[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
- }
- }
diff --git a/gnu/packages/patches/gst-plugins-bad-fix-overflow.patch b/gnu/packages/patches/gst-plugins-bad-fix-overflow.patch
deleted file mode 100644
index 95ab13db51..0000000000
--- a/gnu/packages/patches/gst-plugins-bad-fix-overflow.patch
+++ /dev/null
@@ -1,263 +0,0 @@
-Fix an overflow when calculating something for AVC/HEVC videos:
-
-https://security-tracker.debian.org/tracker/TEMP-0000000-C6AAE1
-
-Patch copied from upstream source repository:
-
-https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/commit/0cfbf7ad91c7f121192c8ce135769f8eb276c41d
-From 0cfbf7ad91c7f121192c8ce135769f8eb276c41d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
-Date: Tue, 23 Mar 2021 19:19:14 +0200
-Subject: [PATCH] h2645parser: Catch overflows in AVC/HEVC NAL unit length
- calculations
-
-Offset and size are stored as 32 bit guint and might overflow when
-adding the nal_length_size, so let's avoid that.
-
-For the size this would happen if the AVC/HEVC NAL unit size happens to
-be stored in 4 bytes and is 4294967292 or higher, which is likely
-corrupted data anyway.
-
-For the offset this is something for the caller of these functions to
-take care of but is unlikely to happen as it would require parsing on a
->4GB buffer.
-
-Allowing these overflows causes all kinds of follow-up bugs in the
-h2645parse elements, ranging from infinite loops and memory leaks to
-potential memory corruptions.
-
-Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2107>
----
- gst-libs/gst/codecparsers/gsth264parser.c | 16 +++++-
- gst-libs/gst/codecparsers/gsth265parser.c | 16 +++++-
- tests/check/libs/h264parser.c | 60 +++++++++++++++++++++++
- tests/check/libs/h265parser.c | 60 +++++++++++++++++++++++
- 4 files changed, 150 insertions(+), 2 deletions(-)
-
-diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c
-index 012f1d0d7..68aa25068 100644
---- a/gst-libs/gst/codecparsers/gsth264parser.c
-+++ b/gst-libs/gst/codecparsers/gsth264parser.c
-@@ -1556,6 +1556,14 @@ gst_h264_parser_identify_nalu_avc (GstH264NalParser * nalparser,
-
- memset (nalu, 0, sizeof (*nalu));
-
-+ /* Would overflow guint below otherwise: the callers needs to ensure that
-+ * this never happens */
-+ if (offset > G_MAXUINT32 - nal_length_size) {
-+ GST_WARNING ("offset + nal_length_size overflow");
-+ nalu->size = 0;
-+ return GST_H264_PARSER_BROKEN_DATA;
-+ }
-+
- if (size < offset + nal_length_size) {
- GST_DEBUG ("Can't parse, buffer has too small size %" G_GSIZE_FORMAT
- ", offset %u", size, offset);
-@@ -1570,7 +1578,13 @@ gst_h264_parser_identify_nalu_avc (GstH264NalParser * nalparser,
- nalu->sc_offset = offset;
- nalu->offset = offset + nal_length_size;
-
-- if (size < nalu->size + nal_length_size) {
-+ if (nalu->size > G_MAXUINT32 - nal_length_size) {
-+ GST_WARNING ("NALU size + nal_length_size overflow");
-+ nalu->size = 0;
-+ return GST_H264_PARSER_BROKEN_DATA;
-+ }
-+
-+ if (size < (gsize) nalu->size + nal_length_size) {
- nalu->size = 0;
-
- return GST_H264_PARSER_NO_NAL_END;
-diff --git a/gst-libs/gst/codecparsers/gsth265parser.c b/gst-libs/gst/codecparsers/gsth265parser.c
-index 26e68b276..dc7f27aa9 100644
---- a/gst-libs/gst/codecparsers/gsth265parser.c
-+++ b/gst-libs/gst/codecparsers/gsth265parser.c
-@@ -1531,6 +1531,14 @@ gst_h265_parser_identify_nalu_hevc (GstH265Parser * parser,
-
- memset (nalu, 0, sizeof (*nalu));
-
-+ /* Would overflow guint below otherwise: the callers needs to ensure that
-+ * this never happens */
-+ if (offset > G_MAXUINT32 - nal_length_size) {
-+ GST_WARNING ("offset + nal_length_size overflow");
-+ nalu->size = 0;
-+ return GST_H265_PARSER_BROKEN_DATA;
-+ }
-+
- if (size < offset + nal_length_size) {
- GST_DEBUG ("Can't parse, buffer has too small size %" G_GSIZE_FORMAT
- ", offset %u", size, offset);
-@@ -1545,7 +1553,13 @@ gst_h265_parser_identify_nalu_hevc (GstH265Parser * parser,
- nalu->sc_offset = offset;
- nalu->offset = offset + nal_length_size;
-
-- if (size < nalu->size + nal_length_size) {
-+ if (nalu->size > G_MAXUINT32 - nal_length_size) {
-+ GST_WARNING ("NALU size + nal_length_size overflow");
-+ nalu->size = 0;
-+ return GST_H265_PARSER_BROKEN_DATA;
-+ }
-+
-+ if (size < (gsize) nalu->size + nal_length_size) {
- nalu->size = 0;
-
- return GST_H265_PARSER_NO_NAL_END;
-diff --git a/tests/check/libs/h264parser.c b/tests/check/libs/h264parser.c
-index c7c46d9a2..d322dd8db 100644
---- a/tests/check/libs/h264parser.c
-+++ b/tests/check/libs/h264parser.c
-@@ -229,6 +229,65 @@ GST_START_TEST (test_h264_parse_slice_5bytes)
-
- GST_END_TEST;
-
-+GST_START_TEST (test_h264_parse_identify_nalu_avc)
-+{
-+ GstH264ParserResult res;
-+ GstH264NalUnit nalu;
-+ GstH264NalParser *const parser = gst_h264_nal_parser_new ();
-+ /* Skip 3 bytes for the start code */
-+ const gsize nal_size = sizeof (slice_dpa) - 3;
-+ const gsize buf_size = 4 + nal_size;
-+ guint8 *buf = g_new (guint8, buf_size);
-+
-+ memcpy (buf + 4, slice_dpa + 3, nal_size);
-+
-+ GST_WRITE_UINT16_BE (buf + 2, nal_size);
-+ res = gst_h264_parser_identify_nalu_avc (parser, buf, 2, buf_size, 2, &nalu);
-+
-+ assert_equals_int (res, GST_H264_PARSER_OK);
-+ assert_equals_int (nalu.type, GST_H264_NAL_SLICE_DPA);
-+ assert_equals_int (nalu.offset, 4);
-+ assert_equals_int (nalu.size, nal_size);
-+
-+ GST_WRITE_UINT32_BE (buf, nal_size);
-+ res = gst_h264_parser_identify_nalu_avc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H264_PARSER_OK);
-+ assert_equals_int (nalu.type, GST_H264_NAL_SLICE_DPA);
-+ assert_equals_int (nalu.offset, 4);
-+ assert_equals_int (nalu.size, nal_size);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32);
-+ res = gst_h264_parser_identify_nalu_avc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H264_PARSER_BROKEN_DATA);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 2);
-+ res = gst_h264_parser_identify_nalu_avc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H264_PARSER_BROKEN_DATA);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 3);
-+ res = gst_h264_parser_identify_nalu_avc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H264_PARSER_BROKEN_DATA);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 4);
-+ res = gst_h264_parser_identify_nalu_avc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H264_PARSER_NO_NAL_END);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 6);
-+ res = gst_h264_parser_identify_nalu_avc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H264_PARSER_NO_NAL_END);
-+
-+ g_free (buf);
-+ gst_h264_nal_parser_free (parser);
-+}
-+
-+GST_END_TEST;
-+
- static guint8 nalu_sps_with_vui[] = {
- 0x00, 0x00, 0x00, 0x01, 0x67, 0x64, 0x00, 0x28,
- 0xac, 0xd9, 0x40, 0x78, 0x04, 0x4f, 0xde, 0x03,
-@@ -666,6 +725,7 @@ h264parser_suite (void)
- tcase_add_test (tc_chain, test_h264_parse_slice_dpa);
- tcase_add_test (tc_chain, test_h264_parse_slice_eoseq_slice);
- tcase_add_test (tc_chain, test_h264_parse_slice_5bytes);
-+ tcase_add_test (tc_chain, test_h264_parse_identify_nalu_avc);
- tcase_add_test (tc_chain, test_h264_parse_invalid_sei);
- tcase_add_test (tc_chain, test_h264_create_sei);
-
-diff --git a/tests/check/libs/h265parser.c b/tests/check/libs/h265parser.c
-index 0a0e4db97..5b6a215ec 100644
---- a/tests/check/libs/h265parser.c
-+++ b/tests/check/libs/h265parser.c
-@@ -255,6 +255,65 @@ GST_START_TEST (test_h265_parse_slice_6bytes)
-
- GST_END_TEST;
-
-+GST_START_TEST (test_h265_parse_identify_nalu_hevc)
-+{
-+ GstH265ParserResult res;
-+ GstH265NalUnit nalu;
-+ GstH265Parser *parser = gst_h265_parser_new ();
-+ /* Skip 4 bytes for the start code */
-+ const gsize nal_size = sizeof (slice_eos_slice_eob) - 4;
-+ const gsize buf_size = 4 + nal_size;
-+ guint8 *buf = g_new (guint8, buf_size);
-+
-+ memcpy (buf + 4, slice_eos_slice_eob + 4, nal_size);
-+
-+ GST_WRITE_UINT16_BE (buf + 2, nal_size);
-+ res = gst_h265_parser_identify_nalu_hevc (parser, buf, 2, buf_size, 2, &nalu);
-+
-+ assert_equals_int (res, GST_H265_PARSER_OK);
-+ assert_equals_int (nalu.type, GST_H265_NAL_SLICE_IDR_W_RADL);
-+ assert_equals_int (nalu.offset, 4);
-+ assert_equals_int (nalu.size, nal_size);
-+
-+ GST_WRITE_UINT32_BE (buf, nal_size);
-+ res = gst_h265_parser_identify_nalu_hevc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H265_PARSER_OK);
-+ assert_equals_int (nalu.type, GST_H265_NAL_SLICE_IDR_W_RADL);
-+ assert_equals_int (nalu.offset, 4);
-+ assert_equals_int (nalu.size, nal_size);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32);
-+ res = gst_h265_parser_identify_nalu_hevc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H265_PARSER_BROKEN_DATA);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 2);
-+ res = gst_h265_parser_identify_nalu_hevc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H265_PARSER_BROKEN_DATA);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 3);
-+ res = gst_h265_parser_identify_nalu_hevc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H265_PARSER_BROKEN_DATA);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 4);
-+ res = gst_h265_parser_identify_nalu_hevc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H265_PARSER_NO_NAL_END);
-+
-+ GST_WRITE_UINT32_BE (buf, G_MAXUINT32 - 6);
-+ res = gst_h265_parser_identify_nalu_hevc (parser, buf, 0, buf_size, 4, &nalu);
-+
-+ assert_equals_int (res, GST_H265_PARSER_NO_NAL_END);
-+
-+ g_free (buf);
-+ gst_h265_parser_free (parser);
-+}
-+
-+GST_END_TEST;
-+
- GST_START_TEST (test_h265_base_profiles)
- {
- GstH265ProfileTierLevel ptl;
-@@ -1101,6 +1160,7 @@ h265parser_suite (void)
- tcase_add_test (tc_chain, test_h265_parse_slice_eos_slice_eob);
- tcase_add_test (tc_chain, test_h265_parse_pic_timing);
- tcase_add_test (tc_chain, test_h265_parse_slice_6bytes);
-+ tcase_add_test (tc_chain, test_h265_parse_identify_nalu_hevc);
- tcase_add_test (tc_chain, test_h265_base_profiles);
- tcase_add_test (tc_chain, test_h265_base_profiles_compat);
- tcase_add_test (tc_chain, test_h265_format_range_profiles_exact_match);
---
-2.31.1
-
diff --git a/gnu/packages/patches/gst-plugins-base-fix-id3v2-invalid-read.patch b/gnu/packages/patches/gst-plugins-base-fix-id3v2-invalid-read.patch
deleted file mode 100644
index b2dfef0118..0000000000
--- a/gnu/packages/patches/gst-plugins-base-fix-id3v2-invalid-read.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Fix an "invalid read during ID3v2 tag parsing".
-
-https://security-tracker.debian.org/tracker/TEMP-0000000-57E7C1
-https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/876
-
-Patch copied from upstream source repository:
-
-https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/commit/f4a1428a6997658625d529b9db60fde812fbf1ee
-
-From f4a1428a6997658625d529b9db60fde812fbf1ee Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
-Date: Wed, 3 Mar 2021 01:08:25 +0000
-Subject: [PATCH] tag: id3v2: fix frame size check and potential invalid reads
-
-Check the right variable when checking if there's
-enough data left to read the frame size.
-
-Closes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/876
-
-Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1065>
----
- gst-libs/gst/tag/id3v2frames.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gst-libs/gst/tag/id3v2frames.c b/gst-libs/gst/tag/id3v2frames.c
-index 8e9f78254..f39659bf7 100644
---- a/gst-libs/gst/tag/id3v2frames.c
-+++ b/gst-libs/gst/tag/id3v2frames.c
-@@ -109,7 +109,7 @@ id3v2_parse_frame (ID3TagsWorking * work)
-
- if (work->frame_flags & (ID3V2_FRAME_FORMAT_COMPRESSION |
- ID3V2_FRAME_FORMAT_DATA_LENGTH_INDICATOR)) {
-- if (work->hdr.frame_data_size <= 4)
-+ if (frame_data_size <= 4)
- return FALSE;
- if (ID3V2_VER_MAJOR (work->hdr.version) == 3) {
- work->parse_size = GST_READ_UINT32_BE (frame_data);
---
-2.31.1
-
diff --git a/gnu/packages/patches/gst-plugins-good-CVE-2021-3497.patch b/gnu/packages/patches/gst-plugins-good-CVE-2021-3497.patch
deleted file mode 100644
index c8c3ee6cf1..0000000000
--- a/gnu/packages/patches/gst-plugins-good-CVE-2021-3497.patch
+++ /dev/null
@@ -1,174 +0,0 @@
-Fix CVE-2021-3497:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3497
-https://gstreamer.freedesktop.org/security/sa-2021-0002.html
-
-Patch copied from upstream source repository:
-
-https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/commit/9181191511f9c0be6a89c98b311f49d66bd46dc3?merge_request_iid=903
-
-diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
-index 467815986c8c3d86fd8906a0d539b34f67d6693e..0e47ee7b5e25ac3331f30439710ae755235f2a22 100644
---- a/gst/matroska/matroska-demux.c
-+++ b/gst/matroska/matroska-demux.c
-@@ -3851,6 +3851,12 @@ gst_matroska_demux_add_wvpk_header (GstElement * element,
- guint32 block_samples, tmp;
- gsize size = gst_buffer_get_size (*buf);
-
-+ if (size < 4) {
-+ GST_ERROR_OBJECT (element, "Too small wavpack buffer");
-+ gst_buffer_unmap (*buf, &map);
-+ return GST_FLOW_ERROR;
-+ }
-+
- gst_buffer_extract (*buf, 0, &tmp, sizeof (guint32));
- block_samples = GUINT32_FROM_LE (tmp);
- /* we need to reconstruct the header of the wavpack block */
-@@ -3858,10 +3864,10 @@ gst_matroska_demux_add_wvpk_header (GstElement * element,
- /* -20 because ck_size is the size of the wavpack block -8
- * and lace_size is the size of the wavpack block + 12
- * (the three guint32 of the header that already are in the buffer) */
-- wvh.ck_size = size + sizeof (Wavpack4Header) - 20;
-+ wvh.ck_size = size + WAVPACK4_HEADER_SIZE - 20;
-
- /* block_samples, flags and crc are already in the buffer */
-- newbuf = gst_buffer_new_allocate (NULL, sizeof (Wavpack4Header) - 12, NULL);
-+ newbuf = gst_buffer_new_allocate (NULL, WAVPACK4_HEADER_SIZE - 12, NULL);
-
- gst_buffer_map (newbuf, &outmap, GST_MAP_WRITE);
- data = outmap.data;
-@@ -3886,9 +3892,11 @@ gst_matroska_demux_add_wvpk_header (GstElement * element,
- audiocontext->wvpk_block_index += block_samples;
- } else {
- guint8 *outdata = NULL;
-- guint outpos = 0;
-- gsize buf_size, size, out_size = 0;
-+ gsize buf_size, size;
- guint32 block_samples, flags, crc, blocksize;
-+ GstAdapter *adapter;
-+
-+ adapter = gst_adapter_new ();
-
- gst_buffer_map (*buf, &map, GST_MAP_READ);
- buf_data = map.data;
-@@ -3897,6 +3905,7 @@ gst_matroska_demux_add_wvpk_header (GstElement * element,
- if (buf_size < 4) {
- GST_ERROR_OBJECT (element, "Too small wavpack buffer");
- gst_buffer_unmap (*buf, &map);
-+ g_object_unref (adapter);
- return GST_FLOW_ERROR;
- }
-
-@@ -3918,59 +3927,57 @@ gst_matroska_demux_add_wvpk_header (GstElement * element,
- data += 4;
- size -= 4;
-
-- if (blocksize == 0 || size < blocksize)
-- break;
--
-- g_assert ((newbuf == NULL) == (outdata == NULL));
-+ if (blocksize == 0 || size < blocksize) {
-+ GST_ERROR_OBJECT (element, "Too small wavpack buffer");
-+ gst_buffer_unmap (*buf, &map);
-+ g_object_unref (adapter);
-+ return GST_FLOW_ERROR;
-+ }
-
-- if (newbuf == NULL) {
-- out_size = sizeof (Wavpack4Header) + blocksize;
-- newbuf = gst_buffer_new_allocate (NULL, out_size, NULL);
-+ g_assert (newbuf == NULL);
-
-- gst_buffer_copy_into (newbuf, *buf,
-- GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS, 0, -1);
-+ newbuf =
-+ gst_buffer_new_allocate (NULL, WAVPACK4_HEADER_SIZE + blocksize,
-+ NULL);
-+ gst_buffer_map (newbuf, &outmap, GST_MAP_WRITE);
-+ outdata = outmap.data;
-+
-+ outdata[0] = 'w';
-+ outdata[1] = 'v';
-+ outdata[2] = 'p';
-+ outdata[3] = 'k';
-+ outdata += 4;
-+
-+ GST_WRITE_UINT32_LE (outdata, blocksize + WAVPACK4_HEADER_SIZE - 8);
-+ GST_WRITE_UINT16_LE (outdata + 4, wvh.version);
-+ GST_WRITE_UINT8 (outdata + 6, wvh.track_no);
-+ GST_WRITE_UINT8 (outdata + 7, wvh.index_no);
-+ GST_WRITE_UINT32_LE (outdata + 8, wvh.total_samples);
-+ GST_WRITE_UINT32_LE (outdata + 12, wvh.block_index);
-+ GST_WRITE_UINT32_LE (outdata + 16, block_samples);
-+ GST_WRITE_UINT32_LE (outdata + 20, flags);
-+ GST_WRITE_UINT32_LE (outdata + 24, crc);
-+ outdata += 28;
-+
-+ memcpy (outdata, data, blocksize);
-
-- outpos = 0;
-- gst_buffer_map (newbuf, &outmap, GST_MAP_WRITE);
-- outdata = outmap.data;
-- } else {
-- gst_buffer_unmap (newbuf, &outmap);
-- out_size += sizeof (Wavpack4Header) + blocksize;
-- gst_buffer_set_size (newbuf, out_size);
-- gst_buffer_map (newbuf, &outmap, GST_MAP_WRITE);
-- outdata = outmap.data;
-- }
-+ gst_buffer_unmap (newbuf, &outmap);
-+ gst_adapter_push (adapter, newbuf);
-+ newbuf = NULL;
-
-- outdata[outpos] = 'w';
-- outdata[outpos + 1] = 'v';
-- outdata[outpos + 2] = 'p';
-- outdata[outpos + 3] = 'k';
-- outpos += 4;
--
-- GST_WRITE_UINT32_LE (outdata + outpos,
-- blocksize + sizeof (Wavpack4Header) - 8);
-- GST_WRITE_UINT16_LE (outdata + outpos + 4, wvh.version);
-- GST_WRITE_UINT8 (outdata + outpos + 6, wvh.track_no);
-- GST_WRITE_UINT8 (outdata + outpos + 7, wvh.index_no);
-- GST_WRITE_UINT32_LE (outdata + outpos + 8, wvh.total_samples);
-- GST_WRITE_UINT32_LE (outdata + outpos + 12, wvh.block_index);
-- GST_WRITE_UINT32_LE (outdata + outpos + 16, block_samples);
-- GST_WRITE_UINT32_LE (outdata + outpos + 20, flags);
-- GST_WRITE_UINT32_LE (outdata + outpos + 24, crc);
-- outpos += 28;
--
-- memmove (outdata + outpos, data, blocksize);
-- outpos += blocksize;
- data += blocksize;
- size -= blocksize;
- }
- gst_buffer_unmap (*buf, &map);
-- gst_buffer_unref (*buf);
-
-- if (newbuf)
-- gst_buffer_unmap (newbuf, &outmap);
-+ newbuf = gst_adapter_take_buffer (adapter, gst_adapter_available (adapter));
-+ g_object_unref (adapter);
-
-+ gst_buffer_copy_into (newbuf, *buf,
-+ GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS, 0, -1);
-+ gst_buffer_unref (*buf);
- *buf = newbuf;
-+
- audiocontext->wvpk_block_index += block_samples;
- }
-
-diff --git a/gst/matroska/matroska-ids.h b/gst/matroska/matroska-ids.h
-index 429213f778063ba0063944ab64ad60373bbce5ee..8d4a685a910ec13100a3c3d156b2412d28ec0522 100644
---- a/gst/matroska/matroska-ids.h
-+++ b/gst/matroska/matroska-ids.h
-@@ -688,6 +688,8 @@ typedef struct _Wavpack4Header {
- guint32 crc; /* crc for actual decoded data */
- } Wavpack4Header;
-
-+#define WAVPACK4_HEADER_SIZE (32)
-+
- typedef enum {
- GST_MATROSKA_TRACK_ENCODING_SCOPE_FRAME = (1<<0),
- GST_MATROSKA_TRACK_ENCODING_SCOPE_CODEC_DATA = (1<<1),
diff --git a/gnu/packages/patches/gst-plugins-good-CVE-2021-3498.patch b/gnu/packages/patches/gst-plugins-good-CVE-2021-3498.patch
deleted file mode 100644
index 50eb42f126..0000000000
--- a/gnu/packages/patches/gst-plugins-good-CVE-2021-3498.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Fix CVE-2021-3498:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3498
-https://gstreamer.freedesktop.org/security/sa-2021-0003.html
-
-Patch copied from upstream source repository:
-
-https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/commit/02174790726dd20a5c73ce2002189bf240ad4fe0?merge_request_iid=903
-
-diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
-index 4d0234743b8cf243b4521e56ef9027ba23b1b5d0..467815986c8c3d86fd8906a0d539b34f67d6693e 100644
---- a/gst/matroska/matroska-demux.c
-+++ b/gst/matroska/matroska-demux.c
-@@ -692,6 +692,8 @@ gst_matroska_demux_parse_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml,
-
- DEBUG_ELEMENT_START (demux, ebml, "TrackEntry");
-
-+ *dest_context = NULL;
-+
- /* start with the master */
- if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
- DEBUG_ELEMENT_STOP (demux, ebml, "TrackEntry", ret);
diff --git a/gnu/packages/patches/gst-plugins-ugly-fix-out-of-bound-reads.patch b/gnu/packages/patches/gst-plugins-ugly-fix-out-of-bound-reads.patch
deleted file mode 100644
index 3c6a96f45d..0000000000
--- a/gnu/packages/patches/gst-plugins-ugly-fix-out-of-bound-reads.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-Fix out of bounds reads when parsing audio and video packets:
-
-https://security-tracker.debian.org/tracker/TEMP-0000000-4DAA44
-https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/issues/37
-
-Patch copied from upstream source repository:
-
-https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/commit/3aba7d1e625554b2407bc77b3d09b4928b937d5f
-From 3aba7d1e625554b2407bc77b3d09b4928b937d5f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
-Date: Wed, 3 Mar 2021 11:05:14 +0200
-Subject: [PATCH] rmdemux: Make sure we have enough data available when parsing
- audio/video packets
-
-Otherwise there will be out-of-bounds reads and potential crashes.
-
-Thanks to Natalie Silvanovich for reporting.
-
-Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/issues/37
-
-Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/merge_requests/74>
----
- gst/realmedia/rmdemux.c | 35 +++++++++++++++++++++++++++++++++++
- 1 file changed, 35 insertions(+)
-
-diff --git a/gst/realmedia/rmdemux.c b/gst/realmedia/rmdemux.c
-index 6cc659a1..68b0736b 100644
---- a/gst/realmedia/rmdemux.c
-+++ b/gst/realmedia/rmdemux.c
-@@ -2223,6 +2223,9 @@ gst_rmdemux_parse_video_packet (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
-
- gst_buffer_map (in, &map, GST_MAP_READ);
-
-+ if (map.size < offset)
-+ goto not_enough_data;
-+
- data = map.data + offset;
- size = map.size - offset;
-
-@@ -2289,6 +2292,9 @@ gst_rmdemux_parse_video_packet (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
- }
- GST_DEBUG_OBJECT (rmdemux, "fragment size %d", fragment_size);
-
-+ if (map.size < (data - map.data) + fragment_size)
-+ goto not_enough_data;
-+
- /* get the fragment */
- fragment =
- gst_buffer_copy_region (in, GST_BUFFER_COPY_ALL, data - map.data,
-@@ -2437,6 +2443,9 @@ gst_rmdemux_parse_audio_packet (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
- GstFlowReturn ret;
- GstBuffer *buffer;
-
-+ if (gst_buffer_get_size (in) < offset)
-+ goto not_enough_data;
-+
- buffer = gst_buffer_copy_region (in, GST_BUFFER_COPY_MEMORY, offset, -1);
-
- if (rmdemux->first_ts != -1 && timestamp > rmdemux->first_ts)
-@@ -2467,9 +2476,19 @@ gst_rmdemux_parse_audio_packet (GstRMDemux * rmdemux, GstRMDemuxStream * stream,
- ret = gst_pad_push (stream->pad, buffer);
- }
-
-+done:
- gst_buffer_unref (in);
-
- return ret;
-+
-+ /* ERRORS */
-+not_enough_data:
-+ {
-+ GST_ELEMENT_WARNING (rmdemux, STREAM, DECODE, ("Skipping bad packet."),
-+ (NULL));
-+ ret = GST_FLOW_OK;
-+ goto done;
-+ }
- }
-
- static GstFlowReturn
-@@ -2490,6 +2509,9 @@ gst_rmdemux_parse_packet (GstRMDemux * rmdemux, GstBuffer * in, guint16 version)
- data = map.data;
- size = map.size;
-
-+ if (size < 4 + 6 + 1 + 2)
-+ goto not_enough_data;
-+
- /* stream number */
- id = RMDEMUX_GUINT16_GET (data);
-
-@@ -2525,6 +2547,9 @@ gst_rmdemux_parse_packet (GstRMDemux * rmdemux, GstBuffer * in, guint16 version)
-
- /* version 1 has an extra byte */
- if (version == 1) {
-+ if (size < 1)
-+ goto not_enough_data;
-+
- data += 1;
- size -= 1;
- }
-@@ -2596,6 +2621,16 @@ unknown_stream:
- gst_buffer_unref (in);
- return GST_FLOW_OK;
- }
-+
-+ /* ERRORS */
-+not_enough_data:
-+ {
-+ GST_ELEMENT_WARNING (rmdemux, STREAM, DECODE, ("Skipping bad packet."),
-+ (NULL));
-+ gst_buffer_unmap (in, &map);
-+ gst_buffer_unref (in);
-+ return GST_FLOW_OK;
-+ }
- }
-
- gboolean
---
-2.31.1
-
diff --git a/gnu/packages/patches/gtk-doc-respect-xml-catalog.patch b/gnu/packages/patches/gtk-doc-respect-xml-catalog.patch
new file mode 100644
index 0000000000..710f208285
--- /dev/null
+++ b/gnu/packages/patches/gtk-doc-respect-xml-catalog.patch
@@ -0,0 +1,16 @@
+Taken from here:
+https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/documentation/gtk-doc/respect-xml-catalog-files-var.patch.
+
+--- a/m4/gtkdoc_jh_check_xml_catalog.m4
++++ b/m4/gtkdoc_jh_check_xml_catalog.m4
+@@ -5,8 +5,8 @@
+ [
+ AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl
+ AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
+- if $jh_found_xmlcatalog && \
+- AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
++ # empty argument forces libxml to use XML_CATALOG_FILES variable
++ if AC_RUN_LOG([$XMLCATALOG --noout "" "$1" >&2]); then
+ AC_MSG_RESULT([found])
+ ifelse([$3],,,[$3])
+ else
diff --git a/gnu/packages/patches/gtk2-fix-builder-test.patch b/gnu/packages/patches/gtk2-fix-builder-test.patch
new file mode 100644
index 0000000000..8c41e596fe
--- /dev/null
+++ b/gnu/packages/patches/gtk2-fix-builder-test.patch
@@ -0,0 +1,94 @@
+From e45e11238036e06c8fe78bea1691b256ca41837b Mon Sep 17 00:00:00 2001
+From: Steve Langasek <steve.langasek@ubuntu.com>
+Date: Tue, 7 Jan 2014 13:55:28 +0100
+Subject: [PATCH] fix prototypes of signal callbacks in the test suite
+
+The signal callbacks are defined to take pointers as their arguments, but the
+callbacks found in testsuite/gtk/builder.c are passing a GParamSpec by value
+as the second argument. This confuses and angers the compiler on ppc64el,
+resulting in segfaults after return from the function due to stack-smashing
+by the (completely-unused) argument.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=721700
+---
+
+This is a backport to v2.24.33 of upstream commit:
+
+https://gitlab.gnome.org/GNOME/gtk/-/commit/256561db2f0b34e01047f8882b3e0cb8c6d9dbab
+
+ gtk/tests/builder.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c
+index 8529dacc2f6e..23d5096062fa 100644
+--- a/gtk/tests/builder.c
++++ b/gtk/tests/builder.c
+@@ -132,7 +132,7 @@ static int object = 0;
+ static int object_after = 0;
+
+ void /* exported for GtkBuilder */
+-signal_normal (GtkWindow *window, GParamSpec spec)
++signal_normal (GtkWindow *window, GParamSpec *spec)
+ {
+ g_assert (GTK_IS_WINDOW (window));
+ g_assert (normal == 0);
+@@ -142,7 +142,7 @@ signal_normal (GtkWindow *window, GParamSpec spec)
+ }
+
+ void /* exported for GtkBuilder */
+-signal_after (GtkWindow *window, GParamSpec spec)
++signal_after (GtkWindow *window, GParamSpec *spec)
+ {
+ g_assert (GTK_IS_WINDOW (window));
+ g_assert (normal == 1);
+@@ -152,7 +152,7 @@ signal_after (GtkWindow *window, GParamSpec spec)
+ }
+
+ void /* exported for GtkBuilder */
+-signal_object (GtkButton *button, GParamSpec spec)
++signal_object (GtkButton *button, GParamSpec *spec)
+ {
+ g_assert (GTK_IS_BUTTON (button));
+ g_assert (object == 0);
+@@ -162,7 +162,7 @@ signal_object (GtkButton *button, GParamSpec spec)
+ }
+
+ void /* exported for GtkBuilder */
+-signal_object_after (GtkButton *button, GParamSpec spec)
++signal_object_after (GtkButton *button, GParamSpec *spec)
+ {
+ g_assert (GTK_IS_BUTTON (button));
+ g_assert (object == 1);
+@@ -172,28 +172,28 @@ signal_object_after (GtkButton *button, GParamSpec spec)
+ }
+
+ void /* exported for GtkBuilder */
+-signal_first (GtkButton *button, GParamSpec spec)
++signal_first (GtkButton *button, GParamSpec *spec)
+ {
+ g_assert (normal == 0);
+ normal = 10;
+ }
+
+ void /* exported for GtkBuilder */
+-signal_second (GtkButton *button, GParamSpec spec)
++signal_second (GtkButton *button, GParamSpec *spec)
+ {
+ g_assert (normal == 10);
+ normal = 20;
+ }
+
+ void /* exported for GtkBuilder */
+-signal_extra (GtkButton *button, GParamSpec spec)
++signal_extra (GtkButton *button, GParamSpec *spec)
+ {
+ g_assert (normal == 20);
+ normal = 30;
+ }
+
+ void /* exported for GtkBuilder */
+-signal_extra2 (GtkButton *button, GParamSpec spec)
++signal_extra2 (GtkButton *button, GParamSpec *spec)
+ {
+ g_assert (normal == 30);
+ normal = 40;
diff --git a/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch b/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
new file mode 100644
index 0000000000..4a60023bf7
--- /dev/null
+++ b/gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch
@@ -0,0 +1,51 @@
+From 889294a93fc6464c2c2919bc47f6fd85ec823363 Mon Sep 17 00:00:00 2001
+From: Raghav Gururajan <rg@raghavgururajan.name>
+Date: Tue, 18 May 2021 19:57:00 -0400
+Subject: [PATCH] [PATCH]: Honor GUIX_GTK4_PATH.
+
+This patch makes GTK look for additional modules in a list of directories
+specified by the environment variable "GUIX_GTK4_PATH". This can be used
+instead of "GTK_PATH" to make GTK find modules that are incompatible with
+other major versions of GTK.
+---
+ gtk/gtkmodules.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
+index aace5dcbc9..193b6a02e9 100644
+--- a/gtk/gtkmodules.c
++++ b/gtk/gtkmodules.c
+@@ -105,6 +105,7 @@ static char **
+ get_module_path (void)
+ {
+ const char *module_path_env;
++ const gchar *module_guix_gtk4_path_env;
+ const char *exe_prefix;
+ char *module_path;
+ char *default_dir;
+@@ -114,6 +115,7 @@ get_module_path (void)
+ return result;
+
+ module_path_env = g_getenv ("GTK_PATH");
++ module_guix_gtk4_path_env = g_getenv ("GUIX_GTK4_PATH");
+ exe_prefix = g_getenv ("GTK_EXE_PREFIX");
+
+ if (exe_prefix)
+@@ -121,7 +123,13 @@ get_module_path (void)
+ else
+ default_dir = g_build_filename (_gtk_get_libdir (), "gtk-4.0", NULL);
+
+- if (module_path_env)
++ if (module_guix_gtk4_path_env && module_path_env)
++ module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
++ module_guix_gtk4_path_env, module_path_env, default_dir, NULL);
++ else if (module_guix_gtk4_path_env)
++ module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
++ module_guix_gtk4_path_env, default_dir, NULL);
++ else if (module_path_env)
+ module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
+ module_path_env, default_dir, NULL);
+ else
+--
+2.31.1
+
diff --git a/gnu/packages/patches/guile-email-fix-tests.patch b/gnu/packages/patches/guile-email-fix-tests.patch
new file mode 100644
index 0000000000..8621aaea02
--- /dev/null
+++ b/gnu/packages/patches/guile-email-fix-tests.patch
@@ -0,0 +1,35 @@
+This patch has been proposed upstream:
+https://lists.systemreboot.net/guile-email/87mtnv1r2p.fsf@gnu.org/T/#u.
+
+From c21fe0f0e28b80b606973d3e372e2bc8528c9766 Mon Sep 17 00:00:00 2001
+From: Mathieu Othacehe <othacehe@gnu.org>
+Date: Wed, 29 Sep 2021 12:47:35 +0000
+Subject: [PATCH 1/1] email: Do not use an empty bytevector to test the
+ charset.
+
+Using an empty bytevector no longer throws an exception since this Guile
+commit: 5ea8c69e9153a970952bf6f0b32c4fad6a28e839.
+
+* email/email.scm (post-process-content-transfer-encoding): Use a bytevector
+containg the 'e' character to test the charset validity.
+---
+ email/email.scm | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/email/email.scm b/email/email.scm
+index 3f4e194..ac70463 100644
+--- a/email/email.scm
++++ b/email/email.scm
+@@ -832,7 +832,8 @@ values. The returned headers is a string and body is a bytevector."
+ (define (valid-charset? charset)
+ (catch #t
+ (lambda ()
+- (bytevector->string (make-bytevector 0 0) charset)
++ ;; Try to convert a bytevector containg the 'e' character.
++ (bytevector->string (make-bytevector 1 48) charset)
+ #t)
+ (const #f)))
+
+--
+2.33.0
+
diff --git a/gnu/packages/patches/guile-git-adjust-for-libgit2-1.2.0.patch b/gnu/packages/patches/guile-git-adjust-for-libgit2-1.2.0.patch
new file mode 100644
index 0000000000..436a11ad19
--- /dev/null
+++ b/gnu/packages/patches/guile-git-adjust-for-libgit2-1.2.0.patch
@@ -0,0 +1,78 @@
+diff --git a/configure.ac b/configure.ac
+index 107e6ca..20e9019 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2,6 +2,7 @@ dnl Guile-Git --- GNU Guile bindings of libgit2
+ dnl Copyright © 2016-2018 Erik Edrosa <erik.edrosa@gmail.com>
+ dnl Copyright © 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+ dnl Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
++dnl Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+ dnl
+ dnl This file is part of Guile-Git.
+ dnl
+@@ -43,15 +44,20 @@ AS_IF([test "x$LIBGIT2_LIBDIR" = "x"], [
+ ])
+ AC_SUBST([LIBGIT2_LIBDIR])
+
++dnl Does the 'git_remote_callbacks' struct have a 'remote_ready' field?
++dnl It was added in 1.2.0, obsoleting 'resolve_url'.
++AC_CHECK_MEMBER([git_remote_callbacks.remote_ready],
++ [HAVE_REMOTE_CALLBACKS_REMOTE_READY="#true"],
++ [HAVE_REMOTE_CALLBACKS_REMOTE_READY="#false"],
++ [[#include <git2.h>]])
++AC_SUBST([HAVE_REMOTE_CALLBACKS_REMOTE_READY])
++
+ dnl Does the 'git_remote_callbacks' struct have a 'resolve_url' field?
+ dnl It's missing in libgit2 0.28.5, added in 1.0.
+-AC_CHECK_MEMBER([git_remote_callbacks.resolve_url], [], [],
++AC_CHECK_MEMBER([git_remote_callbacks.resolve_url],
++ [HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#true"],
++ [HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#false"],
+ [[#include <git2.h>]])
+-if test "x$ac_cv_member_git_remote_callbacks_resolve_url" = "xyes"; then
+- HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#true"
+-else
+- HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#false"
+-fi
+ AC_SUBST([HAVE_REMOTE_CALLBACKS_RESOLVE_URL])
+
+ dnl Those binaries are required for ssh authentication tests.
+diff --git a/git/configuration.scm.in b/git/configuration.scm.in
+index c45f698..64c4360 100644
+--- a/git/configuration.scm.in
++++ b/git/configuration.scm.in
+@@ -19,11 +19,17 @@
+
+ (define-module (git configuration)
+ #:export (%libgit2
++ %have-remote-callbacks-remote-ready?
+ %have-remote-callbacks-resolve-url?))
+
+ (define %libgit2
+ "@LIBGIT2_LIBDIR@/libgit2")
+
++(define %have-remote-callbacks-remote-ready?
++ ;; True if the 'git_remote_callbacks' struct has a
++ ;; 'remote_ready' field.
++ @HAVE_REMOTE_CALLBACKS_REMOTE_READY@)
++
+ (define %have-remote-callbacks-resolve-url?
+ ;; True if the 'git_remote_callbacks' struct has a 'resolve_url' field.
+ @HAVE_REMOTE_CALLBACKS_RESOLVE_URL@)
+diff --git a/git/structs.scm b/git/structs.scm
+index ca51728..be3d050 100644
+--- a/git/structs.scm
++++ b/git/structs.scm
+@@ -637,6 +637,12 @@ type to 'specified for this to take effect."
+ (push-update-reference ,(bs:pointer uint8))
+ (push-negotiation ,(bs:pointer uint8))
+ (transport ,(bs:pointer uint8))
++
++ ;; Added in libgit2 1.2.0.
++ ,@(if %have-remote-callbacks-remote-ready?
++ `((remote-ready ,(bs:pointer uint8)))
++ '())
++
+ (payload ,(bs:pointer uint8))
+
+ ;; libgit2 1.0 added this field, which is missing from 0.28.5,
diff --git a/gnu/packages/patches/guile-ssh-fix-test-suite.patch b/gnu/packages/patches/guile-ssh-fix-test-suite.patch
new file mode 100644
index 0000000000..dc10e08b0f
--- /dev/null
+++ b/gnu/packages/patches/guile-ssh-fix-test-suite.patch
@@ -0,0 +1,217 @@
+From f7942cded8b65341916a555186e2219efe174cd0 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Thu, 4 Feb 2021 14:38:25 -0500
+Subject: [PATCH] tests: Fix test suite for Guile 3.0.5.
+
+The test-runner object is now reset to #f when calling the 'test-end'
+procedure. See the commit de5d1a7f99b8e952b115237ebc29633062f99bb9 in
+Guile (srfi-64: Reset test-runner-current if done) which introduced this
+change.
+
+* tests/client-server.scm (exit-status): New variable. Use it when calling
+exit.
+* tests/dist.scm: Likewise.
+* tests/key.scm: Likewise.
+* tests/log.scm: Likewise.
+* tests/popen.scm: Likewise.
+* tests/server-client.scm: Likewise.
+* tests/server.scm: Likewise.
+* tests/session.scm: Likewise.
+* tests/shell.scm: Likewise.
+* tests/sssh-ssshd.scm: Likewise.
+* tests/tunnel.scm: Likewise.
+---
+ tests/client-server.scm | 4 +++-
+ tests/dist.scm | 4 +++-
+ tests/key.scm | 3 ++-
+ tests/log.scm | 5 ++++-
+ tests/popen.scm | 4 +++-
+ tests/server-client.scm | 4 +++-
+ tests/server.scm | 4 +++-
+ tests/session.scm | 4 +++-
+ tests/shell.scm | 3 ++-
+ tests/sssh-ssshd.scm | 4 +++-
+ tests/tunnel.scm | 4 +++-
+ 11 files changed, 32 insertions(+), 11 deletions(-)
+
+diff --git a/tests/client-server.scm b/tests/client-server.scm
+index 432a48c..fc46140 100644
+--- a/tests/client-server.scm
++++ b/tests/client-server.scm
+@@ -743,8 +743,10 @@
+
+ ;;;
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "client-server")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; client-server.scm ends here.
+diff --git a/tests/dist.scm b/tests/dist.scm
+index 2a3a75f..79f9e23 100644
+--- a/tests/dist.scm
++++ b/tests/dist.scm
+@@ -269,8 +269,10 @@ $4 = #<session #<undefined>@#<undefined>:22 (disconnected) 453fff>"
+ ;;;
+
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "dist")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; dist.scm ends here.
+diff --git a/tests/key.scm b/tests/key.scm
+index be31378..e1678f4 100644
+--- a/tests/key.scm
++++ b/tests/key.scm
+@@ -170,9 +170,10 @@
+ (eq? (get-key-type key) 'ecdsa-p256)))))))
+
+ ;;;
++(define exit-status (test-runner-fail-count (test-runner-current)))
+
+ (test-end "key")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; key.scm ends here.
+diff --git a/tests/log.scm b/tests/log.scm
+index f547202..d528251 100644
+--- a/tests/log.scm
++++ b/tests/log.scm
+@@ -64,8 +64,11 @@
+ (get-log-verbosity))
+
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "log")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
++
+
+ ;;; log.scm ends here
+diff --git a/tests/popen.scm b/tests/popen.scm
+index e063e0b..fe77108 100644
+--- a/tests/popen.scm
++++ b/tests/popen.scm
+@@ -129,8 +129,10 @@
+ (format-log/scm 'nolog "open-remote-output-pipe" "channel: ~A" channel)
+ (output-only? channel)))))))
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "popen")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; popen.scm ends here.
+diff --git a/tests/server-client.scm b/tests/server-client.scm
+index 920aa22..b6ed3eb 100644
+--- a/tests/server-client.scm
++++ b/tests/server-client.scm
+@@ -148,8 +148,10 @@
+ (equal? x session))))))
+
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "server-client")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; server-client.scm ends here.
+diff --git a/tests/server.scm b/tests/server.scm
+index c7f8b6c..1a6daea 100644
+--- a/tests/server.scm
++++ b/tests/server.scm
+@@ -157,9 +157,11 @@
+ (server-listen server)
+ #t))
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "server")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; server.scm ends here.
+
+diff --git a/tests/session.scm b/tests/session.scm
+index 8caa039..7310647 100644
+--- a/tests/session.scm
++++ b/tests/session.scm
+@@ -210,8 +210,10 @@
+ (let ((session (%make-session)))
+ (not (connected? session))))
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "session")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; session.scm ends here.
+diff --git a/tests/shell.scm b/tests/shell.scm
+index 7d613fb..e36e661 100644
+--- a/tests/shell.scm
++++ b/tests/shell.scm
+@@ -113,9 +113,10 @@
+
+
+ ;;;
++(define exit-status (test-runner-fail-count (test-runner-current)))
+
+ (test-end "shell")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; shell.scm ends here.
+diff --git a/tests/sssh-ssshd.scm b/tests/sssh-ssshd.scm
+index 2fe23db..edb53fc 100644
+--- a/tests/sssh-ssshd.scm
++++ b/tests/sssh-ssshd.scm
+@@ -118,8 +118,10 @@
+ result)))
+
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "sssh-ssshd")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; sssh-ssshd.scm ends here.
+diff --git a/tests/tunnel.scm b/tests/tunnel.scm
+index ef5a568..d6453b7 100644
+--- a/tests/tunnel.scm
++++ b/tests/tunnel.scm
+@@ -191,8 +191,10 @@
+ (= pnum portnum)))
+ (eq? (channel-cancel-forward session "localhost" portnum) 'ok))))))))
+
++(define exit-status (test-runner-fail-count (test-runner-current)))
++
+ (test-end "tunnel")
+
+-(exit (= (test-runner-fail-count (test-runner-current)) 0))
++(exit (= 0 exit-status))
+
+ ;;; tunnel.scm ends here.
+--
+2.30.0
+
diff --git a/gnu/packages/patches/guile-ssh-read-error.patch b/gnu/packages/patches/guile-ssh-read-error.patch
new file mode 100644
index 0000000000..9cc6b048a0
--- /dev/null
+++ b/gnu/packages/patches/guile-ssh-read-error.patch
@@ -0,0 +1,18 @@
+This patch adjusts to slightly different 'read-error' in Guile 3.0.6
+compared to earlier versions:
+
+ https://github.com/artyom-poptsov/guile-ssh/issues/28
+
+--- a/tests/dist.scm
++++ b/tests/dist.scm
+@@ -183,8 +183,8 @@ Unbound variable: e"
+ rrepl-get-result))
+
+ (test-error-with-log/= "rrepl-get-result, unknown # object error"
+- 'node-repl-error "Reader error: scm_lreadr: #<unknown port>:1:3: \
+-Unknown # object: (#\\<): scheme@(guile-user)> \
++ 'node-repl-error "Reader error: #f: #<unknown port>:1:3: \
++Unknown # object: (\"#<\"): scheme@(guile-user)> \
+ $4 = #<session #<undefined>@#<undefined>:22 (disconnected) 453fff>"
+ (call-with-input-string
+ (string-append "scheme@(guile-user)> $4 = "
diff --git a/gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch b/gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch
deleted file mode 100644
index 250eef2c8b..0000000000
--- a/gnu/packages/patches/gvfs-add-support-for-libplist-2.2.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Source: https://gitlab.gnome.org/GNOME/gvfs/-/commit/13551f3f40d41f1357126ac5a26d0fa012cd8123
-
-Note: This change should be incorporated into stable version 1.46.x of gvfs.
-
-From 13551f3f40d41f1357126ac5a26d0fa012cd8123 Mon Sep 17 00:00:00 2001
-From: Bastien Nocera <hadess@hadess.net>
-Date: Tue, 16 Jun 2020 13:28:35 +0200
-Subject: [PATCH] afc: Add support for libplist-2.2
-
-Which changed name from libplist to libplist-2.0 to embed its API
-version number in the library name.
----
- meson.build | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/meson.build b/meson.build
-index 1750f65ca..187bfd55f 100644
---- a/meson.build
-+++ b/meson.build
-@@ -357,7 +357,10 @@ config_h.set('HAVE_LOGIND', enable_logind)
- enable_afc = get_option('afc')
- if enable_afc
- libimobiledevice_dep = dependency('libimobiledevice-1.0', version: '>= 1.2')
-- libplist_dep = dependency('libplist', version: '>= 0.15')
-+ libplist_dep = dependency('libplist-2.0', required: false)
-+ if not libplist_dep.found()
-+ libplist_dep = dependency('libplist', version: '>= 0.15')
-+ endif
- endif
-
- # *** Check if we should build with GOA volume monitor ***
---
-GitLab
-
diff --git a/gnu/packages/patches/helm-fix-gcc-9-build.patch b/gnu/packages/patches/helm-fix-gcc-9-build.patch
new file mode 100644
index 0000000000..f623fef203
--- /dev/null
+++ b/gnu/packages/patches/helm-fix-gcc-9-build.patch
@@ -0,0 +1,140 @@
+From cb611a80bd5a36d31bfc31212ebbf79aa86c6f08 Mon Sep 17 00:00:00 2001
+From: jikstra <jikstra@disroot.org>
+Date: Tue, 20 Aug 2019 03:00:51 +0200
+Subject: [PATCH] Backport
+ https://github.com/WeAreROLI/JUCE/commit/4e0adb2af8b424c43d22bd431011c9a6c57d36b6
+ to the bundled JUCE framework to make helm compile on gcc 9.1 again
+
+---
+ .../juce_graphics/colour/juce_PixelFormats.h | 25 +---------
+ .../native/juce_RenderingHelpers.h | 48 +------------------
+ 2 files changed, 4 insertions(+), 69 deletions(-)
+
+diff --git a/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h b/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h
+index 9be9ba09c..3535eab80 100644
+--- a/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h
++++ b/JUCE/modules/juce_graphics/colour/juce_PixelFormats.h
+@@ -105,23 +105,9 @@ class JUCE_API PixelARGB
+
+ //==============================================================================
+ forcedinline uint8 getAlpha() const noexcept { return components.a; }
+- forcedinline uint8 getRed() const noexcept { return components.r; }
++ forcedinline uint8 getRed() const noexcept { return components.r; }
+ forcedinline uint8 getGreen() const noexcept { return components.g; }
+- forcedinline uint8 getBlue() const noexcept { return components.b; }
+-
+- #if JUCE_GCC
+- // NB these are here as a workaround because GCC refuses to bind to packed values.
+- forcedinline uint8& getAlpha() noexcept { return comps [indexA]; }
+- forcedinline uint8& getRed() noexcept { return comps [indexR]; }
+- forcedinline uint8& getGreen() noexcept { return comps [indexG]; }
+- forcedinline uint8& getBlue() noexcept { return comps [indexB]; }
+- #else
+- forcedinline uint8& getAlpha() noexcept { return components.a; }
+- forcedinline uint8& getRed() noexcept { return components.r; }
+- forcedinline uint8& getGreen() noexcept { return components.g; }
+- forcedinline uint8& getBlue() noexcept { return components.b; }
+- #endif
+-
++ forcedinline uint8 getBlue() const noexcept { return components.b; }
+ //==============================================================================
+ /** Copies another pixel colour over this one.
+
+@@ -340,9 +326,6 @@ class JUCE_API PixelARGB
+ {
+ uint32 internal;
+ Components components;
+- #if JUCE_GCC
+- uint8 comps[4]; // helper struct needed because gcc does not allow references to packed union members
+- #endif
+ };
+ }
+ #ifndef DOXYGEN
+@@ -429,10 +412,6 @@ class JUCE_API PixelRGB
+ forcedinline uint8 getGreen() const noexcept { return g; }
+ forcedinline uint8 getBlue() const noexcept { return b; }
+
+- forcedinline uint8& getRed() noexcept { return r; }
+- forcedinline uint8& getGreen() noexcept { return g; }
+- forcedinline uint8& getBlue() noexcept { return b; }
+-
+ //==============================================================================
+ /** Copies another pixel colour over this one.
+
+diff --git a/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h b/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h
+index 1c4cd31ef..29519cb5a 100644
+--- a/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h
++++ b/JUCE/modules/juce_graphics/native/juce_RenderingHelpers.h
+@@ -581,18 +581,10 @@ namespace EdgeTableFillers
+ : destData (image), sourceColour (colour)
+ {
+ if (sizeof (PixelType) == 3 && destData.pixelStride == sizeof (PixelType))
+- {
+ areRGBComponentsEqual = sourceColour.getRed() == sourceColour.getGreen()
+ && sourceColour.getGreen() == sourceColour.getBlue();
+- filler[0].set (sourceColour);
+- filler[1].set (sourceColour);
+- filler[2].set (sourceColour);
+- filler[3].set (sourceColour);
+- }
+ else
+- {
+ areRGBComponentsEqual = false;
+- }
+ }
+
+ forcedinline void setEdgeTableYPos (const int y) noexcept
+@@ -643,7 +635,6 @@ namespace EdgeTableFillers
+ const Image::BitmapData& destData;
+ PixelType* linePixels;
+ PixelARGB sourceColour;
+- PixelRGB filler [4];
+ bool areRGBComponentsEqual;
+
+ forcedinline PixelType* getPixel (const int x) const noexcept
+@@ -658,43 +649,8 @@ namespace EdgeTableFillers
+
+ forcedinline void replaceLine (PixelRGB* dest, const PixelARGB colour, int width) const noexcept
+ {
+- if (destData.pixelStride == sizeof (*dest))
+- {
+- if (areRGBComponentsEqual) // if all the component values are the same, we can cheat..
+- {
+- memset (dest, colour.getRed(), (size_t) width * 3);
+- }
+- else
+- {
+- if (width >> 5)
+- {
+- const int* const intFiller = reinterpret_cast<const int*> (filler);
+-
+- while (width > 8 && (((pointer_sized_int) dest) & 7) != 0)
+- {
+- dest->set (colour);
+- ++dest;
+- --width;
+- }
+-
+- while (width > 4)
+- {
+- int* d = reinterpret_cast<int*> (dest);
+- *d++ = intFiller[0];
+- *d++ = intFiller[1];
+- *d++ = intFiller[2];
+- dest = reinterpret_cast<PixelRGB*> (d);
+- width -= 4;
+- }
+- }
+-
+- while (--width >= 0)
+- {
+- dest->set (colour);
+- ++dest;
+- }
+- }
+- }
++ if ((size_t) destData.pixelStride == sizeof (*dest) && areRGBComponentsEqual)
++ memset ((void*) dest, colour.getRed(), (size_t) width * 3); // if all the component values are the same, we can cheat..
+ else
+ {
+ JUCE_PERFORM_PIXEL_OP_LOOP (set (colour))
diff --git a/gnu/packages/patches/icu4c-CVE-2020-10531.patch b/gnu/packages/patches/icu4c-CVE-2020-10531.patch
deleted file mode 100644
index c2ab923bdc..0000000000
--- a/gnu/packages/patches/icu4c-CVE-2020-10531.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-Fix CVE-2020-10531:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10531
-
-Patch copied from upstream source repository (changes to the test suite
-are commented out):
-
-https://github.com/unicode-org/icu/commit/b7d08bc04a4296982fcef8b6b8a354a9e4e7afca
-
-From b7d08bc04a4296982fcef8b6b8a354a9e4e7afca Mon Sep 17 00:00:00 2001
-From: Frank Tang <ftang@chromium.org>
-Date: Sat, 1 Feb 2020 02:39:04 +0000
-Subject: [PATCH] ICU-20958 Prevent SEGV_MAPERR in append
-
-See #971
----
- icu4c/source/common/unistr.cpp | 6 ++-
- icu4c/source/test/intltest/ustrtest.cpp | 62 +++++++++++++++++++++++++
- icu4c/source/test/intltest/ustrtest.h | 1 +
- 3 files changed, 68 insertions(+), 1 deletion(-)
-
-diff --git a/icu4c/source/common/unistr.cpp b/icu4c/source/common/unistr.cpp
-index 901bb3358ba..077b4d6ef20 100644
---- a/icu4c/source/common/unistr.cpp
-+++ b/icu4c/source/common/unistr.cpp
-@@ -1563,7 +1563,11 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
- }
-
- int32_t oldLength = length();
-- int32_t newLength = oldLength + srcLength;
-+ int32_t newLength;
-+ if (uprv_add32_overflow(oldLength, srcLength, &newLength)) {
-+ setToBogus();
-+ return *this;
-+ }
-
- // Check for append onto ourself
- const UChar* oldArray = getArrayStart();
-#diff --git a/icu4c/source/test/intltest/ustrtest.cpp b/icu4c/source/test/intltest/ustrtest.cpp
-#index b6515ea813c..ad38bdf53a3 100644
-#--- a/icu4c/source/test/intltest/ustrtest.cpp
-#+++ b/icu4c/source/test/intltest/ustrtest.cpp
-#@@ -67,6 +67,7 @@ void UnicodeStringTest::runIndexedTest( int32_t index, UBool exec, const char* &
-# TESTCASE_AUTO(TestWCharPointers);
-# TESTCASE_AUTO(TestNullPointers);
-# TESTCASE_AUTO(TestUnicodeStringInsertAppendToSelf);
-#+ TESTCASE_AUTO(TestLargeAppend);
-# TESTCASE_AUTO_END;
-# }
-#
-#@@ -2310,3 +2311,64 @@ void UnicodeStringTest::TestUnicodeStringInsertAppendToSelf() {
-# str.insert(2, sub);
-# assertEquals("", u"abbcdcde", str);
-# }
-#+
-#+void UnicodeStringTest::TestLargeAppend() {
-#+ if(quick) return;
-#+
-#+ IcuTestErrorCode status(*this, "TestLargeAppend");
-#+ // Make a large UnicodeString
-#+ int32_t len = 0xAFFFFFF;
-#+ UnicodeString str;
-#+ char16_t *buf = str.getBuffer(len);
-#+ // A fast way to set buffer to valid Unicode.
-#+ // 4E4E is a valid unicode character
-#+ uprv_memset(buf, 0x4e, len * 2);
-#+ str.releaseBuffer(len);
-#+ UnicodeString dest;
-#+ // Append it 16 times
-#+ // 0xAFFFFFF times 16 is 0xA4FFFFF1,
-#+ // which is greater than INT32_MAX, which is 0x7FFFFFFF.
-#+ int64_t total = 0;
-#+ for (int32_t i = 0; i < 16; i++) {
-#+ dest.append(str);
-#+ total += len;
-#+ if (total <= INT32_MAX) {
-#+ assertFalse("dest is not bogus", dest.isBogus());
-#+ } else {
-#+ assertTrue("dest should be bogus", dest.isBogus());
-#+ }
-#+ }
-#+ dest.remove();
-#+ total = 0;
-#+ for (int32_t i = 0; i < 16; i++) {
-#+ dest.append(str);
-#+ total += len;
-#+ if (total + len <= INT32_MAX) {
-#+ assertFalse("dest is not bogus", dest.isBogus());
-#+ } else if (total <= INT32_MAX) {
-#+ // Check that a string of exactly the maximum size works
-#+ UnicodeString str2;
-#+ int32_t remain = INT32_MAX - total;
-#+ char16_t *buf2 = str2.getBuffer(remain);
-#+ if (buf2 == nullptr) {
-#+ // if somehow memory allocation fail, return the test
-#+ return;
-#+ }
-#+ uprv_memset(buf2, 0x4e, remain * 2);
-#+ str2.releaseBuffer(remain);
-#+ dest.append(str2);
-#+ total += remain;
-#+ assertEquals("When a string of exactly the maximum size works", (int64_t)INT32_MAX, total);
-#+ assertEquals("When a string of exactly the maximum size works", INT32_MAX, dest.length());
-#+ assertFalse("dest is not bogus", dest.isBogus());
-#+
-#+ // Check that a string size+1 goes bogus
-#+ str2.truncate(1);
-#+ dest.append(str2);
-#+ total++;
-#+ assertTrue("dest should be bogus", dest.isBogus());
-#+ } else {
-#+ assertTrue("dest should be bogus", dest.isBogus());
-#+ }
-#+ }
-#+}
-#diff --git a/icu4c/source/test/intltest/ustrtest.h b/icu4c/source/test/intltest/ustrtest.h
-#index 218befdcc68..4a356a92c7a 100644
-#--- a/icu4c/source/test/intltest/ustrtest.h
-#+++ b/icu4c/source/test/intltest/ustrtest.h
-#@@ -97,6 +97,7 @@ class UnicodeStringTest: public IntlTest {
-# void TestWCharPointers();
-# void TestNullPointers();
-# void TestUnicodeStringInsertAppendToSelf();
-#+ void TestLargeAppend();
-# };
-#
-# #endif
diff --git a/gnu/packages/patches/inetutils-hurd.patch b/gnu/packages/patches/inetutils-hurd.patch
deleted file mode 100644
index bd65c4feb1..0000000000
--- a/gnu/packages/patches/inetutils-hurd.patch
+++ /dev/null
@@ -1,583 +0,0 @@
-Support compiling on the Hurd.
-
-Taken from https://git.hadrons.org/cgit/debian/pkgs/inetutils.git/tree/debian/patches/0002-ifconfig-Improve-the-support-for-GNU-Hurd.patch
-
-From 9a90d9b9119906df23cb2db1503cb0f099942dd9 Mon Sep 17 00:00:00 2001
-From: Mats Erik Andersson <gnu@gisladisker.se>
-Date: Sat, 18 Jul 2015 01:12:41 +0200
-Subject: [PATCH 02/35] ifconfig: Improve the support for GNU/Hurd.
-
-Use system specific code instead of generic code.
-This provides abilities similar to other systems.
----
- ChangeLog | 17 +++
- ifconfig/system.c | 10 +-
- ifconfig/system.h | 2 +
- ifconfig/system/Makefile.am | 4 +-
- ifconfig/system/generic.c | 14 +-
- ifconfig/system/hurd.c | 292 ++++++++++++++++++++++++++++++++++++
- ifconfig/system/hurd.h | 50 ++++++
- 7 files changed, 381 insertions(+), 8 deletions(-)
- create mode 100644 ifconfig/system/hurd.c
- create mode 100644 ifconfig/system/hurd.h
-
-diff --git a/ifconfig/system.c b/ifconfig/system.c
-index 30677e41..e108dc2e 100644
---- a/ifconfig/system.c
-+++ b/ifconfig/system.c
-@@ -25,10 +25,12 @@
- # include "system/solaris.c"
- #elif defined __QNX__
- # include "system/qnx.c"
--# elif defined __DragonFly__ || defined __FreeBSD__ || \
-- defined __FreeBSD_kernel__ || \
-- defined __NetBSD__ || defined __OpenBSD__
--# include "system/bsd.c"
-+#elif defined __DragonFly__ || defined __FreeBSD__ || \
-+ defined __FreeBSD_kernel__ || \
-+ defined __NetBSD__ || defined __OpenBSD__
-+# include "system/bsd.c"
-+#elif defined __GNU__
-+# include "system/hurd.c"
- #else
- # include "system/generic.c"
- #endif
-diff --git a/ifconfig/system.h b/ifconfig/system.h
-index 8521ad95..66878d3a 100644
---- a/ifconfig/system.h
-+++ b/ifconfig/system.h
-@@ -97,6 +97,8 @@ extern struct if_nameindex* (*system_if_nameindex) (void);
- defined __FreeBSD_kernel__ || \
- defined __NetBSD__ || defined __OpenBSD__
- # include "system/bsd.h"
-+# elif defined __GNU__
-+# include "system/hurd.h"
- # else
- # include "system/generic.h"
- # endif
-diff --git a/ifconfig/system/Makefile.am b/ifconfig/system/Makefile.am
-index 954c6774..62a9f1c4 100644
---- a/ifconfig/system/Makefile.am
-+++ b/ifconfig/system/Makefile.am
-@@ -26,8 +26,10 @@ noinst_HEADERS = \
- linux.h \
- solaris.h \
- qnx.h \
-+ hurd.h \
- bsd.c \
- generic.c \
- linux.c \
- solaris.c \
-- qnx.c
-+ qnx.c \
-+ hurd.c
-diff --git a/ifconfig/system/generic.c b/ifconfig/system/generic.c
-index 9a2bda55..20a78bde 100644
---- a/ifconfig/system/generic.c
-+++ b/ifconfig/system/generic.c
-@@ -22,6 +22,8 @@
- #include <config.h>
-
- #include "../ifconfig.h"
-+
-+#include <unused-parameter.h>
-
-
- /* Output format stuff. */
-@@ -36,19 +38,25 @@ const char *system_help;
- struct argp_child system_argp_child;
-
- int
--system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
-+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
-+ char option _GL_UNUSED_PARAMETER,
-+ char *optarg _GL_UNUSED_PARAMETER)
- {
- return 0;
- }
-
- int
--system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
-+system_parse_opt_rest (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
-+ int argc _GL_UNUSED_PARAMETER,
-+ char *argv[] _GL_UNUSED_PARAMETER)
- {
- return 0;
- }
-
- int
--system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
-+system_configure (int sfd _GL_UNUSED_PARAMETER,
-+ struct ifreq *ifr _GL_UNUSED_PARAMETER,
-+ struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
- {
- return 0;
- }
-diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
-new file mode 100644
-index 00000000..3bd19775
---- /dev/null
-+++ b/ifconfig/system/hurd.c
-@@ -0,0 +1,292 @@
-+/* hurd.c -- Code for ifconfig specific to GNU/Hurd.
-+ Copyright (C) 2015 Free Software Foundation, Inc.
-+
-+ This file is part of GNU Inetutils.
-+
-+ GNU Inetutils is free software: you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation, either version 3 of the License, or (at
-+ your option) any later version.
-+
-+ GNU Inetutils is distributed in the hope that it will be useful, but
-+ WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program. If not, see `http://www.gnu.org/licenses/'. */
-+
-+/* Mostly written by Marcus Brinkmann.
-+ Adaptions to GNU/Hurd by Mats Erik Andersson. */
-+
-+#include <config.h>
-+
-+#include <stdlib.h>
-+#include <sys/ioctl.h>
-+#include <net/if_arp.h>
-+#include "../ifconfig.h"
-+
-+#include <unused-parameter.h>
-+
-+
-+/* Output format stuff. */
-+
-+const char *system_default_format = "gnu";
-+
-+
-+/* Argument parsing stuff. */
-+
-+const char *system_help = "NAME [ADDR]\
-+ [broadcast BRDADDR] [netmask MASK]\
-+ [mtu N] [up|down] [FLAGS]";
-+
-+struct argp_child system_argp_child;
-+
-+int
-+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
-+ char option _GL_UNUSED_PARAMETER,
-+ char *optarg _GL_UNUSED_PARAMETER)
-+{
-+ return 0;
-+}
-+
-+int
-+system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
-+{
-+ int i = 0, mask, rev;
-+ enum {
-+ EXPECT_NOTHING,
-+ EXPECT_AF,
-+ EXPECT_BROADCAST,
-+ EXPECT_NETMASK,
-+ EXPECT_METRIC,
-+ EXPECT_MTU
-+ } expect = EXPECT_AF;
-+
-+ *ifp = parse_opt_new_ifs (argv[0]);
-+
-+ while (++i < argc)
-+ {
-+ switch (expect)
-+ {
-+ case EXPECT_BROADCAST:
-+ parse_opt_set_brdaddr (*ifp, argv[i]);
-+ break;
-+
-+ case EXPECT_NETMASK:
-+ parse_opt_set_netmask (*ifp, argv[i]);
-+ break;
-+
-+ case EXPECT_MTU:
-+ parse_opt_set_mtu (*ifp, argv[i]);
-+ break;
-+
-+ /* XXX: 2015-07-18, GNU/Hurd does not yet support
-+ ioctl(SIOCSIFMETRIC), but we let the code
-+ handle this standard ability anyway!
-+ */
-+ case EXPECT_METRIC:
-+ parse_opt_set_metric (*ifp, argv[i]);
-+ break;
-+
-+ case EXPECT_AF:
-+ expect = EXPECT_NOTHING;
-+ if (!strcmp (argv[i], "inet"))
-+ continue;
-+ else if (!strcmp (argv[i], "inet6"))
-+ {
-+ error (0, 0, "%s is not a supported address family", argv[i]);
-+ return 0;
-+ }
-+ break;
-+
-+ case EXPECT_NOTHING:
-+ break;
-+ }
-+
-+ if (expect != EXPECT_NOTHING)
-+ expect = EXPECT_NOTHING;
-+ else if (!strcmp (argv[i], "broadcast"))
-+ expect = EXPECT_BROADCAST;
-+ else if (!strcmp (argv[i], "netmask"))
-+ expect = EXPECT_NETMASK;
-+ else if (!strcmp (argv[i], "metric"))
-+ expect = EXPECT_METRIC;
-+ else if (!strcmp (argv[i], "mtu"))
-+ expect = EXPECT_MTU;
-+ else if (!strcmp (argv[i], "up"))
-+ parse_opt_set_flag (*ifp, IFF_UP | IFF_RUNNING, 0);
-+ else if (!strcmp (argv[i], "down"))
-+ parse_opt_set_flag (*ifp, IFF_UP, 1);
-+ else if (((mask = if_nameztoflag (argv[i], &rev))
-+ & ~IU_IFF_CANTCHANGE) != 0)
-+ parse_opt_set_flag (*ifp, mask, rev);
-+ else
-+ {
-+ if (!((*ifp)->valid & IF_VALID_ADDR))
-+ parse_opt_set_address (*ifp, argv[i]);
-+ else if (!((*ifp)->valid & IF_VALID_DSTADDR))
-+ parse_opt_set_dstaddr (*ifp, argv[i]);
-+ }
-+ }
-+
-+ switch (expect)
-+ {
-+ case EXPECT_BROADCAST:
-+ error (0, 0, "option `broadcast' requires an argument");
-+ break;
-+
-+ case EXPECT_NETMASK:
-+ error (0, 0, "option `netmask' requires an argument");
-+ break;
-+
-+ case EXPECT_METRIC:
-+ error (0, 0, "option `metric' requires an argument");
-+ break;
-+
-+ case EXPECT_MTU:
-+ error (0, 0, "option `mtu' requires an argument");
-+ break;
-+
-+ case EXPECT_AF:
-+ case EXPECT_NOTHING:
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
-+int
-+system_configure (int sfd _GL_UNUSED_PARAMETER,
-+ struct ifreq *ifr _GL_UNUSED_PARAMETER,
-+ struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
-+{
-+ return 0;
-+}
-+
-+struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
-+
-+static void
-+print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
-+ unsigned char *data)
-+{
-+ *column += printf ("%02X:%02X:%02X:%02X:%02X:%02X",
-+ data[0], data[1], data[2], data[3], data[4], data[5]);
-+ had_output = 1;
-+}
-+
-+struct arphrd_symbol
-+{
-+ const char *name;
-+ const char *title;
-+ int value;
-+ void (*print_hwaddr) (format_data_t form, unsigned char *data);
-+} arphrd_symbols[] =
-+ {
-+#ifdef ARPHRD_ETHER /* Ethernet 10/100Mbps. */
-+ { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
-+#endif
-+#ifdef ARPHRD_LOOPBACK /* Loopback device. */
-+ { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
-+#endif
-+ /* XXX: The image debian-hurd-20150424 returns the value 4
-+ instead of expected ARPHRD_LOOPBACK. This has been
-+ discussed in the list debian-hurd, where I was asked
-+ to resist the temptation of a work around!
-+ */
-+ { NULL, NULL, 0, NULL}
-+ };
-+
-+struct arphrd_symbol *
-+arphrd_findvalue (int value)
-+{
-+ struct arphrd_symbol *arp = arphrd_symbols;
-+ while (arp->name != NULL)
-+ {
-+ if (arp->value == value)
-+ break;
-+ arp++;
-+ }
-+ if (arp->name)
-+ return arp;
-+ else
-+ return NULL;
-+}
-+
-+void
-+system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
-+{
-+#ifdef SIOCGIFHWADDR
-+ struct arphrd_symbol *arp;
-+
-+ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
-+ select_arg (form, argc, argv, 1);
-+
-+ arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
-+ select_arg (form, argc, argv, (arp && arp->print_hwaddr) ? 0 : 1);
-+#else
-+ select_arg (form, argc, argv, 1);
-+#endif
-+}
-+
-+void
-+system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
-+ char *argv[] _GL_UNUSED_PARAMETER)
-+{
-+#ifdef SIOCGIFHWADDR
-+ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
-+ error (EXIT_FAILURE, errno,
-+ "SIOCGIFHWADDR failed for interface `%s'",
-+ form->ifr->ifr_name);
-+ else
-+ {
-+ struct arphrd_symbol *arp;
-+
-+ arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
-+ if (arp && arp->print_hwaddr)
-+ arp->print_hwaddr (form,
-+ (unsigned char *) form->ifr->ifr_hwaddr.sa_data);
-+ else
-+ put_string (form, "(hwaddr unknown)");
-+ }
-+#else
-+ *column += printf ("(not available)");
-+ had_output = 1;
-+#endif
-+}
-+
-+void
-+system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
-+{
-+#ifdef SIOCGIFHWADDR
-+ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) >= 0)
-+ select_arg (form, argc, argv, 0);
-+ else
-+#endif
-+ select_arg (form, argc, argv, 1);
-+}
-+
-+void
-+system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
-+ char *argv[] _GL_UNUSED_PARAMETER)
-+{
-+#ifdef SIOCGIFHWADDR
-+ if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
-+ error (EXIT_FAILURE, errno,
-+ "SIOCGIFHWADDR failed for interface `%s'",
-+ form->ifr->ifr_name);
-+ else
-+ {
-+ struct arphrd_symbol *arp;
-+
-+ arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
-+ if (arp)
-+ put_string (form, arp->title);
-+ else
-+ put_string (form, "(hwtype unknown)");
-+ }
-+#else
-+ *column += printf ("(not available)");
-+ had_output = 1;
-+#endif
-+}
-diff --git a/ifconfig/system/hurd.h b/ifconfig/system/hurd.h
-new file mode 100644
-index 00000000..bab14565
---- /dev/null
-+++ b/ifconfig/system/hurd.h
-@@ -0,0 +1,50 @@
-+/*
-+ Copyright (C) 2015 Free Software Foundation, Inc.
-+
-+ This file is part of GNU Inetutils.
-+
-+ GNU Inetutils is free software: you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation, either version 3 of the License, or (at
-+ your option) any later version.
-+
-+ GNU Inetutils is distributed in the hope that it will be useful, but
-+ WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program. If not, see `http://www.gnu.org/licenses/'. */
-+
-+/* Written by Mats Erik Andersson. */
-+
-+#ifndef IFCONFIG_SYSTEM_HURD_H
-+# define IFCONFIG_SYSTEM_HURD_H
-+
-+# include "../printif.h"
-+# include "../options.h"
-+
-+
-+/* Option support. */
-+
-+struct system_ifconfig
-+{
-+ int valid;
-+};
-+
-+
-+/* Output format support. */
-+
-+# define SYSTEM_FORMAT_HANDLER \
-+ { "hurd", fh_nothing}, \
-+ { "hwaddr?", system_fh_hwaddr_query}, \
-+ { "hwaddr", system_fh_hwaddr}, \
-+ { "hwtype?", system_fh_hwtype_query}, \
-+ { "hwtype", system_fh_hwtype},
-+
-+void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
-+void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
-+void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
-+void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
-+
-+#endif /* !IFCONFIG_SYSTEM_HURD_H */
---
-2.23.0.rc1.170.gbd704faa3e
-
-From 589dab9c7d3119da82837dabae34c8a3d16cbe49 Mon Sep 17 00:00:00 2001
-From: Mats Erik Andersson <gnu@gisladisker.se>
-Date: Thu, 30 Jul 2015 01:06:42 +0200
-Subject: [PATCH 07/35] ifconfig: Hardware detection in GNU/Hurd.
-
-A work-around needed to distinguish hardware type.
----
- ChangeLog | 10 ++++++++++
- ifconfig/system/hurd.c | 19 ++++++++++++-------
- 2 files changed, 22 insertions(+), 7 deletions(-)
-
-diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
-index 3bd19775..b6261a00 100644
---- a/ifconfig/system/hurd.c
-+++ b/ifconfig/system/hurd.c
-@@ -175,6 +175,16 @@ print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
- had_output = 1;
- }
-
-+/* GNU/Hurd and Mach are using a mixture of BSD definitions
-+ * and GNU/Linux interface headers, which in this situation
-+ * means that sa_family_t is an unsigned char, from BSD, while
-+ * all ARPHRD_* come from GNU/Linux and are thus 16 bits wide.
-+ * We must account for this. The following bitmask will
-+ * adapt to any future change!
-+ */
-+
-+#define _ARP_MASK ((sizeof (sa_family_t) == 1) ? 0xff : 0xffff)
-+
- struct arphrd_symbol
- {
- const char *name;
-@@ -184,16 +194,11 @@ struct arphrd_symbol
- } arphrd_symbols[] =
- {
- #ifdef ARPHRD_ETHER /* Ethernet 10/100Mbps. */
-- { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
-+ { "ETHER", "Ethernet", ARPHRD_ETHER & _ARP_MASK, print_hwaddr_ether},
- #endif
- #ifdef ARPHRD_LOOPBACK /* Loopback device. */
-- { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
-+ { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK & _ARP_MASK, NULL},
- #endif
-- /* XXX: The image debian-hurd-20150424 returns the value 4
-- instead of expected ARPHRD_LOOPBACK. This has been
-- discussed in the list debian-hurd, where I was asked
-- to resist the temptation of a work around!
-- */
- { NULL, NULL, 0, NULL}
- };
-
---
-2.23.0.rc1.170.gbd704faa3e
-
-From d379784b4461d17b2536effd1b52bae21cd28a32 Mon Sep 17 00:00:00 2001
-From: Guillem Jover <guillem@hadrons.org>
-Date: Fri, 16 Aug 2019 00:34:03 +0200
-Subject: [PATCH 35/35] telnet: Several ioctls have been disabled in the Hurd's
- glibc
-
-But not the related option macros. inetutils uses those macros to decide
-whether the ioctls are available, so it is FTBFS now. The Hurd's glibc
-is being fixed, but we'll use this for now to get the builds going.
----
- telnet/sys_bsd.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/telnet/sys_bsd.c b/telnet/sys_bsd.c
-index 662536ab..5eb35cb5 100644
---- a/telnet/sys_bsd.c
-+++ b/telnet/sys_bsd.c
-@@ -63,6 +63,7 @@
- #include <errno.h>
- #include <arpa/telnet.h>
- #include <sys/select.h>
-+#include <sys/ioctl.h>
- #include <unused-parameter.h>
-
- #include "ring.h"
-@@ -157,7 +158,7 @@ TerminalRead (char *buf, int n)
- int
- TerminalAutoFlush (void)
- {
--#if defined LNOFLSH
-+#if defined TIOCLGET && defined LNOFLSH
- int flush;
-
- ioctl (0, TIOCLGET, (char *) &flush);
-@@ -260,7 +261,9 @@ TerminalSaveState (void)
- ioctl (0, TIOCGETP, (char *) &ottyb);
- ioctl (0, TIOCGETC, (char *) &otc);
- ioctl (0, TIOCGLTC, (char *) &oltc);
-+#ifdef TIOCLGET
- ioctl (0, TIOCLGET, (char *) &olmode);
-+#endif
-
- ntc = otc;
- nltc = oltc;
-@@ -755,7 +758,9 @@ TerminalNewMode (register int f)
- #endif
- }
- #ifndef USE_TERMIO
-+#ifdef TIOCLSET
- ioctl (tin, TIOCLSET, (char *) &lmode);
-+#endif
- ioctl (tin, TIOCSLTC, (char *) &ltc);
- ioctl (tin, TIOCSETC, (char *) &tc);
- ioctl (tin, TIOCSETN, (char *) &sb);
---
-2.23.0.rc1.170.gbd704faa3e
-
diff --git a/gnu/packages/patches/json-c-CVE-2020-12762.patch b/gnu/packages/patches/json-c-CVE-2020-12762.patch
deleted file mode 100644
index 80daa475e9..0000000000
--- a/gnu/packages/patches/json-c-CVE-2020-12762.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-https://github.com/json-c/json-c/pull/608
-https://github.com/json-c/json-c/commit/5d6fa331418d49f1bd488553fd1cfa9ab023fabb.patch
-
-From 5d6fa331418d49f1bd488553fd1cfa9ab023fabb Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
-Date: Thu, 14 May 2020 12:32:30 +0200
-Subject: [PATCH] Fix CVE-2020-12762.
-
-This commit is a squashed backport of the following commits
-on the master branch:
-
- * 099016b7e8d70a6d5dd814e788bba08d33d48426
- * 77d935b7ae7871a1940cd827e850e6063044ec45
- * d07b91014986900a3a75f306d302e13e005e9d67
- * 519dfe1591d85432986f9762d41d1a883198c157
- * a59d5acfab4485d5133114df61785b1fc633e0c6
- * 26f080997d41cfdb17beab65e90c82217d0ac43b
----
- arraylist.c | 3 +++
- linkhash.c | 9 ++++++++-
- printbuf.c | 18 ++++++++++++++++--
- tests/test4.c | 29 +++++++++++++++++++++++++++++
- tests/test4.expected | 1 +
- 5 files changed, 57 insertions(+), 3 deletions(-)
-
-diff --git a/arraylist.c b/arraylist.c
-index 12ad8af6d3..e5524aca75 100644
---- a/arraylist.c
-+++ b/arraylist.c
-@@ -136,6 +136,9 @@ int array_list_del_idx(struct array_list *arr, size_t idx, size_t count)
- {
- size_t i, stop;
-
-+ /* Avoid overflow in calculation with large indices. */
-+ if (idx > SIZE_T_MAX - count)
-+ return -1;
- stop = idx + count;
- if (idx >= arr->length || stop > arr->length)
- return -1;
-diff --git a/linkhash.c b/linkhash.c
-index 7ea58c0abf..b021ef10b0 100644
---- a/linkhash.c
-+++ b/linkhash.c
-@@ -12,6 +12,7 @@
-
- #include "config.h"
-
-+#include <assert.h>
- #include <limits.h>
- #include <stdarg.h>
- #include <stddef.h>
-@@ -499,6 +500,8 @@ struct lh_table *lh_table_new(int size, lh_entry_free_fn *free_fn, lh_hash_fn *h
- int i;
- struct lh_table *t;
-
-+ /* Allocate space for elements to avoid divisions by zero. */
-+ assert(size > 0);
- t = (struct lh_table *)calloc(1, sizeof(struct lh_table));
- if (!t)
- return NULL;
-@@ -578,8 +581,12 @@ int lh_table_insert_w_hash(struct lh_table *t, const void *k, const void *v, con
- unsigned long n;
-
- if (t->count >= t->size * LH_LOAD_FACTOR)
-- if (lh_table_resize(t, t->size * 2) != 0)
-+ {
-+ /* Avoid signed integer overflow with large tables. */
-+ int new_size = (t->size > INT_MAX / 2) ? INT_MAX : (t->size * 2);
-+ if (t->size == INT_MAX || lh_table_resize(t, new_size) != 0)
- return -1;
-+ }
-
- n = h % t->size;
-
-diff --git a/printbuf.c b/printbuf.c
-index 976c12dde5..f9b15b1191 100644
---- a/printbuf.c
-+++ b/printbuf.c
-@@ -15,6 +15,7 @@
-
- #include "config.h"
-
-+#include <limits.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -66,9 +67,16 @@ static int printbuf_extend(struct printbuf *p, int min_size)
- if (p->size >= min_size)
- return 0;
-
-- new_size = p->size * 2;
-- if (new_size < min_size + 8)
-+ /* Prevent signed integer overflows with large buffers. */
-+ if (min_size > INT_MAX - 8)
-+ return -1;
-+ if (p->size > INT_MAX / 2)
- new_size = min_size + 8;
-+ else {
-+ new_size = p->size * 2;
-+ if (new_size < min_size + 8)
-+ new_size = min_size + 8;
-+ }
- #ifdef PRINTBUF_DEBUG
- MC_DEBUG("printbuf_memappend: realloc "
- "bpos=%d min_size=%d old_size=%d new_size=%d\n",
-@@ -83,6 +91,9 @@ static int printbuf_extend(struct printbuf *p, int min_size)
-
- int printbuf_memappend(struct printbuf *p, const char *buf, int size)
- {
-+ /* Prevent signed integer overflows with large buffers. */
-+ if (size > INT_MAX - p->bpos - 1)
-+ return -1;
- if (p->size <= p->bpos + size + 1)
- {
- if (printbuf_extend(p, p->bpos + size + 1) < 0)
-@@ -100,6 +111,9 @@ int printbuf_memset(struct printbuf *pb, int offset, int charvalue, int len)
-
- if (offset == -1)
- offset = pb->bpos;
-+ /* Prevent signed integer overflows with large buffers. */
-+ if (len > INT_MAX - offset)
-+ return -1;
- size_needed = offset + len;
- if (pb->size < size_needed)
- {
-diff --git a/tests/test4.c b/tests/test4.c
-index bd964ec789..288cec1792 100644
---- a/tests/test4.c
-+++ b/tests/test4.c
-@@ -3,12 +3,15 @@
- */
-
- #include "config.h"
-+#include <assert.h>
- #include <stdio.h>
-+#include <stdlib.h>
- #include <string.h>
-
- #include "json_inttypes.h"
- #include "json_object.h"
- #include "json_tokener.h"
-+#include "snprintf_compat.h"
-
- void print_hex(const char *s)
- {
-@@ -24,6 +27,29 @@ void print_hex(const char *s)
- putchar('\n');
- }
-
-+static void test_lot_of_adds(void);
-+static void test_lot_of_adds()
-+{
-+ int ii;
-+ char key[50];
-+ json_object *jobj = json_object_new_object();
-+ assert(jobj != NULL);
-+ for (ii = 0; ii < 500; ii++)
-+ {
-+ snprintf(key, sizeof(key), "k%d", ii);
-+ json_object *iobj = json_object_new_int(ii);
-+ assert(iobj != NULL);
-+ if (json_object_object_add(jobj, key, iobj))
-+ {
-+ fprintf(stderr, "FAILED to add object #%d\n", ii);
-+ abort();
-+ }
-+ }
-+ printf("%s\n", json_object_to_json_string(jobj));
-+ assert(json_object_object_length(jobj) == 500);
-+ json_object_put(jobj);
-+}
-+
- int main(void)
- {
- const char *input = "\"\\ud840\\udd26,\\ud840\\udd27,\\ud800\\udd26,\\ud800\\udd27\"";
-@@ -52,5 +78,8 @@ int main(void)
- retval = 1;
- }
- json_object_put(parse_result);
-+
-+ test_lot_of_adds();
-+
- return retval;
- }
-diff --git a/tests/test4.expected b/tests/test4.expected
-index 68d4336d90..cb2744012b 100644
---- a/tests/test4.expected
-+++ b/tests/test4.expected
-@@ -1,3 +1,4 @@
- input: "\ud840\udd26,\ud840\udd27,\ud800\udd26,\ud800\udd27"
- JSON parse result is correct: 𠄦,𠄧,𐄦,𐄧
- PASS
-+{ "k0": 0, "k1": 1, "k2": 2, "k3": 3, "k4": 4, "k5": 5, "k6": 6, "k7": 7, "k8": 8, "k9": 9, "k10": 10, "k11": 11, "k12": 12, "k13": 13, "k14": 14, "k15": 15, "k16": 16, "k17": 17, "k18": 18, "k19": 19, "k20": 20, "k21": 21, "k22": 22, "k23": 23, "k24": 24, "k25": 25, "k26": 26, "k27": 27, "k28": 28, "k29": 29, "k30": 30, "k31": 31, "k32": 32, "k33": 33, "k34": 34, "k35": 35, "k36": 36, "k37": 37, "k38": 38, "k39": 39, "k40": 40, "k41": 41, "k42": 42, "k43": 43, "k44": 44, "k45": 45, "k46": 46, "k47": 47, "k48": 48, "k49": 49, "k50": 50, "k51": 51, "k52": 52, "k53": 53, "k54": 54, "k55": 55, "k56": 56, "k57": 57, "k58": 58, "k59": 59, "k60": 60, "k61": 61, "k62": 62, "k63": 63, "k64": 64, "k65": 65, "k66": 66, "k67": 67, "k68": 68, "k69": 69, "k70": 70, "k71": 71, "k72": 72, "k73": 73, "k74": 74, "k75": 75, "k76": 76, "k77": 77, "k78": 78, "k79": 79, "k80": 80, "k81": 81, "k82": 82, "k83": 83, "k84": 84, "k85": 85, "k86": 86, "k87": 87, "k88": 88, "k89": 89, "k90": 90, "k91": 91, "k92": 92, "k93": 93, "k94": 94, "k95": 95, "k96": 96, "k97": 97, "k98": 98, "k99": 99, "k100": 100, "k101": 101, "k102": 102, "k103": 103, "k104": 104, "k105": 105, "k106": 106, "k107": 107, "k108": 108, "k109": 109, "k110": 110, "k111": 111, "k112": 112, "k113": 113, "k114": 114, "k115": 115, "k116": 116, "k117": 117, "k118": 118, "k119": 119, "k120": 120, "k121": 121, "k122": 122, "k123": 123, "k124": 124, "k125": 125, "k126": 126, "k127": 127, "k128": 128, "k129": 129, "k130": 130, "k131": 131, "k132": 132, "k133": 133, "k134": 134, "k135": 135, "k136": 136, "k137": 137, "k138": 138, "k139": 139, "k140": 140, "k141": 141, "k142": 142, "k143": 143, "k144": 144, "k145": 145, "k146": 146, "k147": 147, "k148": 148, "k149": 149, "k150": 150, "k151": 151, "k152": 152, "k153": 153, "k154": 154, "k155": 155, "k156": 156, "k157": 157, "k158": 158, "k159": 159, "k160": 160, "k161": 161, "k162": 162, "k163": 163, "k164": 164, "k165": 165, "k166": 166, "k167": 167, "k168": 168, "k169": 169, "k170": 170, "k171": 171, "k172": 172, "k173": 173, "k174": 174, "k175": 175, "k176": 176, "k177": 177, "k178": 178, "k179": 179, "k180": 180, "k181": 181, "k182": 182, "k183": 183, "k184": 184, "k185": 185, "k186": 186, "k187": 187, "k188": 188, "k189": 189, "k190": 190, "k191": 191, "k192": 192, "k193": 193, "k194": 194, "k195": 195, "k196": 196, "k197": 197, "k198": 198, "k199": 199, "k200": 200, "k201": 201, "k202": 202, "k203": 203, "k204": 204, "k205": 205, "k206": 206, "k207": 207, "k208": 208, "k209": 209, "k210": 210, "k211": 211, "k212": 212, "k213": 213, "k214": 214, "k215": 215, "k216": 216, "k217": 217, "k218": 218, "k219": 219, "k220": 220, "k221": 221, "k222": 222, "k223": 223, "k224": 224, "k225": 225, "k226": 226, "k227": 227, "k228": 228, "k229": 229, "k230": 230, "k231": 231, "k232": 232, "k233": 233, "k234": 234, "k235": 235, "k236": 236, "k237": 237, "k238": 238, "k239": 239, "k240": 240, "k241": 241, "k242": 242, "k243": 243, "k244": 244, "k245": 245, "k246": 246, "k247": 247, "k248": 248, "k249": 249, "k250": 250, "k251": 251, "k252": 252, "k253": 253, "k254": 254, "k255": 255, "k256": 256, "k257": 257, "k258": 258, "k259": 259, "k260": 260, "k261": 261, "k262": 262, "k263": 263, "k264": 264, "k265": 265, "k266": 266, "k267": 267, "k268": 268, "k269": 269, "k270": 270, "k271": 271, "k272": 272, "k273": 273, "k274": 274, "k275": 275, "k276": 276, "k277": 277, "k278": 278, "k279": 279, "k280": 280, "k281": 281, "k282": 282, "k283": 283, "k284": 284, "k285": 285, "k286": 286, "k287": 287, "k288": 288, "k289": 289, "k290": 290, "k291": 291, "k292": 292, "k293": 293, "k294": 294, "k295": 295, "k296": 296, "k297": 297, "k298": 298, "k299": 299, "k300": 300, "k301": 301, "k302": 302, "k303": 303, "k304": 304, "k305": 305, "k306": 306, "k307": 307, "k308": 308, "k309": 309, "k310": 310, "k311": 311, "k312": 312, "k313": 313, "k314": 314, "k315": 315, "k316": 316, "k317": 317, "k318": 318, "k319": 319, "k320": 320, "k321": 321, "k322": 322, "k323": 323, "k324": 324, "k325": 325, "k326": 326, "k327": 327, "k328": 328, "k329": 329, "k330": 330, "k331": 331, "k332": 332, "k333": 333, "k334": 334, "k335": 335, "k336": 336, "k337": 337, "k338": 338, "k339": 339, "k340": 340, "k341": 341, "k342": 342, "k343": 343, "k344": 344, "k345": 345, "k346": 346, "k347": 347, "k348": 348, "k349": 349, "k350": 350, "k351": 351, "k352": 352, "k353": 353, "k354": 354, "k355": 355, "k356": 356, "k357": 357, "k358": 358, "k359": 359, "k360": 360, "k361": 361, "k362": 362, "k363": 363, "k364": 364, "k365": 365, "k366": 366, "k367": 367, "k368": 368, "k369": 369, "k370": 370, "k371": 371, "k372": 372, "k373": 373, "k374": 374, "k375": 375, "k376": 376, "k377": 377, "k378": 378, "k379": 379, "k380": 380, "k381": 381, "k382": 382, "k383": 383, "k384": 384, "k385": 385, "k386": 386, "k387": 387, "k388": 388, "k389": 389, "k390": 390, "k391": 391, "k392": 392, "k393": 393, "k394": 394, "k395": 395, "k396": 396, "k397": 397, "k398": 398, "k399": 399, "k400": 400, "k401": 401, "k402": 402, "k403": 403, "k404": 404, "k405": 405, "k406": 406, "k407": 407, "k408": 408, "k409": 409, "k410": 410, "k411": 411, "k412": 412, "k413": 413, "k414": 414, "k415": 415, "k416": 416, "k417": 417, "k418": 418, "k419": 419, "k420": 420, "k421": 421, "k422": 422, "k423": 423, "k424": 424, "k425": 425, "k426": 426, "k427": 427, "k428": 428, "k429": 429, "k430": 430, "k431": 431, "k432": 432, "k433": 433, "k434": 434, "k435": 435, "k436": 436, "k437": 437, "k438": 438, "k439": 439, "k440": 440, "k441": 441, "k442": 442, "k443": 443, "k444": 444, "k445": 445, "k446": 446, "k447": 447, "k448": 448, "k449": 449, "k450": 450, "k451": 451, "k452": 452, "k453": 453, "k454": 454, "k455": 455, "k456": 456, "k457": 457, "k458": 458, "k459": 459, "k460": 460, "k461": 461, "k462": 462, "k463": 463, "k464": 464, "k465": 465, "k466": 466, "k467": 467, "k468": 468, "k469": 469, "k470": 470, "k471": 471, "k472": 472, "k473": 473, "k474": 474, "k475": 475, "k476": 476, "k477": 477, "k478": 478, "k479": 479, "k480": 480, "k481": 481, "k482": 482, "k483": 483, "k484": 484, "k485": 485, "k486": 486, "k487": 487, "k488": 488, "k489": 489, "k490": 490, "k491": 491, "k492": 492, "k493": 493, "k494": 494, "k495": 495, "k496": 496, "k497": 497, "k498": 498, "k499": 499 }
diff --git a/gnu/packages/patches/jsoncpp-fix-inverted-case.patch b/gnu/packages/patches/jsoncpp-fix-inverted-case.patch
deleted file mode 100644
index e4897de1b8..0000000000
--- a/gnu/packages/patches/jsoncpp-fix-inverted-case.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-This patch fixes a bug and related test failure on platforms where 'char'
-is unsigned.
-
-Taken from upstream:
-https://github.com/open-source-parsers/jsoncpp/commit/f11611c8785082ead760494cba06196f14a06dcb
-
-diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp
-index 8e06cca2..56195dc1 100644
---- a/src/lib_json/json_writer.cpp
-+++ b/src/lib_json/json_writer.cpp
-@@ -178,8 +178,9 @@ static bool isAnyCharRequiredQuoting(char const* s, size_t n) {
-
- char const* const end = s + n;
- for (char const* cur = s; cur < end; ++cur) {
-- if (*cur == '\\' || *cur == '\"' || *cur < ' ' ||
-- static_cast<unsigned char>(*cur) < 0x80)
-+ if (*cur == '\\' || *cur == '\"' ||
-+ static_cast<unsigned char>(*cur) < ' ' ||
-+ static_cast<unsigned char>(*cur) >= 0x80)
- return true;
- }
- return false;
diff --git a/gnu/packages/patches/jsoncpp-pkg-config-version.patch b/gnu/packages/patches/jsoncpp-pkg-config-version.patch
new file mode 100644
index 0000000000..3983cc300c
--- /dev/null
+++ b/gnu/packages/patches/jsoncpp-pkg-config-version.patch
@@ -0,0 +1,24 @@
+Taken from upstream: https://github.com/open-source-parsers/jsoncpp/issues/1235.
+
+From ac2870298ed5b5a96a688d9df07461b31f83e906 Mon Sep 17 00:00:00 2001
+From: Derick Vigne <derickvigne@me.com>
+Date: Tue, 26 Jan 2021 14:59:12 -0500
+Subject: [PATCH] Fixed pkg-config Version
+
+---
+ pkg-config/jsoncpp.pc.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pkg-config/jsoncpp.pc.in b/pkg-config/jsoncpp.pc.in
+index 632a377f5..2a2221069 100644
+--- a/pkg-config/jsoncpp.pc.in
++++ b/pkg-config/jsoncpp.pc.in
+@@ -5,7 +5,7 @@ includedir=@includedir_for_pc_file@
+
+ Name: jsoncpp
+ Description: A C++ library for interacting with JSON
+-Version: @JSONCPP_VERSION@
++Version: @PROJECT_VERSION@
+ URL: https://github.com/open-source-parsers/jsoncpp
+ Libs: -L${libdir} -ljsoncpp
+ Cflags: -I${includedir}
diff --git a/gnu/packages/patches/julia-allow-parallel-build.patch b/gnu/packages/patches/julia-allow-parallel-build.patch
new file mode 100644
index 0000000000..cc1d42fee4
--- /dev/null
+++ b/gnu/packages/patches/julia-allow-parallel-build.patch
@@ -0,0 +1,32 @@
+Allow parallel tests with isolated environment.
+
+See https://github.com/JuliaLang/julia/issues/43205 and
+https://github.com/JuliaLang/julia/pull/43211.
+
+diff --git a/test/runtests.jl b/test/runtests.jl
+index 2f9cd058bb..150395e78c 100644
+--- a/test/runtests.jl
++++ b/test/runtests.jl
+@@ -4,7 +4,7 @@ using Test
+ using Distributed
+ using Dates
+ import REPL
+-using Printf: @sprintf
++using Printf: @sprintf, @printf
+ using Base: Experimental
+
+ include("choosetests.jl")
+@@ -83,11 +83,12 @@ prepend!(tests, linalg_tests)
+ import LinearAlgebra
+ cd(@__DIR__) do
+ n = 1
+- if net_on
++ if net_on || haskey(ENV, "JULIA_CPU_THREADS")
+ n = min(Sys.CPU_THREADS, length(tests))
+ n > 1 && addprocs_with_testenv(n)
+ LinearAlgebra.BLAS.set_num_threads(1)
+ end
++ @printf("Number of threads: %i\n", n)
+ skipped = 0
+
+ @everywhere include("testdefs.jl")
diff --git a/gnu/packages/patches/lcms-CVE-2018-16435.patch b/gnu/packages/patches/lcms-CVE-2018-16435.patch
deleted file mode 100644
index 60228e73af..0000000000
--- a/gnu/packages/patches/lcms-CVE-2018-16435.patch
+++ /dev/null
@@ -1,171 +0,0 @@
-https://github.com/mm2/Little-CMS/commit/768f70ca405cd3159d990e962d54456773bb8cf8.patch
-
-From 768f70ca405cd3159d990e962d54456773bb8cf8 Mon Sep 17 00:00:00 2001
-From: Marti Maria <info@littlecms.com>
-Date: Wed, 15 Aug 2018 20:07:56 +0200
-Subject: [PATCH] Upgrade Visual studio 2017 15.8
-
-- Upgrade to 15.8
-- Add check on CGATS memory allocation (thanks to Quang Nguyen for
-pointing out this)
----
- Projects/VC2017/jpegicc/jpegicc.vcxproj | 1 +
- Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj | 2 +-
- Projects/VC2017/lcms2_static/lcms2_static.vcxproj | 2 +-
- Projects/VC2017/linkicc/linkicc.vcxproj | 2 +-
- Projects/VC2017/psicc/psicc.vcxproj | 2 +-
- Projects/VC2017/testbed/testbed.vcxproj | 2 +-
- Projects/VC2017/tiffdiff/tiffdiff.vcxproj | 2 +-
- Projects/VC2017/tifficc/tifficc.vcxproj | 2 +-
- Projects/VC2017/transicc/transicc.vcxproj | 1 +
- src/cmscgats.c | 14 ++++++++++----
- 10 files changed, 19 insertions(+), 11 deletions(-)
-
-diff --git a/Projects/VC2017/jpegicc/jpegicc.vcxproj b/Projects/VC2017/jpegicc/jpegicc.vcxproj
-index ab26a53..39cfd00 100644
---- a/Projects/VC2017/jpegicc/jpegicc.vcxproj
-+++ b/Projects/VC2017/jpegicc/jpegicc.vcxproj
-@@ -22,6 +22,7 @@
- <ProjectGuid>{62812507-F926-4968-96A9-17678460AD90}</ProjectGuid>
- <RootNamespace>jpegicc</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj b/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
-index 4c8aa3f..d1bf3eb 100644
---- a/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
-+++ b/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj
-@@ -22,7 +22,7 @@
- <ProjectGuid>{8C51BE48-ADB8-4089-A9EC-F6BF993A0548}</ProjectGuid>
- <RootNamespace>lcms2_DLL</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/lcms2_static/lcms2_static.vcxproj b/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
-index 2a9988a..9fc05ce 100644
---- a/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
-+++ b/Projects/VC2017/lcms2_static/lcms2_static.vcxproj
-@@ -22,7 +22,7 @@
- <ProjectGuid>{71DEDE59-3F1E-486B-A899-4283000F76B5}</ProjectGuid>
- <RootNamespace>lcms2_static</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/linkicc/linkicc.vcxproj b/Projects/VC2017/linkicc/linkicc.vcxproj
-index 30c2b4e..51586dd 100644
---- a/Projects/VC2017/linkicc/linkicc.vcxproj
-+++ b/Projects/VC2017/linkicc/linkicc.vcxproj
-@@ -22,7 +22,7 @@
- <ProjectGuid>{FBFBE1DC-DB84-4BA1-9552-B4780F457849}</ProjectGuid>
- <RootNamespace>linkicc</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/psicc/psicc.vcxproj b/Projects/VC2017/psicc/psicc.vcxproj
-index 9dcf89a..8f26e12 100644
---- a/Projects/VC2017/psicc/psicc.vcxproj
-+++ b/Projects/VC2017/psicc/psicc.vcxproj
-@@ -22,7 +22,7 @@
- <ProjectGuid>{EF6A8851-65FE-46F5-B9EF-14F0B671F693}</ProjectGuid>
- <RootNamespace>psicc</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/testbed/testbed.vcxproj b/Projects/VC2017/testbed/testbed.vcxproj
-index 0af3762..3f6aea3 100644
---- a/Projects/VC2017/testbed/testbed.vcxproj
-+++ b/Projects/VC2017/testbed/testbed.vcxproj
-@@ -22,7 +22,7 @@
- <ProjectGuid>{928A3A2B-46EF-4279-959C-513B3652FF0E}</ProjectGuid>
- <RootNamespace>testbed</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/tiffdiff/tiffdiff.vcxproj b/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
-index 7edfe28..3a6d837 100644
---- a/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
-+++ b/Projects/VC2017/tiffdiff/tiffdiff.vcxproj
-@@ -22,7 +22,7 @@
- <ProjectGuid>{75B91835-CCD7-48BE-A606-A9C997D5DBEE}</ProjectGuid>
- <RootNamespace>tiffdiff</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/tifficc/tifficc.vcxproj b/Projects/VC2017/tifficc/tifficc.vcxproj
-index cd9f04c..5ef954f 100644
---- a/Projects/VC2017/tifficc/tifficc.vcxproj
-+++ b/Projects/VC2017/tifficc/tifficc.vcxproj
-@@ -22,7 +22,7 @@
- <ProjectGuid>{2256DE16-ED92-4A6F-9C54-F65BB61E64A2}</ProjectGuid>
- <RootNamespace>tifficc</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/Projects/VC2017/transicc/transicc.vcxproj b/Projects/VC2017/transicc/transicc.vcxproj
-index d9b77c6..b3173d8 100644
---- a/Projects/VC2017/transicc/transicc.vcxproj
-+++ b/Projects/VC2017/transicc/transicc.vcxproj
-@@ -22,6 +22,7 @@
- <ProjectGuid>{9EE22D66-C849-474C-9ED5-C3E141DAB160}</ProjectGuid>
- <RootNamespace>transicc</RootNamespace>
- <Keyword>Win32Proj</Keyword>
-+ <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-diff --git a/src/cmscgats.c b/src/cmscgats.c
-index 1a87613..8c3e96d 100644
---- a/src/cmscgats.c
-+++ b/src/cmscgats.c
-@@ -1,7 +1,7 @@
- //---------------------------------------------------------------------------------
- //
- // Little Color Management System
--// Copyright (c) 1998-2017 Marti Maria Saguer
-+// Copyright (c) 1998-2018 Marti Maria Saguer
- //
- // Permission is hereby granted, free of charge, to any person obtaining
- // a copy of this software and associated documentation files (the "Software"),
-@@ -1506,10 +1506,16 @@ void AllocateDataSet(cmsIT8* it8)
- t-> nSamples = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS"));
- t-> nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS"));
-
-- t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * ((cmsUInt32Number) t->nPatches + 1) *sizeof (char*));
-- if (t->Data == NULL) {
-+ if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe)
-+ {
-+ SynError(it8, "AllocateDataSet: too much data");
-+ }
-+ else {
-+ t->Data = (char**)AllocChunk(it8, ((cmsUInt32Number)t->nSamples + 1) * ((cmsUInt32Number)t->nPatches + 1) * sizeof(char*));
-+ if (t->Data == NULL) {
-
-- SynError(it8, "AllocateDataSet: Unable to allocate data array");
-+ SynError(it8, "AllocateDataSet: Unable to allocate data array");
-+ }
- }
-
- }
diff --git a/gnu/packages/patches/ldc-bootstrap-disable-tests.patch b/gnu/packages/patches/ldc-bootstrap-disable-tests.patch
deleted file mode 100644
index d2e40b8016..0000000000
--- a/gnu/packages/patches/ldc-bootstrap-disable-tests.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-This patch fixes a failing unit test by feeding buildNormalizedPath to the
-tzdata properly. Three other tests are disabled, one assumes /root and the
-two others use networking. Not bad out of almost 700 tests!
-
-by Pjotr Prins <pjotr.guix@thebird.nl>
-
---- a/std/datetime.d.orig 2016-11-24 01:13:52.584495545 +0100
-+++ b/std/datetime.d 2016-11-24 01:17:09.655306728 +0100
-@@ -28081,22 +28081,24 @@
- import std.range : retro;
- import std.format : format;
-
-- name = strip(name);
--
- enforce(tzDatabaseDir.exists(), new DateTimeException(format("Directory %s does not exist.", tzDatabaseDir)));
- enforce(tzDatabaseDir.isDir, new DateTimeException(format("%s is not a directory.", tzDatabaseDir)));
-
- version(Android)
- {
-+ name = strip(name);
- auto tzfileOffset = name in tzdataIndex(tzDatabaseDir);
- enforce(tzfileOffset, new DateTimeException(format("The time zone %s is not listed.", name)));
- string tzFilename = separate_index ? "zoneinfo.dat" : "tzdata";
- immutable file = buildNormalizedPath(tzDatabaseDir, tzFilename);
- }
- else
-- immutable file = buildNormalizedPath(tzDatabaseDir, name);
-+ {
-+ auto filename = "./" ~ strip(name); // make sure the prefix is not stripped
-+ immutable file = buildNormalizedPath(tzDatabaseDir, filename);
-+ }
-
-- enforce(file.exists(), new DateTimeException(format("File %s does not exist.", file)));
-+ enforce(file.exists(), new DateTimeException(format("File %s does not exist in %s.", file, tzDatabaseDir)));
- enforce(file.isFile, new DateTimeException(format("%s is not a file.", file)));
-
- auto tzFile = File(file);
-diff --git a/std/path.d b/std/path.d
-index 254d8f0..b0fc04d 100644
---- a/std/path.d
-+++ b/std/path.d
-@@ -3080,8 +3080,11 @@ unittest
- }
- else
- {
-+ pragma(msg, "test disabled on GNU Guix");
-+/*
- assert(expandTilde("~root") == "/root", expandTilde("~root"));
- assert(expandTilde("~root/") == "/root/", expandTilde("~root/"));
-+*/
- }
- assert(expandTilde("~Idontexist/hey") == "~Idontexist/hey");
- }
-diff --git a/std/socket.d b/std/socket.d
-index b85d1c9..7fbf346 100644
---- a/std/socket.d
-+++ b/std/socket.d
-@@ -859,6 +862,8 @@ class InternetHost
-
- unittest
- {
-+ pragma(msg, "test disabled on GNU Guix");
-+ /*
- InternetHost ih = new InternetHost;
-
- ih.getHostByAddr(0x7F_00_00_01);
-@@ -889,6 +894,7 @@ unittest
- // writefln("aliases[%d] = %s", i, s);
- // }
- });
-+ */
- }
diff --git a/gnu/packages/patches/ldc-disable-phobos-tests.patch b/gnu/packages/patches/ldc-disable-phobos-tests.patch
deleted file mode 100644
index f8a9743d59..0000000000
--- a/gnu/packages/patches/ldc-disable-phobos-tests.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/std/socket.d b/std/socket.d
-index 111cd17..6d23da9 100644
---- a/std/socket.d
-+++ b/std/socket.d
-@@ -448,7 +448,7 @@ class Protocol
- // Skip this test on Android because getprotobyname/number are
- // unimplemented in bionic.
- version(CRuntime_Bionic) {} else
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
- // import std.stdio : writefln;
- softUnittest({
-@@ -770,7 +770,7 @@ class InternetHost
- }
-
- ///
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
- InternetHost ih = new InternetHost;
-
diff --git a/gnu/packages/patches/lib2geom-fix-tests.patch b/gnu/packages/patches/lib2geom-fix-tests.patch
deleted file mode 100644
index 47e8f6e2ec..0000000000
--- a/gnu/packages/patches/lib2geom-fix-tests.patch
+++ /dev/null
@@ -1,192 +0,0 @@
-From 3e858cc87f2f8b7dc514a8ad7709c1f47f1f4cde Mon Sep 17 00:00:00 2001
-From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-Date: Wed, 17 Jun 2020 23:20:53 -0400
-Subject: [PATCH] tests: Fix tests on non-x86_64 platforms.
-
-On platform other than x86_64 such as aarch64-linux or i686-linux,
-some double comparisons would fail.
-
-See <http://issues.guix.gnu.org/41827>.
-
-* tests/bezier-test.cpp: (Casteljau): Replace EXPECT_EQ by
-EXPECT_near.
-(Subdivide): Replace EXPECT_EQ by EXPECT_DOUBLE_EQ.
-(Portion): Replace EXPECT_EQ by EXPECT_near.
-* tests/ellipse-test.cpp (BezierIntersection): Lower error tolerance
-from 6e-13 to 6e-12.
-(LineIntersection): Replace EXPECT_DOUBLE_EQ by EXPECT_NEAR.
-* tests/line-test.cpp (Reflection): Replace EXPECT_FLOAT_EQ BY
-EXPECT_near.
-(Coefficients): Skip test.
-* tests/parallelogram-test.cpp (area): Replace EXPECT_EQ by
-EXPECT_DOUBLE_EQ.
----
- tests/bezier-test.cpp | 31 +++++++++++++++++--------------
- tests/ellipse-test.cpp | 11 ++++++-----
- tests/line-test.cpp | 11 +++++++----
- tests/parallelogram-test.cpp | 8 ++++----
- 4 files changed, 34 insertions(+), 27 deletions(-)
-
-diff --git a/tests/bezier-test.cpp b/tests/bezier-test.cpp
-index 4054a654..46209f40 100644
---- a/tests/bezier-test.cpp
-+++ b/tests/bezier-test.cpp
-@@ -152,11 +152,13 @@ TEST_F(BezierTest, Casteljau) {
- EXPECT_vector_equal(right2, right);
-
- double vnone = casteljau_subdivision<double>(t, &wiggle[0], NULL, NULL, wiggle.order());
-- EXPECT_EQ(vnone, vok);
-+ EXPECT_near(vnone, vok, 1e-12);
- }
- }
-
- TEST_F(BezierTest, Portion) {
-+ constexpr Coord eps{1e-12};
-+
- for (unsigned i = 0; i < 10000; ++i) {
- double from = g_random_double_range(0, 1);
- double to = g_random_double_range(0, 1);
-@@ -165,8 +167,8 @@ TEST_F(BezierTest, Portion) {
- Bezier result = portion(input, from, to);
-
- // the endpoints must correspond exactly
-- EXPECT_EQ(result.at0(), input.valueAt(from));
-- EXPECT_EQ(result.at1(), input.valueAt(to));
-+ EXPECT_near(result.at0(), input.valueAt(from), eps);
-+ EXPECT_near(result.at1(), input.valueAt(to), eps);
- }
- }
- }
-@@ -181,16 +183,16 @@ TEST_F(BezierTest, Subdivide) {
-
- // the endpoints must correspond exactly
- // moreover, the subdivision point must be exactly equal to valueAt(t)
-- EXPECT_EQ(result.first.at0(), input.at0());
-- EXPECT_EQ(result.first.at1(), result.second.at0());
-- EXPECT_EQ(result.second.at0(), input.valueAt(t));
-- EXPECT_EQ(result.second.at1(), input.at1());
-+ EXPECT_DOUBLE_EQ(result.first.at0(), input.at0());
-+ EXPECT_DOUBLE_EQ(result.first.at1(), result.second.at0());
-+ EXPECT_DOUBLE_EQ(result.second.at0(), input.valueAt(t));
-+ EXPECT_DOUBLE_EQ(result.second.at1(), input.at1());
-
- // ditto for valueAt
-- EXPECT_EQ(result.first.valueAt(0), input.valueAt(0));
-- EXPECT_EQ(result.first.valueAt(1), result.second.valueAt(0));
-- EXPECT_EQ(result.second.valueAt(0), input.valueAt(t));
-- EXPECT_EQ(result.second.valueAt(1), input.valueAt(1));
-+ EXPECT_DOUBLE_EQ(result.first.valueAt(0), input.valueAt(0));
-+ EXPECT_DOUBLE_EQ(result.first.valueAt(1), result.second.valueAt(0));
-+ EXPECT_DOUBLE_EQ(result.second.valueAt(0), input.valueAt(t));
-+ EXPECT_DOUBLE_EQ(result.second.valueAt(1), input.valueAt(1));
-
- if (result.first.at1() != result.second.at0()) {
- errors.push_back(std::pair<Bezier,double>(input, t));
-@@ -271,9 +273,10 @@ TEST_F(BezierTest, Deflate) {
- EXPECT_FLOAT_EQ(0, b.at0());
- b = b.deflate();
- const double rootposition = (0.5-0.25) / (1-0.25);
-- EXPECT_FLOAT_EQ(0, b.valueAt(rootposition));
-+ constexpr Coord eps{1e-12};
-+ EXPECT_near(0.0, b.valueAt(rootposition), eps);
- b = b.subdivide(rootposition).second;
-- EXPECT_FLOAT_EQ(0, b.at0());
-+ EXPECT_near(0.0, b.at0(), eps);
- }
-
- TEST_F(BezierTest, Roots) {
-@@ -364,7 +367,7 @@ TEST_F(BezierTest, Operators) {
- for(int i = 0; i <= 16; i++) {
- double t = i/16.0;
- double b = B.valueAt(t);
-- EXPECT_FLOAT_EQ(b*b, product.valueAt(t));
-+ EXPECT_near(b*b, product.valueAt(t), 1e-12);
- }
- }
- }
-diff --git a/tests/ellipse-test.cpp b/tests/ellipse-test.cpp
-index 561c285a..8e4de12c 100644
---- a/tests/ellipse-test.cpp
-+++ b/tests/ellipse-test.cpp
-@@ -158,13 +158,14 @@ TEST(EllipseTest, LineIntersection) {
- std::vector<ShapeIntersection> xs = e.intersect(l);
-
- ASSERT_EQ(xs.size(), 2ul);
-- EXPECT_FLOAT_EQ(xs[0].point()[X], 0);
-- EXPECT_FLOAT_EQ(xs[0].point()[Y], -2);
-- EXPECT_FLOAT_EQ(xs[1].point()[X], 9./5);
-- EXPECT_FLOAT_EQ(xs[1].point()[Y], 8./5);
-
- // due to numeric imprecision when evaluating Ellipse,
- // the points may deviate by around 2e-16
-+ EXPECT_NEAR(xs[0].point()[X], 0, 1e-15);
-+ EXPECT_NEAR(xs[0].point()[Y], -2, 1e-15);
-+ EXPECT_NEAR(xs[1].point()[X], 9./5, 1e-15);
-+ EXPECT_NEAR(xs[1].point()[Y], 8./5, 1e-15);
-+
- EXPECT_intersections_valid(e, l, xs, 1e-15);
- }
-
-@@ -199,7 +200,7 @@ TEST(EllipseTest, BezierIntersection) {
- std::vector<ShapeIntersection> xs = e.intersect(b);
-
- EXPECT_EQ(xs.size(), 2ul);
-- EXPECT_intersections_valid(e, b, xs, 6e-13);
-+ EXPECT_intersections_valid(e, b, xs, 6e-12);
- }
-
- TEST(EllipseTest, Coefficients) {
-diff --git a/tests/line-test.cpp b/tests/line-test.cpp
-index 99546ddc..23991300 100644
---- a/tests/line-test.cpp
-+++ b/tests/line-test.cpp
-@@ -91,10 +91,12 @@ TEST(LineTest, Reflection) {
-
- Point testra = pa * reflecta;
- Point testrb = pb * reflectb;
-- EXPECT_FLOAT_EQ(testra[X], ra[X]);
-- EXPECT_FLOAT_EQ(testra[Y], ra[Y]);
-- EXPECT_FLOAT_EQ(testrb[X], rb[X]);
-- EXPECT_FLOAT_EQ(testrb[Y], rb[Y]);
-+
-+ constexpr Coord eps{1e-12};
-+ EXPECT_near(testra[X], ra[X], eps);
-+ EXPECT_near(testra[Y], ra[Y], eps);
-+ EXPECT_near(testrb[X], rb[X], eps);
-+ EXPECT_near(testrb[Y], rb[Y], eps);
- }
-
- TEST(LineTest, RotationToZero) {
-@@ -115,6 +117,7 @@ TEST(LineTest, RotationToZero) {
- }
-
- TEST(LineTest, Coefficients) {
-+ GTEST_SKIP() << "This test fails on i686-linux and aarch64-linux";
- std::vector<Line> lines;
- lines.push_back(Line(Point(1e9,1e9), Point(1,1)));
- //the case below will never work without normalizing the line
-diff --git a/tests/parallelogram-test.cpp b/tests/parallelogram-test.cpp
-index 8109eadd..70ccea13 100644
---- a/tests/parallelogram-test.cpp
-+++ b/tests/parallelogram-test.cpp
-@@ -106,13 +106,13 @@ TEST(ParallelogramTest, area)
- {
- Rect r(2, 4, 7, 8);
- Parallelogram p(r);
-- EXPECT_EQ(p.area(), r.area());
-+ EXPECT_DOUBLE_EQ(p.area(), r.area());
- p *= Rotate(M_PI / 4.0); // 45°
-- EXPECT_EQ(p.area(), r.area());
-+ EXPECT_DOUBLE_EQ(p.area(), r.area());
- p *= HShear(2);
-- EXPECT_EQ(p.area(), r.area());
-+ EXPECT_DOUBLE_EQ(p.area(), r.area());
- p *= Scale(2);
-- EXPECT_EQ(p.area(), r.area() * 4);
-+ EXPECT_DOUBLE_EQ(p.area(), r.area() * 4);
- }
-
- class ParallelogramTest
---
-2.27.0
-
diff --git a/gnu/packages/patches/libmicrohttpd-0.9.73-test-ssl3.patch b/gnu/packages/patches/libmicrohttpd-0.9.73-test-ssl3.patch
new file mode 100644
index 0000000000..e8d5dce0ed
--- /dev/null
+++ b/gnu/packages/patches/libmicrohttpd-0.9.73-test-ssl3.patch
@@ -0,0 +1,35 @@
+ Disable usage of SSLv3 in testing
+
+ Integrated uptream version 0.9.74
+
+
+diff --git a/src/testcurl/https/test_tls_options.c b/src/testcurl/https/test_tls_options.c
+
+--- a/src/testcurl/https/test_tls_options.c
++++ b/src/testcurl/https/test_tls_options.c
+@@ -119,11 +119,6 @@ main (int argc, char *const *argv)
+ fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
+ return 77;
+ }
+- if (0 != strncmp (ssl_version, "GnuTLS", 6))
+- {
+- fprintf (stderr, "This test can be run only with libcurl-gnutls.\n");
+- return 77;
+- }
+
+ if (! testsuite_curl_global_init ())
+ return 99;
+@@ -152,10 +147,10 @@ main (int argc, char *const *argv)
+ fprintf (stderr,
+ "The following handshake should fail (and print an error message)...\n");
+ if (0 !=
+- test_wrap ("TLS1.0 vs SSL3",
++ test_wrap ("TLS1.1 vs TLS1.0",
+ &test_unmatching_ssl_version, NULL, port, daemon_flags,
+ aes256_sha,
+- CURL_SSLVERSION_SSLv3,
++ CURL_SSLVERSION_TLSv1_1,
+ MHD_OPTION_HTTPS_MEM_KEY, srv_key_pem,
+ MHD_OPTION_HTTPS_MEM_CERT, srv_self_signed_cert_pem,
+ MHD_OPTION_HTTPS_PRIORITIES,
+
diff --git a/gnu/packages/patches/librime-fix-build-with-gcc10.patch b/gnu/packages/patches/librime-fix-build-with-gcc10.patch
new file mode 100644
index 0000000000..49ad011b57
--- /dev/null
+++ b/gnu/packages/patches/librime-fix-build-with-gcc10.patch
@@ -0,0 +1,41 @@
+From: Felix Gruber <felgru@posteo.net>
+Date: Mon, 6 Sep 2021 19:38:17 +0200
+Subject: [PATCH] Add missing <cmath> includes
+
+Fix a build failure with GCC 10 that manifests like this:
+
+------
+/tmp/guix-build-librime-1.7.3.drv-0/source/src/rime/gear/script_translator.cc: In member function ‘void rime::ScriptTranslation::PrepareCandidate()’:
+/tmp/guix-build-librime-1.7.3.drv-0/source/src/rime/gear/script_translator.cc:490:23: error: ‘exp’ was not declared in this scope
+ 490 | cand->set_quality(exp(entry->weight) +
+ | ^~~
+/tmp/guix-build-librime-1.7.3.drv-0/source/src/rime/gear/script_translator.cc:504:23: error: ‘exp’ was not declared in this scope
+ 504 | cand->set_quality(exp(entry->weight) +
+ | ^~~
+make[2]: *** [src/CMakeFiles/rime.dir/build.make:1241: src/CMakeFiles/rime.dir/rime/gear/script_translator.cc.o] Error 1
+------
+
+diff --git a/src/rime/gear/script_translator.cc b/src/rime/gear/script_translator.cc
+index 4a45f05..515c8db 100644
+--- a/src/rime/gear/script_translator.cc
++++ b/src/rime/gear/script_translator.cc
+@@ -7,6 +7,7 @@
+ // 2011-07-10 GONG Chen <chen.sst@gmail.com>
+ //
+ #include <algorithm>
++#include <cmath>
+ #include <stack>
+ #include <boost/algorithm/string/join.hpp>
+ #include <boost/range/adaptor/reversed.hpp>
+diff --git a/src/rime/gear/table_translator.cc b/src/rime/gear/table_translator.cc
+index 162ac02..dbea76a 100644
+--- a/src/rime/gear/table_translator.cc
++++ b/src/rime/gear/table_translator.cc
+@@ -4,6 +4,7 @@
+ //
+ // 2011-07-10 GONG Chen <chen.sst@gmail.com>
+ //
++#include <cmath>
+ #include <boost/algorithm/string.hpp>
+ #include <boost/range/adaptor/reversed.hpp>
+ #include <utf8.h>
diff --git a/gnu/packages/patches/libtirpc-hurd-client.patch b/gnu/packages/patches/libtirpc-hurd-client.patch
deleted file mode 100644
index 526ad262d2..0000000000
--- a/gnu/packages/patches/libtirpc-hurd-client.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Taken from https://salsa.debian.org/debian/libtirpc/-/raw/master/debian/patches/06-hurd-client-port.diff
-
-Description: Fix client code for hurd, avoiding malloc overflow
- When trying to setup a inet connection, it happens the following:
- - in libtirp, src/clnt_vc.c, clnt_vc_create gets called
- - when trying to allocate vc_fd_locks, __rpc_dtbsize() is used as size
- for that array of fd locks
- - __rpc_dtbsize(), in src/rpc_generic.c, queries using rlimit the
- maximum (rlim_max) number of file descriptors (RLIMIT_NOFILE):
- - on Linux, the default is { rlim_cur = 1024, rlim_max = 4096 }
- - on kFreeBSD, the default is { rlim_cur = 1024, rlim_max = 1024 }
- - on Hurd, the default is { rlim_cur = 1024, rlim_max = RLIM_INFINITY }
- meaning that on Hurd the memory allocation fails (as
- __rpc_dtbsize() * sizeof(int) overflows and is negative)
-
- Change libtiprc so __rpc_dtbsize falls back on rlim_cur if rlim_max
- is unlimited.
-
- This patch fixes the client connection using inet sockets; local unix
- sockets are not working, for two reasons so far:
- - getpeername on them gives EOPNOTSUPP
- - SO_REUSEADDR is not implemented for them
-Author: Pino Toscano <pino@debian.org>
-
-Bug-Debian: http://bugs.debian.org/739674
-Forwarded: no
-Reviewed-By: Petter Reinholdtsen
-Last-Update: 2014-03-03
-
---- a/src/rpc_generic.c
-+++ b/src/rpc_generic.c
-@@ -107,12 +107,17 @@
- {
- static int tbsize;
- struct rlimit rl;
-+ rlim_t lim;
-
- if (tbsize) {
- return (tbsize);
- }
- if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
-- return (tbsize = (int)rl.rlim_max);
-+ lim = rl.rlim_max;
-+ if (lim == RLIM_INFINITY) {
-+ lim = rl.rlim_cur;
-+ }
-+ return (tbsize = (int)lim);
- }
- /*
- * Something wrong. I'll try to save face by returning a
diff --git a/gnu/packages/patches/libunwind-julia-fix-GCC10-fno-common.patch b/gnu/packages/patches/libunwind-julia-fix-GCC10-fno-common.patch
new file mode 100644
index 0000000000..8ef4b111e4
--- /dev/null
+++ b/gnu/packages/patches/libunwind-julia-fix-GCC10-fno-common.patch
@@ -0,0 +1,40 @@
+Fix compilation with -fno-common.
+
+Borrowed from upstream 29e17d8d2ccbca07c423e3089a6d5ae8a1c9cb6e.
+Author: Yichao Yu <yyc1992@gmail.com>
+AuthorDate: Tue Mar 31 00:43:32 2020 -0400
+Commit: Dave Watson <dade.watson@gmail.com>
+CommitDate: Tue Mar 31 08:06:29 2020 -0700
+
+diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c
+index f6b8dc2..9550efa 100644
+--- a/src/x86/Ginit.c
++++ b/src/x86/Ginit.c
+@@ -54,13 +54,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
+
+ # endif /* UNW_LOCAL_ONLY */
+
+-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+-
+-/* XXX fix me: there is currently no way to locate the dyn-info list
+- by a remote unwinder. On ia64, this is done via a special
+- unwind-table entry. Perhaps something similar can be done with
+- DWARF2 unwind info. */
+-
+ static void
+ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
+ {
+@@ -71,7 +64,12 @@ static int
+ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
+ void *arg)
+ {
+- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
++#ifndef UNW_LOCAL_ONLY
++# pragma weak _U_dyn_info_list_addr
++ if (!_U_dyn_info_list_addr)
++ return -UNW_ENOINFO;
++#endif
++ *dyn_info_list_addr = _U_dyn_info_list_addr ();
+ return 0;
+ }
+
diff --git a/gnu/packages/patches/libxml2-parent-pointers.patch b/gnu/packages/patches/libxml2-parent-pointers.patch
new file mode 100644
index 0000000000..1f0615c512
--- /dev/null
+++ b/gnu/packages/patches/libxml2-parent-pointers.patch
@@ -0,0 +1,228 @@
+Fix a regression in 2.9.12 where some corrupt XML structures were handled
+incorrectly:
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/issues/255
+
+This is an amalgamation of these upstream commits:
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/commit/85b1792e37b131e7a51af98a37f92472e8de5f3f
+ https://gitlab.gnome.org/GNOME/libxml2/-/commit/13ad8736d294536da4cbcd70a96b0a2fbf47070c
+
+diff --git a/HTMLtree.c b/HTMLtree.c
+--- a/HTMLtree.c
++++ b/HTMLtree.c
+@@ -744,7 +744,7 @@ void
+ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ xmlNodePtr cur, const char *encoding ATTRIBUTE_UNUSED,
+ int format) {
+- xmlNodePtr root;
++ xmlNodePtr root, parent;
+ xmlAttrPtr attr;
+ const htmlElemDesc * info;
+
+@@ -755,6 +755,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ }
+
+ root = cur;
++ parent = cur->parent;
+ while (1) {
+ switch (cur->type) {
+ case XML_HTML_DOCUMENT_NODE:
+@@ -762,13 +763,25 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ if (((xmlDocPtr) cur)->intSubset != NULL) {
+ htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
+ }
+- if (cur->children != NULL) {
++ /* Always validate cur->parent when descending. */
++ if ((cur->parent == parent) && (cur->children != NULL)) {
++ parent = cur;
+ cur = cur->children;
+ continue;
+ }
+ break;
+
+ case XML_ELEMENT_NODE:
++ /*
++ * Some users like lxml are known to pass nodes with a corrupted
++ * tree structure. Fall back to a recursive call to handle this
++ * case.
++ */
++ if ((cur->parent != parent) && (cur->children != NULL)) {
++ htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
++ break;
++ }
++
+ /*
+ * Get specific HTML info for that node.
+ */
+@@ -817,6 +830,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ (cur->name != NULL) &&
+ (cur->name[0] != 'p')) /* p, pre, param */
+ xmlOutputBufferWriteString(buf, "\n");
++ parent = cur;
+ cur = cur->children;
+ continue;
+ }
+@@ -825,9 +839,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ (info != NULL) && (!info->isinline)) {
+ if ((cur->next->type != HTML_TEXT_NODE) &&
+ (cur->next->type != HTML_ENTITY_REF_NODE) &&
+- (cur->parent != NULL) &&
+- (cur->parent->name != NULL) &&
+- (cur->parent->name[0] != 'p')) /* p, pre, param */
++ (parent != NULL) &&
++ (parent->name != NULL) &&
++ (parent->name[0] != 'p')) /* p, pre, param */
+ xmlOutputBufferWriteString(buf, "\n");
+ }
+
+@@ -842,9 +856,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ break;
+ if (((cur->name == (const xmlChar *)xmlStringText) ||
+ (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
+- ((cur->parent == NULL) ||
+- ((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) &&
+- (xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) {
++ ((parent == NULL) ||
++ ((xmlStrcasecmp(parent->name, BAD_CAST "script")) &&
++ (xmlStrcasecmp(parent->name, BAD_CAST "style"))))) {
+ xmlChar *buffer;
+
+ buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
+@@ -902,13 +916,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ break;
+ }
+
+- /*
+- * The parent should never be NULL here but we want to handle
+- * corrupted documents gracefully.
+- */
+- if (cur->parent == NULL)
+- return;
+- cur = cur->parent;
++ cur = parent;
++ /* cur->parent was validated when descending. */
++ parent = cur->parent;
+
+ if ((cur->type == XML_HTML_DOCUMENT_NODE) ||
+ (cur->type == XML_DOCUMENT_NODE)) {
+@@ -939,9 +949,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ (cur->next != NULL)) {
+ if ((cur->next->type != HTML_TEXT_NODE) &&
+ (cur->next->type != HTML_ENTITY_REF_NODE) &&
+- (cur->parent != NULL) &&
+- (cur->parent->name != NULL) &&
+- (cur->parent->name[0] != 'p')) /* p, pre, param */
++ (parent != NULL) &&
++ (parent->name != NULL) &&
++ (parent->name[0] != 'p')) /* p, pre, param */
+ xmlOutputBufferWriteString(buf, "\n");
+ }
+ }
+diff --git a/xmlsave.c b/xmlsave.c
+--- a/xmlsave.c
++++ b/xmlsave.c
+@@ -847,7 +847,7 @@ htmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ static void
+ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ int format = ctxt->format;
+- xmlNodePtr tmp, root, unformattedNode = NULL;
++ xmlNodePtr tmp, root, unformattedNode = NULL, parent;
+ xmlAttrPtr attr;
+ xmlChar *start, *end;
+ xmlOutputBufferPtr buf;
+@@ -856,6 +856,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ buf = ctxt->buf;
+
+ root = cur;
++ parent = cur->parent;
+ while (1) {
+ switch (cur->type) {
+ case XML_DOCUMENT_NODE:
+@@ -868,7 +869,9 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ break;
+
+ case XML_DOCUMENT_FRAG_NODE:
+- if (cur->children != NULL) {
++ /* Always validate cur->parent when descending. */
++ if ((cur->parent == parent) && (cur->children != NULL)) {
++ parent = cur;
+ cur = cur->children;
+ continue;
+ }
+@@ -887,7 +890,18 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ break;
+
+ case XML_ELEMENT_NODE:
+- if ((cur != root) && (ctxt->format == 1) && (xmlIndentTreeOutput))
++ /*
++ * Some users like lxml are known to pass nodes with a corrupted
++ * tree structure. Fall back to a recursive call to handle this
++ * case.
++ */
++ if ((cur->parent != parent) && (cur->children != NULL)) {
++ xmlNodeDumpOutputInternal(ctxt, cur);
++ break;
++ }
++
++ if ((ctxt->level > 0) && (ctxt->format == 1) &&
++ (xmlIndentTreeOutput))
+ xmlOutputBufferWrite(buf, ctxt->indent_size *
+ (ctxt->level > ctxt->indent_nr ?
+ ctxt->indent_nr : ctxt->level),
+@@ -942,6 +956,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ xmlOutputBufferWrite(buf, 1, ">");
+ if (ctxt->format == 1) xmlOutputBufferWrite(buf, 1, "\n");
+ if (ctxt->level >= 0) ctxt->level++;
++ parent = cur;
+ cur = cur->children;
+ continue;
+ }
+@@ -1058,13 +1073,9 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ break;
+ }
+
+- /*
+- * The parent should never be NULL here but we want to handle
+- * corrupted documents gracefully.
+- */
+- if (cur->parent == NULL)
+- return;
+- cur = cur->parent;
++ cur = parent;
++ /* cur->parent was validated when descending. */
++ parent = cur->parent;
+
+ if (cur->type == XML_ELEMENT_NODE) {
+ if (ctxt->level > 0) ctxt->level--;
+diff --git a/xmlsave.c b/xmlsave.c
+--- a/xmlsave.c
++++ b/xmlsave.c
+@@ -890,6 +890,13 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ break;
+
+ case XML_ELEMENT_NODE:
++ if ((cur != root) && (ctxt->format == 1) &&
++ (xmlIndentTreeOutput))
++ xmlOutputBufferWrite(buf, ctxt->indent_size *
++ (ctxt->level > ctxt->indent_nr ?
++ ctxt->indent_nr : ctxt->level),
++ ctxt->indent);
++
+ /*
+ * Some users like lxml are known to pass nodes with a corrupted
+ * tree structure. Fall back to a recursive call to handle this
+@@ -900,13 +907,6 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
+ break;
+ }
+
+- if ((ctxt->level > 0) && (ctxt->format == 1) &&
+- (xmlIndentTreeOutput))
+- xmlOutputBufferWrite(buf, ctxt->indent_size *
+- (ctxt->level > ctxt->indent_nr ?
+- ctxt->indent_nr : ctxt->level),
+- ctxt->indent);
+-
+ xmlOutputBufferWrite(buf, 1, "<");
+ if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
+ xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
diff --git a/gnu/packages/patches/libxml2-terminating-newline.patch b/gnu/packages/patches/libxml2-terminating-newline.patch
new file mode 100644
index 0000000000..3f5c88dd4e
--- /dev/null
+++ b/gnu/packages/patches/libxml2-terminating-newline.patch
@@ -0,0 +1,33 @@
+Fix a regression in 2.9.12 where serializing empty HTML documents would
+not add a terminating newline.
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/issues/266
+
+Taken from upstream:
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/commit/92d9ab4c28842a09ca2b76d3ff2f933e01b6cd6f
+
+diff --git a/HTMLtree.c b/HTMLtree.c
+--- a/HTMLtree.c
++++ b/HTMLtree.c
+@@ -763,11 +763,15 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ if (((xmlDocPtr) cur)->intSubset != NULL) {
+ htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
+ }
+- /* Always validate cur->parent when descending. */
+- if ((cur->parent == parent) && (cur->children != NULL)) {
+- parent = cur;
+- cur = cur->children;
+- continue;
++ if (cur->children != NULL) {
++ /* Always validate cur->parent when descending. */
++ if (cur->parent == parent) {
++ parent = cur;
++ cur = cur->children;
++ continue;
++ }
++ } else {
++ xmlOutputBufferWriteString(buf, "\n");
+ }
+ break;
+
diff --git a/gnu/packages/patches/libxml2-xpath-recursion-limit.patch b/gnu/packages/patches/libxml2-xpath-recursion-limit.patch
new file mode 100644
index 0000000000..051196c635
--- /dev/null
+++ b/gnu/packages/patches/libxml2-xpath-recursion-limit.patch
@@ -0,0 +1,20 @@
+Fix recursion accounting in XPath expressions:
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/issues/264
+
+Taken from upstream:
+
+ https://gitlab.gnome.org/GNOME/libxml2/-/commit/3e1aad4fe584747fd7d17cc7b2863a78e2d21a77
+
+diff --git a/xpath.c b/xpath.c
+--- a/xpath.c
++++ b/xpath.c
+@@ -10983,7 +10983,7 @@ xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) {
+ }
+
+ if (xpctxt != NULL)
+- xpctxt->depth -= 1;
++ xpctxt->depth -= 10;
+ }
+
+ /**
diff --git a/gnu/packages/patches/libxt-guix-search-paths.patch b/gnu/packages/patches/libxt-guix-search-paths.patch
index 5419edd1bd..61022d232a 100644
--- a/gnu/packages/patches/libxt-guix-search-paths.patch
+++ b/gnu/packages/patches/libxt-guix-search-paths.patch
@@ -1,13 +1,9 @@
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
-index c9624ec..addcdba 100644
--- a/src/Intrinsic.c
+++ b/src/Intrinsic.c
-@@ -1312,21 +1312,101 @@ static void FillInLangSubs(
- } else (void) strcpy(*rest, string);
+@@ -1345,21 +1345,99 @@ FillInLangSubs(Substitution subs, XtPerDisplay pd)
}
-+
-+
/*
- * default path used if environment variable XFILESEARCHPATH
- * is not defined. Also substitued for %D.
@@ -24,8 +20,9 @@ index c9624ec..addcdba 100644
+ These values provide the default paths where Guix/GuixSD can expect
+ to find resources for installed packages.
*/
--static const char *implementation_default_path(void)
-+static const char *guix_default_path(void)
+ static const char *
+-implementation_default_path(void)
++guix_default_path(void)
{
-#if defined(WIN32)
- static char xfilesearchpath[] = "";
@@ -115,7 +112,7 @@ index c9624ec..addcdba 100644
}
-@@ -1354,7 +1434,7 @@ _XtString XtResolvePathname(
+@@ -1388,7 +1466,7 @@ XtResolvePathname(Display *dpy,
{
XtPerDisplay pd;
static const char *defaultPath = NULL;
diff --git a/gnu/packages/patches/llvm-3.6-fix-build-with-gcc-10.patch b/gnu/packages/patches/llvm-3.6-fix-build-with-gcc-10.patch
new file mode 100644
index 0000000000..4982587d15
--- /dev/null
+++ b/gnu/packages/patches/llvm-3.6-fix-build-with-gcc-10.patch
@@ -0,0 +1,13 @@
+Adapted from https://github.com/digego/extempore/pull/322/files
+
+--- a/include/llvm/IR/ValueMap.h 2015-08-04 00:30:24.000000000 +0200
++++ b/include/llvm/IR/ValueMap.h 2018-07-14 21:09:09.769502736 +0200
+@@ -99,7 +99,7 @@
+ explicit ValueMap(const ExtraData &Data, unsigned NumInitBuckets = 64)
+ : Map(NumInitBuckets), Data(Data) {}
+
+- bool hasMD() const { return MDMap; }
++ bool hasMD() const { return static_cast<bool>(MDMap); }
+ MDMapT &MD() {
+ if (!MDMap)
+ MDMap.reset(new MDMapT);
diff --git a/gnu/packages/patches/mariadb-CVE-2021-27928.patch b/gnu/packages/patches/mariadb-CVE-2021-27928.patch
deleted file mode 100644
index 39a023c159..0000000000
--- a/gnu/packages/patches/mariadb-CVE-2021-27928.patch
+++ /dev/null
@@ -1,642 +0,0 @@
-From 7580701e6279900fec40822952a3b874732289cf Mon Sep 17 00:00:00 2001
-From: Sergei Golubchik <serg@mariadb.org>
-Date: Thu, 18 Feb 2021 14:20:48 +0100
-Subject: [PATCH] make @@wsrep_provider and @@wsrep_notify_cmd read-only
-
-this should simplify run-time cluster management
----
- mysql-test/suite/galera/disabled.def | 2 +
- .../galera/include/galera_load_provider.inc | 19 --------
- .../galera/include/galera_unload_provider.inc | 3 +-
- .../suite/galera/r/galera_ist_rsync.result | 2 +-
- .../galera/r/galera_sst_mysqldump.result | 2 +-
- .../suite/galera/r/mysql-wsrep#33.result | 2 +-
- .../suite/sys_vars/r/sysvars_wsrep.result | 4 +-
- .../sys_vars/r/wsrep_notify_cmd_basic.result | 47 -------------------
- .../sys_vars/r/wsrep_provider_basic.result | 40 ----------------
- .../r/wsrep_provider_options_basic.result | 46 ------------------
- .../sys_vars/t/wsrep_notify_cmd_basic.test | 43 -----------------
- .../sys_vars/t/wsrep_provider_basic.test | 39 ---------------
- .../t/wsrep_provider_options_basic.test | 41 ----------------
- mysql-test/suite/wsrep/disabled.def | 2 +
- mysql-test/suite/wsrep/r/variables.result | 12 ++---
- mysql-test/suite/wsrep/t/variables.test | 32 +++----------
- sql/sys_vars.cc | 8 ++--
- 17 files changed, 25 insertions(+), 319 deletions(-)
- delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
- delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
- delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
- delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
- delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
- delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
-
-diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
-index d940c702d54..83f26e81636 100644
---- a/mysql-test/suite/galera/disabled.def
-+++ b/mysql-test/suite/galera/disabled.def
-@@ -49,3 +49,5 @@ partition : MDEV-19958 Galera test failure on galera.partition
- query_cache: MDEV-15805 Test failure on galera.query_cache
- sql_log_bin : MDEV-21491 galera.sql_log_bin
- versioning_trx_id : MDEV-18590 galera.versioning_trx_id
-+galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons
-+pxc-421: wsrep_provider is read-only for security reasons
-diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc
-index 0f843597d9c..28010cc5b71 100644
---- a/mysql-test/suite/galera/include/galera_load_provider.inc
-+++ b/mysql-test/suite/galera/include/galera_load_provider.inc
-@@ -1,25 +1,6 @@
- --echo Loading wsrep provider ...
-
- --disable_query_log
----eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
--
--#
--# count occurences of successful node starts in error log
--#
--perl;
-- use strict;
-- my $test_log=$ENV{'LOG_FILE'} or die "LOG_FILE not set";
-- my $test_log_copy=$test_log . '.copy';
-- if (-e $test_log_copy) {
-- unlink $test_log_copy;
-- }
--
--EOF
----copy_file $LOG_FILE $LOG_FILE.copy
--
--#
--# now join to the cluster
--#
- --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
-
- --enable_query_log
-diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc
-index cd841f51fbc..ed7e9bc41f0 100644
---- a/mysql-test/suite/galera/include/galera_unload_provider.inc
-+++ b/mysql-test/suite/galera/include/galera_unload_provider.inc
-@@ -1,7 +1,6 @@
- --echo Unloading wsrep provider ...
-
- --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
----let $wsrep_provider_orig = `SELECT @@wsrep_provider`
- --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
- --let $wsrep_error_log_orig = `SELECT @@log_error`
- if(!$wsrep_log_error_orig)
-@@ -12,4 +11,4 @@ if(!$wsrep_log_error_orig)
- }
- --let LOG_FILE= $wsrep_log_error_orig
-
--SET GLOBAL wsrep_provider = 'none';
-+SET GLOBAL wsrep_cluster_address = '';
-diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result
-index 13f7d898a59..70a87c73df7 100644
---- a/mysql-test/suite/galera/r/galera_ist_rsync.result
-+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result
-@@ -23,7 +23,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
- INSERT INTO t1 VALUES ('node2_committed_before');
- COMMIT;
- Unloading wsrep provider ...
--SET GLOBAL wsrep_provider = 'none';
-+SET GLOBAL wsrep_cluster_address = '';
- connection node_1;
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
-diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
-index 4ed679ba477..145b3a94775 100644
---- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result
-+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
-@@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
- INSERT INTO t1 VALUES ('node2_committed_before');
- COMMIT;
- Unloading wsrep provider ...
--SET GLOBAL wsrep_provider = 'none';
-+SET GLOBAL wsrep_cluster_address = '';
- connection node_1;
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
-diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result
-index fb0b593cc96..45c6a3f660a 100644
---- a/mysql-test/suite/galera/r/mysql-wsrep#33.result
-+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result
-@@ -32,7 +32,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
- INSERT INTO t1 VALUES ('node2_committed_before');
- COMMIT;
- Unloading wsrep provider ...
--SET GLOBAL wsrep_provider = 'none';
-+SET GLOBAL wsrep_cluster_address = '';
- connection node_1;
- SET AUTOCOMMIT=OFF;
- START TRANSACTION;
-diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
-index 4b6abf85434..f73bfbd13e7 100644
---- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
-+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
-@@ -403,7 +403,7 @@ NUMERIC_MIN_VALUE NULL
- NUMERIC_MAX_VALUE NULL
- NUMERIC_BLOCK_SIZE NULL
- ENUM_VALUE_LIST NULL
--READ_ONLY NO
-+READ_ONLY YES
- COMMAND_LINE_ARGUMENT REQUIRED
- GLOBAL_VALUE_PATH NULL
- VARIABLE_NAME WSREP_ON
-@@ -463,7 +463,7 @@ NUMERIC_MIN_VALUE NULL
- NUMERIC_MAX_VALUE NULL
- NUMERIC_BLOCK_SIZE NULL
- ENUM_VALUE_LIST NULL
--READ_ONLY NO
-+READ_ONLY YES
- COMMAND_LINE_ARGUMENT REQUIRED
- GLOBAL_VALUE_PATH NULL
- VARIABLE_NAME WSREP_PROVIDER_OPTIONS
-diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
-deleted file mode 100644
-index 056ff8c817b..00000000000
---- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result
-+++ /dev/null
-@@ -1,47 +0,0 @@
--#
--# wsrep_notify_cmd
--#
--call mtr.add_suppression("WSREP: Failed to get provider options");
--# save the initial value
--SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd;
--# default
--SELECT @@global.wsrep_notify_cmd;
--@@global.wsrep_notify_cmd
--
--
--# scope
--SELECT @@session.wsrep_notify_cmd;
--ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable
--SET @@global.wsrep_notify_cmd='notify_cmd';
--SELECT @@global.wsrep_notify_cmd;
--@@global.wsrep_notify_cmd
--notify_cmd
--
--# valid values
--SET @@global.wsrep_notify_cmd='command';
--SELECT @@global.wsrep_notify_cmd;
--@@global.wsrep_notify_cmd
--command
--SET @@global.wsrep_notify_cmd='hyphenated-command';
--SELECT @@global.wsrep_notify_cmd;
--@@global.wsrep_notify_cmd
--hyphenated-command
--SET @@global.wsrep_notify_cmd=default;
--SELECT @@global.wsrep_notify_cmd;
--@@global.wsrep_notify_cmd
--
--SET @@global.wsrep_notify_cmd=NULL;
--SELECT @@global.wsrep_notify_cmd;
--@@global.wsrep_notify_cmd
--NULL
--
--# invalid values
--SET @@global.wsrep_notify_cmd=1;
--ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd'
--SELECT @@global.wsrep_notify_cmd;
--@@global.wsrep_notify_cmd
--NULL
--
--# restore the initial value
--SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved;
--# End of test
-diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
-deleted file mode 100644
-index 3e4ac8ca883..00000000000
---- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result
-+++ /dev/null
-@@ -1,40 +0,0 @@
--#
--# wsrep_provider
--#
--# save the initial value
--SET @wsrep_provider_global_saved = @@global.wsrep_provider;
--# default
--SELECT @@global.wsrep_provider;
--@@global.wsrep_provider
--none
--
--# scope
--SELECT @@session.wsrep_provider;
--ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable
--SELECT @@global.wsrep_provider;
--@@global.wsrep_provider
--none
--
--# valid values
--SET @@global.wsrep_provider=default;
--SELECT @@global.wsrep_provider;
--@@global.wsrep_provider
--none
--
--# invalid values
--SET @@global.wsrep_provider='/invalid/libgalera_smm.so';
--ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so'
--SET @@global.wsrep_provider=NULL;
--ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL'
--SELECT @@global.wsrep_provider;
--@@global.wsrep_provider
--none
--SET @@global.wsrep_provider=1;
--ERROR 42000: Incorrect argument type to variable 'wsrep_provider'
--SELECT @@global.wsrep_provider;
--@@global.wsrep_provider
--none
--
--# restore the initial value
--SET @@global.wsrep_provider = @wsrep_provider_global_saved;
--# End of test
-diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
-deleted file mode 100644
-index 15949a14e39..00000000000
---- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result
-+++ /dev/null
-@@ -1,46 +0,0 @@
--#
--# wsrep_provider_options
--#
--call mtr.add_suppression("WSREP: Failed to get provider options");
--# default
--SELECT @@global.wsrep_provider_options;
--@@global.wsrep_provider_options
--
--
--# scope
--SELECT @@session.wsrep_provider_options;
--ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable
--SET @@global.wsrep_provider_options='option1';
--SELECT @@global.wsrep_provider_options;
--@@global.wsrep_provider_options
--
--
--# valid values
--SET @@global.wsrep_provider_options='name1=value1;name2=value2';
--ERROR HY000: WSREP (galera) not started
--SELECT @@global.wsrep_provider_options;
--@@global.wsrep_provider_options
--
--SET @@global.wsrep_provider_options='hyphenated-name:value';
--ERROR HY000: WSREP (galera) not started
--SELECT @@global.wsrep_provider_options;
--@@global.wsrep_provider_options
--
--SET @@global.wsrep_provider_options=default;
--ERROR HY000: WSREP (galera) not started
--SELECT @@global.wsrep_provider_options;
--@@global.wsrep_provider_options
--
--
--# invalid values
--SET @@global.wsrep_provider_options=1;
--ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options'
--SELECT @@global.wsrep_provider_options;
--@@global.wsrep_provider_options
--
--SET @@global.wsrep_provider_options=NULL;
--Got one of the listed errors
--SELECT @@global.wsrep_provider_options;
--@@global.wsrep_provider_options
--
--# End of test
-diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
-deleted file mode 100644
-index 6d1535ba148..00000000000
---- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test
-+++ /dev/null
-@@ -1,43 +0,0 @@
----source include/have_wsrep.inc
--
----echo #
----echo # wsrep_notify_cmd
----echo #
--
--call mtr.add_suppression("WSREP: Failed to get provider options");
--
----echo # save the initial value
--SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd;
--
----echo # default
--SELECT @@global.wsrep_notify_cmd;
--
----echo
----echo # scope
----error ER_INCORRECT_GLOBAL_LOCAL_VAR
--SELECT @@session.wsrep_notify_cmd;
--SET @@global.wsrep_notify_cmd='notify_cmd';
--SELECT @@global.wsrep_notify_cmd;
--
----echo
----echo # valid values
--SET @@global.wsrep_notify_cmd='command';
--SELECT @@global.wsrep_notify_cmd;
--SET @@global.wsrep_notify_cmd='hyphenated-command';
--SELECT @@global.wsrep_notify_cmd;
--SET @@global.wsrep_notify_cmd=default;
--SELECT @@global.wsrep_notify_cmd;
--SET @@global.wsrep_notify_cmd=NULL;
--SELECT @@global.wsrep_notify_cmd;
--
----echo
----echo # invalid values
----error ER_WRONG_TYPE_FOR_VAR
--SET @@global.wsrep_notify_cmd=1;
--SELECT @@global.wsrep_notify_cmd;
--
----echo
----echo # restore the initial value
--SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved;
--
----echo # End of test
-diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
-deleted file mode 100644
-index 1190ab41bb0..00000000000
---- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test
-+++ /dev/null
-@@ -1,39 +0,0 @@
----source include/have_wsrep.inc
--
----echo #
----echo # wsrep_provider
----echo #
--
----echo # save the initial value
--SET @wsrep_provider_global_saved = @@global.wsrep_provider;
--
----echo # default
--SELECT @@global.wsrep_provider;
--
----echo
----echo # scope
----error ER_INCORRECT_GLOBAL_LOCAL_VAR
--SELECT @@session.wsrep_provider;
--SELECT @@global.wsrep_provider;
--
----echo
----echo # valid values
--SET @@global.wsrep_provider=default;
--SELECT @@global.wsrep_provider;
--
----echo
----echo # invalid values
----error ER_WRONG_VALUE_FOR_VAR
--SET @@global.wsrep_provider='/invalid/libgalera_smm.so';
----error ER_WRONG_VALUE_FOR_VAR
--SET @@global.wsrep_provider=NULL;
--SELECT @@global.wsrep_provider;
----error ER_WRONG_TYPE_FOR_VAR
--SET @@global.wsrep_provider=1;
--SELECT @@global.wsrep_provider;
--
----echo
----echo # restore the initial value
--SET @@global.wsrep_provider = @wsrep_provider_global_saved;
--
----echo # End of test
-diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
-deleted file mode 100644
-index 6eb3a94b6a4..00000000000
---- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test
-+++ /dev/null
-@@ -1,41 +0,0 @@
----source include/have_wsrep.inc
--
----echo #
----echo # wsrep_provider_options
----echo #
--
--call mtr.add_suppression("WSREP: Failed to get provider options");
--
----echo # default
--SELECT @@global.wsrep_provider_options;
--
----echo
----echo # scope
----error ER_INCORRECT_GLOBAL_LOCAL_VAR
--SELECT @@session.wsrep_provider_options;
----error 0,ER_WRONG_ARGUMENTS
--SET @@global.wsrep_provider_options='option1';
--SELECT @@global.wsrep_provider_options;
--
----echo
----echo # valid values
----error ER_WRONG_ARGUMENTS
--SET @@global.wsrep_provider_options='name1=value1;name2=value2';
--SELECT @@global.wsrep_provider_options;
----error ER_WRONG_ARGUMENTS
--SET @@global.wsrep_provider_options='hyphenated-name:value';
--SELECT @@global.wsrep_provider_options;
----error ER_WRONG_ARGUMENTS
--SET @@global.wsrep_provider_options=default;
--SELECT @@global.wsrep_provider_options;
--
----echo
----echo # invalid values
----error ER_WRONG_TYPE_FOR_VAR
--SET @@global.wsrep_provider_options=1;
--SELECT @@global.wsrep_provider_options;
----error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS
--SET @@global.wsrep_provider_options=NULL;
--SELECT @@global.wsrep_provider_options;
--
----echo # End of test
-diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
-index 11577bfe8b0..3d204db6945 100644
---- a/mysql-test/suite/wsrep/disabled.def
-+++ b/mysql-test/suite/wsrep/disabled.def
-@@ -10,3 +10,5 @@
- #
- ##############################################################################
-
-+
-+mdev_6832: wsrep_provider is read-only for security reasons
-diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
-index a9988fd1628..e57440125ee 100644
---- a/mysql-test/suite/wsrep/r/variables.result
-+++ b/mysql-test/suite/wsrep/r/variables.result
-@@ -14,7 +14,6 @@ SET SESSION wsrep_replicate_myisam= ON;
- ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL
- SET GLOBAL wsrep_replicate_myisam= ON;
- SET GLOBAL wsrep_replicate_myisam= OFF;
--SET GLOBAL wsrep_provider=none;
- #
- # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
- # variables when using "_"
-@@ -151,7 +150,6 @@ wsrep_local_state_comment #
- # Should show nothing.
- SHOW STATUS LIKE 'x';
- Variable_name Value
--SET GLOBAL wsrep_provider=none;
-
- SHOW STATUS LIKE 'wsrep_local_state_uuid';
- Variable_name Value
-@@ -160,7 +158,6 @@ wsrep_local_state_uuid #
- SHOW STATUS LIKE 'wsrep_last_committed';
- Variable_name Value
- wsrep_last_committed #
--SET GLOBAL wsrep_provider=none;
-
- #
- # MDEV#6206: wsrep_slave_threads subtracts from max_connections
-@@ -174,7 +171,7 @@ SELECT @@global.wsrep_slave_threads;
- 1
- SELECT @@global.wsrep_cluster_address;
- @@global.wsrep_cluster_address
--
-+gcomm://
- SELECT @@global.wsrep_on;
- @@global.wsrep_on
- 1
-@@ -183,14 +180,14 @@ Variable_name Value
- Threads_connected 1
- SHOW STATUS LIKE 'wsrep_thread_count';
- Variable_name Value
--wsrep_thread_count 0
-+wsrep_thread_count 2
-
- SELECT @@global.wsrep_provider;
- @@global.wsrep_provider
- libgalera_smm.so
- SELECT @@global.wsrep_cluster_address;
- @@global.wsrep_cluster_address
--
-+gcomm://
- SELECT @@global.wsrep_on;
- @@global.wsrep_on
- 1
-@@ -199,11 +196,10 @@ Variable_name Value
- Threads_connected 1
- SHOW STATUS LIKE 'wsrep_thread_count';
- Variable_name Value
--wsrep_thread_count 0
-+wsrep_thread_count 2
-
- # Setting wsrep_cluster_address triggers the creation of
- # applier/rollbacker threads.
--SET GLOBAL wsrep_cluster_address= 'gcomm://';
- # Wait for applier thread to get created 1.
- # Wait for applier thread to get created 2.
- SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
-index f2c3a0a3b78..fd352b61a3a 100644
---- a/mysql-test/suite/wsrep/t/variables.test
-+++ b/mysql-test/suite/wsrep/t/variables.test
-@@ -23,7 +23,7 @@ SET GLOBAL wsrep_replicate_myisam= ON;
-
- # Reset it back.
- SET GLOBAL wsrep_replicate_myisam= OFF;
--SET GLOBAL wsrep_provider=none;
-+#SET GLOBAL wsrep_provider=none;
-
- --echo #
- --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
-@@ -32,9 +32,6 @@ SET GLOBAL wsrep_provider=none;
-
- CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");
-
----disable_query_log
--eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
----enable_query_log
-
- --replace_column 2 #
- SHOW GLOBAL STATUS LIKE 'wsrep%';
-@@ -50,11 +47,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
- SHOW STATUS LIKE 'x';
-
- # Reset it back.
--SET GLOBAL wsrep_provider=none;
-+#SET GLOBAL wsrep_provider=none;
-
----disable_query_log
--eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
----enable_query_log
-+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
-
- # The following 2 variables are used by mariabackup
- # SST.
-@@ -66,7 +61,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid';
- SHOW STATUS LIKE 'wsrep_last_committed';
-
- # Reset it back.
--SET GLOBAL wsrep_provider=none;
-+#SET GLOBAL wsrep_provider=none;
-
- --echo
- --echo #
-@@ -74,9 +69,7 @@ SET GLOBAL wsrep_provider=none;
- --echo #
- call mtr.add_suppression("WSREP: Failed to get provider options");
-
----disable_query_log
--eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
----enable_query_log
-+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
-
- --replace_regex /.*libgalera_smm.*/libgalera_smm.so/
- SELECT @@global.wsrep_provider;
-@@ -87,9 +80,7 @@ SHOW STATUS LIKE 'threads_connected';
- SHOW STATUS LIKE 'wsrep_thread_count';
- --echo
-
----disable_query_log
--eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
----enable_query_log
-+#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
-
- --replace_regex /.*libgalera_smm.*/libgalera_smm.so/
- SELECT @@global.wsrep_provider;
-@@ -101,7 +92,7 @@ SHOW STATUS LIKE 'wsrep_thread_count';
-
- --echo # Setting wsrep_cluster_address triggers the creation of
- --echo # applier/rollbacker threads.
--SET GLOBAL wsrep_cluster_address= 'gcomm://';
-+#SET GLOBAL wsrep_cluster_address= 'gcomm://';
-
- --echo # Wait for applier thread to get created 1.
- --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
-@@ -162,15 +153,6 @@ SET @@global.wsrep_sst_auth= NULL;
- SELECT @@global.wsrep_sst_auth;
- SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
-
--# Reset (for mtr internal checks)
--
----disable_query_log
--SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
--eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
--SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
----enable_query_log
--
- --source include/galera_wait_ready.inc
-
- --echo # End of test.
-diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
-index 64040243df0..8c67a4d432a 100644
---- a/sql/sys_vars.cc
-+++ b/sql/sys_vars.cc
-@@ -5669,8 +5669,8 @@ static Sys_var_tz Sys_time_zone(
-
- static Sys_var_charptr_fscs Sys_wsrep_provider(
- "wsrep_provider", "Path to replication provider library",
-- PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
-- DEFAULT(WSREP_NONE),
-+ PREALLOCATED READ_ONLY GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG),
-+ DEFAULT(WSREP_NONE),
- NO_MUTEX_GUARD, NOT_IN_BINLOG,
- ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update));
-
-@@ -5886,8 +5886,8 @@ static Sys_var_ulong Sys_wsrep_max_ws_rows (
-
- static Sys_var_charptr Sys_wsrep_notify_cmd(
- "wsrep_notify_cmd", "",
-- GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG),
-- DEFAULT(""));
-+ READ_ONLY GLOBAL_VAR(wsrep_notify_cmd), CMD_LINE(REQUIRED_ARG),
-+ DEFAULT(""));
-
- static Sys_var_mybool Sys_wsrep_certify_nonPK(
- "wsrep_certify_nonPK", "Certify tables with no primary key",
---
-2.31.0
-
diff --git a/gnu/packages/patches/mesa-opencl-all-targets.patch b/gnu/packages/patches/mesa-opencl-all-targets.patch
new file mode 100644
index 0000000000..99d4abcea4
--- /dev/null
+++ b/gnu/packages/patches/mesa-opencl-all-targets.patch
@@ -0,0 +1,25 @@
+This patch restores LLVM targets needed for OpenCL, *reverting* this
+upstream commit:
+
+ From 80817b6e344258ac9b955f824ebf9019a0fc1610 Mon Sep 17 00:00:00 2001
+ From: Jesse Natalie <jenatali@microsoft.com>
+ Date: Wed, 18 Nov 2020 18:30:30 -0800
+ Subject: [PATCH] meson: Adjust Clover's required LLVM modules
+
+diff --git a/meson.build b/meson.build
+index 6d1607c35a3..f828eb80faa 100644
+--- b/meson.build
++++ a/meson.build
+@@ -1479,10 +1479,9 @@
+ endif
+ if with_gallium_opencl
+ llvm_modules += [
+- 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
+- 'lto', 'option', 'objcarcopts', 'profiledata'
++ 'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
++ 'lto', 'option', 'objcarcopts', 'profiledata',
+ ]
+- llvm_optional_modules += ['frontendopenmp']
+ endif
+ if with_microsoft_clc
+ llvm_modules += ['target', 'linker', 'irreader', 'option', 'libdriver']
diff --git a/gnu/packages/patches/mesa-skip-tests.patch b/gnu/packages/patches/mesa-skip-tests.patch
index 2622d5d312..7ff571dcf5 100644
--- a/gnu/packages/patches/mesa-skip-tests.patch
+++ b/gnu/packages/patches/mesa-skip-tests.patch
@@ -1,23 +1,3 @@
-disk_cache_create() here looks up the users home directory from <pwd.h>
-which resolves to "/" in the build environment. I could not find an easy
-way to set the home directory to something else, so we disable this test
-for now.
-
---- a/src/compiler/glsl/tests/cache_test.c
-+++ b/src/compiler/glsl/tests/cache_test.c
-@@ -170,11 +170,6 @@
- unsetenv("MESA_GLSL_CACHE_DIR");
- unsetenv("XDG_CACHE_HOME");
-
-- cache = disk_cache_create("test", "make_check", 0);
-- expect_non_null(cache, "disk_cache_create with no environment variables");
--
-- disk_cache_destroy(cache);
--
- /* Test with XDG_CACHE_HOME set */
- setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
- cache = disk_cache_create("test", "make_check", 0);
-
This test fails on i686-linux. I couldn't come up with a regex that
could be used to disable it just on i686-linux, so we disable it
completely with this patch:
@@ -25,25 +5,15 @@ completely with this patch:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/4091
diff --git a/src/util/meson.build b/src/util/meson.build
-index 0893f64..909b3e0 100644
+index 319b22d9bf7..93790c72675 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
-@@ -289,18 +289,6 @@ if with_tests
- suite : ['util'],
- )
+@@ -344,7 +344,7 @@ if with_tests
+ )
+ endif
-- test(
-- 'u_debug_stack',
-- executable(
-- 'u_debug_stack_test',
-- files('u_debug_stack_test.cpp'),
-- include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
-- dependencies : [idep_mesautil, idep_gtest],
-- c_args : [c_msvc_compat_args],
-- ),
-- suite : ['util'],
-- )
--
- process_test_exe = executable(
- 'process_test',
- files('process_test.c'),
+- foreach t: ['bitset', 'register_allocate', 'u_debug_stack', 'u_qsort']
++ foreach t: ['bitset', 'register_allocate', 'u_qsort']
+ test(
+ t,
+ executable(
diff --git a/gnu/packages/patches/meson-allow-dirs-outside-of-prefix.patch b/gnu/packages/patches/meson-allow-dirs-outside-of-prefix.patch
new file mode 100644
index 0000000000..f16daa8009
--- /dev/null
+++ b/gnu/packages/patches/meson-allow-dirs-outside-of-prefix.patch
@@ -0,0 +1,20 @@
+Source: https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch
+--- a/mesonbuild/coredata.py
++++ b/mesonbuild/coredata.py
+@@ -506,7 +506,6 @@ class CoreData:
+ return value
+ if option.name.endswith('dir') and value.is_absolute() and \
+ option not in BULITIN_DIR_NOPREFIX_OPTIONS:
+- # Value must be a subdir of the prefix
+ # commonpath will always return a path in the native format, so we
+ # must use pathlib.PurePath to do the same conversion before
+ # comparing.
+@@ -518,7 +517,7 @@ class CoreData:
+ try:
+ value = value.relative_to(prefix)
+ except ValueError:
+- raise MesonException(msg.format(option, value, prefix))
++ pass
+ if '..' in str(value):
+ raise MesonException(msg.format(option, value, prefix))
+ return value.as_posix()
diff --git a/gnu/packages/patches/meson-for-build-rpath.patch b/gnu/packages/patches/meson-for-build-rpath.patch
deleted file mode 100644
index ef9a73f07c..0000000000
--- a/gnu/packages/patches/meson-for-build-rpath.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-This patch removes a part of meson that clears the rpath upon installation.
-This will only be applied to a special version of meson, used for the
-meson-build-system.
-
-Original patch for Meson 0.42.0 by Peter Mikkelsen <petermikkelsen10@gmail.com>
-
---- meson-0.47.1/mesonbuild/minstall.py.old 2018-08-10 11:01:27.812327013 +0200
-+++ meson-0.47.1/mesonbuild/minstall.py 2018-08-10 11:01:51.940368505 +0200
-@@ -436,15 +436,6 @@
- print("Symlink creation does not work on this platform. "
- "Skipping all symlinking.")
- printed_symlink_error = True
-- if os.path.isfile(outname):
-- try:
-- depfixer.fix_rpath(outname, install_rpath, final_path,
-- install_name_mappings, verbose=False)
-- except SystemExit as e:
-- if isinstance(e.code, int) and e.code == 0:
-- pass
-- else:
-- raise
-
- def run(args):
- parser = buildparser()
diff --git a/gnu/packages/patches/metabat-fix-compilation.patch b/gnu/packages/patches/metabat-fix-compilation.patch
deleted file mode 100644
index 7086a96e86..0000000000
--- a/gnu/packages/patches/metabat-fix-compilation.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-This patch changes metabat so that (1) it is not build statically, (2) it uses
-shared libraries rather than static libraries where possible.
-
-diff --git a/SConstruct b/SConstruct
-index 69cdc0a..ac99bcb 100644
---- a/SConstruct
-+++ b/SConstruct
-@@ -26,8 +26,6 @@ debug = ARGUMENTS.get('DEBUG', None)
- build_flags = ['-Wall', '-g', '-std=c++11', '-fopenmp']
- link_flags = ['-lstdc++', '-lm', '-fopenmp']
-
--if platform.platform(True, True).find('Darwin') == -1:
-- link_flags.extend(['-static', '-static-libgcc', '-static-libstdc++'])
-
- if debug is None:
- build_flags.extend(['-O3', '-DNDEBUG', '-Wno-unknown-pragmas', '-Wno-deprecated-declarations', '-Wno-overflow', '-Wno-unused-variable'])
-@@ -110,17 +108,17 @@ def findStaticOrShared( lib, testPaths, static_source_list, link_flag_list, stat
- for path in testPaths:
- if not os.path.isdir(path):
- continue
-+ for testfile in ('%s/lib%s.so' % (path, lib), '%s/lib%s.dylib' % (path, lib)):
-+ if os.path.isfile(testfile):
-+ print "Found shared library %s as %s" % (lib, testfile)
-+ link_flag_list.extend( ["-L%s" % (path), "-l%s" % (lib) ] )
-+ return
- for suffix in staticSuffixes:
- testfile = '%s/lib%s%s' % (path, lib, suffix)
- if os.path.isfile(testfile):
- static_source_list.append(testfile)
- print "Found static library %s as %s" % (lib, testfile)
- return
-- for testfile in ('%s/lib%s.so' % (path, lib), '%s/lib%s.dylib' % (path, lib)):
-- if os.path.isfile(testfile):
-- print "Found shared library %s as %s" % (lib, testfile)
-- link_flag_list.extend( ["-L%s" % (path), "-l%s" % (lib) ] )
-- return
- print "Could not find library for %s!!! Looked in %s" % (lib, testPaths)
- return
-
diff --git a/gnu/packages/patches/mit-krb5-hurd.patch b/gnu/packages/patches/mit-krb5-hurd.patch
index d4962b1e60..449320cea4 100644
--- a/gnu/packages/patches/mit-krb5-hurd.patch
+++ b/gnu/packages/patches/mit-krb5-hurd.patch
@@ -148,18 +148,3 @@ index 7e981d4..d83b3b6 100644
+# define MAXPATHLEN 4096
+#endif
#endif /* _DB_INT_H_ */
-diff --git a/src/tests/resolve/resolve.c b/src/tests/resolve/resolve.c
-index 7339d21..38f7253 100644
---- a/src/tests/resolve/resolve.c
-+++ b/src/tests/resolve/resolve.c
-@@ -73,6 +73,10 @@ char *strchr();
- #include <netinet/in.h>
- #include <netdb.h>
-
-+#ifndef MAXHOSTNAMELEN
-+# define MAXHOSTNAMELEN 256
-+#endif
-+
- int
- main(argc, argv)
- int argc;
diff --git a/gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch b/gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch
deleted file mode 100644
index 491a358731..0000000000
--- a/gnu/packages/patches/mit-krb5-qualify-short-hostnames.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Fix a null pointer dereference when no DNS search path is configured.
-This showed up as a segfault while running the gsasl test suite.
-
-Taken from upstream:
-https://github.com/krb5/krb5/commit/cd82bf377e7fad2409c76bf8b241920692f34fda
-
-diff --git a/src/lib/krb5/os/dnsglue.c b/src/lib/krb5/os/dnsglue.c
-index e35ca9d76c..0cd213fdd7 100644
---- a/src/lib/krb5/os/dnsglue.c
-+++ b/src/lib/krb5/os/dnsglue.c
-@@ -91,7 +91,7 @@ static int initparse(struct krb5int_dns_state *);
- #define DECLARE_HANDLE(h) struct __res_state h
- #define INIT_HANDLE(h) (memset(&h, 0, sizeof(h)), res_ninit(&h) == 0)
- #define SEARCH(h, n, c, t, a, l) res_nsearch(&h, n, c, t, a, l)
--#define PRIMARY_DOMAIN(h) strdup(h.dnsrch[0])
-+#define PRIMARY_DOMAIN(h) ((h.dnsrch[0] == NULL) ? NULL : strdup(h.dnsrch[0]))
- #if HAVE_RES_NDESTROY
- #define DESTROY_HANDLE(h) res_ndestroy(&h)
- #else
-@@ -104,7 +104,8 @@ static int initparse(struct krb5int_dns_state *);
- #define DECLARE_HANDLE(h)
- #define INIT_HANDLE(h) (res_init() == 0)
- #define SEARCH(h, n, c, t, a, l) res_search(n, c, t, a, l)
--#define PRIMARY_DOMAIN(h) strdup(_res.defdname)
-+#define PRIMARY_DOMAIN(h) \
-+ ((_res.defdname == NULL) ? NULL : strdup(_res.defdname))
- #define DESTROY_HANDLE(h)
-
- #endif
diff --git a/gnu/packages/patches/mpg321-gcc-10.patch b/gnu/packages/patches/mpg321-gcc-10.patch
new file mode 100644
index 0000000000..8966d9f7c8
--- /dev/null
+++ b/gnu/packages/patches/mpg321-gcc-10.patch
@@ -0,0 +1,83 @@
+From f930c3b81bdf9c05152fb005562b3869f6e36f34 Mon Sep 17 00:00:00 2001
+From: "Azamat H. Hackimov" <azamat.hackimov@gmail.com>
+Date: Thu, 4 Jun 2020 20:41:25 +0300
+Subject: [PATCH] Fix GCC10 compilation
+
+---
+ mpg321.c | 8 ++++++++
+ mpg321.h | 16 ++++++++--------
+ 2 files changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/mpg321.c b/mpg321.c
+index 19282bb..663882e 100644
+--- a/mpg321.c
++++ b/mpg321.c
+@@ -63,6 +63,14 @@
+ #include <pthread.h>
+ #include <semaphore.h>
+
++output_frame *Output_Queue;
++decoded_frames *Decoded_Frames;
++int semarray;
++int mad_decoder_position;
++int output_buffer_position;
++double real[FFT_BUFFER_SIZE];
++double imag[FFT_BUFFER_SIZE];
++int loop_remaining;
+
+ int pflag = 0;
+ int volume = 0;
+diff --git a/mpg321.h b/mpg321.h
+index 798bff0..235cf4a 100644
+--- a/mpg321.h
++++ b/mpg321.h
+@@ -116,7 +116,7 @@ extern char *playlist_file;
+ extern int quit_now;
+ extern char remote_input_buf[PATH_MAX + 5];
+ extern int file_change;
+-int loop_remaining;
++extern int loop_remaining;
+
+ extern int status;
+ extern int scrobbler_time;
+@@ -233,8 +233,8 @@ RETSIGTYPE handle_sigchld(int sig);
+ #define FFT_BUFFER_SIZE_LOG 9
+ #define FFT_BUFFER_SIZE (1 << FFT_BUFFER_SIZE_LOG) /* 512 */
+ /*Temporary data stores to perform FFT in */
+-double real[FFT_BUFFER_SIZE];
+-double imag[FFT_BUFFER_SIZE];
++extern double real[FFT_BUFFER_SIZE];
++extern double imag[FFT_BUFFER_SIZE];
+
+ typedef struct {
+ double real[FFT_BUFFER_SIZE];
+@@ -258,10 +258,10 @@ fft_state *fft_init(void);
+ /* Output buffer process */
+ void frame_buffer_p();
+ /* Semaphore array */
+-int semarray;
++extern int semarray;
+ /* Input/Output buffer position */
+-int mad_decoder_position;
+-int output_buffer_position;
++extern int mad_decoder_position;
++extern int output_buffer_position;
+ /* Output Frame including needed information */
+ typedef struct {
+ unsigned char data[4*1152];
+@@ -285,10 +285,10 @@ typedef struct {
+ } decoded_frames;
+
+ /* Output frame queue pointer */
+-output_frame *Output_Queue;
++extern output_frame *Output_Queue;
+
+ /* Shared total decoded frames */
+-decoded_frames *Decoded_Frames;
++extern decoded_frames *Decoded_Frames;
+
+ #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
+ /* */
+--
+2.26.2
+
diff --git a/gnu/packages/patches/network-manager-meson.patch b/gnu/packages/patches/network-manager-meson.patch
new file mode 100644
index 0000000000..1056d40ede
--- /dev/null
+++ b/gnu/packages/patches/network-manager-meson.patch
@@ -0,0 +1,21 @@
+Since libnm-wwan.so is not just a loadable module but also a shared library
+that some plugin links against, build it as a shared library while avoiding
+'-Wl,--no-undefined':
+
+ https://github.com/mesonbuild/meson/issues/9492#issuecomment-973117289
+
+diff --git a/src/core/devices/wwan/meson.build b/src/core/devices/wwan/meson.build
+index 37ef738..18ac54f 100644
+--- a/src/core/devices/wwan/meson.build
++++ b/src/core/devices/wwan/meson.build
+@@ -4,8 +4,9 @@ wwan_inc = include_directories('.')
+
+ linker_script = join_paths(meson.current_source_dir(), 'libnm-wwan.ver')
+
+-libnm_wwan = shared_module(
++libnm_wwan = shared_library(
+ 'nm-wwan',
++ override_options: ['b_lundef=false'],
+ sources: files(
+ 'nm-service-providers.c',
+ 'nm-modem-broadband.c',
diff --git a/gnu/packages/patches/network-manager-plugin-path.patch b/gnu/packages/patches/network-manager-plugin-path.patch
index 505ae31534..ec6767aaac 100644
--- a/gnu/packages/patches/network-manager-plugin-path.patch
+++ b/gnu/packages/patches/network-manager-plugin-path.patch
@@ -3,49 +3,40 @@ From: =?UTF-8?q?Tom=C3=A1=C5=A1=20=C4=8Cech?= <sleep_walker@gnu.org>
Date: Wed, 3 Jul 2019 13:31:54 +0200
Subject: [PATCH] respect NM_VPN_PLUGIN_DIR
----
- src/vpn/nm-vpn-manager.c | 14 ++++++++++++++
- 1 file changed, 14 insertions(+)
-
-diff --git a/src/vpn/nm-vpn-manager.c b/src/vpn/nm-vpn-manager.c
-index d063916..d779166 100644
---- a/src/vpn/nm-vpn-manager.c
-+++ b/src/vpn/nm-vpn-manager.c
-@@ -223,6 +223,7 @@ nm_vpn_manager_init (NMVpnManager *self)
- GSList *infos, *info;
- const char *conf_dir_etc = _nm_vpn_plugin_info_get_default_dir_etc ();
- const char *conf_dir_lib = _nm_vpn_plugin_info_get_default_dir_lib ();
-+ const char *conf_dir_user = _nm_vpn_plugin_info_get_default_dir_user ();
+--- a/src/core/vpn/nm-vpn-manager.c 2021-10-29 13:20:01.062917840 -0400
++++ b/src/core/vpn/nm-vpn-manager.c 2021-10-29 13:26:46.094397018 -0400
+@@ -211,6 +211,7 @@
+ GSList * infos, *info;
+ const char * conf_dir_etc = _nm_vpn_plugin_info_get_default_dir_etc();
+ const char * conf_dir_lib = _nm_vpn_plugin_info_get_default_dir_lib();
++ const char * conf_dir_user = _nm_vpn_plugin_info_get_default_dir_user ();
- /* Watch the VPN directory for changes */
- file = g_file_new_for_path (conf_dir_lib);
-@@ -241,6 +242,14 @@ nm_vpn_manager_init (NMVpnManager *self)
- G_CALLBACK (vpn_dir_changed), self);
- }
+ /* Watch the VPN directory for changes */
+ file = g_file_new_for_path(conf_dir_lib);
+@@ -229,6 +230,14 @@
+ g_signal_connect(priv->monitor_etc, "changed", G_CALLBACK(vpn_dir_changed), self);
+ }
-+ file = g_file_new_for_path (conf_dir_user);
-+ priv->monitor_etc = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
-+ g_object_unref (file);
-+ if (priv->monitor_etc) {
-+ priv->monitor_id_etc = g_signal_connect (priv->monitor_etc, "changed",
-+ G_CALLBACK (vpn_dir_changed), self);
-+ }
++ file = g_file_new_for_path (conf_dir_user);
++ priv->monitor_etc = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
++ g_object_unref (file);
++ if (priv->monitor_etc) {
++ priv->monitor_id_etc =
++ g_signal_connect (priv->monitor_etc, "changed", G_CALLBACK (vpn_dir_changed), self);
++ }
+
- /* first read conf_dir_lib. The name files are not really user configuration, but
- * plugin configuration. Hence we expect ~newer~ plugins to install their files
- * in /usr/lib/NetworkManager. We want to prefer those files.
-@@ -255,6 +264,11 @@ nm_vpn_manager_init (NMVpnManager *self)
- try_add_plugin (self, info->data);
- g_slist_free_full (infos, g_object_unref);
+ /* first read conf_dir_lib. The name files are not really user configuration, but
+ * plugin configuration. Hence we expect ~newer~ plugins to install their files
+ * in /usr/lib/NetworkManager. We want to prefer those files.
+@@ -243,6 +252,11 @@
+ try_add_plugin(self, info->data);
+ g_slist_free_full(infos, g_object_unref);
-+ infos = _nm_vpn_plugin_info_list_load_dir (conf_dir_user, TRUE, 0, NULL, NULL);
-+ for (info = infos; info; info = info->next)
-+ try_add_plugin (self, info->data);
-+ g_slist_free_full (infos, g_object_unref);
++ infos = _nm_vpn_plugin_info_list_load_dir(conf_dir_user, TRUE, 0, NULL, NULL);
++ for (info = infos; info; info = info->next)
++ try_add_plugin (self, info->data);
++ g_slist_free_full (infos, g_object_unref);
+
- priv->active_services = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
+ priv->active_services = g_hash_table_new_full(nm_str_hash, g_str_equal, g_free, NULL);
}
---
-2.22.0
-
diff --git a/gnu/packages/patches/nss-getcwd-nonnull.patch b/gnu/packages/patches/nss-getcwd-nonnull.patch
new file mode 100644
index 0000000000..37c1b1c539
--- /dev/null
+++ b/gnu/packages/patches/nss-getcwd-nonnull.patch
@@ -0,0 +1,30 @@
+Disable -Werror=nonnull on getcwd(0, 4096) because GCC incorrectly warns that
+the second argument should be NULL with recent glibc. See:
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96832
+https://sourceware.org/bugzilla/show_bug.cgi?id=26545
+
+diff --git a/nss/coreconf/nsinstall/nsinstall.c b/nss/coreconf/nsinstall/nsinstall.c
+--- a/nss/coreconf/nsinstall/nsinstall.c
++++ b/nss/coreconf/nsinstall/nsinstall.c
+@@ -236,14 +236,20 @@ main(int argc, char **argv)
+ return 0;
+
+ if (!cwd) {
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wnonnull"
+ cwd = GETCWD(0, PATH_MAX);
++#pragma GCC diagnostic pop
+ if (!cwd)
+ fail("could not get CWD");
+ }
+
+ /* make sure we can get into todir. */
+ xchdir(todir);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wnonnull"
+ todir = GETCWD(0, PATH_MAX);
++#pragma GCC diagnostic pop
+ if (!todir)
+ fail("could not get CWD in todir");
+ tdlen = strlen(todir);
diff --git a/gnu/packages/patches/ocaml-4.09-multiple-definitions.patch b/gnu/packages/patches/ocaml-4.09-multiple-definitions.patch
new file mode 100644
index 0000000000..b2661f822c
--- /dev/null
+++ b/gnu/packages/patches/ocaml-4.09-multiple-definitions.patch
@@ -0,0 +1,41 @@
+Avoid multiply-defined symbols that lead to link errors such as:
+
+ ld: libcamlrund.a(backtrace_bd.o):/tmp/guix-build-ocaml-4.09.0.drv-0/ocaml-4.09.0/runtime/backtrace.c:31: multiple definition of `caml_debug_info'; libcamlrund.a(backtrace_byt_bd.o):/tmp/guix-build-ocaml-4.09.0.drv-0/ocaml-4.09.0/runtime/backtrace_byt.c:47: first defined here
+
+diff --git a/runtime/backtrace.c b/runtime/backtrace.c
+index a3c2c08..f57c81c 100644
+--- a/runtime/backtrace.c
++++ b/runtime/backtrace.c
+@@ -28,7 +28,7 @@
+ #include "caml/fail.h"
+
+ /* The table of debug information fragments */
+-struct ext_table caml_debug_info;
++static struct ext_table caml_debug_info;
+
+ CAMLexport int32_t caml_backtrace_active = 0;
+ CAMLexport int32_t caml_backtrace_pos = 0;
+diff --git a/runtime/backtrace_byt.c b/runtime/backtrace_byt.c
+index b913dac..b5ec926 100644
+--- a/runtime/backtrace_byt.c
++++ b/runtime/backtrace_byt.c
+@@ -44,7 +44,7 @@
+ #include "caml/backtrace_prim.h"
+
+ /* The table of debug information fragments */
+-struct ext_table caml_debug_info;
++static struct ext_table caml_debug_info;
+
+ CAMLexport char_os * caml_cds_file = NULL;
+
+diff --git a/runtime/startup_nat.c b/runtime/startup_nat.c
+index b4e6bc4..7eca5fa 100644
+--- a/runtime/startup_nat.c
++++ b/runtime/startup_nat.c
+@@ -44,6 +44,5 @@
+ #endif
+
+ extern int caml_parser_trace;
+-CAMLexport header_t caml_atom_table[256];
+ char * caml_code_area_start, * caml_code_area_end;
+ struct ext_table caml_code_fragments_table;
diff --git a/gnu/packages/patches/ocaml-multiple-definitions.patch b/gnu/packages/patches/ocaml-multiple-definitions.patch
new file mode 100644
index 0000000000..e8678f4f64
--- /dev/null
+++ b/gnu/packages/patches/ocaml-multiple-definitions.patch
@@ -0,0 +1,43 @@
+Avoid multiply-defined symbols that lead to link errors such as:
+
+ gcc -O2 -fno-strict-aliasing -fwrapv -Wall -fno-tree-vrp -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE -Wl,-E -o ocamlruni prims.o libcamlruni.a -lm -ldl -lpthread
+ ld: libcamlruni.a(backtrace.i.o):/tmp/guix-build-ocaml-4.07.1.drv-0/ocaml-4.07.1/byterun/backtrace.c:31: multiple definition of `caml_debug_info'; libcamlruni.a(backtrace_prim.i.o):/tmp/guix-build-ocaml-4.07.1.drv-0/ocaml-4.07.1/byterun/backtrace_prim.c:47: first defined here
+
+diff --git a/asmrun/startup.c b/asmrun/startup.c
+index 070f0c6..cf8a56f 100644
+--- a/asmrun/startup.c
++++ b/asmrun/startup.c
+@@ -44,7 +44,6 @@
+ #endif
+
+ extern int caml_parser_trace;
+-CAMLexport header_t caml_atom_table[256];
+ char * caml_code_area_start, * caml_code_area_end;
+ struct ext_table caml_code_fragments_table;
+
+diff --git a/byterun/backtrace.c b/byterun/backtrace.c
+index 8dfe9b7..9cc9e72 100644
+--- a/byterun/backtrace.c
++++ b/byterun/backtrace.c
+@@ -28,7 +28,7 @@
+ #include "caml/fail.h"
+
+ /* The table of debug information fragments */
+-struct ext_table caml_debug_info;
++static struct ext_table caml_debug_info;
+
+ CAMLexport int32_t caml_backtrace_active = 0;
+ CAMLexport int32_t caml_backtrace_pos = 0;
+diff --git a/byterun/backtrace_prim.c b/byterun/backtrace_prim.c
+index e69b256..d794f73 100644
+--- a/byterun/backtrace_prim.c
++++ b/byterun/backtrace_prim.c
+@@ -44,7 +44,7 @@
+ #include "caml/backtrace_prim.h"
+
+ /* The table of debug information fragments */
+-struct ext_table caml_debug_info;
++static struct ext_table caml_debug_info;
+
+ CAMLexport char_os * caml_cds_file = NULL;
+
diff --git a/gnu/packages/patches/p11-kit-hurd.patch b/gnu/packages/patches/p11-kit-hurd.patch
new file mode 100644
index 0000000000..01699882c4
--- /dev/null
+++ b/gnu/packages/patches/p11-kit-hurd.patch
@@ -0,0 +1,46 @@
+Taken from: https://groups.google.com/g/linux.debian.bugs.dist/c/mX4GpUJih4k.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -132,6 +132,16 @@ if test "$os_unix" = "yes"; then
+ AC_CHECK_FUNCS([getpeereid])
+ AC_CHECK_FUNCS([getpeerucred])
+ AC_CHECK_FUNCS([issetugid])
++ case "$host_os" in
++ kfreebsd*-gnu | gnu*)
++ have_getpeereid=no
++ AC_CHECK_LIB(bsd, getpeereid, have_getpeereid=yes)
++ if test "x$have_getpeereid" = "xyes"; then
++ AC_DEFINE([HAVE_GETPEEREID], [1], [have getpeereid])
++ AC_SEARCH_LIBS([getpeereid], [bsd])
++ fi
++ ;;
++ esac
+
+ AC_CACHE_CHECK([for thread-local storage class],
+ [ac_cv_tls_keyword],
+
+--- a/common/unix-peer.c
++++ b/common/unix-peer.c
+@@ -47,6 +47,11 @@
+ # include <ucred.h>
+ #endif
+
++#ifdef HAVE_GETPEEREID
++/* Declare getpeereid from /usr/include/bsd/unistd.h */
++extern int getpeereid(int s, uid_t *euid, gid_t *egid);
++#endif
++
+ /* Returns the unix domain socket peer information.
+ * Returns zero on success.
+ */
+@@ -73,7 +78,8 @@ p11_get_upeer_id (int cfd, uid_t *uid, u
+ *pid = cr.pid;
+
+ #elif defined(HAVE_GETPEEREID)
+- /* *BSD/MacOSX */
++ /* *BSD/MacOSX/kFreeBSD/Hurd */
++
+ uid_t euid;
+ gid_t egid;
+ \ No newline at end of file
diff --git a/gnu/packages/patches/perl-cross.patch b/gnu/packages/patches/perl-cross.patch
deleted file mode 100644
index a7d10b4e1f..0000000000
--- a/gnu/packages/patches/perl-cross.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-Submitted upstream.
-
-From 4c3eb19a11dfe5c88c902481a8294c4f675fcd03 Mon Sep 17 00:00:00 2001
-From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
-Date: Sun, 19 Apr 2020 23:33:28 +0200
-Subject: [PATCH] Support cross-compiling to the Hurd.
-
-* cnf/hints/gnu: New file.
-* cnf/configure_tool.sh: Guess it.
----
- cnf/configure_tool.sh | 4 ++++
- cnf/hints/gnu | 21 +++++++++++++++++++++
- 2 files changed, 25 insertions(+)
- create mode 100644 cnf/hints/gnu
-
-diff --git a/cnf/configure_tool.sh b/cnf/configure_tool.sh
-index 32201c0..7b0baa4 100644
---- a/cnf/configure_tool.sh
-+++ b/cnf/configure_tool.sh
-@@ -266,6 +266,10 @@ if not hinted 'osname'; then
- define osname "bsd"
- result "BSD"
- ;;
-+ *-gnu*)
-+ define osname "gnu"
-+ result "GNU"
-+ ;;
- *)
- result "no"
- ;;
-diff --git a/cnf/hints/gnu b/cnf/hints/gnu
-new file mode 100644
-index 0000000..a0583a2
---- /dev/null
-+++ b/cnf/hints/gnu
-@@ -0,0 +1,21 @@
-+# Hurd syscalls
-+d_voidsig='define'
-+d_nanosleep='undef'
-+d_clock_gettime='define'
-+d_clock_getres='define'
-+d_clock_nanosleep='define'
-+d_clock='define'
-+
-+# From the original linux.sh
-+usemallocwrap='define'
-+
-+# libraries to test
-+libswanted='m crypt pthread nm ndbm gdbm dbm db dl gdbm_compat'
-+
-+d_procselfexe='undef'
-+procselfexe='"undef"'
-+
-+st_ino_sign=1
-+st_ino_size=8
-+
-+d_fcntl_can_lock='define'
---
-2.26.0
-
diff --git a/gnu/packages/patches/perl-deterministic-ordering.patch b/gnu/packages/patches/perl-deterministic-ordering.patch
deleted file mode 100644
index be63d5cde3..0000000000
--- a/gnu/packages/patches/perl-deterministic-ordering.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From <https://bugs.debian.org/801523>.
-
-From c01f602d1926b0671fd2c8d91f7e52c4e4c9fb24 Mon Sep 17 00:00:00 2001
-From: Niko Tyni <ntyni@debian.org>
-Date: Sun, 11 Oct 2015 19:27:56 +0300
-Subject: [PATCH] Sort the list of XS code files when generating RealPPPort.xs
-
-all_files_in_dir() uses readdir() ordering to make the list of
-input files. This can vary between build systems, breaking build
-reproducibility.
----
- cpan/Devel-PPPort/PPPort_xs.PL | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/dist/Devel-PPPort/PPPort_xs.PL b/dist/Devel-PPPort/PPPort_xs.PL
-index 5f18940..149f2fe 100644
---- a/dist/Devel-PPPort/PPPort_xs.PL
-+++ b/dist/Devel-PPPort/PPPort_xs.PL
-@@ -38,7 +38,7 @@ END
- my $file;
- my $sec;
-
--for $file (all_files_in_dir('parts/inc')) {
-+for $file (sort(all_files_in_dir('parts/inc'))) {
- my $spec = parse_partspec($file);
-
- my $msg = 0;
---
-2.5.1
diff --git a/gnu/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch b/gnu/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch
deleted file mode 100644
index f2166aebfd..0000000000
--- a/gnu/packages/patches/perl-io-socket-ssl-openssl-1.0.2f-fix.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Work around a problem arising from the update to OpenSSL 1.0.2f, based on the
-following upstream commit:
-
- https://github.com/noxxi/p5-io-socket-ssl/commit/6e23ee4a433f83f1065bd2467255eba5ee9b1ddd
-
-Attempting to update to IO-Socket-SSL-2.023, which includes this commit,
-caused other test failures. See:
-
- https://lists.gnu.org/archive/html/guix-devel/2016-01/msg01032.html
-
-Description from the upstream commit:
-
- OpenSSL 1.0.2f changed the behavior of SSL shutdown in case the TLS connection
- was not fully established (commit: f73c737c7ac908c5d6407c419769123392a3b0a9).
- This somehow resulted in Net::SSLeay::shutdown returning 0 (i.e. keep trying)
- which caused an endless loop. It will now ignore this result in case the TLS
- connection was not yet established and consider the TLS connection closed
- instead.
-
---- IO-Socket-SSL-2.002/lib/IO/Socket/SSL.pm.orig 2014-10-21 16:51:16.000000000 -0400
-+++ IO-Socket-SSL-2.002/lib/IO/Socket/SSL.pm 2016-01-31 15:07:14.971099894 -0500
-@@ -1213,6 +1213,11 @@
- # shutdown complete
- last;
- }
-+ if ((${*$self}{'_SSL_opened'}||0) <= 0) {
-+ # not really open, thus don't expect shutdown to return
-+ # something meaningful
-+ last;
-+ }
-
- # initiate or complete shutdown
- local $SIG{PIPE} = 'IGNORE';
diff --git a/gnu/packages/patches/perl-no-sys-dirs.patch b/gnu/packages/patches/perl-no-sys-dirs.patch
index 2269d715c7..14d634cac9 100644
--- a/gnu/packages/patches/perl-no-sys-dirs.patch
+++ b/gnu/packages/patches/perl-no-sys-dirs.patch
@@ -6,7 +6,7 @@ Patch adapted from Nixpkgs, originally by Eelco Dolstra
diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
--- perl-5.20.0-orig/Configure 2014-05-26 15:34:18.000000000 +0200
+++ perl-5.20.0/Configure 2014-06-25 10:43:35.368285986 +0200
-@@ -106,15 +106,7 @@
+@@ -108,15 +108,7 @@
fi
: Proper PATH setting
@@ -23,8 +23,8 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
for p in $paths
do
-@@ -1337,8 +1329,7 @@
- archname=''
+@@ -1435,8 +1427,7 @@
+ i_whoami=''
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
@@ -33,8 +33,8 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
:
: no include file wanted by default
inclwanted=''
-@@ -1349,17 +1340,12 @@
-
+@@ -1450,17 +1441,12 @@
+ archobjs=''
libnames=''
: change the next line if compiling for Xenix/286 on Xenix/386
-xlibpth='/usr/lib/386 /lib/386'
@@ -54,8 +54,8 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
: Private path used by Configure to find libraries. Its value
: is prepended to libpth. This variable takes care of special
-@@ -1391,8 +1377,6 @@
- libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
+@@ -1495,8 +1481,6 @@
+ libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
: We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
@@ -63,7 +63,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
: Do not use vfork unless overridden by a hint file.
usevfork=false
-@@ -2446,7 +2430,6 @@
+@@ -2553,7 +2537,6 @@
zip
"
pth=`echo $PATH | sed -e "s/$p_/ /g"`
@@ -71,7 +71,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
for file in $loclist; do
eval xxx=\$$file
case "$xxx" in
-@@ -4936,7 +4919,7 @@
+@@ -5049,7 +5033,7 @@
: Set private lib path
case "$plibpth" in
'') if ./mips; then
@@ -80,7 +80,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
fi;;
esac
case "$libpth" in
-@@ -8600,13 +8583,8 @@
+@@ -8877,13 +8861,8 @@
echo " "
case "$sysman" in
'')
@@ -96,7 +96,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
;;
esac
if $test -d "$sysman"; then
-@@ -19900,9 +19878,10 @@
+@@ -21027,9 +21006,10 @@
case "$full_ar" in
'') full_ar=$ar ;;
esac
@@ -169,7 +169,7 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/freebsd.sh perl-5.20.0/hints/
diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/linux.sh
--- perl-5.20.0-orig/hints/linux.sh 2014-05-26 15:34:20.000000000 +0200
+++ perl-5.20.0/hints/linux.sh 2014-06-25 10:33:47.354883843 +0200
-@@ -150,25 +150,6 @@
+@@ -150,28 +150,6 @@
;;
esac
@@ -188,6 +188,9 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/li
-# plibpth to bypass this check.
-if [ -x /usr/bin/gcc ] ; then
- gcc=/usr/bin/gcc
+-# clang also provides -print-search-dirs
+-elif ${cc:-cc} --version 2>/dev/null | grep -q '^clang ' ; then
+- gcc=${cc:-cc}
-else
- gcc=gcc
-fi
@@ -195,7 +198,40 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/li
case "$plibpth" in
'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
-@@ -367,33 +322,6 @@
+@@ -208,32 +186,6 @@
+ ;;
+ esac
+
+-case "$libc" in
+-'')
+-# If you have glibc, then report the version for ./myconfig bug reporting.
+-# (Configure doesn't need to know the specific version since it just uses
+-# gcc to load the library for all tests.)
+-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
+-# are insufficiently precise to distinguish things like
+-# libc-2.0.6 and libc-2.0.7.
+- for p in $plibpth
+- do
+- for trylib in libc.so.6 libc.so
+- do
+- if $test -e $p/$trylib; then
+- libc=`ls -l $p/$trylib | awk '{print $NF}'`
+- if $test "X$libc" != X; then
+- break
+- fi
+- fi
+- done
+- if $test "X$libc" != X; then
+- break
+- fi
+- done
+- ;;
+-esac
+-
+ if ${sh:-/bin/sh} -c exit; then
+ echo ''
+ echo 'You appear to have a working bash. Good.'
+@@ -311,33 +263,6 @@
;;
esac
@@ -229,40 +265,3 @@ diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/li
# Linux on Synology.
if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
# Tested on Synology DS213 and DS413
-diff --git a/hints/linux.sh b/hints/linux.sh
-index 3f38ea0..97aed11 100644
---- a/hints/linux.sh
-+++ b/hints/linux.sh
-@@ -195,32 +195,6 @@ case "$usequadmath" in
- ;;
- esac
-
--case "$libc" in
--'')
--# If you have glibc, then report the version for ./myconfig bug reporting.
--# (Configure doesn't need to know the specific version since it just uses
--# gcc to load the library for all tests.)
--# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
--# are insufficiently precise to distinguish things like
--# libc-2.0.6 and libc-2.0.7.
-- for p in $plibpth
-- do
-- for trylib in libc.so.6 libc.so
-- do
-- if $test -e $p/$trylib; then
-- libc=`ls -l $p/$trylib | awk '{print $NF}'`
-- if $test "X$libc" != X; then
-- break
-- fi
-- fi
-- done
-- if $test "X$libc" != X; then
-- break
-- fi
-- done
-- ;;
--esac
--
- if ${sh:-/bin/sh} -c exit; then
- echo ''
- echo 'You appear to have a working bash. Good.'
diff --git a/gnu/packages/patches/pipewire-0.2.7-fno-common.patch b/gnu/packages/patches/pipewire-0.2.7-fno-common.patch
new file mode 100644
index 0000000000..f7d9b25932
--- /dev/null
+++ b/gnu/packages/patches/pipewire-0.2.7-fno-common.patch
@@ -0,0 +1,51 @@
+Fixes 'multiple definition errors' when building with GCC 10+
+
+From: https://bugs.gentoo.org/710796
+Originally from: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/a62e41e
+and https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/7a976c7
+
+--- a/spa/plugins/bluez5/a2dp-codecs.h
++++ b/spa/plugins/bluez5/a2dp-codecs.h
+@@ -284,15 +284,15 @@
+ }
+ }
+
+-const a2dp_sbc_t bluez_a2dp_sbc;
++extern const a2dp_sbc_t bluez_a2dp_sbc;
+ #if ENABLE_MP3
+-const a2dp_mpeg_t bluez_a2dp_mpeg;
++extern const a2dp_mpeg_t bluez_a2dp_mpeg;
+ #endif
+ #if ENABLE_AAC
+-const a2dp_aac_t bluez_a2dp_aac;
++extern const a2dp_aac_t bluez_a2dp_aac;
+ #endif
+ #if ENABLE_APTX
+-const a2dp_aptx_t bluez_a2dp_aptx;
++extern const a2dp_aptx_t bluez_a2dp_aptx;
+ #endif
+
+ #endif
+--- a/spa/plugins/bluez5/bluez5-monitor.c
++++ b/spa/plugins/bluez5/bluez5-monitor.c
+@@ -75,7 +75,7 @@
+ struct spa_list transport_list;
+ };
+
+-struct spa_handle_factory spa_a2dp_sink_factory;
++extern struct spa_handle_factory spa_a2dp_sink_factory;
+
+ static void fill_item(struct spa_bt_monitor *this, struct spa_bt_transport *transport,
+ struct spa_pod **result, struct spa_pod_builder *builder)
+--- a/spa/plugins/bluez5/meson.build
++++ b/spa/plugins/bluez5/meson.build
+@@ -1,7 +1,8 @@
+
+ bluez5_sources = ['plugin.c',
+ 'a2dp-sink.c',
+- 'bluez5-monitor.c']
++ 'a2dp-codecs.c',
++ 'bluez5-monitor.c']
+
+ bluez5lib = shared_library('spa-bluez5',
+ bluez5_sources,
diff --git a/gnu/packages/patches/pitivi-fix-build-with-meson-0.60.patch b/gnu/packages/patches/pitivi-fix-build-with-meson-0.60.patch
new file mode 100644
index 0000000000..652a86bff7
--- /dev/null
+++ b/gnu/packages/patches/pitivi-fix-build-with-meson-0.60.patch
@@ -0,0 +1,46 @@
+From b54da52289f9578d7021f466d731cfd48330e5fe Mon Sep 17 00:00:00 2001
+From: Leo Famulari <leo@famulari.name>
+Date: Thu, 25 Nov 2021 18:56:44 -0500
+Subject: [PATCH] Fix build with Meson 0.60.
+
+https://gitlab.gnome.org/GNOME/pitivi/-/issues/2593
+
+* data/meson.build: Adjust to changes in Meson 0.60.
+---
+ data/meson.build | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/data/meson.build b/data/meson.build
+index 2ea82cf..60d2316 100644
+--- a/data/meson.build
++++ b/data/meson.build
+@@ -6,7 +6,7 @@ install_subdir('audiopresets', install_dir: pkgdatadir)
+ install_subdir('videopresets', install_dir: pkgdatadir)
+ install_subdir('gstpresets', install_dir: pkgdatadir)
+
+-desktop_file = i18n.merge_file('org.pitivi.Pitivi.desktop',
++desktop_file = i18n.merge_file(
+ type: 'desktop',
+ output : 'org.pitivi.Pitivi.desktop',
+ input : 'org.pitivi.Pitivi.desktop.in',
+@@ -25,7 +25,7 @@ if desktop_file_validate.found()
+ )
+ endif
+
+-appdata_file = i18n.merge_file('org.pitivi.Pitivi.appdata.xml',
++appdata_file = i18n.merge_file(
+ type: 'xml',
+ output : 'org.pitivi.Pitivi.appdata.xml',
+ input : 'org.pitivi.Pitivi.appdata.xml.in',
+@@ -43,7 +43,7 @@ if appstream_util.found()
+ )
+ endif
+
+-i18n.merge_file('org.pitivi.Pitivi-mime.xml',
++i18n.merge_file(
+ output : 'org.pitivi.Pitivi-mime.xml',
+ input : 'org.pitivi.Pitivi-mime.xml.in',
+ po_dir: podir,
+--
+2.33.1
+
diff --git a/gnu/packages/patches/polkit-CVE-2021-3560.patch b/gnu/packages/patches/polkit-CVE-2021-3560.patch
deleted file mode 100644
index 9aa0373fda..0000000000
--- a/gnu/packages/patches/polkit-CVE-2021-3560.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-This patch fixes CVE-2021-3560, "local privilege escalation using
-polkit_system_bus_name_get_creds_sync()":
-
- https://www.openwall.com/lists/oss-security/2021/06/03/1
-
-Patch from <https://gitlab.freedesktop.org/polkit/polkit/-/commit/a04d13a>.
-
-diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c
-index 8daa12cb9093c1d765c7b83654a2b8d0d382378e..8ed13631508dd96624898df90ee2ece4dcf3e1e5 100644
---- a/src/polkit/polkitsystembusname.c
-+++ b/src/polkit/polkitsystembusname.c
-@@ -435,6 +435,9 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus
- while (!((data.retrieved_uid && data.retrieved_pid) || data.caught_error))
- g_main_context_iteration (tmp_context, TRUE);
-
-+ if (data.caught_error)
-+ goto out;
-+
- if (out_uid)
- *out_uid = data.uid;
- if (out_pid)
diff --git a/gnu/packages/patches/polkit-configure-elogind.patch b/gnu/packages/patches/polkit-configure-elogind.patch
new file mode 100644
index 0000000000..8fefb7a0c2
--- /dev/null
+++ b/gnu/packages/patches/polkit-configure-elogind.patch
@@ -0,0 +1,15 @@
+Even when the polkit configure script detects elogind, it does not use
+it. This patch ensures that elogind is used when it is detected.
+
+diff -ruN a/configure b/configure
+--- a/configure 1969-12-31 19:00:01.000000000 -0500
++++ b/configure 2021-11-19 00:04:55.581385020 -0500
+@@ -20390,7 +20390,7 @@
+
+
+
+- if test "$have_libsystemd" = "yes"; then
++ if test "$have_libsystemd" = "yes" || test "$have_libelogind" = "yes"; then
+ HAVE_LIBSYSTEMD_TRUE=
+ HAVE_LIBSYSTEMD_FALSE='#'
+ else
diff --git a/gnu/packages/patches/polkit-use-duktape.patch b/gnu/packages/patches/polkit-use-duktape.patch
new file mode 100644
index 0000000000..4eaa7963c2
--- /dev/null
+++ b/gnu/packages/patches/polkit-use-duktape.patch
@@ -0,0 +1,5030 @@
+From 4f66a9549a393e4d74b93eb85301a04ea94bc750 Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Wed, 24 Jul 2019 15:55:17 +0800
+Subject: [PATCH 01/16] Add duktape as javascript engine.
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ configure.ac | 28 +-
+ src/polkitbackend/Makefile.am | 14 +-
+ .../polkitbackendduktapeauthority.c | 1402 +++++++++++++++++
+ 3 files changed, 1436 insertions(+), 8 deletions(-)
+ create mode 100644 src/polkitbackend/polkitbackendduktapeauthority.c
+
+diff --git a/configure.ac b/configure.ac
+index e434ca2..5a03593 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -80,11 +80,22 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+
+-PKG_CHECK_MODULES(LIBJS, [mozjs-78])
+-
+-AC_SUBST(LIBJS_CFLAGS)
+-AC_SUBST(LIBJS_CXXFLAGS)
+-AC_SUBST(LIBJS_LIBS)
++dnl ---------------------------------------------------------------------------
++dnl - Check javascript backend
++dnl ---------------------------------------------------------------------------
++AC_ARG_WITH(duktape, AS_HELP_STRING([--with-duktape],[Use Duktape as javascript backend]),with_duktape=yes,with_duktape=no)
++AS_IF([test x${with_duktape} == xyes], [
++ PKG_CHECK_MODULES(LIBJS, [duktape >= 2.0.0 ])
++ AC_SUBST(LIBJS_CFLAGS)
++ AC_SUBST(LIBJS_LIBS)
++], [
++ PKG_CHECK_MODULES(LIBJS, [mozjs-78])
++
++ AC_SUBST(LIBJS_CFLAGS)
++ AC_SUBST(LIBJS_CXXFLAGS)
++ AC_SUBST(LIBJS_LIBS)
++])
++AM_CONDITIONAL(USE_DUKTAPE, [test x$with_duktape == xyes], [Using duktape as javascript engine library])
+
+ EXPAT_LIB=""
+ AC_ARG_WITH(expat, [ --with-expat=<dir> Use expat from here],
+@@ -585,6 +596,13 @@ echo "
+ PAM support: ${have_pam}
+ systemdsystemunitdir: ${systemdsystemunitdir}
+ polkitd user: ${POLKITD_USER}"
++if test "x${with_duktape}" = xyes; then
++echo "
++ Javascript engine: Duktape"
++else
++echo "
++ Javascript engine: Mozjs"
++fi
+
+ if test "$have_pam" = yes ; then
+ echo "
+diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am
+index 7e3c080..abcbc6f 100644
+--- a/src/polkitbackend/Makefile.am
++++ b/src/polkitbackend/Makefile.am
+@@ -33,7 +33,7 @@ libpolkit_backend_1_la_SOURCES = \
+ polkitbackendprivate.h \
+ polkitbackendauthority.h polkitbackendauthority.c \
+ polkitbackendinteractiveauthority.h polkitbackendinteractiveauthority.c \
+- polkitbackendjsauthority.h polkitbackendjsauthority.cpp \
++ polkitbackendjsauthority.h \
+ polkitbackendactionpool.h polkitbackendactionpool.c \
+ polkitbackendactionlookup.h polkitbackendactionlookup.c \
+ $(NULL)
+@@ -51,19 +51,27 @@ libpolkit_backend_1_la_CFLAGS = \
+ -D_POLKIT_BACKEND_COMPILATION \
+ $(GLIB_CFLAGS) \
+ $(LIBSYSTEMD_CFLAGS) \
+- $(LIBJS_CFLAGS) \
++ $(LIBJS_CFLAGS) \
+ $(NULL)
+
+ libpolkit_backend_1_la_CXXFLAGS = $(libpolkit_backend_1_la_CFLAGS)
+
+ libpolkit_backend_1_la_LIBADD = \
+ $(GLIB_LIBS) \
++ $(DUKTAPE_LIBS) \
+ $(LIBSYSTEMD_LIBS) \
+ $(top_builddir)/src/polkit/libpolkit-gobject-1.la \
+ $(EXPAT_LIBS) \
+- $(LIBJS_LIBS) \
++ $(LIBJS_LIBS) \
+ $(NULL)
+
++if USE_DUKTAPE
++libpolkit_backend_1_la_SOURCES += polkitbackendduktapeauthority.c
++libpolkit_backend_1_la_LIBADD += -lm
++else
++libpolkit_backend_1_la_SOURCES += polkitbackendjsauthority.cpp
++endif
++
+ rulesdir = $(sysconfdir)/polkit-1/rules.d
+ rules_DATA = 50-default.rules
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+new file mode 100644
+index 0000000..ae98453
+--- /dev/null
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -0,0 +1,1402 @@
++/*
++ * Copyright (C) 2008-2012 Red Hat, Inc.
++ * Copyright (C) 2015 Tangent Space <jstpierre@mecheye.net>
++ * Copyright (C) 2019 Wu Xiaotian <yetist@gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General
++ * Public License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
++ * Boston, MA 02111-1307, USA.
++ *
++ * Author: David Zeuthen <davidz@redhat.com>
++ */
++
++#include "config.h"
++#include <sys/wait.h>
++#include <errno.h>
++#include <pwd.h>
++#include <grp.h>
++#include <netdb.h>
++#include <string.h>
++#include <glib/gstdio.h>
++#include <locale.h>
++#include <glib/gi18n-lib.h>
++
++#include <polkit/polkit.h>
++#include "polkitbackendjsauthority.h"
++
++#include <polkit/polkitprivate.h>
++
++#ifdef HAVE_LIBSYSTEMD
++#include <systemd/sd-login.h>
++#endif /* HAVE_LIBSYSTEMD */
++
++#include "initjs.h" /* init.js */
++#include "duktape.h"
++
++/**
++ * SECTION:polkitbackendjsauthority
++ * @title: PolkitBackendJsAuthority
++ * @short_description: JS Authority
++ * @stability: Unstable
++ *
++ * An implementation of #PolkitBackendAuthority that reads and
++ * evalates Javascript files and supports interaction with
++ * authentication agents (virtue of being based on
++ * #PolkitBackendInteractiveAuthority).
++ */
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++struct _PolkitBackendJsAuthorityPrivate
++{
++ gchar **rules_dirs;
++ GFileMonitor **dir_monitors; /* NULL-terminated array of GFileMonitor instances */
++ duk_context *cx;
++};
++
++#define WATCHDOG_TIMEOUT (15 * G_TIME_SPAN_SECOND)
++
++static void utils_spawn (const gchar *const *argv,
++ guint timeout_seconds,
++ GCancellable *cancellable,
++ GAsyncReadyCallback callback,
++ gpointer user_data);
++
++gboolean utils_spawn_finish (GAsyncResult *res,
++ gint *out_exit_status,
++ gchar **out_standard_output,
++ gchar **out_standard_error,
++ GError **error);
++
++static void on_dir_monitor_changed (GFileMonitor *monitor,
++ GFile *file,
++ GFile *other_file,
++ GFileMonitorEvent event_type,
++ gpointer user_data);
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++enum
++{
++ PROP_0,
++ PROP_RULES_DIRS,
++};
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details);
++
++static PolkitImplicitAuthorization polkit_backend_js_authority_check_authorization_sync (
++ PolkitBackendInteractiveAuthority *authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details,
++ PolkitImplicitAuthorization implicit);
++
++G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY);
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static void
++polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority)
++{
++ authority->priv = G_TYPE_INSTANCE_GET_PRIVATE (authority,
++ POLKIT_BACKEND_TYPE_JS_AUTHORITY,
++ PolkitBackendJsAuthorityPrivate);
++}
++
++static gint
++rules_file_name_cmp (const gchar *a,
++ const gchar *b)
++{
++ gint ret;
++ const gchar *a_base;
++ const gchar *b_base;
++
++ a_base = strrchr (a, '/');
++ b_base = strrchr (b, '/');
++
++ g_assert (a_base != NULL);
++ g_assert (b_base != NULL);
++ a_base += 1;
++ b_base += 1;
++
++ ret = g_strcmp0 (a_base, b_base);
++ if (ret == 0)
++ {
++ /* /etc wins over /usr */
++ ret = g_strcmp0 (a, b);
++ g_assert (ret != 0);
++ }
++
++ return ret;
++}
++
++static void
++load_scripts (PolkitBackendJsAuthority *authority)
++{
++ duk_context *cx = authority->priv->cx;
++ GList *files = NULL;
++ GList *l;
++ guint num_scripts = 0;
++ GError *error = NULL;
++ guint n;
++
++ files = NULL;
++
++ for (n = 0; authority->priv->rules_dirs != NULL && authority->priv->rules_dirs[n] != NULL; n++)
++ {
++ const gchar *dir_name = authority->priv->rules_dirs[n];
++ GDir *dir = NULL;
++
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Loading rules from directory %s",
++ dir_name);
++
++ dir = g_dir_open (dir_name,
++ 0,
++ &error);
++ if (dir == NULL)
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error opening rules directory: %s (%s, %d)",
++ error->message, g_quark_to_string (error->domain), error->code);
++ g_clear_error (&error);
++ }
++ else
++ {
++ const gchar *name;
++ while ((name = g_dir_read_name (dir)) != NULL)
++ {
++ if (g_str_has_suffix (name, ".rules"))
++ files = g_list_prepend (files, g_strdup_printf ("%s/%s", dir_name, name));
++ }
++ g_dir_close (dir);
++ }
++ }
++
++ files = g_list_sort (files, (GCompareFunc) rules_file_name_cmp);
++
++ for (l = files; l != NULL; l = l->next)
++ {
++ const gchar *filename = l->data;
++
++#if (DUK_VERSION >= 20000)
++ gchar *contents;
++ gsize length;
++ GError *error = NULL;
++ if (!g_file_get_contents (filename, &contents, &length, &error)){
++ g_warning("Error when file contents of %s: %s\n", filename, error->message);
++ g_error_free (error);
++ continue;
++ }
++ if (duk_peval_lstring_noresult(cx, contents,length) != 0)
++#else
++ if (duk_peval_file_noresult (cx, filename) != 0)
++#endif
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error compiling script %s: %s",
++ filename, duk_safe_to_string (authority->priv->cx, -1));
++#if (DUK_VERSION >= 20000)
++ g_free (contents);
++#endif
++ continue;
++ }
++#if (DUK_VERSION >= 20000)
++ g_free (contents);
++#endif
++ num_scripts++;
++ }
++
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Finished loading, compiling and executing %d rules",
++ num_scripts);
++ g_list_free_full (files, g_free);
++}
++
++static void
++reload_scripts (PolkitBackendJsAuthority *authority)
++{
++ duk_context *cx = authority->priv->cx;
++
++ duk_set_top (cx, 0);
++ duk_get_global_string (cx, "polkit");
++ duk_push_string (cx, "_deleteRules");
++
++ duk_call_prop (cx, 0, 0);
++
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Collecting garbage unconditionally...");
++
++ load_scripts (authority);
++
++ /* Let applications know we have new rules... */
++ g_signal_emit_by_name (authority, "changed");
++}
++
++static void
++on_dir_monitor_changed (GFileMonitor *monitor,
++ GFile *file,
++ GFile *other_file,
++ GFileMonitorEvent event_type,
++ gpointer user_data)
++{
++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data);
++
++ /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution?
++ * Because when editing a file with emacs we get 4-8 events..
++ */
++
++ if (file != NULL)
++ {
++ gchar *name;
++
++ name = g_file_get_basename (file);
++
++ /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */
++ if (!g_str_has_prefix (name, ".") &&
++ !g_str_has_prefix (name, "#") &&
++ g_str_has_suffix (name, ".rules") &&
++ (event_type == G_FILE_MONITOR_EVENT_CREATED ||
++ event_type == G_FILE_MONITOR_EVENT_DELETED ||
++ event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Reloading rules");
++ reload_scripts (authority);
++ }
++ g_free (name);
++ }
++}
++
++
++static void
++setup_file_monitors (PolkitBackendJsAuthority *authority)
++{
++ guint n;
++ GPtrArray *p;
++
++ p = g_ptr_array_new ();
++ for (n = 0; authority->priv->rules_dirs != NULL && authority->priv->rules_dirs[n] != NULL; n++)
++ {
++ GFile *file;
++ GError *error;
++ GFileMonitor *monitor;
++
++ file = g_file_new_for_path (authority->priv->rules_dirs[n]);
++ error = NULL;
++ monitor = g_file_monitor_directory (file,
++ G_FILE_MONITOR_NONE,
++ NULL,
++ &error);
++ g_object_unref (file);
++ if (monitor == NULL)
++ {
++ g_warning ("Error monitoring directory %s: %s",
++ authority->priv->rules_dirs[n],
++ error->message);
++ g_clear_error (&error);
++ }
++ else
++ {
++ g_signal_connect (monitor,
++ "changed",
++ G_CALLBACK (on_dir_monitor_changed),
++ authority);
++ g_ptr_array_add (p, monitor);
++ }
++ }
++ g_ptr_array_add (p, NULL);
++ authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE);
++}
++
++static duk_ret_t js_polkit_log (duk_context *cx);
++static duk_ret_t js_polkit_spawn (duk_context *cx);
++static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx);
++
++static const duk_function_list_entry js_polkit_functions[] =
++{
++ { "log", js_polkit_log, 1 },
++ { "spawn", js_polkit_spawn, 1 },
++ { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 },
++ { NULL, NULL, 0 },
++};
++
++static void
++polkit_backend_js_authority_constructed (GObject *object)
++{
++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
++ duk_context *cx;
++
++ cx = duk_create_heap (NULL, NULL, NULL, authority, NULL);
++ if (cx == NULL)
++ goto fail;
++
++ authority->priv->cx = cx;
++
++ duk_push_global_object (cx);
++ duk_push_object (cx);
++ duk_put_function_list (cx, -1, js_polkit_functions);
++ duk_put_prop_string (cx, -2, "polkit");
++
++ duk_eval_string (cx, init_js);
++
++ if (authority->priv->rules_dirs == NULL)
++ {
++ authority->priv->rules_dirs = g_new0 (gchar *, 3);
++ authority->priv->rules_dirs[0] = g_strdup (PACKAGE_SYSCONF_DIR "/polkit-1/rules.d");
++ authority->priv->rules_dirs[1] = g_strdup (PACKAGE_DATA_DIR "/polkit-1/rules.d");
++ }
++
++ setup_file_monitors (authority);
++ load_scripts (authority);
++
++ G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->constructed (object);
++ return;
++
++ fail:
++ g_critical ("Error initializing JavaScript environment");
++ g_assert_not_reached ();
++}
++
++static void
++polkit_backend_js_authority_finalize (GObject *object)
++{
++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
++ guint n;
++
++ for (n = 0; authority->priv->dir_monitors != NULL && authority->priv->dir_monitors[n] != NULL; n++)
++ {
++ GFileMonitor *monitor = authority->priv->dir_monitors[n];
++ g_signal_handlers_disconnect_by_func (monitor,
++ G_CALLBACK (on_dir_monitor_changed),
++ authority);
++ g_object_unref (monitor);
++ }
++ g_free (authority->priv->dir_monitors);
++ g_strfreev (authority->priv->rules_dirs);
++
++ duk_destroy_heap (authority->priv->cx);
++
++ G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object);
++}
++
++static void
++polkit_backend_js_authority_set_property (GObject *object,
++ guint property_id,
++ const GValue *value,
++ GParamSpec *pspec)
++{
++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
++
++ switch (property_id)
++ {
++ case PROP_RULES_DIRS:
++ g_assert (authority->priv->rules_dirs == NULL);
++ authority->priv->rules_dirs = (gchar **) g_value_dup_boxed (value);
++ break;
++
++ default:
++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
++ break;
++ }
++}
++
++static const gchar *
++polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority)
++{
++ return "js";
++}
++
++static const gchar *
++polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority)
++{
++ return PACKAGE_VERSION;
++}
++
++static PolkitAuthorityFeatures
++polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority)
++{
++ return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION;
++}
++
++static void
++polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass)
++{
++ GObjectClass *gobject_class;
++ PolkitBackendAuthorityClass *authority_class;
++ PolkitBackendInteractiveAuthorityClass *interactive_authority_class;
++
++
++ gobject_class = G_OBJECT_CLASS (klass);
++ gobject_class->finalize = polkit_backend_js_authority_finalize;
++ gobject_class->set_property = polkit_backend_js_authority_set_property;
++ gobject_class->constructed = polkit_backend_js_authority_constructed;
++
++ authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass);
++ authority_class->get_name = polkit_backend_js_authority_get_name;
++ authority_class->get_version = polkit_backend_js_authority_get_version;
++ authority_class->get_features = polkit_backend_js_authority_get_features;
++
++ interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass);
++ interactive_authority_class->get_admin_identities = polkit_backend_js_authority_get_admin_auth_identities;
++ interactive_authority_class->check_authorization_sync = polkit_backend_js_authority_check_authorization_sync;
++
++ g_object_class_install_property (gobject_class,
++ PROP_RULES_DIRS,
++ g_param_spec_boxed ("rules-dirs",
++ NULL,
++ NULL,
++ G_TYPE_STRV,
++ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
++
++
++ g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate));
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static void
++set_property_str (duk_context *cx,
++ const gchar *name,
++ const gchar *value)
++{
++ duk_push_string (cx, value);
++ duk_put_prop_string (cx, -2, name);
++}
++
++static void
++set_property_strv (duk_context *cx,
++ const gchar *name,
++ GPtrArray *value)
++{
++ guint n;
++ duk_push_array (cx);
++ for (n = 0; n < value->len; n++)
++ {
++ duk_push_string (cx, g_ptr_array_index (value, n));
++ duk_put_prop_index (cx, -2, n);
++ }
++ duk_put_prop_string (cx, -2, name);
++}
++
++static void
++set_property_int32 (duk_context *cx,
++ const gchar *name,
++ gint32 value)
++{
++ duk_push_int (cx, value);
++ duk_put_prop_string (cx, -2, name);
++}
++
++static void
++set_property_bool (duk_context *cx,
++ const char *name,
++ gboolean value)
++{
++ duk_push_boolean (cx, value);
++ duk_put_prop_string (cx, -2, name);
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static gboolean
++push_subject (duk_context *cx,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ GError **error)
++{
++ gboolean ret = FALSE;
++ pid_t pid;
++ uid_t uid;
++ gchar *user_name = NULL;
++ GPtrArray *groups = NULL;
++ struct passwd *passwd;
++ char *seat_str = NULL;
++ char *session_str = NULL;
++
++ duk_get_global_string (cx, "Subject");
++ duk_new (cx, 0);
++
++ if (POLKIT_IS_UNIX_PROCESS (subject))
++ {
++ pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject));
++ }
++ else if (POLKIT_IS_SYSTEM_BUS_NAME (subject))
++ {
++ PolkitSubject *process;
++ process = polkit_system_bus_name_get_process_sync (POLKIT_SYSTEM_BUS_NAME (subject), NULL, error);
++ if (process == NULL)
++ goto out;
++ pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (process));
++ g_object_unref (process);
++ }
++ else
++ {
++ g_assert_not_reached ();
++ }
++
++#ifdef HAVE_LIBSYSTEMD
++ if (sd_pid_get_session (pid, &session_str) == 0)
++ {
++ if (sd_session_get_seat (session_str, &seat_str) == 0)
++ {
++ /* do nothing */
++ }
++ }
++#endif /* HAVE_LIBSYSTEMD */
++
++ g_assert (POLKIT_IS_UNIX_USER (user_for_subject));
++ uid = polkit_unix_user_get_uid (POLKIT_UNIX_USER (user_for_subject));
++
++ groups = g_ptr_array_new_with_free_func (g_free);
++
++ passwd = getpwuid (uid);
++ if (passwd == NULL)
++ {
++ user_name = g_strdup_printf ("%d", (gint) uid);
++ g_warning ("Error looking up info for uid %d: %m", (gint) uid);
++ }
++ else
++ {
++ gid_t gids[512];
++ int num_gids = 512;
++
++ user_name = g_strdup (passwd->pw_name);
++
++ if (getgrouplist (passwd->pw_name,
++ passwd->pw_gid,
++ gids,
++ &num_gids) < 0)
++ {
++ g_warning ("Error looking up groups for uid %d: %m", (gint) uid);
++ }
++ else
++ {
++ gint n;
++ for (n = 0; n < num_gids; n++)
++ {
++ struct group *group;
++ group = getgrgid (gids[n]);
++ if (group == NULL)
++ {
++ g_ptr_array_add (groups, g_strdup_printf ("%d", (gint) gids[n]));
++ }
++ else
++ {
++ g_ptr_array_add (groups, g_strdup (group->gr_name));
++ }
++ }
++ }
++ }
++
++ set_property_int32 (cx, "pid", pid);
++ set_property_str (cx, "user", user_name);
++ set_property_strv (cx, "groups", groups);
++ set_property_str (cx, "seat", seat_str);
++ set_property_str (cx, "session", session_str);
++ set_property_bool (cx, "local", subject_is_local);
++ set_property_bool (cx, "active", subject_is_active);
++
++ ret = TRUE;
++
++ out:
++ free (session_str);
++ free (seat_str);
++ g_free (user_name);
++ if (groups != NULL)
++ g_ptr_array_unref (groups);
++
++ return ret;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static gboolean
++push_action_and_details (duk_context *cx,
++ const gchar *action_id,
++ PolkitDetails *details,
++ GError **error)
++{
++ gchar **keys;
++ guint n;
++
++ duk_get_global_string (cx, "Action");
++ duk_new (cx, 0);
++
++ set_property_str (cx, "id", action_id);
++
++ keys = polkit_details_get_keys (details);
++ for (n = 0; keys != NULL && keys[n] != NULL; n++)
++ {
++ gchar *key;
++ const gchar *value;
++ key = g_strdup_printf ("_detail_%s", keys[n]);
++ value = polkit_details_lookup (details, keys[n]);
++ set_property_str (cx, key, value);
++ g_free (key);
++ }
++ g_strfreev (keys);
++
++ return TRUE;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static GList *
++polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details)
++{
++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
++ GList *ret = NULL;
++ guint n;
++ GError *error = NULL;
++ const char *ret_str = NULL;
++ gchar **ret_strs = NULL;
++ duk_context *cx = authority->priv->cx;
++
++ duk_set_top (cx, 0);
++ duk_get_global_string (cx, "polkit");
++ duk_push_string (cx, "_runAdminRules");
++
++ if (!push_action_and_details (cx, action_id, details, &error))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error converting action and details to JS object: %s",
++ error->message);
++ g_clear_error (&error);
++ goto out;
++ }
++
++ if (!push_subject (cx, subject, user_for_subject, subject_is_local, subject_is_active, &error))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error converting subject to JS object: %s",
++ error->message);
++ g_clear_error (&error);
++ goto out;
++ }
++
++ if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE)
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error evaluating admin rules: ",
++ duk_safe_to_string (cx, -1));
++ goto out;
++ }
++
++ ret_str = duk_require_string (cx, -1);
++
++ ret_strs = g_strsplit (ret_str, ",", -1);
++ for (n = 0; ret_strs != NULL && ret_strs[n] != NULL; n++)
++ {
++ const gchar *identity_str = ret_strs[n];
++ PolkitIdentity *identity;
++
++ error = NULL;
++ identity = polkit_identity_from_string (identity_str, &error);
++ if (identity == NULL)
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Identity `%s' is not valid, ignoring: %s",
++ identity_str, error->message);
++ g_clear_error (&error);
++ }
++ else
++ {
++ ret = g_list_prepend (ret, identity);
++ }
++ }
++ ret = g_list_reverse (ret);
++
++ out:
++ g_strfreev (ret_strs);
++ /* fallback to root password auth */
++ if (ret == NULL)
++ ret = g_list_prepend (ret, polkit_unix_user_new (0));
++
++ return ret;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static PolkitImplicitAuthorization
++polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details,
++ PolkitImplicitAuthorization implicit)
++{
++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
++ PolkitImplicitAuthorization ret = implicit;
++ GError *error = NULL;
++ gchar *ret_str = NULL;
++ gboolean good = FALSE;
++ duk_context *cx = authority->priv->cx;
++
++ duk_set_top (cx, 0);
++ duk_get_global_string (cx, "polkit");
++ duk_push_string (cx, "_runRules");
++
++ if (!push_action_and_details (cx, action_id, details, &error))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error converting action and details to JS object: %s",
++ error->message);
++ g_clear_error (&error);
++ goto out;
++ }
++
++ if (!push_subject (cx, subject, user_for_subject, subject_is_local, subject_is_active, &error))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error converting subject to JS object: %s",
++ error->message);
++ g_clear_error (&error);
++ goto out;
++ }
++
++ if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE)
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error evaluating authorization rules: ",
++ duk_safe_to_string (cx, -1));
++ goto out;
++ }
++
++ if (duk_is_null(cx, -1)) {
++ good = TRUE;
++ goto out;
++ }
++ ret_str = g_strdup (duk_require_string (cx, -1));
++ if (!polkit_implicit_authorization_from_string (ret_str, &ret))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Returned result `%s' is not valid",
++ ret_str);
++ goto out;
++ }
++
++ good = TRUE;
++
++ out:
++ if (!good)
++ ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED;
++ g_free (ret_str);
++
++ return ret;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static duk_ret_t
++js_polkit_log (duk_context *cx)
++{
++ const char *str = duk_require_string (cx, 0);
++ fprintf (stderr, "%s\n", str);
++ return 0;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++static const gchar *
++get_signal_name (gint signal_number)
++{
++ switch (signal_number)
++ {
++#define _HANDLE_SIG(sig) case sig: return #sig;
++ _HANDLE_SIG (SIGHUP);
++ _HANDLE_SIG (SIGINT);
++ _HANDLE_SIG (SIGQUIT);
++ _HANDLE_SIG (SIGILL);
++ _HANDLE_SIG (SIGABRT);
++ _HANDLE_SIG (SIGFPE);
++ _HANDLE_SIG (SIGKILL);
++ _HANDLE_SIG (SIGSEGV);
++ _HANDLE_SIG (SIGPIPE);
++ _HANDLE_SIG (SIGALRM);
++ _HANDLE_SIG (SIGTERM);
++ _HANDLE_SIG (SIGUSR1);
++ _HANDLE_SIG (SIGUSR2);
++ _HANDLE_SIG (SIGCHLD);
++ _HANDLE_SIG (SIGCONT);
++ _HANDLE_SIG (SIGSTOP);
++ _HANDLE_SIG (SIGTSTP);
++ _HANDLE_SIG (SIGTTIN);
++ _HANDLE_SIG (SIGTTOU);
++ _HANDLE_SIG (SIGBUS);
++#ifdef SIGPOLL
++ _HANDLE_SIG (SIGPOLL);
++#endif
++ _HANDLE_SIG (SIGPROF);
++ _HANDLE_SIG (SIGSYS);
++ _HANDLE_SIG (SIGTRAP);
++ _HANDLE_SIG (SIGURG);
++ _HANDLE_SIG (SIGVTALRM);
++ _HANDLE_SIG (SIGXCPU);
++ _HANDLE_SIG (SIGXFSZ);
++#undef _HANDLE_SIG
++ default:
++ break;
++ }
++ return "UNKNOWN_SIGNAL";
++}
++
++typedef struct
++{
++ GMainLoop *loop;
++ GAsyncResult *res;
++} SpawnData;
++
++static void
++spawn_cb (GObject *source_object,
++ GAsyncResult *res,
++ gpointer user_data)
++{
++ SpawnData *data = user_data;
++ data->res = g_object_ref (res);
++ g_main_loop_quit (data->loop);
++}
++
++static duk_ret_t
++js_polkit_spawn (duk_context *cx)
++{
++#if (DUK_VERSION >= 20000)
++ duk_ret_t ret = DUK_RET_ERROR;
++#else
++ duk_ret_t ret = DUK_RET_INTERNAL_ERROR;
++#endif
++ gchar *standard_output = NULL;
++ gchar *standard_error = NULL;
++ gint exit_status;
++ GError *error = NULL;
++ guint32 array_len;
++ gchar **argv = NULL;
++ GMainContext *context = NULL;
++ GMainLoop *loop = NULL;
++ SpawnData data = {0};
++ char *err_str = NULL;
++ guint n;
++
++ if (!duk_is_array (cx, 0))
++ goto out;
++
++ array_len = duk_get_length (cx, 0);
++
++ argv = g_new0 (gchar*, array_len + 1);
++ for (n = 0; n < array_len; n++)
++ {
++ duk_get_prop_index (cx, 0, n);
++ argv[n] = g_strdup (duk_to_string (cx, -1));
++ duk_pop (cx);
++ }
++
++ context = g_main_context_new ();
++ loop = g_main_loop_new (context, FALSE);
++
++ g_main_context_push_thread_default (context);
++
++ data.loop = loop;
++ utils_spawn ((const gchar *const *) argv,
++ 10, /* timeout_seconds */
++ NULL, /* cancellable */
++ spawn_cb,
++ &data);
++
++ g_main_loop_run (loop);
++
++ g_main_context_pop_thread_default (context);
++
++ if (!utils_spawn_finish (data.res,
++ &exit_status,
++ &standard_output,
++ &standard_error,
++ &error))
++ {
++ err_str = g_strdup_printf ("Error spawning helper: %s (%s, %d)",
++ error->message, g_quark_to_string (error->domain), error->code);
++ g_clear_error (&error);
++ goto out;
++ }
++
++ if (!(WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0))
++ {
++ GString *gstr;
++ gstr = g_string_new (NULL);
++ if (WIFEXITED (exit_status))
++ {
++ g_string_append_printf (gstr,
++ "Helper exited with non-zero exit status %d",
++ WEXITSTATUS (exit_status));
++ }
++ else if (WIFSIGNALED (exit_status))
++ {
++ g_string_append_printf (gstr,
++ "Helper was signaled with signal %s (%d)",
++ get_signal_name (WTERMSIG (exit_status)),
++ WTERMSIG (exit_status));
++ }
++ g_string_append_printf (gstr, ", stdout=`%s', stderr=`%s'",
++ standard_output, standard_error);
++ err_str = g_string_free (gstr, FALSE);
++ goto out;
++ }
++
++ duk_push_string (cx, standard_output);
++ ret = 1;
++
++ out:
++ g_strfreev (argv);
++ g_free (standard_output);
++ g_free (standard_error);
++ g_clear_object (&data.res);
++ if (loop != NULL)
++ g_main_loop_unref (loop);
++ if (context != NULL)
++ g_main_context_unref (context);
++
++ if (err_str)
++ duk_error (cx, DUK_ERR_ERROR, err_str);
++
++ return ret;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++
++static duk_ret_t
++js_polkit_user_is_in_netgroup (duk_context *cx)
++{
++ const char *user;
++ const char *netgroup;
++ gboolean is_in_netgroup = FALSE;
++
++ user = duk_require_string (cx, 0);
++ netgroup = duk_require_string (cx, 1);
++
++ if (innetgr (netgroup,
++ NULL, /* host */
++ user,
++ NULL)) /* domain */
++ {
++ is_in_netgroup = TRUE;
++ }
++
++ duk_push_boolean (cx, is_in_netgroup);
++ return 1;
++}
++
++/* ---------------------------------------------------------------------------------------------------- */
++
++typedef struct
++{
++ GSimpleAsyncResult *simple; /* borrowed reference */
++ GMainContext *main_context; /* may be NULL */
++
++ GCancellable *cancellable; /* may be NULL */
++ gulong cancellable_handler_id;
++
++ GPid child_pid;
++ gint child_stdout_fd;
++ gint child_stderr_fd;
++
++ GIOChannel *child_stdout_channel;
++ GIOChannel *child_stderr_channel;
++
++ GSource *child_watch_source;
++ GSource *child_stdout_source;
++ GSource *child_stderr_source;
++
++ guint timeout_seconds;
++ gboolean timed_out;
++ GSource *timeout_source;
++
++ GString *child_stdout;
++ GString *child_stderr;
++
++ gint exit_status;
++} UtilsSpawnData;
++
++static void
++utils_child_watch_from_release_cb (GPid pid,
++ gint status,
++ gpointer user_data)
++{
++}
++
++static void
++utils_spawn_data_free (UtilsSpawnData *data)
++{
++ if (data->timeout_source != NULL)
++ {
++ g_source_destroy (data->timeout_source);
++ data->timeout_source = NULL;
++ }
++
++ /* Nuke the child, if necessary */
++ if (data->child_watch_source != NULL)
++ {
++ g_source_destroy (data->child_watch_source);
++ data->child_watch_source = NULL;
++ }
++
++ if (data->child_pid != 0)
++ {
++ GSource *source;
++ kill (data->child_pid, SIGTERM);
++ /* OK, we need to reap for the child ourselves - we don't want
++ * to use waitpid() because that might block the calling
++ * thread (the child might handle SIGTERM and use several
++ * seconds for cleanup/rollback).
++ *
++ * So we use GChildWatch instead.
++ *
++ * Avoid taking a references to ourselves. but note that we need
++ * to pass the GSource so we can nuke it once handled.
++ */
++ source = g_child_watch_source_new (data->child_pid);
++ g_source_set_callback (source,
++ (GSourceFunc) utils_child_watch_from_release_cb,
++ source,
++ (GDestroyNotify) g_source_destroy);
++ g_source_attach (source, data->main_context);
++ g_source_unref (source);
++ data->child_pid = 0;
++ }
++
++ if (data->child_stdout != NULL)
++ {
++ g_string_free (data->child_stdout, TRUE);
++ data->child_stdout = NULL;
++ }
++
++ if (data->child_stderr != NULL)
++ {
++ g_string_free (data->child_stderr, TRUE);
++ data->child_stderr = NULL;
++ }
++
++ if (data->child_stdout_channel != NULL)
++ {
++ g_io_channel_unref (data->child_stdout_channel);
++ data->child_stdout_channel = NULL;
++ }
++ if (data->child_stderr_channel != NULL)
++ {
++ g_io_channel_unref (data->child_stderr_channel);
++ data->child_stderr_channel = NULL;
++ }
++
++ if (data->child_stdout_source != NULL)
++ {
++ g_source_destroy (data->child_stdout_source);
++ data->child_stdout_source = NULL;
++ }
++ if (data->child_stderr_source != NULL)
++ {
++ g_source_destroy (data->child_stderr_source);
++ data->child_stderr_source = NULL;
++ }
++
++ if (data->child_stdout_fd != -1)
++ {
++ g_warn_if_fail (close (data->child_stdout_fd) == 0);
++ data->child_stdout_fd = -1;
++ }
++ if (data->child_stderr_fd != -1)
++ {
++ g_warn_if_fail (close (data->child_stderr_fd) == 0);
++ data->child_stderr_fd = -1;
++ }
++
++ if (data->cancellable_handler_id > 0)
++ {
++ g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id);
++ data->cancellable_handler_id = 0;
++ }
++
++ if (data->main_context != NULL)
++ g_main_context_unref (data->main_context);
++
++ if (data->cancellable != NULL)
++ g_object_unref (data->cancellable);
++
++ g_slice_free (UtilsSpawnData, data);
++}
++
++/* called in the thread where @cancellable was cancelled */
++static void
++utils_on_cancelled (GCancellable *cancellable,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = user_data;
++ GError *error;
++
++ error = NULL;
++ g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error));
++ g_simple_async_result_take_error (data->simple, error);
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++}
++
++static gboolean
++utils_read_child_stderr (GIOChannel *channel,
++ GIOCondition condition,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = user_data;
++ gchar buf[1024];
++ gsize bytes_read;
++
++ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
++ g_string_append_len (data->child_stderr, buf, bytes_read);
++ return TRUE;
++}
++
++static gboolean
++utils_read_child_stdout (GIOChannel *channel,
++ GIOCondition condition,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = user_data;
++ gchar buf[1024];
++ gsize bytes_read;
++
++ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
++ g_string_append_len (data->child_stdout, buf, bytes_read);
++ return TRUE;
++}
++
++static void
++utils_child_watch_cb (GPid pid,
++ gint status,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = user_data;
++ gchar *buf;
++ gsize buf_size;
++
++ if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
++ {
++ g_string_append_len (data->child_stdout, buf, buf_size);
++ g_free (buf);
++ }
++ if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
++ {
++ g_string_append_len (data->child_stderr, buf, buf_size);
++ g_free (buf);
++ }
++
++ data->exit_status = status;
++
++ /* ok, child watch is history, make sure we don't free it in spawn_data_free() */
++ data->child_pid = 0;
++ data->child_watch_source = NULL;
++
++ /* we're done */
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++}
++
++static gboolean
++utils_timeout_cb (gpointer user_data)
++{
++ UtilsSpawnData *data = user_data;
++
++ data->timed_out = TRUE;
++
++ /* ok, timeout is history, make sure we don't free it in spawn_data_free() */
++ data->timeout_source = NULL;
++
++ /* we're done */
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++
++ return FALSE; /* remove source */
++}
++
++static void
++utils_spawn (const gchar *const *argv,
++ guint timeout_seconds,
++ GCancellable *cancellable,
++ GAsyncReadyCallback callback,
++ gpointer user_data)
++{
++ UtilsSpawnData *data;
++ GError *error;
++
++ data = g_slice_new0 (UtilsSpawnData);
++ data->timeout_seconds = timeout_seconds;
++ data->simple = g_simple_async_result_new (NULL,
++ callback,
++ user_data,
++ utils_spawn);
++ data->main_context = g_main_context_get_thread_default ();
++ if (data->main_context != NULL)
++ g_main_context_ref (data->main_context);
++
++ data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL;
++
++ data->child_stdout = g_string_new (NULL);
++ data->child_stderr = g_string_new (NULL);
++ data->child_stdout_fd = -1;
++ data->child_stderr_fd = -1;
++
++ /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */
++ g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free);
++
++ error = NULL;
++ if (data->cancellable != NULL)
++ {
++ /* could already be cancelled */
++ error = NULL;
++ if (g_cancellable_set_error_if_cancelled (data->cancellable, &error))
++ {
++ g_simple_async_result_take_error (data->simple, error);
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++ goto out;
++ }
++
++ data->cancellable_handler_id = g_cancellable_connect (data->cancellable,
++ G_CALLBACK (utils_on_cancelled),
++ data,
++ NULL);
++ }
++
++ error = NULL;
++ if (!g_spawn_async_with_pipes (NULL, /* working directory */
++ (gchar **) argv,
++ NULL, /* envp */
++ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
++ NULL, /* child_setup */
++ NULL, /* child_setup's user_data */
++ &(data->child_pid),
++ NULL, /* gint *stdin_fd */
++ &(data->child_stdout_fd),
++ &(data->child_stderr_fd),
++ &error))
++ {
++ g_prefix_error (&error, "Error spawning: ");
++ g_simple_async_result_take_error (data->simple, error);
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++ goto out;
++ }
++
++ if (timeout_seconds > 0)
++ {
++ data->timeout_source = g_timeout_source_new_seconds (timeout_seconds);
++ g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT);
++ g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL);
++ g_source_attach (data->timeout_source, data->main_context);
++ g_source_unref (data->timeout_source);
++ }
++
++ data->child_watch_source = g_child_watch_source_new (data->child_pid);
++ g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL);
++ g_source_attach (data->child_watch_source, data->main_context);
++ g_source_unref (data->child_watch_source);
++
++ data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd);
++ g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL);
++ data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN);
++ g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL);
++ g_source_attach (data->child_stdout_source, data->main_context);
++ g_source_unref (data->child_stdout_source);
++
++ data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd);
++ g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL);
++ data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN);
++ g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL);
++ g_source_attach (data->child_stderr_source, data->main_context);
++ g_source_unref (data->child_stderr_source);
++
++ out:
++ ;
++}
++
++gboolean
++utils_spawn_finish (GAsyncResult *res,
++ gint *out_exit_status,
++ gchar **out_standard_output,
++ gchar **out_standard_error,
++ GError **error)
++{
++ GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
++ UtilsSpawnData *data;
++ gboolean ret = FALSE;
++
++ g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
++ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
++
++ g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == utils_spawn);
++
++ if (g_simple_async_result_propagate_error (simple, error))
++ goto out;
++
++ data = g_simple_async_result_get_op_res_gpointer (simple);
++
++ if (data->timed_out)
++ {
++ g_set_error (error,
++ G_IO_ERROR,
++ G_IO_ERROR_TIMED_OUT,
++ "Timed out after %d seconds",
++ data->timeout_seconds);
++ goto out;
++ }
++
++ if (out_exit_status != NULL)
++ *out_exit_status = data->exit_status;
++
++ if (out_standard_output != NULL)
++ *out_standard_output = g_strdup (data->child_stdout->str);
++
++ if (out_standard_error != NULL)
++ *out_standard_error = g_strdup (data->child_stderr->str);
++
++ ret = TRUE;
++
++ out:
++ return ret;
++}
+--
+GitLab
+
+
+From d74aad8152a7c51999fffa9abe28e4306a052399 Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 13:15:17 +0800
+Subject: [PATCH 02/16] check netgroup.h header file
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index ae98453..543d6fd 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -26,7 +26,11 @@
+ #include <errno.h>
+ #include <pwd.h>
+ #include <grp.h>
++#ifdef HAVE_NETGROUP_H
++#include <netgroup.h>
++#else
+ #include <netdb.h>
++#endif
+ #include <string.h>
+ #include <glib/gstdio.h>
+ #include <locale.h>
+--
+GitLab
+
+
+From 69c761506cbe458807e4ae2742c9e05bc60dad3d Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 10:59:03 +0800
+Subject: [PATCH 03/16] check return value
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 543d6fd..a54ed5b 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -249,7 +249,11 @@ reload_scripts (PolkitBackendJsAuthority *authority)
+ duk_context *cx = authority->priv->cx;
+
+ duk_set_top (cx, 0);
+- duk_get_global_string (cx, "polkit");
++ if (!duk_get_global_string (cx, "polkit")) {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error deleting old rules, not loading new ones");
++ return;
++ }
+ duk_push_string (cx, "_deleteRules");
+
+ duk_call_prop (cx, 0, 0);
+--
+GitLab
+
+
+From f1536c4899934fd3c8243fda2d084a472fe57d2e Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 11:22:39 +0800
+Subject: [PATCH 04/16] check return value
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index a54ed5b..1a7e6d3 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -656,7 +656,10 @@ push_action_and_details (duk_context *cx,
+ gchar **keys;
+ guint n;
+
+- duk_get_global_string (cx, "Action");
++ if (!duk_get_global_string (cx, "Action")) {
++ return FALSE;
++ }
++
+ duk_new (cx, 0);
+
+ set_property_str (cx, "id", action_id);
+@@ -699,7 +702,12 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
+ duk_context *cx = authority->priv->cx;
+
+ duk_set_top (cx, 0);
+- duk_get_global_string (cx, "polkit");
++ if (!duk_get_global_string (cx, "polkit")) {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error deleting old rules, not loading new ones");
++ goto out;
++ }
++
+ duk_push_string (cx, "_runAdminRules");
+
+ if (!push_action_and_details (cx, action_id, details, &error))
+--
+GitLab
+
+
+From ca15eecf5dc7755947515c1bfc651fd8770aaf8f Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 13:17:16 +0800
+Subject: [PATCH 05/16] check return value
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 1a7e6d3..3f1b32d 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -550,7 +550,10 @@ push_subject (duk_context *cx,
+ char *seat_str = NULL;
+ char *session_str = NULL;
+
+- duk_get_global_string (cx, "Subject");
++ if (!duk_get_global_string (cx, "Subject")) {
++ return FALSE;
++ }
++
+ duk_new (cx, 0);
+
+ if (POLKIT_IS_UNIX_PROCESS (subject))
+@@ -789,8 +792,11 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
+ gboolean good = FALSE;
+ duk_context *cx = authority->priv->cx;
+
++ if (!duk_get_global_string (cx, "polkit")) {
++ goto out;
++ }
++
+ duk_set_top (cx, 0);
+- duk_get_global_string (cx, "polkit");
+ duk_push_string (cx, "_runRules");
+
+ if (!push_action_and_details (cx, action_id, details, &error))
+--
+GitLab
+
+
+From 870348365cc0166e14f28e0d144ed552bba4d794 Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 13:18:13 +0800
+Subject: [PATCH 06/16] check return value
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 3f1b32d..6294ad9 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -843,7 +843,8 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
+ out:
+ if (!good)
+ ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED;
+- g_free (ret_str);
++ if (ret_str != NULL)
++ g_free (ret_str);
+
+ return ret;
+ }
+--
+GitLab
+
+
+From 81c916ff08fdcee3c7340c4b2d4632086b89666c Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 11:23:04 +0800
+Subject: [PATCH 07/16] fix typecase
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 6294ad9..d466c9d 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -1191,7 +1191,7 @@ static void
+ utils_on_cancelled (GCancellable *cancellable,
+ gpointer user_data)
+ {
+- UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ GError *error;
+
+ error = NULL;
+@@ -1206,7 +1206,7 @@ utils_read_child_stderr (GIOChannel *channel,
+ GIOCondition condition,
+ gpointer user_data)
+ {
+- UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ gchar buf[1024];
+ gsize bytes_read;
+
+@@ -1220,7 +1220,7 @@ utils_read_child_stdout (GIOChannel *channel,
+ GIOCondition condition,
+ gpointer user_data)
+ {
+- UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ gchar buf[1024];
+ gsize bytes_read;
+
+@@ -1234,7 +1234,7 @@ utils_child_watch_cb (GPid pid,
+ gint status,
+ gpointer user_data)
+ {
+- UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ gchar *buf;
+ gsize buf_size;
+
+@@ -1263,7 +1263,7 @@ utils_child_watch_cb (GPid pid,
+ static gboolean
+ utils_timeout_cb (gpointer user_data)
+ {
+- UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+
+ data->timed_out = TRUE;
+
+--
+GitLab
+
+
+From acb956bf52f0a78bf7aaf925876f96e97a146995 Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 18:04:27 +0800
+Subject: [PATCH 08/16] typecase
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index d466c9d..237b1ad 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -915,8 +915,8 @@ spawn_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+ {
+- SpawnData *data = user_data;
+- data->res = g_object_ref (res);
++ SpawnData *data = (SpawnData *)user_data;
++ data->res = (GAsyncResult*)g_object_ref (res);
+ g_main_loop_quit (data->loop);
+ }
+
+@@ -1292,12 +1292,12 @@ utils_spawn (const gchar *const *argv,
+ data->simple = g_simple_async_result_new (NULL,
+ callback,
+ user_data,
+- utils_spawn);
++ (gpointer*)utils_spawn);
+ data->main_context = g_main_context_get_thread_default ();
+ if (data->main_context != NULL)
+ g_main_context_ref (data->main_context);
+
+- data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL;
++ data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL;
+
+ data->child_stdout = g_string_new (NULL);
+ data->child_stderr = g_string_new (NULL);
+@@ -1397,7 +1397,7 @@ utils_spawn_finish (GAsyncResult *res,
+ if (g_simple_async_result_propagate_error (simple, error))
+ goto out;
+
+- data = g_simple_async_result_get_op_res_gpointer (simple);
++ data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple);
+
+ if (data->timed_out)
+ {
+--
+GitLab
+
+
+From be060e4d48aceb09af34868b555b6c73c7afdabb Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 13:53:23 +0800
+Subject: [PATCH 09/16] some change
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ .../polkitbackendduktapeauthority.c | 26 +++++++++++--------
+ 1 file changed, 15 insertions(+), 11 deletions(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 237b1ad..fad9017 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -207,18 +207,22 @@ load_scripts (PolkitBackendJsAuthority *authority)
+
+ for (l = files; l != NULL; l = l->next)
+ {
+- const gchar *filename = l->data;
+-
++ const gchar *filename = (gchar *)l->data;
+ #if (DUK_VERSION >= 20000)
+- gchar *contents;
+- gsize length;
+- GError *error = NULL;
+- if (!g_file_get_contents (filename, &contents, &length, &error)){
+- g_warning("Error when file contents of %s: %s\n", filename, error->message);
+- g_error_free (error);
+- continue;
+- }
+- if (duk_peval_lstring_noresult(cx, contents,length) != 0)
++ GFile *file = g_file_new_for_path (filename);
++ char *contents;
++ gsize len;
++ if (!g_file_load_contents (file, NULL, &contents, &len, NULL, NULL))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error compiling script %s",
++ filename);
++ g_object_unref (file);
++ continue;
++ }
++
++ g_object_unref (file);
++ if (duk_peval_lstring_noresult(cx, contents,len) != 0)
+ #else
+ if (duk_peval_file_noresult (cx, filename) != 0)
+ #endif
+--
+GitLab
+
+
+From 2ffb62048a5ebedfe3bb053feb7385c7270ede28 Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 15:25:45 +0800
+Subject: [PATCH 10/16] some change
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ .../polkitbackendduktapeauthority.c | 24 +++++++++----------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index fad9017..6fac3be 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -125,6 +125,18 @@ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BAC
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
++static duk_ret_t js_polkit_log (duk_context *cx);
++static duk_ret_t js_polkit_spawn (duk_context *cx);
++static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx);
++
++static const duk_function_list_entry js_polkit_functions[] =
++{
++ { "log", js_polkit_log, 1 },
++ { "spawn", js_polkit_spawn, 1 },
++ { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 },
++ { NULL, NULL, 0 },
++};
++
+ static void
+ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority)
+ {
+@@ -347,18 +359,6 @@ setup_file_monitors (PolkitBackendJsAuthority *authority)
+ authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE);
+ }
+
+-static duk_ret_t js_polkit_log (duk_context *cx);
+-static duk_ret_t js_polkit_spawn (duk_context *cx);
+-static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx);
+-
+-static const duk_function_list_entry js_polkit_functions[] =
+-{
+- { "log", js_polkit_log, 1 },
+- { "spawn", js_polkit_spawn, 1 },
+- { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 },
+- { NULL, NULL, 0 },
+-};
+-
+ static void
+ polkit_backend_js_authority_constructed (GObject *object)
+ {
+--
+GitLab
+
+
+From edb70ef69eed3275f5654510d135e680eb46c85d Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 15:25:35 +0800
+Subject: [PATCH 11/16] remove WATCHDOG_TIMEOUT define
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 6fac3be..51e03fd 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -69,7 +69,6 @@ struct _PolkitBackendJsAuthorityPrivate
+ duk_context *cx;
+ };
+
+-#define WATCHDOG_TIMEOUT (15 * G_TIME_SPAN_SECOND)
+
+ static void utils_spawn (const gchar *const *argv,
+ guint timeout_seconds,
+--
+GitLab
+
+
+From 906ae404f29f15ef8c529b999bf091b5d18ed7ac Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 12:46:40 +0800
+Subject: [PATCH 12/16] add meson build system support
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ meson.build | 11 ++++++++++-
+ meson_options.txt | 1 +
+ src/polkitbackend/meson.build | 10 ++++++++--
+ 3 files changed, 19 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 858078d..4e44723 100644
+--- a/meson.build
++++ b/meson.build
+@@ -133,7 +133,13 @@ expat_dep = dependency('expat')
+ assert(cc.has_header('expat.h', dependencies: expat_dep), 'Can\'t find expat.h. Please install expat.')
+ assert(cc.has_function('XML_ParserCreate', dependencies: expat_dep), 'Can\'t find expat library. Please install expat.')
+
+-mozjs_dep = dependency('mozjs-78')
++js_engine = get_option('js_engine')
++if js_engine == 'duktape'
++ js_dep = dependency('duktape')
++ libm_dep = cc.find_library('m')
++elif js_engine == 'mozjs'
++ js_dep = dependency('mozjs-78')
++endif
+
+ dbus_dep = dependency('dbus-1', required: false)
+ dbus_policydir = pk_prefix / pk_datadir / 'dbus-1/system.d'
+@@ -361,6 +367,9 @@ if enable_logind
+ output += ' systemdsystemunitdir: ' + systemd_systemdsystemunitdir + '\n'
+ endif
+ output += ' polkitd user: ' + polkitd_user + ' \n'
++output += ' Javascript engine: ' + js_engine + '\n'
++if enable_logind
++endif
+ output += ' PAM support: ' + enable_pam.to_string() + '\n\n'
+ if enable_pam
+ output += ' PAM file auth: ' + pam_conf['PAM_FILE_INCLUDE_AUTH'] + '\n'
+diff --git a/meson_options.txt b/meson_options.txt
+index 25e3e77..76aa311 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -16,3 +16,4 @@ option('introspection', type: 'boolean', value: true, description: 'Enable intro
+
+ option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+ option('man', type: 'boolean', value: false, description: 'build manual pages')
++option('js_engine', type: 'combo', choices: ['mozjs', 'duktape'], value: 'duktape', description: 'javascript engine')
+diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build
+index 64f0e4a..489897d 100644
+--- a/src/polkitbackend/meson.build
++++ b/src/polkitbackend/meson.build
+@@ -5,7 +5,6 @@ sources = files(
+ 'polkitbackendactionpool.c',
+ 'polkitbackendauthority.c',
+ 'polkitbackendinteractiveauthority.c',
+- 'polkitbackendjsauthority.cpp',
+ )
+
+ output = 'initjs.h'
+@@ -21,7 +20,7 @@ sources += custom_target(
+ deps = [
+ expat_dep,
+ libpolkit_gobject_dep,
+- mozjs_dep,
++ js_dep,
+ ]
+
+ c_flags = [
+@@ -31,6 +30,13 @@ c_flags = [
+ '-DPACKAGE_SYSCONF_DIR="@0@"'.format(pk_prefix / pk_sysconfdir),
+ ]
+
++if js_engine == 'duktape'
++ sources += files('polkitbackendduktapeauthority.c')
++ deps += libm_dep
++elif js_engine == 'mozjs'
++ sources += files('polkitbackendjsauthority.cpp')
++endif
++
+ if enable_logind
+ sources += files('polkitbackendsessionmonitor-systemd.c')
+
+--
+GitLab
+
+
+From 1380b505c25be4aebe54b1b4223a570d64af83cc Mon Sep 17 00:00:00 2001
+From: Wu Xiaotian <yetist@gmail.com>
+Date: Sun, 22 Nov 2020 18:49:14 +0800
+Subject: [PATCH 13/16] fix run error
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/polkitbackendduktapeauthority.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 51e03fd..4b4f8fd 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -795,11 +795,11 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
+ gboolean good = FALSE;
+ duk_context *cx = authority->priv->cx;
+
++ duk_set_top (cx, 0);
+ if (!duk_get_global_string (cx, "polkit")) {
+ goto out;
+ }
+
+- duk_set_top (cx, 0);
+ duk_push_string (cx, "_runRules");
+
+ if (!push_action_and_details (cx, action_id, details, &error))
+--
+GitLab
+
+
+From 6856a704b70378948ef5f66e9b09555d97d4070b Mon Sep 17 00:00:00 2001
+From: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+Date: Fri, 10 Sep 2021 15:17:58 -0700
+Subject: [PATCH 14/16] Deduplicate code for "Add duktape as JS engine backend"
+ effort/MR
+
+This leverages Wu Xiaotian (@yetist)'s original MR
+(https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35), in
+an effort to complete said work.
+
+This is the first of the requests from maintainers--to reduce
+eliminate code duplication.
+
+The runaway-killer missing functionality will come in the sequence.
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ src/polkitbackend/Makefile.am | 1 +
+ src/polkitbackend/meson.build | 1 +
+ src/polkitbackend/polkitbackendcommon.c | 530 +++++++++++++
+ src/polkitbackend/polkitbackendcommon.h | 156 ++++
+ .../polkitbackendduktapeauthority.c | 714 ++----------------
+ .../polkitbackendjsauthority.cpp | 711 ++---------------
+ 6 files changed, 790 insertions(+), 1323 deletions(-)
+ create mode 100644 src/polkitbackend/polkitbackendcommon.c
+ create mode 100644 src/polkitbackend/polkitbackendcommon.h
+
+diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am
+index abcbc6f..6a8b4ae 100644
+--- a/src/polkitbackend/Makefile.am
++++ b/src/polkitbackend/Makefile.am
+@@ -31,6 +31,7 @@ libpolkit_backend_1_la_SOURCES = \
+ polkitbackend.h \
+ polkitbackendtypes.h \
+ polkitbackendprivate.h \
++ polkitbackendcommon.h polkitbackendcommon.c \
+ polkitbackendauthority.h polkitbackendauthority.c \
+ polkitbackendinteractiveauthority.h polkitbackendinteractiveauthority.c \
+ polkitbackendjsauthority.h \
+diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build
+index 489897d..9ec01b2 100644
+--- a/src/polkitbackend/meson.build
++++ b/src/polkitbackend/meson.build
+@@ -4,6 +4,7 @@ sources = files(
+ 'polkitbackendactionlookup.c',
+ 'polkitbackendactionpool.c',
+ 'polkitbackendauthority.c',
++ 'polkitbackendcommon.c',
+ 'polkitbackendinteractiveauthority.c',
+ )
+
+diff --git a/src/polkitbackend/polkitbackendcommon.c b/src/polkitbackend/polkitbackendcommon.c
+new file mode 100644
+index 0000000..6783dff
+--- /dev/null
++++ b/src/polkitbackend/polkitbackendcommon.c
+@@ -0,0 +1,530 @@
++/*
++ * Copyright (C) 2008 Red Hat, Inc.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General
++ * Public License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
++ * Boston, MA 02111-1307, USA.
++ *
++ * Author: David Zeuthen <davidz@redhat.com>
++ */
++
++#include "polkitbackendcommon.h"
++
++static void
++utils_child_watch_from_release_cb (GPid pid,
++ gint status,
++ gpointer user_data)
++{
++}
++
++static void
++utils_spawn_data_free (UtilsSpawnData *data)
++{
++ if (data->timeout_source != NULL)
++ {
++ g_source_destroy (data->timeout_source);
++ data->timeout_source = NULL;
++ }
++
++ /* Nuke the child, if necessary */
++ if (data->child_watch_source != NULL)
++ {
++ g_source_destroy (data->child_watch_source);
++ data->child_watch_source = NULL;
++ }
++
++ if (data->child_pid != 0)
++ {
++ GSource *source;
++ kill (data->child_pid, SIGTERM);
++ /* OK, we need to reap for the child ourselves - we don't want
++ * to use waitpid() because that might block the calling
++ * thread (the child might handle SIGTERM and use several
++ * seconds for cleanup/rollback).
++ *
++ * So we use GChildWatch instead.
++ *
++ * Avoid taking a references to ourselves. but note that we need
++ * to pass the GSource so we can nuke it once handled.
++ */
++ source = g_child_watch_source_new (data->child_pid);
++ g_source_set_callback (source,
++ (GSourceFunc) utils_child_watch_from_release_cb,
++ source,
++ (GDestroyNotify) g_source_destroy);
++ g_source_attach (source, data->main_context);
++ g_source_unref (source);
++ data->child_pid = 0;
++ }
++
++ if (data->child_stdout != NULL)
++ {
++ g_string_free (data->child_stdout, TRUE);
++ data->child_stdout = NULL;
++ }
++
++ if (data->child_stderr != NULL)
++ {
++ g_string_free (data->child_stderr, TRUE);
++ data->child_stderr = NULL;
++ }
++
++ if (data->child_stdout_channel != NULL)
++ {
++ g_io_channel_unref (data->child_stdout_channel);
++ data->child_stdout_channel = NULL;
++ }
++ if (data->child_stderr_channel != NULL)
++ {
++ g_io_channel_unref (data->child_stderr_channel);
++ data->child_stderr_channel = NULL;
++ }
++
++ if (data->child_stdout_source != NULL)
++ {
++ g_source_destroy (data->child_stdout_source);
++ data->child_stdout_source = NULL;
++ }
++ if (data->child_stderr_source != NULL)
++ {
++ g_source_destroy (data->child_stderr_source);
++ data->child_stderr_source = NULL;
++ }
++
++ if (data->child_stdout_fd != -1)
++ {
++ g_warn_if_fail (close (data->child_stdout_fd) == 0);
++ data->child_stdout_fd = -1;
++ }
++ if (data->child_stderr_fd != -1)
++ {
++ g_warn_if_fail (close (data->child_stderr_fd) == 0);
++ data->child_stderr_fd = -1;
++ }
++
++ if (data->cancellable_handler_id > 0)
++ {
++ g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id);
++ data->cancellable_handler_id = 0;
++ }
++
++ if (data->main_context != NULL)
++ g_main_context_unref (data->main_context);
++
++ if (data->cancellable != NULL)
++ g_object_unref (data->cancellable);
++
++ g_slice_free (UtilsSpawnData, data);
++}
++
++/* called in the thread where @cancellable was cancelled */
++static void
++utils_on_cancelled (GCancellable *cancellable,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
++ GError *error;
++
++ error = NULL;
++ g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error));
++ g_simple_async_result_take_error (data->simple, error);
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++}
++
++static gboolean
++utils_timeout_cb (gpointer user_data)
++{
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
++
++ data->timed_out = TRUE;
++
++ /* ok, timeout is history, make sure we don't free it in spawn_data_free() */
++ data->timeout_source = NULL;
++
++ /* we're done */
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++
++ return FALSE; /* remove source */
++}
++
++static void
++utils_child_watch_cb (GPid pid,
++ gint status,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
++ gchar *buf;
++ gsize buf_size;
++
++ if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
++ {
++ g_string_append_len (data->child_stdout, buf, buf_size);
++ g_free (buf);
++ }
++ if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
++ {
++ g_string_append_len (data->child_stderr, buf, buf_size);
++ g_free (buf);
++ }
++
++ data->exit_status = status;
++
++ /* ok, child watch is history, make sure we don't free it in spawn_data_free() */
++ data->child_pid = 0;
++ data->child_watch_source = NULL;
++
++ /* we're done */
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++}
++
++static gboolean
++utils_read_child_stderr (GIOChannel *channel,
++ GIOCondition condition,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
++ gchar buf[1024];
++ gsize bytes_read;
++
++ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
++ g_string_append_len (data->child_stderr, buf, bytes_read);
++ return TRUE;
++}
++
++static gboolean
++utils_read_child_stdout (GIOChannel *channel,
++ GIOCondition condition,
++ gpointer user_data)
++{
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
++ gchar buf[1024];
++ gsize bytes_read;
++
++ g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
++ g_string_append_len (data->child_stdout, buf, bytes_read);
++ return TRUE;
++}
++
++void
++polkit_backend_common_spawn (const gchar *const *argv,
++ guint timeout_seconds,
++ GCancellable *cancellable,
++ GAsyncReadyCallback callback,
++ gpointer user_data)
++{
++ UtilsSpawnData *data;
++ GError *error;
++
++ data = g_slice_new0 (UtilsSpawnData);
++ data->timeout_seconds = timeout_seconds;
++ data->simple = g_simple_async_result_new (NULL,
++ callback,
++ user_data,
++ (gpointer*)polkit_backend_common_spawn);
++ data->main_context = g_main_context_get_thread_default ();
++ if (data->main_context != NULL)
++ g_main_context_ref (data->main_context);
++
++ data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL;
++
++ data->child_stdout = g_string_new (NULL);
++ data->child_stderr = g_string_new (NULL);
++ data->child_stdout_fd = -1;
++ data->child_stderr_fd = -1;
++
++ /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */
++ g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free);
++
++ error = NULL;
++ if (data->cancellable != NULL)
++ {
++ /* could already be cancelled */
++ error = NULL;
++ if (g_cancellable_set_error_if_cancelled (data->cancellable, &error))
++ {
++ g_simple_async_result_take_error (data->simple, error);
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++ goto out;
++ }
++
++ data->cancellable_handler_id = g_cancellable_connect (data->cancellable,
++ G_CALLBACK (utils_on_cancelled),
++ data,
++ NULL);
++ }
++
++ error = NULL;
++ if (!g_spawn_async_with_pipes (NULL, /* working directory */
++ (gchar **) argv,
++ NULL, /* envp */
++ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
++ NULL, /* child_setup */
++ NULL, /* child_setup's user_data */
++ &(data->child_pid),
++ NULL, /* gint *stdin_fd */
++ &(data->child_stdout_fd),
++ &(data->child_stderr_fd),
++ &error))
++ {
++ g_prefix_error (&error, "Error spawning: ");
++ g_simple_async_result_take_error (data->simple, error);
++ g_simple_async_result_complete_in_idle (data->simple);
++ g_object_unref (data->simple);
++ goto out;
++ }
++
++ if (timeout_seconds > 0)
++ {
++ data->timeout_source = g_timeout_source_new_seconds (timeout_seconds);
++ g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT);
++ g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL);
++ g_source_attach (data->timeout_source, data->main_context);
++ g_source_unref (data->timeout_source);
++ }
++
++ data->child_watch_source = g_child_watch_source_new (data->child_pid);
++ g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL);
++ g_source_attach (data->child_watch_source, data->main_context);
++ g_source_unref (data->child_watch_source);
++
++ data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd);
++ g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL);
++ data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN);
++ g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL);
++ g_source_attach (data->child_stdout_source, data->main_context);
++ g_source_unref (data->child_stdout_source);
++
++ data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd);
++ g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL);
++ data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN);
++ g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL);
++ g_source_attach (data->child_stderr_source, data->main_context);
++ g_source_unref (data->child_stderr_source);
++
++ out:
++ ;
++}
++
++void
++polkit_backend_common_on_dir_monitor_changed (GFileMonitor *monitor,
++ GFile *file,
++ GFile *other_file,
++ GFileMonitorEvent event_type,
++ gpointer user_data)
++{
++ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data);
++
++ /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution?
++ * Because when editing a file with emacs we get 4-8 events..
++ */
++
++ if (file != NULL)
++ {
++ gchar *name;
++
++ name = g_file_get_basename (file);
++
++ /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */
++ if (!g_str_has_prefix (name, ".") &&
++ !g_str_has_prefix (name, "#") &&
++ g_str_has_suffix (name, ".rules") &&
++ (event_type == G_FILE_MONITOR_EVENT_CREATED ||
++ event_type == G_FILE_MONITOR_EVENT_DELETED ||
++ event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Reloading rules");
++ polkit_backend_common_reload_scripts (authority);
++ }
++ g_free (name);
++ }
++}
++
++gboolean
++polkit_backend_common_spawn_finish (GAsyncResult *res,
++ gint *out_exit_status,
++ gchar **out_standard_output,
++ gchar **out_standard_error,
++ GError **error)
++{
++ GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
++ UtilsSpawnData *data;
++ gboolean ret = FALSE;
++
++ g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
++ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
++
++ g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_backend_common_spawn);
++
++ if (g_simple_async_result_propagate_error (simple, error))
++ goto out;
++
++ data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple);
++
++ if (data->timed_out)
++ {
++ g_set_error (error,
++ G_IO_ERROR,
++ G_IO_ERROR_TIMED_OUT,
++ "Timed out after %d seconds",
++ data->timeout_seconds);
++ goto out;
++ }
++
++ if (out_exit_status != NULL)
++ *out_exit_status = data->exit_status;
++
++ if (out_standard_output != NULL)
++ *out_standard_output = g_strdup (data->child_stdout->str);
++
++ if (out_standard_error != NULL)
++ *out_standard_error = g_strdup (data->child_stderr->str);
++
++ ret = TRUE;
++
++ out:
++ return ret;
++}
++
++static const gchar *
++polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority)
++{
++ return "js";
++}
++
++static const gchar *
++polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority)
++{
++ return PACKAGE_VERSION;
++}
++
++static PolkitAuthorityFeatures
++polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority)
++{
++ return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION;
++}
++
++void
++polkit_backend_common_js_authority_class_init_common (PolkitBackendJsAuthorityClass *klass)
++{
++ GObjectClass *gobject_class;
++ PolkitBackendAuthorityClass *authority_class;
++ PolkitBackendInteractiveAuthorityClass *interactive_authority_class;
++
++ gobject_class = G_OBJECT_CLASS (klass);
++ gobject_class->finalize = polkit_backend_common_js_authority_finalize;
++ gobject_class->set_property = polkit_backend_common_js_authority_set_property;
++ gobject_class->constructed = polkit_backend_common_js_authority_constructed;
++
++ authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass);
++ authority_class->get_name = polkit_backend_js_authority_get_name;
++ authority_class->get_version = polkit_backend_js_authority_get_version;
++ authority_class->get_features = polkit_backend_js_authority_get_features;
++
++ interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass);
++ interactive_authority_class->get_admin_identities = polkit_backend_common_js_authority_get_admin_auth_identities;
++ interactive_authority_class->check_authorization_sync = polkit_backend_common_js_authority_check_authorization_sync;
++
++ g_object_class_install_property (gobject_class,
++ PROP_RULES_DIRS,
++ g_param_spec_boxed ("rules-dirs",
++ NULL,
++ NULL,
++ G_TYPE_STRV,
++ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
++}
++
++gint
++polkit_backend_common_rules_file_name_cmp (const gchar *a,
++ const gchar *b)
++{
++ gint ret;
++ const gchar *a_base;
++ const gchar *b_base;
++
++ a_base = strrchr (a, '/');
++ b_base = strrchr (b, '/');
++
++ g_assert (a_base != NULL);
++ g_assert (b_base != NULL);
++ a_base += 1;
++ b_base += 1;
++
++ ret = g_strcmp0 (a_base, b_base);
++ if (ret == 0)
++ {
++ /* /etc wins over /usr */
++ ret = g_strcmp0 (a, b);
++ g_assert (ret != 0);
++ }
++
++ return ret;
++}
++
++const gchar *
++polkit_backend_common_get_signal_name (gint signal_number)
++{
++ switch (signal_number)
++ {
++#define _HANDLE_SIG(sig) case sig: return #sig;
++ _HANDLE_SIG (SIGHUP);
++ _HANDLE_SIG (SIGINT);
++ _HANDLE_SIG (SIGQUIT);
++ _HANDLE_SIG (SIGILL);
++ _HANDLE_SIG (SIGABRT);
++ _HANDLE_SIG (SIGFPE);
++ _HANDLE_SIG (SIGKILL);
++ _HANDLE_SIG (SIGSEGV);
++ _HANDLE_SIG (SIGPIPE);
++ _HANDLE_SIG (SIGALRM);
++ _HANDLE_SIG (SIGTERM);
++ _HANDLE_SIG (SIGUSR1);
++ _HANDLE_SIG (SIGUSR2);
++ _HANDLE_SIG (SIGCHLD);
++ _HANDLE_SIG (SIGCONT);
++ _HANDLE_SIG (SIGSTOP);
++ _HANDLE_SIG (SIGTSTP);
++ _HANDLE_SIG (SIGTTIN);
++ _HANDLE_SIG (SIGTTOU);
++ _HANDLE_SIG (SIGBUS);
++#ifdef SIGPOLL
++ _HANDLE_SIG (SIGPOLL);
++#endif
++ _HANDLE_SIG (SIGPROF);
++ _HANDLE_SIG (SIGSYS);
++ _HANDLE_SIG (SIGTRAP);
++ _HANDLE_SIG (SIGURG);
++ _HANDLE_SIG (SIGVTALRM);
++ _HANDLE_SIG (SIGXCPU);
++ _HANDLE_SIG (SIGXFSZ);
++#undef _HANDLE_SIG
++ default:
++ break;
++ }
++ return "UNKNOWN_SIGNAL";
++}
++
++void
++polkit_backend_common_spawn_cb (GObject *source_object,
++ GAsyncResult *res,
++ gpointer user_data)
++{
++ SpawnData *data = (SpawnData *)user_data;
++ data->res = (GAsyncResult*)g_object_ref (res);
++ g_main_loop_quit (data->loop);
++}
+diff --git a/src/polkitbackend/polkitbackendcommon.h b/src/polkitbackend/polkitbackendcommon.h
+new file mode 100644
+index 0000000..6d0d267
+--- /dev/null
++++ b/src/polkitbackend/polkitbackendcommon.h
+@@ -0,0 +1,156 @@
++/*
++ * Copyright (C) 2008 Red Hat, Inc.
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General
++ * Public License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
++ * Boston, MA 02111-1307, USA.
++ *
++ * Author: David Zeuthen <davidz@redhat.com>
++ */
++
++#if !defined (_POLKIT_BACKEND_COMPILATION) && !defined(_POLKIT_BACKEND_INSIDE_POLKIT_BACKEND_H)
++#error "Only <polkitbackend/polkitbackend.h> can be included directly, this file may disappear or change contents."
++#endif
++
++#ifndef __POLKIT_BACKEND_COMMON_H
++#define __POLKIT_BACKEND_COMMON_H
++
++#include "config.h"
++#include <sys/wait.h>
++#include <errno.h>
++#include <pwd.h>
++#include <grp.h>
++#ifdef HAVE_NETGROUP_H
++#include <netgroup.h>
++#else
++#include <netdb.h>
++#endif
++#include <string.h>
++#include <glib/gstdio.h>
++#include <locale.h>
++#include <glib/gi18n-lib.h> //here, all things glib via glib.h (including -> gspawn.h)
++
++#include <polkit/polkit.h>
++#include "polkitbackendjsauthority.h"
++
++#include <polkit/polkitprivate.h>
++
++#ifdef HAVE_LIBSYSTEMD
++#include <systemd/sd-login.h>
++#endif /* HAVE_LIBSYSTEMD */
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++enum
++{
++ PROP_0,
++ PROP_RULES_DIRS,
++};
++
++typedef struct
++{
++ GSimpleAsyncResult *simple; /* borrowed reference */
++ GMainContext *main_context; /* may be NULL */
++
++ GCancellable *cancellable; /* may be NULL */
++ gulong cancellable_handler_id;
++
++ GPid child_pid;
++ gint child_stdout_fd;
++ gint child_stderr_fd;
++
++ GIOChannel *child_stdout_channel;
++ GIOChannel *child_stderr_channel;
++
++ GSource *child_watch_source;
++ GSource *child_stdout_source;
++ GSource *child_stderr_source;
++
++ guint timeout_seconds;
++ gboolean timed_out;
++ GSource *timeout_source;
++
++ GString *child_stdout;
++ GString *child_stderr;
++
++ gint exit_status;
++} UtilsSpawnData;
++
++typedef struct
++{
++ GMainLoop *loop;
++ GAsyncResult *res;
++} SpawnData;
++
++void polkit_backend_common_spawn (const gchar *const *argv,
++ guint timeout_seconds,
++ GCancellable *cancellable,
++ GAsyncReadyCallback callback,
++ gpointer user_data);
++void polkit_backend_common_spawn_cb (GObject *source_object,
++ GAsyncResult *res,
++ gpointer user_data);
++gboolean polkit_backend_common_spawn_finish (GAsyncResult *res,
++ gint *out_exit_status,
++ gchar **out_standard_output,
++ gchar **out_standard_error,
++ GError **error);
++
++void polkit_backend_common_on_dir_monitor_changed (GFileMonitor *monitor,
++ GFile *file,
++ GFile *other_file,
++ GFileMonitorEvent event_type,
++ gpointer user_data);
++
++void polkit_backend_common_js_authority_class_init_common (PolkitBackendJsAuthorityClass *klass);
++
++gint polkit_backend_common_rules_file_name_cmp (const gchar *a,
++ const gchar *b);
++
++const gchar *polkit_backend_common_get_signal_name (gint signal_number);
++
++/* To be provided by each JS backend, from here onwards ---------------------------------------------- */
++
++void polkit_backend_common_reload_scripts (PolkitBackendJsAuthority *authority);
++void polkit_backend_common_js_authority_finalize (GObject *object);
++void polkit_backend_common_js_authority_constructed (GObject *object);
++GList *polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details);
++void polkit_backend_common_js_authority_set_property (GObject *object,
++ guint property_id,
++ const GValue *value,
++ GParamSpec *pspec);
++PolkitImplicitAuthorization polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details,
++ PolkitImplicitAuthorization implicit);
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* __POLKIT_BACKEND_COMMON_H */
++
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index 4b4f8fd..a2b4420 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -21,32 +21,12 @@
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+-#include "config.h"
+-#include <sys/wait.h>
+-#include <errno.h>
+-#include <pwd.h>
+-#include <grp.h>
+-#ifdef HAVE_NETGROUP_H
+-#include <netgroup.h>
+-#else
+-#include <netdb.h>
+-#endif
+-#include <string.h>
+-#include <glib/gstdio.h>
+-#include <locale.h>
+-#include <glib/gi18n-lib.h>
+-
+-#include <polkit/polkit.h>
+-#include "polkitbackendjsauthority.h"
+-
+-#include <polkit/polkitprivate.h>
++#include "polkitbackendcommon.h"
+
+-#ifdef HAVE_LIBSYSTEMD
+-#include <systemd/sd-login.h>
+-#endif /* HAVE_LIBSYSTEMD */
++#include "duktape.h"
+
++/* Built source and not too big to worry about deduplication */
+ #include "initjs.h" /* init.js */
+-#include "duktape.h"
+
+ /**
+ * SECTION:polkitbackendjsauthority
+@@ -54,10 +34,9 @@
+ * @short_description: JS Authority
+ * @stability: Unstable
+ *
+- * An implementation of #PolkitBackendAuthority that reads and
+- * evalates Javascript files and supports interaction with
+- * authentication agents (virtue of being based on
+- * #PolkitBackendInteractiveAuthority).
++ * An (Duktape-based) implementation of #PolkitBackendAuthority that reads and
++ * evaluates Javascript files and supports interaction with authentication
++ * agents (virtue of being based on #PolkitBackendInteractiveAuthority).
+ */
+
+ /* ---------------------------------------------------------------------------------------------------- */
+@@ -66,64 +45,16 @@ struct _PolkitBackendJsAuthorityPrivate
+ {
+ gchar **rules_dirs;
+ GFileMonitor **dir_monitors; /* NULL-terminated array of GFileMonitor instances */
+- duk_context *cx;
+-};
+-
+-
+-static void utils_spawn (const gchar *const *argv,
+- guint timeout_seconds,
+- GCancellable *cancellable,
+- GAsyncReadyCallback callback,
+- gpointer user_data);
+-
+-gboolean utils_spawn_finish (GAsyncResult *res,
+- gint *out_exit_status,
+- gchar **out_standard_output,
+- gchar **out_standard_error,
+- GError **error);
+
+-static void on_dir_monitor_changed (GFileMonitor *monitor,
+- GFile *file,
+- GFile *other_file,
+- GFileMonitorEvent event_type,
+- gpointer user_data);
+-
+-/* ---------------------------------------------------------------------------------------------------- */
+-
+-enum
+-{
+- PROP_0,
+- PROP_RULES_DIRS,
++ duk_context *cx;
+ };
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details);
+-
+-static PolkitImplicitAuthorization polkit_backend_js_authority_check_authorization_sync (
+- PolkitBackendInteractiveAuthority *authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details,
+- PolkitImplicitAuthorization implicit);
+-
+ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY);
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-/* ---------------------------------------------------------------------------------------------------- */
+-
+ static duk_ret_t js_polkit_log (duk_context *cx);
+ static duk_ret_t js_polkit_spawn (duk_context *cx);
+ static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx);
+@@ -144,33 +75,6 @@ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority)
+ PolkitBackendJsAuthorityPrivate);
+ }
+
+-static gint
+-rules_file_name_cmp (const gchar *a,
+- const gchar *b)
+-{
+- gint ret;
+- const gchar *a_base;
+- const gchar *b_base;
+-
+- a_base = strrchr (a, '/');
+- b_base = strrchr (b, '/');
+-
+- g_assert (a_base != NULL);
+- g_assert (b_base != NULL);
+- a_base += 1;
+- b_base += 1;
+-
+- ret = g_strcmp0 (a_base, b_base);
+- if (ret == 0)
+- {
+- /* /etc wins over /usr */
+- ret = g_strcmp0 (a, b);
+- g_assert (ret != 0);
+- }
+-
+- return ret;
+-}
+-
+ static void
+ load_scripts (PolkitBackendJsAuthority *authority)
+ {
+@@ -214,7 +118,7 @@ load_scripts (PolkitBackendJsAuthority *authority)
+ }
+ }
+
+- files = g_list_sort (files, (GCompareFunc) rules_file_name_cmp);
++ files = g_list_sort (files, (GCompareFunc) polkit_backend_common_rules_file_name_cmp);
+
+ for (l = files; l != NULL; l = l->next)
+ {
+@@ -258,8 +162,8 @@ load_scripts (PolkitBackendJsAuthority *authority)
+ g_list_free_full (files, g_free);
+ }
+
+-static void
+-reload_scripts (PolkitBackendJsAuthority *authority)
++void
++polkit_backend_common_reload_scripts (PolkitBackendJsAuthority *authority)
+ {
+ duk_context *cx = authority->priv->cx;
+
+@@ -282,42 +186,6 @@ reload_scripts (PolkitBackendJsAuthority *authority)
+ g_signal_emit_by_name (authority, "changed");
+ }
+
+-static void
+-on_dir_monitor_changed (GFileMonitor *monitor,
+- GFile *file,
+- GFile *other_file,
+- GFileMonitorEvent event_type,
+- gpointer user_data)
+-{
+- PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data);
+-
+- /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution?
+- * Because when editing a file with emacs we get 4-8 events..
+- */
+-
+- if (file != NULL)
+- {
+- gchar *name;
+-
+- name = g_file_get_basename (file);
+-
+- /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */
+- if (!g_str_has_prefix (name, ".") &&
+- !g_str_has_prefix (name, "#") &&
+- g_str_has_suffix (name, ".rules") &&
+- (event_type == G_FILE_MONITOR_EVENT_CREATED ||
+- event_type == G_FILE_MONITOR_EVENT_DELETED ||
+- event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT))
+- {
+- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+- "Reloading rules");
+- reload_scripts (authority);
+- }
+- g_free (name);
+- }
+-}
+-
+-
+ static void
+ setup_file_monitors (PolkitBackendJsAuthority *authority)
+ {
+@@ -349,7 +217,7 @@ setup_file_monitors (PolkitBackendJsAuthority *authority)
+ {
+ g_signal_connect (monitor,
+ "changed",
+- G_CALLBACK (on_dir_monitor_changed),
++ G_CALLBACK (polkit_backend_common_on_dir_monitor_changed),
+ authority);
+ g_ptr_array_add (p, monitor);
+ }
+@@ -358,8 +226,8 @@ setup_file_monitors (PolkitBackendJsAuthority *authority)
+ authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE);
+ }
+
+-static void
+-polkit_backend_js_authority_constructed (GObject *object)
++void
++polkit_backend_common_js_authority_constructed (GObject *object)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
+ duk_context *cx;
+@@ -395,8 +263,8 @@ polkit_backend_js_authority_constructed (GObject *object)
+ g_assert_not_reached ();
+ }
+
+-static void
+-polkit_backend_js_authority_finalize (GObject *object)
++void
++polkit_backend_common_js_authority_finalize (GObject *object)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
+ guint n;
+@@ -405,7 +273,7 @@ polkit_backend_js_authority_finalize (GObject *object)
+ {
+ GFileMonitor *monitor = authority->priv->dir_monitors[n];
+ g_signal_handlers_disconnect_by_func (monitor,
+- G_CALLBACK (on_dir_monitor_changed),
++ G_CALLBACK (polkit_backend_common_on_dir_monitor_changed),
+ authority);
+ g_object_unref (monitor);
+ }
+@@ -417,11 +285,11 @@ polkit_backend_js_authority_finalize (GObject *object)
+ G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object);
+ }
+
+-static void
+-polkit_backend_js_authority_set_property (GObject *object,
+- guint property_id,
+- const GValue *value,
+- GParamSpec *pspec)
++void
++polkit_backend_common_js_authority_set_property (GObject *object,
++ guint property_id,
++ const GValue *value,
++ GParamSpec *pspec)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
+
+@@ -438,55 +306,10 @@ polkit_backend_js_authority_set_property (GObject *object,
+ }
+ }
+
+-static const gchar *
+-polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority)
+-{
+- return "js";
+-}
+-
+-static const gchar *
+-polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority)
+-{
+- return PACKAGE_VERSION;
+-}
+-
+-static PolkitAuthorityFeatures
+-polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority)
+-{
+- return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION;
+-}
+-
+ static void
+ polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass)
+ {
+- GObjectClass *gobject_class;
+- PolkitBackendAuthorityClass *authority_class;
+- PolkitBackendInteractiveAuthorityClass *interactive_authority_class;
+-
+-
+- gobject_class = G_OBJECT_CLASS (klass);
+- gobject_class->finalize = polkit_backend_js_authority_finalize;
+- gobject_class->set_property = polkit_backend_js_authority_set_property;
+- gobject_class->constructed = polkit_backend_js_authority_constructed;
+-
+- authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass);
+- authority_class->get_name = polkit_backend_js_authority_get_name;
+- authority_class->get_version = polkit_backend_js_authority_get_version;
+- authority_class->get_features = polkit_backend_js_authority_get_features;
+-
+- interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass);
+- interactive_authority_class->get_admin_identities = polkit_backend_js_authority_get_admin_auth_identities;
+- interactive_authority_class->check_authorization_sync = polkit_backend_js_authority_check_authorization_sync;
+-
+- g_object_class_install_property (gobject_class,
+- PROP_RULES_DIRS,
+- g_param_spec_boxed ("rules-dirs",
+- NULL,
+- NULL,
+- G_TYPE_STRV,
+- G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+-
+-
++ polkit_backend_common_js_authority_class_init_common (klass);
+ g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate));
+ }
+
+@@ -689,15 +512,15 @@ push_action_and_details (duk_context *cx,
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static GList *
+-polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details)
++GList *
++polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
+ GList *ret = NULL;
+@@ -777,16 +600,16 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static PolkitImplicitAuthorization
+-polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details,
+- PolkitImplicitAuthorization implicit)
++PolkitImplicitAuthorization
++polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details,
++ PolkitImplicitAuthorization implicit)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
+ PolkitImplicitAuthorization ret = implicit;
+@@ -864,65 +687,6 @@ js_polkit_log (duk_context *cx)
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static const gchar *
+-get_signal_name (gint signal_number)
+-{
+- switch (signal_number)
+- {
+-#define _HANDLE_SIG(sig) case sig: return #sig;
+- _HANDLE_SIG (SIGHUP);
+- _HANDLE_SIG (SIGINT);
+- _HANDLE_SIG (SIGQUIT);
+- _HANDLE_SIG (SIGILL);
+- _HANDLE_SIG (SIGABRT);
+- _HANDLE_SIG (SIGFPE);
+- _HANDLE_SIG (SIGKILL);
+- _HANDLE_SIG (SIGSEGV);
+- _HANDLE_SIG (SIGPIPE);
+- _HANDLE_SIG (SIGALRM);
+- _HANDLE_SIG (SIGTERM);
+- _HANDLE_SIG (SIGUSR1);
+- _HANDLE_SIG (SIGUSR2);
+- _HANDLE_SIG (SIGCHLD);
+- _HANDLE_SIG (SIGCONT);
+- _HANDLE_SIG (SIGSTOP);
+- _HANDLE_SIG (SIGTSTP);
+- _HANDLE_SIG (SIGTTIN);
+- _HANDLE_SIG (SIGTTOU);
+- _HANDLE_SIG (SIGBUS);
+-#ifdef SIGPOLL
+- _HANDLE_SIG (SIGPOLL);
+-#endif
+- _HANDLE_SIG (SIGPROF);
+- _HANDLE_SIG (SIGSYS);
+- _HANDLE_SIG (SIGTRAP);
+- _HANDLE_SIG (SIGURG);
+- _HANDLE_SIG (SIGVTALRM);
+- _HANDLE_SIG (SIGXCPU);
+- _HANDLE_SIG (SIGXFSZ);
+-#undef _HANDLE_SIG
+- default:
+- break;
+- }
+- return "UNKNOWN_SIGNAL";
+-}
+-
+-typedef struct
+-{
+- GMainLoop *loop;
+- GAsyncResult *res;
+-} SpawnData;
+-
+-static void
+-spawn_cb (GObject *source_object,
+- GAsyncResult *res,
+- gpointer user_data)
+-{
+- SpawnData *data = (SpawnData *)user_data;
+- data->res = (GAsyncResult*)g_object_ref (res);
+- g_main_loop_quit (data->loop);
+-}
+-
+ static duk_ret_t
+ js_polkit_spawn (duk_context *cx)
+ {
+@@ -962,21 +726,21 @@ js_polkit_spawn (duk_context *cx)
+ g_main_context_push_thread_default (context);
+
+ data.loop = loop;
+- utils_spawn ((const gchar *const *) argv,
+- 10, /* timeout_seconds */
+- NULL, /* cancellable */
+- spawn_cb,
+- &data);
++ polkit_backend_common_spawn ((const gchar *const *) argv,
++ 10, /* timeout_seconds */
++ NULL, /* cancellable */
++ polkit_backend_common_spawn_cb,
++ &data);
+
+ g_main_loop_run (loop);
+
+ g_main_context_pop_thread_default (context);
+
+- if (!utils_spawn_finish (data.res,
+- &exit_status,
+- &standard_output,
+- &standard_error,
+- &error))
++ if (!polkit_backend_common_spawn_finish (data.res,
++ &exit_status,
++ &standard_output,
++ &standard_error,
++ &error))
+ {
+ err_str = g_strdup_printf ("Error spawning helper: %s (%s, %d)",
+ error->message, g_quark_to_string (error->domain), error->code);
+@@ -998,7 +762,7 @@ js_polkit_spawn (duk_context *cx)
+ {
+ g_string_append_printf (gstr,
+ "Helper was signaled with signal %s (%d)",
+- get_signal_name (WTERMSIG (exit_status)),
++ polkit_backend_common_get_signal_name (WTERMSIG (exit_status)),
+ WTERMSIG (exit_status));
+ }
+ g_string_append_printf (gstr, ", stdout=`%s', stderr=`%s'",
+@@ -1052,377 +816,3 @@ js_polkit_user_is_in_netgroup (duk_context *cx)
+ }
+
+ /* ---------------------------------------------------------------------------------------------------- */
+-
+-typedef struct
+-{
+- GSimpleAsyncResult *simple; /* borrowed reference */
+- GMainContext *main_context; /* may be NULL */
+-
+- GCancellable *cancellable; /* may be NULL */
+- gulong cancellable_handler_id;
+-
+- GPid child_pid;
+- gint child_stdout_fd;
+- gint child_stderr_fd;
+-
+- GIOChannel *child_stdout_channel;
+- GIOChannel *child_stderr_channel;
+-
+- GSource *child_watch_source;
+- GSource *child_stdout_source;
+- GSource *child_stderr_source;
+-
+- guint timeout_seconds;
+- gboolean timed_out;
+- GSource *timeout_source;
+-
+- GString *child_stdout;
+- GString *child_stderr;
+-
+- gint exit_status;
+-} UtilsSpawnData;
+-
+-static void
+-utils_child_watch_from_release_cb (GPid pid,
+- gint status,
+- gpointer user_data)
+-{
+-}
+-
+-static void
+-utils_spawn_data_free (UtilsSpawnData *data)
+-{
+- if (data->timeout_source != NULL)
+- {
+- g_source_destroy (data->timeout_source);
+- data->timeout_source = NULL;
+- }
+-
+- /* Nuke the child, if necessary */
+- if (data->child_watch_source != NULL)
+- {
+- g_source_destroy (data->child_watch_source);
+- data->child_watch_source = NULL;
+- }
+-
+- if (data->child_pid != 0)
+- {
+- GSource *source;
+- kill (data->child_pid, SIGTERM);
+- /* OK, we need to reap for the child ourselves - we don't want
+- * to use waitpid() because that might block the calling
+- * thread (the child might handle SIGTERM and use several
+- * seconds for cleanup/rollback).
+- *
+- * So we use GChildWatch instead.
+- *
+- * Avoid taking a references to ourselves. but note that we need
+- * to pass the GSource so we can nuke it once handled.
+- */
+- source = g_child_watch_source_new (data->child_pid);
+- g_source_set_callback (source,
+- (GSourceFunc) utils_child_watch_from_release_cb,
+- source,
+- (GDestroyNotify) g_source_destroy);
+- g_source_attach (source, data->main_context);
+- g_source_unref (source);
+- data->child_pid = 0;
+- }
+-
+- if (data->child_stdout != NULL)
+- {
+- g_string_free (data->child_stdout, TRUE);
+- data->child_stdout = NULL;
+- }
+-
+- if (data->child_stderr != NULL)
+- {
+- g_string_free (data->child_stderr, TRUE);
+- data->child_stderr = NULL;
+- }
+-
+- if (data->child_stdout_channel != NULL)
+- {
+- g_io_channel_unref (data->child_stdout_channel);
+- data->child_stdout_channel = NULL;
+- }
+- if (data->child_stderr_channel != NULL)
+- {
+- g_io_channel_unref (data->child_stderr_channel);
+- data->child_stderr_channel = NULL;
+- }
+-
+- if (data->child_stdout_source != NULL)
+- {
+- g_source_destroy (data->child_stdout_source);
+- data->child_stdout_source = NULL;
+- }
+- if (data->child_stderr_source != NULL)
+- {
+- g_source_destroy (data->child_stderr_source);
+- data->child_stderr_source = NULL;
+- }
+-
+- if (data->child_stdout_fd != -1)
+- {
+- g_warn_if_fail (close (data->child_stdout_fd) == 0);
+- data->child_stdout_fd = -1;
+- }
+- if (data->child_stderr_fd != -1)
+- {
+- g_warn_if_fail (close (data->child_stderr_fd) == 0);
+- data->child_stderr_fd = -1;
+- }
+-
+- if (data->cancellable_handler_id > 0)
+- {
+- g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id);
+- data->cancellable_handler_id = 0;
+- }
+-
+- if (data->main_context != NULL)
+- g_main_context_unref (data->main_context);
+-
+- if (data->cancellable != NULL)
+- g_object_unref (data->cancellable);
+-
+- g_slice_free (UtilsSpawnData, data);
+-}
+-
+-/* called in the thread where @cancellable was cancelled */
+-static void
+-utils_on_cancelled (GCancellable *cancellable,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- GError *error;
+-
+- error = NULL;
+- g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error));
+- g_simple_async_result_take_error (data->simple, error);
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+-}
+-
+-static gboolean
+-utils_read_child_stderr (GIOChannel *channel,
+- GIOCondition condition,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- gchar buf[1024];
+- gsize bytes_read;
+-
+- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
+- g_string_append_len (data->child_stderr, buf, bytes_read);
+- return TRUE;
+-}
+-
+-static gboolean
+-utils_read_child_stdout (GIOChannel *channel,
+- GIOCondition condition,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- gchar buf[1024];
+- gsize bytes_read;
+-
+- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
+- g_string_append_len (data->child_stdout, buf, bytes_read);
+- return TRUE;
+-}
+-
+-static void
+-utils_child_watch_cb (GPid pid,
+- gint status,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- gchar *buf;
+- gsize buf_size;
+-
+- if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
+- {
+- g_string_append_len (data->child_stdout, buf, buf_size);
+- g_free (buf);
+- }
+- if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
+- {
+- g_string_append_len (data->child_stderr, buf, buf_size);
+- g_free (buf);
+- }
+-
+- data->exit_status = status;
+-
+- /* ok, child watch is history, make sure we don't free it in spawn_data_free() */
+- data->child_pid = 0;
+- data->child_watch_source = NULL;
+-
+- /* we're done */
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+-}
+-
+-static gboolean
+-utils_timeout_cb (gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+-
+- data->timed_out = TRUE;
+-
+- /* ok, timeout is history, make sure we don't free it in spawn_data_free() */
+- data->timeout_source = NULL;
+-
+- /* we're done */
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+-
+- return FALSE; /* remove source */
+-}
+-
+-static void
+-utils_spawn (const gchar *const *argv,
+- guint timeout_seconds,
+- GCancellable *cancellable,
+- GAsyncReadyCallback callback,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data;
+- GError *error;
+-
+- data = g_slice_new0 (UtilsSpawnData);
+- data->timeout_seconds = timeout_seconds;
+- data->simple = g_simple_async_result_new (NULL,
+- callback,
+- user_data,
+- (gpointer*)utils_spawn);
+- data->main_context = g_main_context_get_thread_default ();
+- if (data->main_context != NULL)
+- g_main_context_ref (data->main_context);
+-
+- data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL;
+-
+- data->child_stdout = g_string_new (NULL);
+- data->child_stderr = g_string_new (NULL);
+- data->child_stdout_fd = -1;
+- data->child_stderr_fd = -1;
+-
+- /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */
+- g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free);
+-
+- error = NULL;
+- if (data->cancellable != NULL)
+- {
+- /* could already be cancelled */
+- error = NULL;
+- if (g_cancellable_set_error_if_cancelled (data->cancellable, &error))
+- {
+- g_simple_async_result_take_error (data->simple, error);
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+- goto out;
+- }
+-
+- data->cancellable_handler_id = g_cancellable_connect (data->cancellable,
+- G_CALLBACK (utils_on_cancelled),
+- data,
+- NULL);
+- }
+-
+- error = NULL;
+- if (!g_spawn_async_with_pipes (NULL, /* working directory */
+- (gchar **) argv,
+- NULL, /* envp */
+- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
+- NULL, /* child_setup */
+- NULL, /* child_setup's user_data */
+- &(data->child_pid),
+- NULL, /* gint *stdin_fd */
+- &(data->child_stdout_fd),
+- &(data->child_stderr_fd),
+- &error))
+- {
+- g_prefix_error (&error, "Error spawning: ");
+- g_simple_async_result_take_error (data->simple, error);
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+- goto out;
+- }
+-
+- if (timeout_seconds > 0)
+- {
+- data->timeout_source = g_timeout_source_new_seconds (timeout_seconds);
+- g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT);
+- g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL);
+- g_source_attach (data->timeout_source, data->main_context);
+- g_source_unref (data->timeout_source);
+- }
+-
+- data->child_watch_source = g_child_watch_source_new (data->child_pid);
+- g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL);
+- g_source_attach (data->child_watch_source, data->main_context);
+- g_source_unref (data->child_watch_source);
+-
+- data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd);
+- g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL);
+- data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN);
+- g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL);
+- g_source_attach (data->child_stdout_source, data->main_context);
+- g_source_unref (data->child_stdout_source);
+-
+- data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd);
+- g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL);
+- data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN);
+- g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL);
+- g_source_attach (data->child_stderr_source, data->main_context);
+- g_source_unref (data->child_stderr_source);
+-
+- out:
+- ;
+-}
+-
+-gboolean
+-utils_spawn_finish (GAsyncResult *res,
+- gint *out_exit_status,
+- gchar **out_standard_output,
+- gchar **out_standard_error,
+- GError **error)
+-{
+- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
+- UtilsSpawnData *data;
+- gboolean ret = FALSE;
+-
+- g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
+- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+-
+- g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == utils_spawn);
+-
+- if (g_simple_async_result_propagate_error (simple, error))
+- goto out;
+-
+- data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple);
+-
+- if (data->timed_out)
+- {
+- g_set_error (error,
+- G_IO_ERROR,
+- G_IO_ERROR_TIMED_OUT,
+- "Timed out after %d seconds",
+- data->timeout_seconds);
+- goto out;
+- }
+-
+- if (out_exit_status != NULL)
+- *out_exit_status = data->exit_status;
+-
+- if (out_standard_output != NULL)
+- *out_standard_output = g_strdup (data->child_stdout->str);
+-
+- if (out_standard_error != NULL)
+- *out_standard_error = g_strdup (data->child_stderr->str);
+-
+- ret = TRUE;
+-
+- out:
+- return ret;
+-}
+diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
+index ca17108..e28091d 100644
+--- a/src/polkitbackend/polkitbackendjsauthority.cpp
++++ b/src/polkitbackend/polkitbackendjsauthority.cpp
+@@ -19,29 +19,7 @@
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+-#include "config.h"
+-#include <sys/wait.h>
+-#include <errno.h>
+-#include <pwd.h>
+-#include <grp.h>
+-#ifdef HAVE_NETGROUP_H
+-#include <netgroup.h>
+-#else
+-#include <netdb.h>
+-#endif
+-#include <string.h>
+-#include <glib/gstdio.h>
+-#include <locale.h>
+-#include <glib/gi18n-lib.h>
+-
+-#include <polkit/polkit.h>
+-#include "polkitbackendjsauthority.h"
+-
+-#include <polkit/polkitprivate.h>
+-
+-#ifdef HAVE_LIBSYSTEMD
+-#include <systemd/sd-login.h>
+-#endif /* HAVE_LIBSYSTEMD */
++#include "polkitbackendcommon.h"
+
+ #include <js/CompilationAndEvaluation.h>
+ #include <js/ContextOptions.h>
+@@ -52,6 +30,7 @@
+ #include <js/Array.h>
+ #include <jsapi.h>
+
++/* Built source and not too big to worry about deduplication */
+ #include "initjs.h" /* init.js */
+
+ #ifdef JSGC_USE_EXACT_ROOTING
+@@ -67,10 +46,9 @@
+ * @short_description: JS Authority
+ * @stability: Unstable
+ *
+- * An implementation of #PolkitBackendAuthority that reads and
+- * evalates Javascript files and supports interaction with
+- * authentication agents (virtue of being based on
+- * #PolkitBackendInteractiveAuthority).
++ * An (SpiderMonkey-based) implementation of #PolkitBackendAuthority that reads
++ * and evaluates Javascript files and supports interaction with authentication
++ * agents (virtue of being based on #PolkitBackendInteractiveAuthority).
+ */
+
+ /* ---------------------------------------------------------------------------------------------------- */
+@@ -100,57 +78,11 @@ static bool execute_script_with_runaway_killer (PolkitBackendJsAuthority *author
+ JS::HandleScript script,
+ JS::MutableHandleValue rval);
+
+-static void utils_spawn (const gchar *const *argv,
+- guint timeout_seconds,
+- GCancellable *cancellable,
+- GAsyncReadyCallback callback,
+- gpointer user_data);
+-
+-gboolean utils_spawn_finish (GAsyncResult *res,
+- gint *out_exit_status,
+- gchar **out_standard_output,
+- gchar **out_standard_error,
+- GError **error);
+-
+-static void on_dir_monitor_changed (GFileMonitor *monitor,
+- GFile *file,
+- GFile *other_file,
+- GFileMonitorEvent event_type,
+- gpointer user_data);
+-
+-/* ---------------------------------------------------------------------------------------------------- */
+-
+-enum
+-{
+- PROP_0,
+- PROP_RULES_DIRS,
+-};
+-
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ static gpointer runaway_killer_thread_func (gpointer user_data);
+ static void runaway_killer_terminate (PolkitBackendJsAuthority *authority);
+
+-static GList *polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details);
+-
+-static PolkitImplicitAuthorization polkit_backend_js_authority_check_authorization_sync (
+- PolkitBackendInteractiveAuthority *authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details,
+- PolkitImplicitAuthorization implicit);
+-
+ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY);
+
+ /* ---------------------------------------------------------------------------------------------------- */
+@@ -229,33 +161,6 @@ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority)
+ PolkitBackendJsAuthorityPrivate);
+ }
+
+-static gint
+-rules_file_name_cmp (const gchar *a,
+- const gchar *b)
+-{
+- gint ret;
+- const gchar *a_base;
+- const gchar *b_base;
+-
+- a_base = strrchr (a, '/');
+- b_base = strrchr (b, '/');
+-
+- g_assert (a_base != NULL);
+- g_assert (b_base != NULL);
+- a_base += 1;
+- b_base += 1;
+-
+- ret = g_strcmp0 (a_base, b_base);
+- if (ret == 0)
+- {
+- /* /etc wins over /usr */
+- ret = g_strcmp0 (a, b);
+- g_assert (ret != 0);
+- }
+-
+- return ret;
+-}
+-
+ /* authority->priv->cx must be within a request */
+ static void
+ load_scripts (PolkitBackendJsAuthority *authority)
+@@ -299,7 +204,7 @@ load_scripts (PolkitBackendJsAuthority *authority)
+ }
+ }
+
+- files = g_list_sort (files, (GCompareFunc) rules_file_name_cmp);
++ files = g_list_sort (files, (GCompareFunc) polkit_backend_common_rules_file_name_cmp);
+
+ for (l = files; l != NULL; l = l->next)
+ {
+@@ -365,8 +270,8 @@ load_scripts (PolkitBackendJsAuthority *authority)
+ g_list_free_full (files, g_free);
+ }
+
+-static void
+-reload_scripts (PolkitBackendJsAuthority *authority)
++void
++polkit_backend_common_reload_scripts (PolkitBackendJsAuthority *authority)
+ {
+ JS::RootedValueArray<1> args(authority->priv->cx);
+ JS::RootedValue rval(authority->priv->cx);
+@@ -395,42 +300,6 @@ reload_scripts (PolkitBackendJsAuthority *authority)
+ g_signal_emit_by_name (authority, "changed");
+ }
+
+-static void
+-on_dir_monitor_changed (GFileMonitor *monitor,
+- GFile *file,
+- GFile *other_file,
+- GFileMonitorEvent event_type,
+- gpointer user_data)
+-{
+- PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (user_data);
+-
+- /* TODO: maybe rate-limit so storms of events are collapsed into one with a 500ms resolution?
+- * Because when editing a file with emacs we get 4-8 events..
+- */
+-
+- if (file != NULL)
+- {
+- gchar *name;
+-
+- name = g_file_get_basename (file);
+-
+- /* g_print ("event_type=%d file=%p name=%s\n", event_type, file, name); */
+- if (!g_str_has_prefix (name, ".") &&
+- !g_str_has_prefix (name, "#") &&
+- g_str_has_suffix (name, ".rules") &&
+- (event_type == G_FILE_MONITOR_EVENT_CREATED ||
+- event_type == G_FILE_MONITOR_EVENT_DELETED ||
+- event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT))
+- {
+- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+- "Reloading rules");
+- reload_scripts (authority);
+- }
+- g_free (name);
+- }
+-}
+-
+-
+ static void
+ setup_file_monitors (PolkitBackendJsAuthority *authority)
+ {
+@@ -462,7 +331,7 @@ setup_file_monitors (PolkitBackendJsAuthority *authority)
+ {
+ g_signal_connect (monitor,
+ "changed",
+- G_CALLBACK (on_dir_monitor_changed),
++ G_CALLBACK (polkit_backend_common_on_dir_monitor_changed),
+ authority);
+ g_ptr_array_add (p, monitor);
+ }
+@@ -471,8 +340,8 @@ setup_file_monitors (PolkitBackendJsAuthority *authority)
+ authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE);
+ }
+
+-static void
+-polkit_backend_js_authority_constructed (GObject *object)
++void
++polkit_backend_common_js_authority_constructed (GObject *object)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
+
+@@ -561,8 +430,8 @@ polkit_backend_js_authority_constructed (GObject *object)
+ g_assert_not_reached ();
+ }
+
+-static void
+-polkit_backend_js_authority_finalize (GObject *object)
++void
++polkit_backend_common_js_authority_finalize (GObject *object)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
+ guint n;
+@@ -577,7 +446,7 @@ polkit_backend_js_authority_finalize (GObject *object)
+ {
+ GFileMonitor *monitor = authority->priv->dir_monitors[n];
+ g_signal_handlers_disconnect_by_func (monitor,
+- (gpointer*)G_CALLBACK (on_dir_monitor_changed),
++ (gpointer*)G_CALLBACK (polkit_backend_common_on_dir_monitor_changed),
+ authority);
+ g_object_unref (monitor);
+ }
+@@ -594,11 +463,11 @@ polkit_backend_js_authority_finalize (GObject *object)
+ G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object);
+ }
+
+-static void
+-polkit_backend_js_authority_set_property (GObject *object,
+- guint property_id,
+- const GValue *value,
+- GParamSpec *pspec)
++void
++polkit_backend_common_js_authority_set_property (GObject *object,
++ guint property_id,
++ const GValue *value,
++ GParamSpec *pspec)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
+
+@@ -615,57 +484,12 @@ polkit_backend_js_authority_set_property (GObject *object,
+ }
+ }
+
+-static const gchar *
+-polkit_backend_js_authority_get_name (PolkitBackendAuthority *authority)
+-{
+- return "js";
+-}
+-
+-static const gchar *
+-polkit_backend_js_authority_get_version (PolkitBackendAuthority *authority)
+-{
+- return PACKAGE_VERSION;
+-}
+-
+-static PolkitAuthorityFeatures
+-polkit_backend_js_authority_get_features (PolkitBackendAuthority *authority)
+-{
+- return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION;
+-}
+-
+ static void
+ polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass)
+ {
+- GObjectClass *gobject_class;
+- PolkitBackendAuthorityClass *authority_class;
+- PolkitBackendInteractiveAuthorityClass *interactive_authority_class;
+-
+-
+- gobject_class = G_OBJECT_CLASS (klass);
+- gobject_class->finalize = polkit_backend_js_authority_finalize;
+- gobject_class->set_property = polkit_backend_js_authority_set_property;
+- gobject_class->constructed = polkit_backend_js_authority_constructed;
+-
+- authority_class = POLKIT_BACKEND_AUTHORITY_CLASS (klass);
+- authority_class->get_name = polkit_backend_js_authority_get_name;
+- authority_class->get_version = polkit_backend_js_authority_get_version;
+- authority_class->get_features = polkit_backend_js_authority_get_features;
+-
+- interactive_authority_class = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_CLASS (klass);
+- interactive_authority_class->get_admin_identities = polkit_backend_js_authority_get_admin_auth_identities;
+- interactive_authority_class->check_authorization_sync = polkit_backend_js_authority_check_authorization_sync;
+-
+- g_object_class_install_property (gobject_class,
+- PROP_RULES_DIRS,
+- g_param_spec_boxed ("rules-dirs",
+- NULL,
+- NULL,
+- G_TYPE_STRV,
+- GParamFlags(G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)));
+-
++ polkit_backend_common_js_authority_class_init_common (klass);
+
+ g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate));
+-
+ JS_Init ();
+ }
+
+@@ -1099,15 +923,15 @@ call_js_function_with_runaway_killer (PolkitBackendJsAuthority *authority,
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static GList *
+-polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details)
++GList *
++polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
+ GList *ret = NULL;
+@@ -1202,16 +1026,16 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static PolkitImplicitAuthorization
+-polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority,
+- PolkitSubject *caller,
+- PolkitSubject *subject,
+- PolkitIdentity *user_for_subject,
+- gboolean subject_is_local,
+- gboolean subject_is_active,
+- const gchar *action_id,
+- PolkitDetails *details,
+- PolkitImplicitAuthorization implicit)
++PolkitImplicitAuthorization
++polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendInteractiveAuthority *_authority,
++ PolkitSubject *caller,
++ PolkitSubject *subject,
++ PolkitIdentity *user_for_subject,
++ gboolean subject_is_local,
++ gboolean subject_is_active,
++ const gchar *action_id,
++ PolkitDetails *details,
++ PolkitImplicitAuthorization implicit)
+ {
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
+ PolkitImplicitAuthorization ret = implicit;
+@@ -1324,65 +1148,6 @@ js_polkit_log (JSContext *cx,
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-static const gchar *
+-get_signal_name (gint signal_number)
+-{
+- switch (signal_number)
+- {
+-#define _HANDLE_SIG(sig) case sig: return #sig;
+- _HANDLE_SIG (SIGHUP);
+- _HANDLE_SIG (SIGINT);
+- _HANDLE_SIG (SIGQUIT);
+- _HANDLE_SIG (SIGILL);
+- _HANDLE_SIG (SIGABRT);
+- _HANDLE_SIG (SIGFPE);
+- _HANDLE_SIG (SIGKILL);
+- _HANDLE_SIG (SIGSEGV);
+- _HANDLE_SIG (SIGPIPE);
+- _HANDLE_SIG (SIGALRM);
+- _HANDLE_SIG (SIGTERM);
+- _HANDLE_SIG (SIGUSR1);
+- _HANDLE_SIG (SIGUSR2);
+- _HANDLE_SIG (SIGCHLD);
+- _HANDLE_SIG (SIGCONT);
+- _HANDLE_SIG (SIGSTOP);
+- _HANDLE_SIG (SIGTSTP);
+- _HANDLE_SIG (SIGTTIN);
+- _HANDLE_SIG (SIGTTOU);
+- _HANDLE_SIG (SIGBUS);
+-#ifdef SIGPOLL
+- _HANDLE_SIG (SIGPOLL);
+-#endif
+- _HANDLE_SIG (SIGPROF);
+- _HANDLE_SIG (SIGSYS);
+- _HANDLE_SIG (SIGTRAP);
+- _HANDLE_SIG (SIGURG);
+- _HANDLE_SIG (SIGVTALRM);
+- _HANDLE_SIG (SIGXCPU);
+- _HANDLE_SIG (SIGXFSZ);
+-#undef _HANDLE_SIG
+- default:
+- break;
+- }
+- return "UNKNOWN_SIGNAL";
+-}
+-
+-typedef struct
+-{
+- GMainLoop *loop;
+- GAsyncResult *res;
+-} SpawnData;
+-
+-static void
+-spawn_cb (GObject *source_object,
+- GAsyncResult *res,
+- gpointer user_data)
+-{
+- SpawnData *data = (SpawnData *)user_data;
+- data->res = (GAsyncResult*)g_object_ref (res);
+- g_main_loop_quit (data->loop);
+-}
+-
+ static bool
+ js_polkit_spawn (JSContext *cx,
+ unsigned js_argc,
+@@ -1440,21 +1205,21 @@ js_polkit_spawn (JSContext *cx,
+ g_main_context_push_thread_default (context);
+
+ data.loop = loop;
+- utils_spawn ((const gchar *const *) argv,
+- 10, /* timeout_seconds */
+- NULL, /* cancellable */
+- spawn_cb,
+- &data);
++ polkit_backend_common_spawn ((const gchar *const *) argv,
++ 10, /* timeout_seconds */
++ NULL, /* cancellable */
++ polkit_backend_common_spawn_cb,
++ &data);
+
+ g_main_loop_run (loop);
+
+ g_main_context_pop_thread_default (context);
+
+- if (!utils_spawn_finish (data.res,
+- &exit_status,
+- &standard_output,
+- &standard_error,
+- &error))
++ if (!polkit_backend_common_spawn_finish (data.res,
++ &exit_status,
++ &standard_output,
++ &standard_error,
++ &error))
+ {
+ JS_ReportErrorUTF8 (cx,
+ "Error spawning helper: %s (%s, %d)",
+@@ -1477,7 +1242,7 @@ js_polkit_spawn (JSContext *cx,
+ {
+ g_string_append_printf (gstr,
+ "Helper was signaled with signal %s (%d)",
+- get_signal_name (WTERMSIG (exit_status)),
++ polkit_backend_common_get_signal_name (WTERMSIG (exit_status)),
+ WTERMSIG (exit_status));
+ }
+ g_string_append_printf (gstr, ", stdout=`%s', stderr=`%s'",
+@@ -1542,381 +1307,5 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
+ return ret;
+ }
+
+-
+-
+ /* ---------------------------------------------------------------------------------------------------- */
+
+-typedef struct
+-{
+- GSimpleAsyncResult *simple; /* borrowed reference */
+- GMainContext *main_context; /* may be NULL */
+-
+- GCancellable *cancellable; /* may be NULL */
+- gulong cancellable_handler_id;
+-
+- GPid child_pid;
+- gint child_stdout_fd;
+- gint child_stderr_fd;
+-
+- GIOChannel *child_stdout_channel;
+- GIOChannel *child_stderr_channel;
+-
+- GSource *child_watch_source;
+- GSource *child_stdout_source;
+- GSource *child_stderr_source;
+-
+- guint timeout_seconds;
+- gboolean timed_out;
+- GSource *timeout_source;
+-
+- GString *child_stdout;
+- GString *child_stderr;
+-
+- gint exit_status;
+-} UtilsSpawnData;
+-
+-static void
+-utils_child_watch_from_release_cb (GPid pid,
+- gint status,
+- gpointer user_data)
+-{
+-}
+-
+-static void
+-utils_spawn_data_free (UtilsSpawnData *data)
+-{
+- if (data->timeout_source != NULL)
+- {
+- g_source_destroy (data->timeout_source);
+- data->timeout_source = NULL;
+- }
+-
+- /* Nuke the child, if necessary */
+- if (data->child_watch_source != NULL)
+- {
+- g_source_destroy (data->child_watch_source);
+- data->child_watch_source = NULL;
+- }
+-
+- if (data->child_pid != 0)
+- {
+- GSource *source;
+- kill (data->child_pid, SIGTERM);
+- /* OK, we need to reap for the child ourselves - we don't want
+- * to use waitpid() because that might block the calling
+- * thread (the child might handle SIGTERM and use several
+- * seconds for cleanup/rollback).
+- *
+- * So we use GChildWatch instead.
+- *
+- * Avoid taking a references to ourselves. but note that we need
+- * to pass the GSource so we can nuke it once handled.
+- */
+- source = g_child_watch_source_new (data->child_pid);
+- g_source_set_callback (source,
+- (GSourceFunc) utils_child_watch_from_release_cb,
+- source,
+- (GDestroyNotify) g_source_destroy);
+- /* attach source to the global default main context */
+- g_source_attach (source, NULL);
+- g_source_unref (source);
+- data->child_pid = 0;
+- }
+-
+- if (data->child_stdout != NULL)
+- {
+- g_string_free (data->child_stdout, TRUE);
+- data->child_stdout = NULL;
+- }
+-
+- if (data->child_stderr != NULL)
+- {
+- g_string_free (data->child_stderr, TRUE);
+- data->child_stderr = NULL;
+- }
+-
+- if (data->child_stdout_channel != NULL)
+- {
+- g_io_channel_unref (data->child_stdout_channel);
+- data->child_stdout_channel = NULL;
+- }
+- if (data->child_stderr_channel != NULL)
+- {
+- g_io_channel_unref (data->child_stderr_channel);
+- data->child_stderr_channel = NULL;
+- }
+-
+- if (data->child_stdout_source != NULL)
+- {
+- g_source_destroy (data->child_stdout_source);
+- data->child_stdout_source = NULL;
+- }
+- if (data->child_stderr_source != NULL)
+- {
+- g_source_destroy (data->child_stderr_source);
+- data->child_stderr_source = NULL;
+- }
+-
+- if (data->child_stdout_fd != -1)
+- {
+- g_warn_if_fail (close (data->child_stdout_fd) == 0);
+- data->child_stdout_fd = -1;
+- }
+- if (data->child_stderr_fd != -1)
+- {
+- g_warn_if_fail (close (data->child_stderr_fd) == 0);
+- data->child_stderr_fd = -1;
+- }
+-
+- if (data->cancellable_handler_id > 0)
+- {
+- g_cancellable_disconnect (data->cancellable, data->cancellable_handler_id);
+- data->cancellable_handler_id = 0;
+- }
+-
+- if (data->main_context != NULL)
+- g_main_context_unref (data->main_context);
+-
+- if (data->cancellable != NULL)
+- g_object_unref (data->cancellable);
+-
+- g_slice_free (UtilsSpawnData, data);
+-}
+-
+-/* called in the thread where @cancellable was cancelled */
+-static void
+-utils_on_cancelled (GCancellable *cancellable,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- GError *error;
+-
+- error = NULL;
+- g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error));
+- g_simple_async_result_take_error (data->simple, error);
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+-}
+-
+-static gboolean
+-utils_read_child_stderr (GIOChannel *channel,
+- GIOCondition condition,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- gchar buf[1024];
+- gsize bytes_read;
+-
+- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
+- g_string_append_len (data->child_stderr, buf, bytes_read);
+- return TRUE;
+-}
+-
+-static gboolean
+-utils_read_child_stdout (GIOChannel *channel,
+- GIOCondition condition,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- gchar buf[1024];
+- gsize bytes_read;
+-
+- g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
+- g_string_append_len (data->child_stdout, buf, bytes_read);
+- return TRUE;
+-}
+-
+-static void
+-utils_child_watch_cb (GPid pid,
+- gint status,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+- gchar *buf;
+- gsize buf_size;
+-
+- if (g_io_channel_read_to_end (data->child_stdout_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
+- {
+- g_string_append_len (data->child_stdout, buf, buf_size);
+- g_free (buf);
+- }
+- if (g_io_channel_read_to_end (data->child_stderr_channel, &buf, &buf_size, NULL) == G_IO_STATUS_NORMAL)
+- {
+- g_string_append_len (data->child_stderr, buf, buf_size);
+- g_free (buf);
+- }
+-
+- data->exit_status = status;
+-
+- /* ok, child watch is history, make sure we don't free it in spawn_data_free() */
+- data->child_pid = 0;
+- data->child_watch_source = NULL;
+-
+- /* we're done */
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+-}
+-
+-static gboolean
+-utils_timeout_cb (gpointer user_data)
+-{
+- UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+-
+- data->timed_out = TRUE;
+-
+- /* ok, timeout is history, make sure we don't free it in spawn_data_free() */
+- data->timeout_source = NULL;
+-
+- /* we're done */
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+-
+- return FALSE; /* remove source */
+-}
+-
+-static void
+-utils_spawn (const gchar *const *argv,
+- guint timeout_seconds,
+- GCancellable *cancellable,
+- GAsyncReadyCallback callback,
+- gpointer user_data)
+-{
+- UtilsSpawnData *data;
+- GError *error;
+-
+- data = g_slice_new0 (UtilsSpawnData);
+- data->timeout_seconds = timeout_seconds;
+- data->simple = g_simple_async_result_new (NULL,
+- callback,
+- user_data,
+- (gpointer*)utils_spawn);
+- data->main_context = g_main_context_get_thread_default ();
+- if (data->main_context != NULL)
+- g_main_context_ref (data->main_context);
+-
+- data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL;
+-
+- data->child_stdout = g_string_new (NULL);
+- data->child_stderr = g_string_new (NULL);
+- data->child_stdout_fd = -1;
+- data->child_stderr_fd = -1;
+-
+- /* the life-cycle of UtilsSpawnData is tied to its GSimpleAsyncResult */
+- g_simple_async_result_set_op_res_gpointer (data->simple, data, (GDestroyNotify) utils_spawn_data_free);
+-
+- error = NULL;
+- if (data->cancellable != NULL)
+- {
+- /* could already be cancelled */
+- error = NULL;
+- if (g_cancellable_set_error_if_cancelled (data->cancellable, &error))
+- {
+- g_simple_async_result_take_error (data->simple, error);
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+- goto out;
+- }
+-
+- data->cancellable_handler_id = g_cancellable_connect (data->cancellable,
+- G_CALLBACK (utils_on_cancelled),
+- data,
+- NULL);
+- }
+-
+- error = NULL;
+- if (!g_spawn_async_with_pipes (NULL, /* working directory */
+- (gchar **) argv,
+- NULL, /* envp */
+- GSpawnFlags(G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD),
+- NULL, /* child_setup */
+- NULL, /* child_setup's user_data */
+- &(data->child_pid),
+- NULL, /* gint *stdin_fd */
+- &(data->child_stdout_fd),
+- &(data->child_stderr_fd),
+- &error))
+- {
+- g_prefix_error (&error, "Error spawning: ");
+- g_simple_async_result_take_error (data->simple, error);
+- g_simple_async_result_complete_in_idle (data->simple);
+- g_object_unref (data->simple);
+- goto out;
+- }
+-
+- if (timeout_seconds > 0)
+- {
+- data->timeout_source = g_timeout_source_new_seconds (timeout_seconds);
+- g_source_set_priority (data->timeout_source, G_PRIORITY_DEFAULT);
+- g_source_set_callback (data->timeout_source, utils_timeout_cb, data, NULL);
+- g_source_attach (data->timeout_source, data->main_context);
+- g_source_unref (data->timeout_source);
+- }
+-
+- data->child_watch_source = g_child_watch_source_new (data->child_pid);
+- g_source_set_callback (data->child_watch_source, (GSourceFunc) utils_child_watch_cb, data, NULL);
+- g_source_attach (data->child_watch_source, data->main_context);
+- g_source_unref (data->child_watch_source);
+-
+- data->child_stdout_channel = g_io_channel_unix_new (data->child_stdout_fd);
+- g_io_channel_set_flags (data->child_stdout_channel, G_IO_FLAG_NONBLOCK, NULL);
+- data->child_stdout_source = g_io_create_watch (data->child_stdout_channel, G_IO_IN);
+- g_source_set_callback (data->child_stdout_source, (GSourceFunc) utils_read_child_stdout, data, NULL);
+- g_source_attach (data->child_stdout_source, data->main_context);
+- g_source_unref (data->child_stdout_source);
+-
+- data->child_stderr_channel = g_io_channel_unix_new (data->child_stderr_fd);
+- g_io_channel_set_flags (data->child_stderr_channel, G_IO_FLAG_NONBLOCK, NULL);
+- data->child_stderr_source = g_io_create_watch (data->child_stderr_channel, G_IO_IN);
+- g_source_set_callback (data->child_stderr_source, (GSourceFunc) utils_read_child_stderr, data, NULL);
+- g_source_attach (data->child_stderr_source, data->main_context);
+- g_source_unref (data->child_stderr_source);
+-
+- out:
+- ;
+-}
+-
+-gboolean
+-utils_spawn_finish (GAsyncResult *res,
+- gint *out_exit_status,
+- gchar **out_standard_output,
+- gchar **out_standard_error,
+- GError **error)
+-{
+- GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
+- UtilsSpawnData *data;
+- gboolean ret = FALSE;
+-
+- g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
+- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+-
+- g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == utils_spawn);
+-
+- if (g_simple_async_result_propagate_error (simple, error))
+- goto out;
+-
+- data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple);
+-
+- if (data->timed_out)
+- {
+- g_set_error (error,
+- G_IO_ERROR,
+- G_IO_ERROR_TIMED_OUT,
+- "Timed out after %d seconds",
+- data->timeout_seconds);
+- goto out;
+- }
+-
+- if (out_exit_status != NULL)
+- *out_exit_status = data->exit_status;
+-
+- if (out_standard_output != NULL)
+- *out_standard_output = g_strdup (data->child_stdout->str);
+-
+- if (out_standard_error != NULL)
+- *out_standard_error = g_strdup (data->child_stderr->str);
+-
+- ret = TRUE;
+-
+- out:
+- return ret;
+-}
+--
+GitLab
+
+
+From 4858128107be9c3ab11828ee8f35c5e26efd36ce Mon Sep 17 00:00:00 2001
+From: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+Date: Tue, 14 Sep 2021 14:38:15 -0700
+Subject: [PATCH 15/16] Gitlab CI: add duktape pkgconfig dependency
+
+Make way for the CI to be able to build with duktape too
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ .gitlab-ci.yml | 1 +
+ 1 file changed, 1 insertion(+)
+
+GitLab
+
+
+From cd5d6da837fce95f8831a355dad88c83347c7337 Mon Sep 17 00:00:00 2001
+From: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+Date: Mon, 20 Sep 2021 17:17:26 -0700
+Subject: [PATCH 16/16] duktape: implement runaway scripts killer timeout
+
+This was missing on Duktape's JS backend proposal, now in. As
+discussed in
+https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35 and
+verified by the commit author, Duktape has no interrupt injection
+mechanism (it has no thread-safe API entry whatsoever, even). Using
+DUK_USE_EXEC_TIMEOUT_CHECK is also not feasible, because:
+
+ i) It must be enabled at build time and shared object builds of the
+ lib on distros go with the default options, something we cannot
+ change/control
+
+ ii) That does not account for non-ECMAScript explicit execution
+ contexts, like regex execution, native C calls, etc.
+
+It has been agreed, on that thread, that pthread_cond_timedwait()-ing
+and having proper Duktape evaluation/execution calls take place in a
+separate thread, to be killed after the runaway script killer's
+accorded timeout value, a reasonable approach. We have considered
+using glib wrappers for direct pthread usage, but that way would make
+it impossible to issue
+pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, ...) and we want to
+be paranoid in that regard.
+
+On Duktape, we don't get to err from the JS context (to be captured by
+the offending script), but to be forcibly killed on timeout scenarios,
+leading to null returns, thus polkit negation, by definition. It's a
+reasonable design/compromise.
+
+A fatal error handler routine, for the Duktape context, has also been
+added, using the polkit_backend_authority_log() logging infra to
+better assist users on what went wrong.
+
+Finally, the script evaluation routine has been made to use
+duk_peval_lstring() (previously using _noresult variant), so to able
+to present the user with proper error messages, should any occur.
+
+The original runaway script killer test has been adjusted to please
+both JS backends.
+
+Signed-off-by: Gustavo Lima Chaves <gustavo.chaves@microsoft.com>
+---
+ meson.build | 1 +
+ src/polkitbackend/meson.build | 1 +
+ src/polkitbackend/polkitbackendcommon.h | 2 +
+ .../polkitbackendduktapeauthority.c | 236 ++++++++++++++----
+ .../polkitbackendjsauthority.cpp | 10 +-
+ .../etc/polkit-1/rules.d/10-testing.rules | 6 +-
+ .../test-polkitbackendjsauthority.c | 2 +-
+ 7 files changed, 209 insertions(+), 49 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 4e44723..46956e3 100644
+--- a/meson.build
++++ b/meson.build
+@@ -137,6 +137,7 @@ js_engine = get_option('js_engine')
+ if js_engine == 'duktape'
+ js_dep = dependency('duktape')
+ libm_dep = cc.find_library('m')
++ libpthread_dep = cc.find_library('pthread')
+ elif js_engine == 'mozjs'
+ js_dep = dependency('mozjs-78')
+ endif
+diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build
+index 9ec01b2..4dfea39 100644
+--- a/src/polkitbackend/meson.build
++++ b/src/polkitbackend/meson.build
+@@ -34,6 +34,7 @@ c_flags = [
+ if js_engine == 'duktape'
+ sources += files('polkitbackendduktapeauthority.c')
+ deps += libm_dep
++ deps += libpthread_dep
+ elif js_engine == 'mozjs'
+ sources += files('polkitbackendjsauthority.cpp')
+ endif
+diff --git a/src/polkitbackend/polkitbackendcommon.h b/src/polkitbackend/polkitbackendcommon.h
+index 6d0d267..dd700fc 100644
+--- a/src/polkitbackend/polkitbackendcommon.h
++++ b/src/polkitbackend/polkitbackendcommon.h
+@@ -50,6 +50,8 @@
+ #include <systemd/sd-login.h>
+ #endif /* HAVE_LIBSYSTEMD */
+
++#define RUNAWAY_KILLER_TIMEOUT (15)
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
+index a2b4420..80f1976 100644
+--- a/src/polkitbackend/polkitbackendduktapeauthority.c
++++ b/src/polkitbackend/polkitbackendduktapeauthority.c
+@@ -47,8 +47,20 @@ struct _PolkitBackendJsAuthorityPrivate
+ GFileMonitor **dir_monitors; /* NULL-terminated array of GFileMonitor instances */
+
+ duk_context *cx;
++
++ pthread_t runaway_killer_thread;
++};
++
++enum
++{
++ RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET,
++ RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS,
++ RUNAWAY_KILLER_THREAD_EXIT_STATUS_FAILURE,
+ };
+
++static gboolean execute_script_with_runaway_killer(PolkitBackendJsAuthority *authority,
++ const gchar *filename);
++
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY);
+@@ -67,6 +79,15 @@ static const duk_function_list_entry js_polkit_functions[] =
+ { NULL, NULL, 0 },
+ };
+
++static void report_error (void *udata,
++ const char *msg)
++{
++ PolkitBackendJsAuthority *authority = udata;
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "fatal Duktape JS backend error: %s",
++ (msg ? msg : "no message"));
++}
++
+ static void
+ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority)
+ {
+@@ -78,7 +99,6 @@ polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority)
+ static void
+ load_scripts (PolkitBackendJsAuthority *authority)
+ {
+- duk_context *cx = authority->priv->cx;
+ GList *files = NULL;
+ GList *l;
+ guint num_scripts = 0;
+@@ -123,36 +143,9 @@ load_scripts (PolkitBackendJsAuthority *authority)
+ for (l = files; l != NULL; l = l->next)
+ {
+ const gchar *filename = (gchar *)l->data;
+-#if (DUK_VERSION >= 20000)
+- GFile *file = g_file_new_for_path (filename);
+- char *contents;
+- gsize len;
+- if (!g_file_load_contents (file, NULL, &contents, &len, NULL, NULL))
+- {
+- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+- "Error compiling script %s",
+- filename);
+- g_object_unref (file);
+- continue;
+- }
+
+- g_object_unref (file);
+- if (duk_peval_lstring_noresult(cx, contents,len) != 0)
+-#else
+- if (duk_peval_file_noresult (cx, filename) != 0)
+-#endif
+- {
+- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+- "Error compiling script %s: %s",
+- filename, duk_safe_to_string (authority->priv->cx, -1));
+-#if (DUK_VERSION >= 20000)
+- g_free (contents);
+-#endif
++ if (!execute_script_with_runaway_killer(authority, filename))
+ continue;
+- }
+-#if (DUK_VERSION >= 20000)
+- g_free (contents);
+-#endif
+ num_scripts++;
+ }
+
+@@ -232,7 +225,7 @@ polkit_backend_common_js_authority_constructed (GObject *object)
+ PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (object);
+ duk_context *cx;
+
+- cx = duk_create_heap (NULL, NULL, NULL, authority, NULL);
++ cx = duk_create_heap (NULL, NULL, NULL, authority, report_error);
+ if (cx == NULL)
+ goto fail;
+
+@@ -243,6 +236,9 @@ polkit_backend_common_js_authority_constructed (GObject *object)
+ duk_put_function_list (cx, -1, js_polkit_functions);
+ duk_put_prop_string (cx, -2, "polkit");
+
++ /* load polkit objects/functions into JS context (e.g. addRule(),
++ * _deleteRules(), _runRules() et al)
++ */
+ duk_eval_string (cx, init_js);
+
+ if (authority->priv->rules_dirs == NULL)
+@@ -510,6 +506,167 @@ push_action_and_details (duk_context *cx,
+
+ /* ---------------------------------------------------------------------------------------------------- */
+
++typedef struct {
++ PolkitBackendJsAuthority *authority;
++ const gchar *filename;
++ pthread_cond_t cond;
++ pthread_mutex_t mutex;
++ gint ret;
++} RunawayKillerCtx;
++
++static gpointer
++runaway_killer_thread_execute_js (gpointer user_data)
++{
++ RunawayKillerCtx *ctx = user_data;
++ duk_context *cx = ctx->authority->priv->cx;
++
++ int oldtype;
++
++ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
++
++#if (DUK_VERSION >= 20000)
++ GFile *file = g_file_new_for_path(ctx->filename);
++ char *contents;
++ gsize len;
++
++ if (!g_file_load_contents(file, NULL, &contents, &len, NULL, NULL)) {
++ polkit_backend_authority_log(POLKIT_BACKEND_AUTHORITY(ctx->authority),
++ "Error compiling script %s", ctx->filename);
++ g_object_unref(file);
++ goto err;
++ }
++
++ g_object_unref(file);
++
++ /* evaluate the script, trying to print context in any syntax errors
++ found */
++ if (duk_peval_lstring(cx, contents, len) != 0)
++#else
++ if (duk_peval_file(cx, ctx->filename) != 0)
++#endif
++ {
++ polkit_backend_authority_log(POLKIT_BACKEND_AUTHORITY(ctx->authority),
++ "Error compiling script %s: %s", ctx->filename,
++ duk_safe_to_string(cx, -1));
++ duk_pop(cx);
++ goto free_err;
++ }
++#if (DUK_VERSION >= 20000)
++ g_free(contents);
++#endif
++
++ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS;
++ goto end;
++
++free_err:
++#if (DUK_VERSION >= 20000)
++ g_free(contents);
++#endif
++err:
++ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_FAILURE;
++end:
++ pthread_cond_signal(&ctx->cond);
++ return NULL;
++}
++
++static gpointer
++runaway_killer_thread_call_js (gpointer user_data)
++{
++ RunawayKillerCtx *ctx = user_data;
++ duk_context *cx = ctx->authority->priv->cx;
++ int oldtype;
++
++ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
++
++ if (duk_pcall_prop (cx, 0, 2) != DUK_EXEC_SUCCESS)
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (ctx->authority),
++ "Error evaluating admin rules: ",
++ duk_safe_to_string (cx, -1));
++ goto err;
++ }
++
++ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS;
++ goto end;
++
++err:
++ ctx->ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_FAILURE;
++end:
++ pthread_cond_signal(&ctx->cond);
++ return NULL;
++}
++
++/* Blocking for at most for RUNAWAY_KILLER_TIMEOUT */
++static gboolean
++execute_script_with_runaway_killer(PolkitBackendJsAuthority *authority,
++ const gchar *filename)
++{
++ gint64 end_time;
++ gboolean cancel = FALSE;
++ RunawayKillerCtx ctx = {.authority = authority, .filename = filename,
++ .ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET,
++ .mutex = PTHREAD_MUTEX_INITIALIZER,
++ .cond = PTHREAD_COND_INITIALIZER};
++ struct timespec abs_time;
++
++ pthread_mutex_lock(&ctx.mutex);
++
++ clock_gettime(CLOCK_REALTIME, &abs_time);
++ abs_time.tv_sec += RUNAWAY_KILLER_TIMEOUT;
++
++ pthread_create(&authority->priv->runaway_killer_thread, NULL, runaway_killer_thread_execute_js, &ctx);
++
++ while (ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET) /* loop to treat spurious wakeups */
++ if (pthread_cond_timedwait(&ctx.cond, &ctx.mutex, &abs_time) == ETIMEDOUT) {
++ cancel = TRUE;
++ break;
++ }
++
++ pthread_mutex_unlock(&ctx.mutex);
++
++ if (cancel)
++ pthread_cancel (authority->priv->runaway_killer_thread);
++ pthread_join (authority->priv->runaway_killer_thread, NULL);
++
++ return ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS;
++}
++
++/* Calls already stacked function and args. Blocking for at most for
++ * RUNAWAY_KILLER_TIMEOUT
++ */
++static gboolean
++call_js_function_with_runaway_killer(PolkitBackendJsAuthority *authority)
++{
++ gint64 end_time;
++ gboolean cancel = FALSE;
++ RunawayKillerCtx ctx = {.authority = authority,
++ .ret = RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET,
++ .mutex = PTHREAD_MUTEX_INITIALIZER,
++ .cond = PTHREAD_COND_INITIALIZER};
++ struct timespec abs_time;
++
++ pthread_mutex_lock(&ctx.mutex);
++
++ clock_gettime(CLOCK_REALTIME, &abs_time);
++ abs_time.tv_sec += RUNAWAY_KILLER_TIMEOUT;
++
++ pthread_create(&authority->priv->runaway_killer_thread, NULL, runaway_killer_thread_call_js, &ctx);
++
++ while (ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_UNSET) /* loop to treat spurious wakeups */
++ if (pthread_cond_timedwait(&ctx.cond, &ctx.mutex, &abs_time) == ETIMEDOUT) {
++ cancel = TRUE;
++ break;
++ }
++
++ pthread_mutex_unlock(&ctx.mutex);
++
++ if (cancel)
++ pthread_cancel (authority->priv->runaway_killer_thread);
++ pthread_join (authority->priv->runaway_killer_thread, NULL);
++
++ return ctx.ret == RUNAWAY_KILLER_THREAD_EXIT_STATUS_SUCCESS;
++}
++
+ /* ---------------------------------------------------------------------------------------------------- */
+
+ GList *
+@@ -557,13 +714,8 @@ polkit_backend_common_js_authority_get_admin_auth_identities (PolkitBackendInter
+ goto out;
+ }
+
+- if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE)
+- {
+- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+- "Error evaluating admin rules: ",
+- duk_safe_to_string (cx, -1));
+- goto out;
+- }
++ if (!call_js_function_with_runaway_killer (authority))
++ goto out;
+
+ ret_str = duk_require_string (cx, -1);
+
+@@ -643,15 +795,11 @@ polkit_backend_common_js_authority_check_authorization_sync (PolkitBackendIntera
+ goto out;
+ }
+
+- if (duk_pcall_prop (cx, 0, 2) != DUK_ERR_NONE)
+- {
+- polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+- "Error evaluating authorization rules: ",
+- duk_safe_to_string (cx, -1));
+- goto out;
+- }
++ if (!call_js_function_with_runaway_killer (authority))
++ goto out;
+
+ if (duk_is_null(cx, -1)) {
++ /* this fine, means there was no match, use implicit authorizations */
+ good = TRUE;
+ goto out;
+ }
+diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
+index e28091d..11e91c0 100644
+--- a/src/polkitbackend/polkitbackendjsauthority.cpp
++++ b/src/polkitbackend/polkitbackendjsauthority.cpp
+@@ -829,11 +829,14 @@ runaway_killer_setup (PolkitBackendJsAuthority *authority)
+ {
+ g_assert (authority->priv->rkt_source == NULL);
+
+- /* set-up timer for runaway scripts, will be executed in runaway_killer_thread */
++ /* set-up timer for runaway scripts, will be executed in
++ runaway_killer_thread, that is one, permanent thread running a glib
++ mainloop (rkt_loop) whose context (rkt_context) has a timeout source
++ (rkt_source) */
+ g_mutex_lock (&authority->priv->rkt_timeout_pending_mutex);
+ authority->priv->rkt_timeout_pending = FALSE;
+ g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex);
+- authority->priv->rkt_source = g_timeout_source_new_seconds (15);
++ authority->priv->rkt_source = g_timeout_source_new_seconds (RUNAWAY_KILLER_TIMEOUT);
+ g_source_set_callback (authority->priv->rkt_source, rkt_on_timeout, authority, NULL);
+ g_source_attach (authority->priv->rkt_source, authority->priv->rkt_context);
+
+@@ -893,6 +896,9 @@ execute_script_with_runaway_killer (PolkitBackendJsAuthority *authority,
+ {
+ bool ret;
+
++ // tries to JS_ExecuteScript(), may hang for > RUNAWAY_KILLER_TIMEOUT,
++ // runaway_killer_thread makes sure the call returns, due to exception
++ // injection
+ runaway_killer_setup (authority);
+ ret = JS_ExecuteScript (authority->priv->cx,
+ script,
+diff --git a/test/data/etc/polkit-1/rules.d/10-testing.rules b/test/data/etc/polkit-1/rules.d/10-testing.rules
+index 98bf062..e346b5d 100644
+--- a/test/data/etc/polkit-1/rules.d/10-testing.rules
++++ b/test/data/etc/polkit-1/rules.d/10-testing.rules
+@@ -189,8 +189,10 @@ polkit.addRule(function(action, subject) {
+ ;
+ } catch (error) {
+ if (error == "Terminating runaway script")
+- return polkit.Result.YES;
+- return polkit.Result.NO;
++ // Inverted logic to accomodate Duktape's model as well, which
++ // will always fail with negation, on timeouts
++ return polkit.Result.NO;
++ return polkit.Result.YES;
+ }
+ }
+ });
+diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c
+index f97e0e0..2103b17 100644
+--- a/test/polkitbackend/test-polkitbackendjsauthority.c
++++ b/test/polkitbackend/test-polkitbackendjsauthority.c
+@@ -328,7 +328,7 @@ static const RulesTestCase rules_test_cases[] = {
+ "net.company.run_away_script",
+ "unix-user:root",
+ NULL,
+- POLKIT_IMPLICIT_AUTHORIZATION_AUTHORIZED,
++ POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED,
+ },
+
+ {
+--
+GitLab
+
diff --git a/gnu/packages/patches/python-2.7-no-static-lib.patch b/gnu/packages/patches/python-2.7-no-static-lib.patch
new file mode 100644
index 0000000000..02529989be
--- /dev/null
+++ b/gnu/packages/patches/python-2.7-no-static-lib.patch
@@ -0,0 +1,70 @@
+From 92e2dcace7a3c02289b314238c5f18caec659ff1 Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Sat, 5 Jun 2021 12:41:47 +0200
+Subject: [PATCH] No static lib.
+
+This patch is adapted from Fedora. The original patch did not apply
+because of whitespace changes.
+
+00111 #
+Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
+a libpythonMAJOR.MINOR.a (bug 550692):
+Downstream only: not appropriate for upstream
+---
+ Makefile.pre.in | 26 +-------------------------
+ 1 file changed, 1 insertion(+), 25 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 6239fc3..948f196 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -486,7 +486,7 @@ coverage-report: regen-grammar
+
+
+ # Build the interpreter
+-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
++$(BUILDPYTHON): Modules/python.o $(LDLIBRARY)
+ $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \
+ Modules/python.o \
+ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
+@@ -527,18 +527,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
+ _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+ $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+
+-# Build static library
+-# avoid long command lines, same as LIBRARY_OBJS
+-$(LIBRARY): $(LIBRARY_OBJS)
+- -rm -f $@
+- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o
+- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS)
+- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS)
+- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS)
+- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS)
+- $(AR) $(ARFLAGS) $@ $(MODOBJS)
+- $(RANLIB) $@
+-
+ libpython$(VERSION).so: $(LIBRARY_OBJS)
+ if test $(INSTSONAME) != $(LDLIBRARY); then \
+ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+@@ -1216,18 +1204,6 @@ libainstall: @DEF_MAKE_RULE@ python-config
+ else true; \
+ fi; \
+ done
+- @if test -d $(LIBRARY); then :; else \
+- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+- if test "$(SO)" = .dll; then \
+- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
+- else \
+- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+- fi; \
+- else \
+- echo Skip install of $(LIBRARY) - use make frameworkinstall; \
+- fi; \
+- fi
+ $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
+ $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
+ $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
+--
+2.31.1
+
diff --git a/gnu/packages/patches/python-3-fix-tests.patch b/gnu/packages/patches/python-3-fix-tests.patch
index e13790bd41..b44e743c71 100644
--- a/gnu/packages/patches/python-3-fix-tests.patch
+++ b/gnu/packages/patches/python-3-fix-tests.patch
@@ -1,10 +1,39 @@
-See the discussion about the issues fixed here at:
-http://bugs.python.org/issue20868 .
+From f0698133e7d6c353a3e6ae0fc62e57ba558a9bc0 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Wed, 28 Oct 2020 22:55:05 -0400
+Subject: [PATCH] Skip problematic Python 3 tests in Guix.
+
+A subset of the hunks in this patch is tracked upstream at
+https://bugs.python.org/issue38845, which was contributed by Tanguy Le
+Carrour <tanguy@bioneland.org>.
+---
+ Lib/ctypes/test/test_callbacks.py | 3 +++
+ Lib/ctypes/test/test_find.py | 1 +
+ Lib/ctypes/test/test_libc.py | 3 +++
+ Lib/distutils/tests/test_archive_util.py | 2 ++
+ Lib/distutils/tests/test_sdist.py | 1 +
+ Lib/test/_test_multiprocessing.py | 2 ++
+ Lib/test/test_asyncio/test_base_events.py | 2 ++
+ Lib/test/test_generators.py | 1 +
+ Lib/test/test_pathlib.py | 3 +--
+ Lib/test/test_pdb.py | 4 ++--
+ Lib/test/test_regrtest.py | 2 ++
+ Lib/test/test_resource.py | 1 +
+ Lib/test/test_shutil.py | 2 ++
+ Lib/test/test_signal.py | 4 ++++
+ Lib/test/test_socket.py | 8 ++++++++
+ Lib/test/test_spwd.py | 6 ++----
+ Lib/test/test_tarfile.py | 9 ++++++---
+ Lib/test/test_threading.py | 3 +++
+ Lib/test/test_unicodedata.py | 1 +
+ Tools/scripts/run_tests.py | 2 +-
+ 20 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.py
+index d8e9c5a760..94fc5929c9 100644
--- a/Lib/ctypes/test/test_callbacks.py
+++ b/Lib/ctypes/test/test_callbacks.py
-@@ -3,6 +3,7 @@ import unittest
+@@ -5,6 +5,7 @@ from test import support
from ctypes import *
from ctypes.test import need_symbol
import _ctypes_test
@@ -12,7 +41,7 @@ diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.
class Callbacks(unittest.TestCase):
functype = CFUNCTYPE
-@@ -176,6 +177,8 @@ class SampleCallbacksTestCase(unittest.TestCase):
+@@ -178,6 +179,8 @@ class SampleCallbacksTestCase(unittest.TestCase):
self.assertLess(diff, 0.01, "%s not less than 0.01" % diff)
@@ -21,7 +50,20 @@ diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.
def test_issue_8959_a(self):
from ctypes.util import find_library
libc_path = find_library("c")
+diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
+index 92ac1840ad..c8eb75dedd 100644
+--- a/Lib/ctypes/test/test_find.py
++++ b/Lib/ctypes/test/test_find.py
+@@ -116,6 +116,7 @@ class FindLibraryLinux(unittest.TestCase):
+ with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None):
+ self.assertNotEqual(find_library('c'), None)
+
++ @unittest.skipIf(True, "ldconfig is not used on Guix")
+ def test_find_library_with_ld(self):
+ with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \
+ unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None):
diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py
+index 56285b5ff8..c088ab3db8 100644
--- a/Lib/ctypes/test/test_libc.py
+++ b/Lib/ctypes/test/test_libc.py
@@ -2,6 +2,7 @@ import unittest
@@ -42,6 +84,7 @@ diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py
comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char))
lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc
diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py
+index e9aad0e40f..8bbaa51ee5 100644
--- a/Lib/distutils/tests/test_archive_util.py
+++ b/Lib/distutils/tests/test_archive_util.py
@@ -333,6 +333,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
@@ -61,6 +104,7 @@ diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test
tmpdir = self._create_files()
base_name = os.path.join(self.mkdtemp(), 'archive')
diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py
+index 23db126959..6e2329df7d 100644
--- a/Lib/distutils/tests/test_sdist.py
+++ b/Lib/distutils/tests/test_sdist.py
@@ -443,6 +443,7 @@ class SDistTestCase(BasePyPIRCCommandTestCase):
@@ -72,9 +116,10 @@ diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.
# now building a sdist
dist, cmd = self.get_cmd()
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
+index e47905c863..31a5a9c308 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
-@@ -1473,6 +1473,7 @@ class _TestCondition(BaseTestCase):
+@@ -1577,6 +1577,7 @@ class _TestCondition(BaseTestCase):
if pid is not None:
os.kill(pid, signal.SIGINT)
@@ -82,10 +127,19 @@ diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.
def test_wait_result(self):
if isinstance(self, ProcessesMixin) and sys.platform != 'win32':
pid = os.getpid()
+@@ -3905,6 +3906,7 @@ class _TestSharedMemory(BaseTestCase):
+ sms.close()
+
+ @unittest.skipIf(os.name != "posix", "not feasible in non-posix platforms")
++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
+ def test_shared_memory_SharedMemoryServer_ignores_sigint(self):
+ # bpo-36368: protect SharedMemoryManager server process from
+ # KeyboardInterrupt signals.
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
+index 533d5cc7f5..c4f860cc3b 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
-@@ -1323,6 +1323,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
+@@ -1341,6 +1341,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
self._test_create_connection_ip_addr(m_socket, False)
@patch_socket
@@ -95,9 +149,10 @@ diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/t
m_socket.getaddrinfo = socket.getaddrinfo
sock = m_socket.socket.return_value
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
+index 3bf1522808..04bac8a7db 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
-@@ -34,6 +34,7 @@ class SignalAndYieldFromTest(unittest.TestCase):
+@@ -33,6 +33,7 @@ class SignalAndYieldFromTest(unittest.TestCase):
else:
return "FAILED"
@@ -105,30 +160,11 @@ diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
def test_raise_and_yield_from(self):
gen = self.generator1()
gen.send(None)
-diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py
---- a/Lib/test/test_normalization.py
-+++ b/Lib/test/test_normalization.py
-@@ -2,6 +2,7 @@ from test.support import open_urlresource
- import unittest
-
- from http.client import HTTPException
-+from urllib.error import URLError
- import sys
- from unicodedata import normalize, unidata_version
-
-@@ -43,6 +44,8 @@ class NormalizationTest(unittest.TestCase):
- except PermissionError:
- self.skipTest(f"Permission error when downloading {TESTDATAURL} "
- f"into the test data directory")
-+ except URLError:
-+ self.skipTest("DNS lookups are not enabled.")
- except (OSError, HTTPException):
- self.fail(f"Could not retrieve {TESTDATAURL}")
-
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
+index 3da35710b9..5404f9193d 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
-@@ -2134,8 +2134,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
+@@ -2408,8 +2408,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
self.assertEqual(given, expect)
self.assertEqual(set(p.rglob("FILEd*")), set())
@@ -139,9 +175,10 @@ diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
P = self.cls
support.import_module('pwd')
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
+index 8016f81e5a..10190486b4 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
-@@ -1150,11 +1150,11 @@ def test_pdb_issue_20766():
+@@ -1219,11 +1219,11 @@ def test_pdb_issue_20766():
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
-> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
(Pdb) continue
@@ -156,9 +193,10 @@ diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
+index a77638b10a..2069b349a8 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
-@@ -762,6 +762,7 @@ class ArgsTestCase(BaseTestCase):
+@@ -811,6 +811,7 @@ class ArgsTestCase(BaseTestCase):
output = self.run_tests('--fromfile', filename)
self.check_executed_tests(output, tests)
@@ -166,7 +204,7 @@ diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
def test_interrupted(self):
code = TEST_INTERRUPTED
test = self.create_test('sigint', code=code)
-@@ -779,6 +780,7 @@ class ArgsTestCase(BaseTestCase):
+@@ -828,6 +829,7 @@ class ArgsTestCase(BaseTestCase):
% (self.TESTNAME_REGEX, len(tests)))
self.check_line(output, regex)
@@ -175,9 +213,10 @@ diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
# Issue #25373: test --slowest with an interrupted test
code = TEST_INTERRUPTED
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
+index e5ece5284c..5299e54507 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
-@@ -145,6 +145,7 @@ class ResourceTest(unittest.TestCase):
+@@ -148,6 +148,7 @@ class ResourceTest(unittest.TestCase):
@unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit')
@support.requires_linux_version(2, 6, 36)
@@ -186,37 +225,75 @@ diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
self.assertRaises(TypeError, resource.prlimit)
self.assertRaises(ProcessLookupError, resource.prlimit,
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
+index e19af64be0..1b893df6fa 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
-@@ -1143,6 +1143,7 @@ class TestShutil(unittest.TestCase):
+@@ -1427,6 +1427,7 @@ class TestArchives(BaseTest, unittest.TestCase):
+ base_name = os.path.join(tmpdir, 'archive')
self.assertRaises(ValueError, make_archive, base_name, 'xxx')
- @support.requires_zlib
-+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
++ @unittest.skipIf(True, "The Guix build container has no root user")
+ @support.requires_zlib()
def test_make_archive_owner_group(self):
# testing make_archive with owner and group, with various combinations
- # this works even if there's not gid/uid support
-@@ -1171,6 +1172,7 @@ class TestShutil(unittest.TestCase):
+@@ -1455,6 +1456,7 @@ class TestArchives(BaseTest, unittest.TestCase):
+ self.assertTrue(os.path.isfile(res))
- @support.requires_zlib
-+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
++ @unittest.skipIf(True, "The Guix build container has no root user")
+ @support.requires_zlib()
@unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
def test_tarfile_root_owner(self):
- root_dir, base_dir = self._create_files()
+diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
+index 45553a6a42..55623f01a3 100644
+--- a/Lib/test/test_signal.py
++++ b/Lib/test/test_signal.py
+@@ -78,6 +78,7 @@ class PosixTests(unittest.TestCase):
+ self.assertLess(len(s), signal.NSIG)
+
+ @unittest.skipUnless(sys.executable, "sys.executable required.")
++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
+ def test_keyboard_interrupt_exit_code(self):
+ """KeyboardInterrupt triggers exit via SIGINT."""
+ process = subprocess.run(
+@@ -128,6 +129,7 @@ class WindowsSignalTests(unittest.TestCase):
+ signal.signal(7, handler)
+
+ @unittest.skipUnless(sys.executable, "sys.executable required.")
++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
+ def test_keyboard_interrupt_exit_code(self):
+ """KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT."""
+ # We don't test via os.kill(os.getpid(), signal.CTRL_C_EVENT) here
+@@ -1245,6 +1247,7 @@ class StressTest(unittest.TestCase):
+
+ class RaiseSignalTest(unittest.TestCase):
+
++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
+ def test_sigint(self):
+ with self.assertRaises(KeyboardInterrupt):
+ signal.raise_signal(signal.SIGINT)
+@@ -1275,6 +1278,7 @@ class RaiseSignalTest(unittest.TestCase):
+
+ class PidfdSignalTest(unittest.TestCase):
+
++ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
+ @unittest.skipUnless(
+ hasattr(signal, "pidfd_send_signal"),
+ "pidfd support not built in",
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
+index aefba4f397..6c89f558d5 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
-@@ -875,6 +875,8 @@ class GeneralModuleTests(unittest.TestCase):
+@@ -1009,6 +1009,8 @@ class GeneralModuleTests(unittest.TestCase):
if not fqhn in all_host_names:
self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names)))
+ @unittest.skipUnless(support.is_resource_enabled('network'),
+ 'network is not enabled')
def test_host_resolution(self):
- for addr in [support.HOSTv4, '10.0.0.1', '255.255.255.255']:
+ for addr in [socket_helper.HOSTv4, '10.0.0.1', '255.255.255.255']:
self.assertEqual(socket.gethostbyname(addr), addr)
-@@ -1004,6 +1006,8 @@ class GeneralModuleTests(unittest.TestCase):
+@@ -1140,6 +1142,8 @@ class GeneralModuleTests(unittest.TestCase):
self.assertWarns(DeprecationWarning, socket.ntohs, k)
self.assertWarns(DeprecationWarning, socket.htons, k)
@@ -225,7 +302,7 @@ diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
def testGetServBy(self):
eq = self.assertEqual
# Find one service that exists, then check all the related interfaces.
-@@ -1358,6 +1362,8 @@ class GeneralModuleTests(unittest.TestCase):
+@@ -1489,6 +1493,8 @@ class GeneralModuleTests(unittest.TestCase):
raise
self.assertRaises(TypeError, s.ioctl, socket.SIO_LOOPBACK_FAST_PATH, None)
@@ -234,7 +311,7 @@ diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
def testGetaddrinfo(self):
try:
socket.getaddrinfo('localhost', 80)
-@@ -1440,6 +1446,8 @@ class GeneralModuleTests(unittest.TestCase):
+@@ -1571,6 +1577,8 @@ class GeneralModuleTests(unittest.TestCase):
# only IP addresses are allowed
self.assertRaises(OSError, socket.getnameinfo, ('mail.python.org',0), 0)
@@ -244,6 +321,7 @@ diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
'network is not enabled')
def test_idna(self):
diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
+index 07793c84c8..fec672bcbe 100644
--- a/Lib/test/test_spwd.py
+++ b/Lib/test/test_spwd.py
@@ -5,8 +5,7 @@ from test import support
@@ -267,9 +345,10 @@ diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
def test_getspnam_exception(self):
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
+index 29cde91bf7..8d0f20e8bf 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
-@@ -2509,9 +2509,12 @@ def root_is_uid_gid_0():
+@@ -2607,9 +2607,12 @@ def root_is_uid_gid_0():
import pwd, grp
except ImportError:
return False
@@ -286,9 +365,10 @@ diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
return True
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
+index c21cdf8eb7..6c9d575032 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
-@@ -1249,6 +1249,7 @@ class MiscTestCase(unittest.TestCase):
+@@ -1398,6 +1398,7 @@ class MiscTestCase(unittest.TestCase):
class InterruptMainTests(unittest.TestCase):
@@ -296,7 +376,7 @@ diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
def test_interrupt_main_subthread(self):
# Calling start_new_thread with a function that executes interrupt_main
# should raise KeyboardInterrupt upon completion.
-@@ -1260,6 +1261,8 @@ class InterruptMainTests(unittest.TestCase):
+@@ -1409,6 +1410,8 @@ class InterruptMainTests(unittest.TestCase):
t.join()
t.join()
@@ -305,10 +385,23 @@ diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
def test_interrupt_main_mainthread(self):
# Make sure that if interrupt_main is called in main thread that
# KeyboardInterrupt is raised instantly.
+diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
+index b552d2bd17..28b1144e15 100644
+--- a/Lib/test/test_unicodedata.py
++++ b/Lib/test/test_unicodedata.py
+@@ -309,6 +309,7 @@ class UnicodeMiscTest(UnicodeDatabaseTest):
+ self.assertEqual(len(lines), 1,
+ r"\u%.4x should not be a linebreak" % i)
+
++@requires_resource('network')
+ class NormalizationTest(unittest.TestCase):
+ @staticmethod
+ def check_version(testfile):
diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
+index bcfa5e943b..1f2484971b 100644
--- a/Tools/scripts/run_tests.py
+++ b/Tools/scripts/run_tests.py
-@@ -39,7 +39,7 @@ def main(regrtest_args):
+@@ -41,7 +41,7 @@ def main(regrtest_args):
if not any(is_multiprocess_flag(arg) for arg in regrtest_args):
args.extend(['-j', '0']) # Use all CPU cores
if not any(is_resource_use_flag(arg) for arg in regrtest_args):
@@ -317,3 +410,6 @@ diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
args.extend(regrtest_args)
print(' '.join(args))
if sys.platform == 'win32':
+--
+2.29.2
+
diff --git a/gnu/packages/patches/python-3-hurd-configure.patch b/gnu/packages/patches/python-3-hurd-configure.patch
new file mode 100644
index 0000000000..aa25a401c5
--- /dev/null
+++ b/gnu/packages/patches/python-3-hurd-configure.patch
@@ -0,0 +1,27 @@
+Upstream status: Not upstreamed.
+
+The build system refuses to cross-compile for unknown targets
+even though it works fine. Add GNU/Hurd target.
+
+--- Python-3.8.5/configure.orig 2020-10-26 14:06:09.665423525 +0100
++++ Python-3.8.5/configure 2020-10-26 14:08:30.987765738 +0100
+@@ -3278,6 +3278,9 @@
+ *-*-vxworks*)
+ ac_sys_system=VxWorks
+ ;;
++ *-*-gnu)
++ ac_sys_system=GNU
++ ;;
+ *)
+ # for now, limit cross builds to known configurations
+ MACHDEP="unknown"
+@@ -3328,6 +3331,9 @@
+ *-*-vxworks*)
+ _host_cpu=$host_cpu
+ ;;
++ *-*-gnu)
++ _host_cpu=$host_cpu
++ ;;
+ *)
+ # for now, limit cross builds to known configurations
+ MACHDEP="unknown"
diff --git a/gnu/packages/patches/python-3-no-static-lib.patch b/gnu/packages/patches/python-3-no-static-lib.patch
new file mode 100644
index 0000000000..b44dbc976c
--- /dev/null
+++ b/gnu/packages/patches/python-3-no-static-lib.patch
@@ -0,0 +1,75 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: David Malcolm <dmalcolm@redhat.com>
+Date: Mon, 18 Jan 2010 17:59:07 +0000
+Subject: [PATCH] 00111: Don't try to build a libpythonMAJOR.MINOR.a
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Downstream only: not appropriate for upstream.
+
+See https://bugzilla.redhat.com/show_bug.cgi?id=556092
+
+Co-authored-by: David Malcolm <dmalcolm@redhat.com>
+Co-authored-by: Bohuslav Kabrda <bkabrda@redhat.com>
+Co-authored-by: Matej Stuchlik <mstuchli@redhat.com>
+Co-authored-by: Robert Kuska <rkuska@redhat.com>
+Co-authored-by: Charalampos Stratakis <cstratak@redhat.com>
+Co-authored-by: Miro Hrončok <miro@hroncok.cz>
+---
+ Makefile.pre.in | 21 ++-------------------
+ 1 file changed, 2 insertions(+), 19 deletions(-)
+
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 0c3981c132..5587422ec7 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -589,7 +589,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
+
+ # Build the interpreter
+-$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
++$(BUILDPYTHON): Programs/python.o $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
+
+ platform: $(BUILDPYTHON) pybuilddir.txt
+@@ -637,12 +637,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
+ _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
+
+-
+-# Build static library
+-$(LIBRARY): $(LIBRARY_OBJS)
+- -rm -f $@
+- $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS)
+-
+ libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS)
+ if test $(INSTSONAME) != $(LDLIBRARY); then \
+ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
+@@ -724,7 +718,7 @@ Makefile Modules/config.c: Makefile.pre \
+ @echo "The Makefile was updated, you may need to re-run make."
+
+
+-Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
++Programs/_testembed: Programs/_testembed.o $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS)
+ $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
+
+ ############################################################################
+@@ -1652,17 +1646,6 @@ libainstall: @DEF_MAKE_RULE@ python-config
+ else true; \
+ fi; \
+ done
+- @if test -d $(LIBRARY); then :; else \
+- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
+- if test "$(SHLIB_SUFFIX)" = .dll; then \
+- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
+- else \
+- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+- fi; \
+- else \
+- echo Skip install of $(LIBRARY) - use make frameworkinstall; \
+- fi; \
+- fi
+ $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
+ $(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
+ $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
diff --git a/gnu/packages/patches/python-3.8-CVE-2021-3177.patch b/gnu/packages/patches/python-3.8-CVE-2021-3177.patch
deleted file mode 100644
index 01f6b52865..0000000000
--- a/gnu/packages/patches/python-3.8-CVE-2021-3177.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-Fix CVE-2021-3177 for Python 3.8:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3177
-
-Patch copied from upstream source repository:
-
-https://github.com/python/cpython/commit/ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f
-
-From ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f Mon Sep 17 00:00:00 2001
-From: "Miss Islington (bot)"
- <31488909+miss-islington@users.noreply.github.com>
-Date: Mon, 18 Jan 2021 13:28:52 -0800
-Subject: [PATCH] closes bpo-42938: Replace snprintf with Python unicode
- formatting in ctypes param reprs. (GH-24248)
-
-(cherry picked from commit 916610ef90a0d0761f08747f7b0905541f0977c7)
-
-Co-authored-by: Benjamin Peterson <benjamin@python.org>
-
-Co-authored-by: Benjamin Peterson <benjamin@python.org>
----
- Lib/ctypes/test/test_parameters.py | 43 ++++++++++++++++
- .../2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | 2 +
- Modules/_ctypes/callproc.c | 51 +++++++------------
- 3 files changed, 64 insertions(+), 32 deletions(-)
- create mode 100644 Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
-
-diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py
-index e4c25fd880cef..531894fdec838 100644
---- a/Lib/ctypes/test/test_parameters.py
-+++ b/Lib/ctypes/test/test_parameters.py
-@@ -201,6 +201,49 @@ def __dict__(self):
- with self.assertRaises(ZeroDivisionError):
- WorseStruct().__setstate__({}, b'foo')
-
-+ def test_parameter_repr(self):
-+ from ctypes import (
-+ c_bool,
-+ c_char,
-+ c_wchar,
-+ c_byte,
-+ c_ubyte,
-+ c_short,
-+ c_ushort,
-+ c_int,
-+ c_uint,
-+ c_long,
-+ c_ulong,
-+ c_longlong,
-+ c_ulonglong,
-+ c_float,
-+ c_double,
-+ c_longdouble,
-+ c_char_p,
-+ c_wchar_p,
-+ c_void_p,
-+ )
-+ self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$")
-+ self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>")
-+ self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$")
-+ self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>")
-+ self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>")
-+ self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>")
-+ self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>")
-+ self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
-+ self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
-+ self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$")
-+ self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$")
-+ self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$")
-+ self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$")
-+ self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>")
-+ self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>")
-+ self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>")
-+ self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$")
-+ self.assertRegex(repr(c_char_p.from_param(b'hihi')), "^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$")
-+ self.assertRegex(repr(c_wchar_p.from_param('hihi')), "^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$")
-+ self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$")
-+
- ################################################################
-
- if __name__ == '__main__':
-#diff --git a/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
-#new file mode 100644
-#index 0000000000000..7df65a156feab
-#--- /dev/null
-#+++ b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst
-#@@ -0,0 +1,2 @@
-#+Avoid static buffers when computing the repr of :class:`ctypes.c_double` and
-#+:class:`ctypes.c_longdouble` values.
-diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
-index a9b8675cd951b..de75918d49f37 100644
---- a/Modules/_ctypes/callproc.c
-+++ b/Modules/_ctypes/callproc.c
-@@ -484,58 +484,47 @@ is_literal_char(unsigned char c)
- static PyObject *
- PyCArg_repr(PyCArgObject *self)
- {
-- char buffer[256];
- switch(self->tag) {
- case 'b':
- case 'B':
-- sprintf(buffer, "<cparam '%c' (%d)>",
-+ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
- self->tag, self->value.b);
-- break;
- case 'h':
- case 'H':
-- sprintf(buffer, "<cparam '%c' (%d)>",
-+ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
- self->tag, self->value.h);
-- break;
- case 'i':
- case 'I':
-- sprintf(buffer, "<cparam '%c' (%d)>",
-+ return PyUnicode_FromFormat("<cparam '%c' (%d)>",
- self->tag, self->value.i);
-- break;
- case 'l':
- case 'L':
-- sprintf(buffer, "<cparam '%c' (%ld)>",
-+ return PyUnicode_FromFormat("<cparam '%c' (%ld)>",
- self->tag, self->value.l);
-- break;
-
- case 'q':
- case 'Q':
-- sprintf(buffer,
--#ifdef MS_WIN32
-- "<cparam '%c' (%I64d)>",
--#else
-- "<cparam '%c' (%lld)>",
--#endif
-+ return PyUnicode_FromFormat("<cparam '%c' (%lld)>",
- self->tag, self->value.q);
-- break;
- case 'd':
-- sprintf(buffer, "<cparam '%c' (%f)>",
-- self->tag, self->value.d);
-- break;
-- case 'f':
-- sprintf(buffer, "<cparam '%c' (%f)>",
-- self->tag, self->value.f);
-- break;
--
-+ case 'f': {
-+ PyObject *f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d);
-+ if (f == NULL) {
-+ return NULL;
-+ }
-+ PyObject *result = PyUnicode_FromFormat("<cparam '%c' (%R)>", self->tag, f);
-+ Py_DECREF(f);
-+ return result;
-+ }
- case 'c':
- if (is_literal_char((unsigned char)self->value.c)) {
-- sprintf(buffer, "<cparam '%c' ('%c')>",
-+ return PyUnicode_FromFormat("<cparam '%c' ('%c')>",
- self->tag, self->value.c);
- }
- else {
-- sprintf(buffer, "<cparam '%c' ('\\x%02x')>",
-+ return PyUnicode_FromFormat("<cparam '%c' ('\\x%02x')>",
- self->tag, (unsigned char)self->value.c);
- }
-- break;
-
- /* Hm, are these 'z' and 'Z' codes useful at all?
- Shouldn't they be replaced by the functionality of c_string
-@@ -544,22 +533,20 @@ PyCArg_repr(PyCArgObject *self)
- case 'z':
- case 'Z':
- case 'P':
-- sprintf(buffer, "<cparam '%c' (%p)>",
-+ return PyUnicode_FromFormat("<cparam '%c' (%p)>",
- self->tag, self->value.p);
- break;
-
- default:
- if (is_literal_char((unsigned char)self->tag)) {
-- sprintf(buffer, "<cparam '%c' at %p>",
-+ return PyUnicode_FromFormat("<cparam '%c' at %p>",
- (unsigned char)self->tag, (void *)self);
- }
- else {
-- sprintf(buffer, "<cparam 0x%02x at %p>",
-+ return PyUnicode_FromFormat("<cparam 0x%02x at %p>",
- (unsigned char)self->tag, (void *)self);
- }
-- break;
- }
-- return PyUnicode_FromString(buffer);
- }
-
- static PyMemberDef PyCArgType_members[] = {
diff --git a/gnu/packages/patches/python-3.8-fix-tests.patch b/gnu/packages/patches/python-3.8-fix-tests.patch
deleted file mode 100644
index 4fbdd444c7..0000000000
--- a/gnu/packages/patches/python-3.8-fix-tests.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
-index 1474624..887f8ee 100644
---- a/Lib/test/_test_multiprocessing.py
-+++ b/Lib/test/_test_multiprocessing.py
-@@ -3801,6 +3801,7 @@ class _TestSharedMemory(BaseTestCase):
- sms.close()
-
- @unittest.skipIf(os.name != "posix", "not feasible in non-posix platforms")
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_shared_memory_SharedMemoryServer_ignores_sigint(self):
- # bpo-36368: protect SharedMemoryManager server process from
- # KeyboardInterrupt signals.
-diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
-index d41e94b..a1c15e7 100644
---- a/Lib/test/test_signal.py
-+++ b/Lib/test/test_signal.py
-@@ -78,6 +78,7 @@ class PosixTests(unittest.TestCase):
- self.assertLess(len(s), signal.NSIG)
-
- @unittest.skipUnless(sys.executable, "sys.executable required.")
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_keyboard_interrupt_exit_code(self):
- """KeyboardInterrupt triggers exit via SIGINT."""
- process = subprocess.run(
-@@ -128,6 +129,7 @@ class WindowsSignalTests(unittest.TestCase):
- signal.signal(7, handler)
-
- @unittest.skipUnless(sys.executable, "sys.executable required.")
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_keyboard_interrupt_exit_code(self):
- """KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT."""
- # We don't test via os.kill(os.getpid(), signal.CTRL_C_EVENT) here
-@@ -1245,6 +1247,7 @@ class StressTest(unittest.TestCase):
-
- class RaiseSignalTest(unittest.TestCase):
-
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_sigint(self):
- with self.assertRaises(KeyboardInterrupt):
- signal.raise_signal(signal.SIGINT)
---
-2.23.0
diff --git a/gnu/packages/patches/python-3.9-fix-tests.patch b/gnu/packages/patches/python-3.9-fix-tests.patch
deleted file mode 100644
index dc6b8c4cc8..0000000000
--- a/gnu/packages/patches/python-3.9-fix-tests.patch
+++ /dev/null
@@ -1,370 +0,0 @@
-See the discussion about the issues fixed here at:
-http://bugs.python.org/issue20868 .
-
-diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.py
---- a/Lib/ctypes/test/test_callbacks.py
-+++ b/Lib/ctypes/test/test_callbacks.py
-@@ -3,6 +3,7 @@ import unittest
- from ctypes import *
- from ctypes.test import need_symbol
- import _ctypes_test
-+import platform
-
- class Callbacks(unittest.TestCase):
- functype = CFUNCTYPE
-@@ -176,6 +177,8 @@ class SampleCallbacksTestCase(unittest.TestCase):
-
- self.assertLess(diff, 0.01, "%s not less than 0.01" % diff)
-
-+ @unittest.skipIf(platform.machine() in ['mips64'],
-+ "This test fails on this platform")
- def test_issue_8959_a(self):
- from ctypes.util import find_library
- libc_path = find_library("c")
-diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py
---- a/Lib/ctypes/test/test_libc.py
-+++ b/Lib/ctypes/test/test_libc.py
-@@ -2,6 +2,7 @@ import unittest
-
- from ctypes import *
- import _ctypes_test
-+import platform
-
- lib = CDLL(_ctypes_test.__file__)
-
-@@ -17,6 +18,8 @@ class LibTest(unittest.TestCase):
- import math
- self.assertEqual(lib.my_sqrt(2.0), math.sqrt(2.0))
-
-+ @unittest.skipIf(platform.machine() in ['mips64'],
-+ "This test fails on this platform")
- def test_qsort(self):
- comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char))
- lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc
-diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py
---- a/Lib/distutils/tests/test_archive_util.py
-+++ b/Lib/distutils/tests/test_archive_util.py
-@@ -333,6 +333,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
- self.assertEqual(os.path.basename(res), 'archive.tar.xz')
- self.assertEqual(self._tarinfo(res), self._created_files)
-
-+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
- def test_make_archive_owner_group(self):
- # testing make_archive with owner and group, with various combinations
- # this works even if there's not gid/uid support
-@@ -362,6 +363,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
-
- @unittest.skipUnless(ZLIB_SUPPORT, "Requires zlib")
- @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
-+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
- def test_tarfile_root_owner(self):
- tmpdir = self._create_files()
- base_name = os.path.join(self.mkdtemp(), 'archive')
-diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py
---- a/Lib/distutils/tests/test_sdist.py
-+++ b/Lib/distutils/tests/test_sdist.py
-@@ -443,6 +443,7 @@ class SDistTestCase(BasePyPIRCCommandTestCase):
- "The tar command is not found")
- @unittest.skipIf(find_executable('gzip') is None,
- "The gzip command is not found")
-+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
- def test_make_distribution_owner_group(self):
- # now building a sdist
- dist, cmd = self.get_cmd()
-diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
---- a/Lib/test/_test_multiprocessing.py
-+++ b/Lib/test/_test_multiprocessing.py
-@@ -1473,6 +1473,7 @@ class _TestCondition(BaseTestCase):
- if pid is not None:
- os.kill(pid, signal.SIGINT)
-
-+ @unittest.skipIf(True, "This fails for unknown reasons on Guix")
- def test_wait_result(self):
- if isinstance(self, ProcessesMixin) and sys.platform != 'win32':
- pid = os.getpid()
-diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
---- a/Lib/test/test_asyncio/test_base_events.py
-+++ b/Lib/test/test_asyncio/test_base_events.py
-@@ -1323,6 +1323,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
- self._test_create_connection_ip_addr(m_socket, False)
-
- @patch_socket
-+ @unittest.skipUnless(support.is_resource_enabled('network'),
-+ 'network is not enabled')
- def test_create_connection_service_name(self, m_socket):
- m_socket.getaddrinfo = socket.getaddrinfo
- sock = m_socket.socket.return_value
-diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
---- a/Lib/test/test_generators.py
-+++ b/Lib/test/test_generators.py
-@@ -34,6 +34,7 @@ class SignalAndYieldFromTest(unittest.TestCase):
- else:
- return "FAILED"
-
-+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment')
- def test_raise_and_yield_from(self):
- gen = self.generator1()
- gen.send(None)
-diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
---- a/Lib/test/test_pathlib.py
-+++ b/Lib/test/test_pathlib.py
-@@ -2134,8 +2134,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
- self.assertEqual(given, expect)
- self.assertEqual(set(p.rglob("FILEd*")), set())
-
-- @unittest.skipUnless(hasattr(pwd, 'getpwall'),
-- 'pwd module does not expose getpwall()')
-+ @unittest.skipIf(True, "Guix builder home is '/' which causes trouble for these tests")
- def test_expanduser(self):
- P = self.cls
- support.import_module('pwd')
-diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
---- a/Lib/test/test_pdb.py
-+++ b/Lib/test/test_pdb.py
-@@ -1150,11 +1150,11 @@ def test_pdb_issue_20766():
- > <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
- -> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
- (Pdb) continue
-- pdb 1: <built-in function default_int_handler>
-+ pdb 1: Handlers.SIG_IGN
- > <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function()
- -> sess.set_trace(sys._getframe())
- (Pdb) continue
-- pdb 2: <built-in function default_int_handler>
-+ pdb 2: Handlers.SIG_IGN
- """
-
-
-diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
---- a/Lib/test/test_regrtest.py
-+++ b/Lib/test/test_regrtest.py
-@@ -762,6 +762,7 @@ class ArgsTestCase(BaseTestCase):
- output = self.run_tests('--fromfile', filename)
- self.check_executed_tests(output, tests)
-
-+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.')
- def test_interrupted(self):
- code = TEST_INTERRUPTED
- test = self.create_test('sigint', code=code)
-@@ -779,6 +780,7 @@ class ArgsTestCase(BaseTestCase):
- % (self.TESTNAME_REGEX, len(tests)))
- self.check_line(output, regex)
-
-+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.')
- def test_slowest_interrupted(self):
- # Issue #25373: test --slowest with an interrupted test
- code = TEST_INTERRUPTED
-diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
---- a/Lib/test/test_resource.py
-+++ b/Lib/test/test_resource.py
-@@ -145,6 +145,7 @@ class ResourceTest(unittest.TestCase):
-
- @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit')
- @support.requires_linux_version(2, 6, 36)
-+ @unittest.skipIf(True, "Bug: the PermissionError is not raised")
- def test_prlimit(self):
- self.assertRaises(TypeError, resource.prlimit)
- self.assertRaises(ProcessLookupError, resource.prlimit,
-diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
---- a/Lib/test/test_shutil.py
-+++ b/Lib/test/test_shutil.py
-@@ -1428,6 +1428,7 @@ class TestArchives(BaseTest, unittest.TestCase):
- self.assertRaises(ValueError, make_archive, base_name, 'xxx')
-
- @support.requires_zlib()
-+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
- def test_make_archive_owner_group(self):
- # testing make_archive with owner and group, with various combinations
- # this works even if there's not gid/uid support
-@@ -1456,6 +1457,7 @@ class TestArchives(BaseTest, unittest.TestCase):
-
-
- @support.requires_zlib()
-+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
- @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
- def test_tarfile_root_owner(self):
- root_dir, base_dir = self._create_files()
-diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
---- a/Lib/test/test_unicodedata.py
-+++ b/Lib/test/test_unicodedata.py
-@@ -320,6 +320,7 @@ class NormalizationTest(unittest.TestCase):
- data = [int(x, 16) for x in data.split(" ")]
- return "".join([chr(x) for x in data])
-
-+ @unittest.skipIf(True, 'Network is not available in the Guix build environment')
- def test_normalization(self):
- TESTDATAFILE = "NormalizationTest.txt"
- TESTDATAURL = f"http://www.pythontest.net/unicode/{unicodedata.unidata_version}/{TESTDATAFILE}"
-diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
---- a/Lib/test/test_socket.py
-+++ b/Lib/test/test_socket.py
-@@ -875,6 +875,8 @@ class GeneralModuleTests(unittest.TestCase):
- if not fqhn in all_host_names:
- self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names)))
-
-+ @unittest.skipUnless(support.is_resource_enabled('network'),
-+ 'network is not enabled')
- def test_host_resolution(self):
- for addr in [support.HOSTv4, '10.0.0.1', '255.255.255.255']:
- self.assertEqual(socket.gethostbyname(addr), addr)
-@@ -1004,6 +1006,8 @@ class GeneralModuleTests(unittest.TestCase):
- self.assertWarns(DeprecationWarning, socket.ntohs, k)
- self.assertWarns(DeprecationWarning, socket.htons, k)
-
-+ @unittest.skipUnless(os.path.exists("/etc/services"),
-+ "getservbyname uses /etc/services, which is not in the chroot")
- def testGetServBy(self):
- eq = self.assertEqual
- # Find one service that exists, then check all the related interfaces.
-@@ -1358,6 +1362,8 @@ class GeneralModuleTests(unittest.TestCase):
- raise
- self.assertRaises(TypeError, s.ioctl, socket.SIO_LOOPBACK_FAST_PATH, None)
-
-+ @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
-+ "getaddrinfo() will fail")
- def testGetaddrinfo(self):
- try:
- socket.getaddrinfo('localhost', 80)
-@@ -1440,6 +1446,8 @@ class GeneralModuleTests(unittest.TestCase):
- # only IP addresses are allowed
- self.assertRaises(OSError, socket.getnameinfo, ('mail.python.org',0), 0)
-
-+ @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
-+ "getaddrinfo() will fail")
- @unittest.skipUnless(support.is_resource_enabled('network'),
- 'network is not enabled')
- def test_idna(self):
-diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
---- a/Lib/test/test_spwd.py
-+++ b/Lib/test/test_spwd.py
-@@ -5,8 +5,7 @@ from test import support
- spwd = support.import_module('spwd')
-
-
--@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
-- 'root privileges required')
-+@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow')
- class TestSpwdRoot(unittest.TestCase):
-
- def test_getspall(self):
-@@ -56,8 +55,7 @@ class TestSpwdRoot(unittest.TestCase):
- self.assertRaises(TypeError, spwd.getspnam, bytes_name)
-
-
--@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() != 0,
-- 'non-root user required')
-+@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow')
- class TestSpwdNonRoot(unittest.TestCase):
-
- def test_getspnam_exception(self):
-diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
---- a/Lib/test/test_tarfile.py
-+++ b/Lib/test/test_tarfile.py
-@@ -2509,9 +2509,12 @@ def root_is_uid_gid_0():
- import pwd, grp
- except ImportError:
- return False
-- if pwd.getpwuid(0)[0] != 'root':
-- return False
-- if grp.getgrgid(0)[0] != 'root':
-+ try:
-+ if pwd.getpwuid(0)[0] != 'root':
-+ return False
-+ if grp.getgrgid(0)[0] != 'root':
-+ return False
-+ except KeyError:
- return False
- return True
-
-diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
---- a/Lib/test/test_threading.py
-+++ b/Lib/test/test_threading.py
-@@ -1249,6 +1249,7 @@ class MiscTestCase(unittest.TestCase):
-
-
- class InterruptMainTests(unittest.TestCase):
-+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.')
- def test_interrupt_main_subthread(self):
- # Calling start_new_thread with a function that executes interrupt_main
- # should raise KeyboardInterrupt upon completion.
-@@ -1260,6 +1261,8 @@ class InterruptMainTests(unittest.TestCase):
- t.join()
- t.join()
-
-+
-+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.')
- def test_interrupt_main_mainthread(self):
- # Make sure that if interrupt_main is called in main thread that
- # KeyboardInterrupt is raised instantly.
-diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
---- a/Tools/scripts/run_tests.py
-+++ b/Tools/scripts/run_tests.py
-@@ -39,7 +39,7 @@ def main(regrtest_args):
- if not any(is_multiprocess_flag(arg) for arg in regrtest_args):
- args.extend(['-j', '0']) # Use all CPU cores
- if not any(is_resource_use_flag(arg) for arg in regrtest_args):
-- args.extend(['-u', 'all,-largefile,-audio,-gui'])
-+ args.extend(['-u', 'all,-largefile,-audio,-gui,-network'])
- args.extend(regrtest_args)
- print(' '.join(args))
- if sys.platform == 'win32':
-diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
-index 1474624..887f8ee 100644
---- a/Lib/test/_test_multiprocessing.py
-+++ b/Lib/test/_test_multiprocessing.py
-@@ -3801,6 +3801,7 @@ class _TestSharedMemory(BaseTestCase):
- sms.close()
-
- @unittest.skipIf(os.name != "posix", "not feasible in non-posix platforms")
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_shared_memory_SharedMemoryServer_ignores_sigint(self):
- # bpo-36368: protect SharedMemoryManager server process from
- # KeyboardInterrupt signals.
-diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
-index d41e94b..a1c15e7 100644
---- a/Lib/test/test_signal.py
-+++ b/Lib/test/test_signal.py
-@@ -78,6 +78,7 @@ class PosixTests(unittest.TestCase):
- self.assertLess(len(s), signal.NSIG)
-
- @unittest.skipUnless(sys.executable, "sys.executable required.")
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_keyboard_interrupt_exit_code(self):
- """KeyboardInterrupt triggers exit via SIGINT."""
- process = subprocess.run(
-@@ -128,6 +129,7 @@ class WindowsSignalTests(unittest.TestCase):
- signal.signal(7, handler)
-
- @unittest.skipUnless(sys.executable, "sys.executable required.")
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_keyboard_interrupt_exit_code(self):
- """KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT."""
- # We don't test via os.kill(os.getpid(), signal.CTRL_C_EVENT) here
-@@ -1245,6 +1247,7 @@ class StressTest(unittest.TestCase):
-
- class RaiseSignalTest(unittest.TestCase):
-
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_sigint(self):
- with self.assertRaises(KeyboardInterrupt):
- signal.raise_signal(signal.SIGINT)
-@@ -1279,6 +1279,7 @@ class PidfdSignalTest(unittest.TestCase):
- hasattr(signal, "pidfd_send_signal"),
- "pidfd support not built in",
- )
-+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
- def test_pidfd_send_signal(self):
- with self.assertRaises(OSError) as cm:
- signal.pidfd_send_signal(0, signal.SIGINT)
-diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
-index 92ac184..49eec2c 100644
---- a/Lib/ctypes/test/test_find.py
-+++ b/Lib/ctypes/test/test_find.py
-@@ -116,6 +116,7 @@ class FindLibraryLinux(unittest.TestCase):
- with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None):
- self.assertNotEqual(find_library('c'), None)
-
-+ @unittest.skipIf(True, "This fails for unknown reasons on Guix")
- def test_find_library_with_ld(self):
- with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \
- unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None):
diff --git a/gnu/packages/patches/python-babel-fix-parse-future-test.patch b/gnu/packages/patches/python-babel-fix-parse-future-test.patch
new file mode 100644
index 0000000000..8a90166ec5
--- /dev/null
+++ b/gnu/packages/patches/python-babel-fix-parse-future-test.patch
@@ -0,0 +1,68 @@
+From 7bdaa28a55e8d8228d5434effa4b1473ab7b3669 Mon Sep 17 00:00:00 2001
+From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
+Date: Tue, 5 May 2020 08:05:56 +0000
+Subject: [PATCH] fix tests when using Python 3.9a6
+
+In Python 3.9a6 integer values for future flags were changed to prevent
+collision with compiler flags. We need to retrieve these at runtime so
+the test suite works with Python <= 3.8 as well as Python 3.9.
+---
+ tests/test_util.py | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_util.py b/tests/test_util.py
+index a6a4450c..b9343aaa 100644
+--- a/tests/test_util.py
++++ b/tests/test_util.py
+@@ -11,6 +11,7 @@
+ # individuals. For the exact contribution history, see the revision
+ # history and logs, available at http://babel.edgewall.org/log/.
+
++import __future__
+ import unittest
+
+ import pytest
+@@ -20,6 +21,12 @@
+ from babel.util import parse_future_flags
+
+
++class _FF:
++ division = __future__.division.compiler_flag
++ print_function = __future__.print_function.compiler_flag
++ with_statement = __future__.with_statement.compiler_flag
++ unicode_literals = __future__.unicode_literals.compiler_flag
++
+ def test_distinct():
+ assert list(util.distinct([1, 2, 1, 3, 4, 4])) == [1, 2, 3, 4]
+ assert list(util.distinct('foobar')) == ['f', 'o', 'b', 'a', 'r']
+@@ -70,25 +77,25 @@ def test_parse_encoding_non_ascii():
+ from __future__ import print_function,
+ division, with_statement,
+ unicode_literals
+-''', 0x10000 | 0x2000 | 0x8000 | 0x20000),
++''', _FF.print_function | _FF.division | _FF.with_statement | _FF.unicode_literals),
+ ('''
+ from __future__ import print_function, division
+ print('hello')
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+ ('''
+ from __future__ import print_function, division, unknown,,,,,
+ print 'hello'
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+ ('''
+ from __future__ import (
+ print_function,
+ division)
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+ ('''
+ from __future__ import \\
+ print_function, \\
+ division
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+ ])
+ def test_parse_future(source, result):
+ fp = BytesIO(source.encode('latin-1'))
diff --git a/gnu/packages/patches/python-chai-drop-python2.patch b/gnu/packages/patches/python-chai-drop-python2.patch
new file mode 100644
index 0000000000..0eb980e5db
--- /dev/null
+++ b/gnu/packages/patches/python-chai-drop-python2.patch
@@ -0,0 +1,32 @@
+Patch copied from Gentoo removing obsolete Python2 code.
+
+--- a/chai/chai.py
++++ b/chai/chai.py
+@@ -62,11 +62,6 @@
+ try:
+ func(self, *args, **kwargs)
+ except UnexpectedCall as e:
+- # if this is not python3, use python2 syntax
+- if not hasattr(e, '__traceback__'):
+- from .python2 import reraise
+- reraise(
+- AssertionError, '\n\n' + str(e), sys.exc_info()[-1])
+ exc = AssertionError('\n\n' + str(e))
+ setattr(exc, '__traceback__', sys.exc_info()[-1])
+ raise exc
+--- a/chai/python2.py
++++ b/chai/python2.py
+@@ -1,3 +0,0 @@
+-
+-def reraise(exc, msg, traceback):
+- raise exc, msg, traceback
+--- a/chai.egg-info/SOURCES.txt
++++ b/chai.egg-info/SOURCES.txt
+@@ -10,7 +10,6 @@
+ chai/exception.py
+ chai/expectation.py
+ chai/mock.py
+-chai/python2.py
+ chai/spy.py
+ chai/stub.py
+ chai.egg-info/PKG-INFO
diff --git a/gnu/packages/patches/python-docopt-pytest6-compat.patch b/gnu/packages/patches/python-docopt-pytest6-compat.patch
new file mode 100644
index 0000000000..acd4955778
--- /dev/null
+++ b/gnu/packages/patches/python-docopt-pytest6-compat.patch
@@ -0,0 +1,29 @@
+https://sources.debian.org/data/main/d/docopt/0.6.2-3/debian/patches/pytest6
+
+From: Michael R. Crusoe <crusoe@debian.org>
+Subject: fix for pytest 6.x comptability
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979285
+
+--- docopt.orig/conftest.py
++++ docopt/conftest.py
+@@ -11,6 +11,8 @@
+
+ def pytest_collect_file(path, parent):
+ if path.ext == ".docopt" and path.basename.startswith("test"):
++ if hasattr(DocoptTestFile, "from_parent"):
++ return DocoptTestFile.from_parent(parent, fspath=path)
+ return DocoptTestFile(path, parent)
+
+
+@@ -41,7 +43,10 @@
+ for name, doc, cases in parse_test(raw):
+ name = self.fspath.purebasename
+ for case in cases:
+- yield DocoptTestItem("%s(%d)" % (name, index), self, doc, case)
++ if hasattr(DocoptTestItem, "from_parent"):
++ yield DocoptTestItem.from_parent(self, name="%s(%d)" % (name, index), doc=doc, case=case)
++ else:
++ yield DocoptTestItem("%s(%d)" % (name, index), self, doc, case)
+ index += 1
+
+
diff --git a/gnu/packages/patches/python-fixtures-remove-monkeypatch-test.patch b/gnu/packages/patches/python-fixtures-remove-monkeypatch-test.patch
new file mode 100644
index 0000000000..4ffe9b373d
--- /dev/null
+++ b/gnu/packages/patches/python-fixtures-remove-monkeypatch-test.patch
@@ -0,0 +1,59 @@
+https://sources.debian.org/data/main/p/python-fixtures/3.0.0-4/debian/patches/remove-broken-monkey-patch-test.patch
+
+The last release was May 2016. This can be removed when the next release happens.
+
+Description: Remove broken monkey patch tests
+Author: Thomas Goirand <zigo@debian.org>
+Bug-Debian: https://bugs.debian.org/973239
+Forwarded: no
+Last-Update: 2020-11-12
+
+--- python-fixtures-3.0.0.orig/fixtures/tests/_fixtures/test_monkeypatch.py
++++ python-fixtures-3.0.0/fixtures/tests/_fixtures/test_monkeypatch.py
+@@ -181,22 +181,6 @@ class TestMonkeyPatch(testtools.TestCase
+ self._check_restored_static_or_class_method(oldmethod, oldmethod_inst,
+ C, 'foo_cls')
+
+- def test_patch_classmethod_with_classmethod(self):
+- oldmethod = C.foo_cls
+- oldmethod_inst = C().foo_cls
+- fixture = MonkeyPatch(
+- 'fixtures.tests._fixtures.test_monkeypatch.C.foo_cls',
+- D.bar_cls_args)
+- with fixture:
+- cls, target_class = C.foo_cls()
+- self.expectThat(cls, Is(D))
+- self.expectThat(target_class, Is(C))
+- cls, target_class = C().foo_cls()
+- self.expectThat(cls, Is(D))
+- self.expectThat(target_class, Is(C))
+- self._check_restored_static_or_class_method(oldmethod, oldmethod_inst,
+- C, 'foo_cls')
+-
+ def test_patch_classmethod_with_function(self):
+ oldmethod = C.foo_cls
+ oldmethod_inst = C().foo_cls
+@@ -212,23 +196,6 @@ class TestMonkeyPatch(testtools.TestCase
+ self._check_restored_static_or_class_method(oldmethod, oldmethod_inst,
+ C, 'foo_cls')
+
+- def test_patch_classmethod_with_boundmethod(self):
+- oldmethod = C.foo_cls
+- oldmethod_inst = C().foo_cls
+- d = D()
+- fixture = MonkeyPatch(
+- 'fixtures.tests._fixtures.test_monkeypatch.C.foo_cls',
+- d.bar_two_args)
+- with fixture:
+- slf, cls = C.foo_cls()
+- self.expectThat(slf, Is(d))
+- self.expectThat(cls, Is(C))
+- slf, cls = C().foo_cls()
+- self.expectThat(slf, Is(d))
+- self.expectThat(cls, Is(C))
+- self._check_restored_static_or_class_method(oldmethod, oldmethod_inst,
+- C, 'foo_cls')
+-
+ def test_patch_function_with_staticmethod(self):
+ oldmethod = fake_no_args
+ fixture = MonkeyPatch(
diff --git a/gnu/packages/patches/python-poppler-qt5-fix-build.patch b/gnu/packages/patches/python-poppler-qt5-fix-build.patch
new file mode 100644
index 0000000000..099bb86d2f
--- /dev/null
+++ b/gnu/packages/patches/python-poppler-qt5-fix-build.patch
@@ -0,0 +1,116 @@
+Patch taken from the upstream repository
+https://github.com/frescobaldi/python-poppler-qt5/issues/43
+
+From 92e5962ec3751ab051d0b655fd61afc7a1cf709e Mon Sep 17 00:00:00 2001
+From: Ben Greiner <code@bnavigator.de>
+Date: Thu, 4 Mar 2021 17:02:51 +0100
+Subject: [PATCH] map type QVector< QPair<TYPE, TYPE> > for
+ FormFieldChoice::choicesWithExportValues() (#45)
+
+---
+ types.sip | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 93 insertions(+)
+
+diff --git a/types.sip b/types.sip
+index 239b8c9..81cb283 100644
+--- a/types.sip
++++ b/types.sip
+@@ -331,5 +331,98 @@ template <TYPE>
+ };
+
+
++/**
++ * Convert QVector< QPair<TYPE, TYPE> >
++ * from and to a Python list of a 2-item tuple
++ */
++
++template<TYPE>
++%MappedType QVector< QPair<TYPE, TYPE> >
++{
++%TypeHeaderCode
++#include <qvector.h>
++#include <qpair.h>
++%End
++
++%ConvertFromTypeCode
++ // Create the list.
++ PyObject *l;
++
++ if ((l = PyList_New(sipCpp->size())) == NULL)
++ return NULL;
++
++ // Set the list elements.
++ for (int i = 0; i < sipCpp->size(); ++i)
++ {
++ QPair<TYPE, TYPE>* p = new QPair<TYPE, TYPE>(sipCpp->at(i));
++ PyObject *ptuple = PyTuple_New(2);
++ PyObject *pfirst;
++ PyObject *psecond;
++
++ TYPE *sfirst = new TYPE(p->first);
++ if ((pfirst = sipConvertFromType(sfirst, sipType_TYPE, sipTransferObj)) == NULL)
++ {
++ Py_DECREF(l);
++ Py_DECREF(ptuple);
++ return NULL;
++ }
++ PyTuple_SET_ITEM(ptuple, 0, pfirst);
++
++ TYPE *ssecond = new TYPE(p->second);
++ if ((psecond = sipConvertFromType(ssecond, sipType_TYPE, sipTransferObj)) == NULL)
++ {
++ Py_DECREF(l);
++ Py_DECREF(ptuple);
++ Py_DECREF(pfirst);
++ return NULL;
++ }
++ PyTuple_SET_ITEM(ptuple, 1, psecond);
++
++ PyList_SET_ITEM(l, i, ptuple);
++ }
++
++ return l;
++%End
++
++%ConvertToTypeCode
++ const sipTypeDef* qpair_type = sipFindType("QPair<TYPE, TYPE>");
++
++ // Check the type if that is all that is required.
++ if (sipIsErr == NULL)
++ {
++ if (!PySequence_Check(sipPy))
++ return 0;
++
++ for (int i = 0; i < PySequence_Size(sipPy); ++i)
++ if (!sipCanConvertToType(PySequence_ITEM(sipPy, i), qpair_type, SIP_NOT_NONE))
++ return 0;
++
++ return 1;
++ }
++
++
++ QVector< QPair<TYPE, TYPE> > *qv = new QVector< QPair<TYPE, TYPE> >;
++
++ for (int i = 0; i < PySequence_Size(sipPy); ++i)
++ {
++ int state;
++ QPair<TYPE, TYPE> * p = reinterpret_cast< QPair<TYPE, TYPE> * >(sipConvertToType(PySequence_ITEM(sipPy, i), qpair_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
++
++ if (*sipIsErr)
++ {
++ sipReleaseType(p, qpair_type, state);
++ delete qv;
++ return 0;
++ }
++ qv->append(*p);
++ sipReleaseType(p, qpair_type, state);
++ }
++
++ *sipCppPtr = qv;
++ return sipGetState(sipTransferObj);
++%End
++
++};
++
+
+ /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */
diff --git a/gnu/packages/patches/python-pyflakes-test-location.patch b/gnu/packages/patches/python-pyflakes-test-location.patch
new file mode 100644
index 0000000000..ea2c50c82e
--- /dev/null
+++ b/gnu/packages/patches/python-pyflakes-test-location.patch
@@ -0,0 +1,42 @@
+This patch fixes test failure related to reported source code locations.
+It is a backport of this patch:
+
+ commit 6a5f38b5ab12260fde8a0463acd433bc2d34dbcf
+ Author: Louis Sautier <sautier.louis@gmail.com>
+ Date: Sat Oct 3 02:37:53 2020 +0200
+
+ Fix tests with Python 3.9, closes #549 (#586)
+
+ Stop allowing failures on Python nightly.
+
+diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
+index 128aa69..b728e65 100644
+--- a/pyflakes/test/test_api.py
++++ b/pyflakes/test/test_api.py
+@@ -515,6 +515,8 @@ def foo(bar=baz, bax):
+ if ERROR_HAS_LAST_LINE:
+ if PYPY and sys.version_info >= (3,):
+ column = 7
++ elif sys.version_info >= (3, 9):
++ column = 21
+ elif sys.version_info >= (3, 8):
+ column = 9
+ else:
+@@ -543,6 +545,8 @@ foo(bar=baz, bax)
+ if ERROR_HAS_LAST_LINE:
+ if PYPY and sys.version_info >= (3,):
+ column = 12
++ elif sys.version_info >= (3, 9):
++ column = 17
+ elif sys.version_info >= (3, 8):
+ column = 14
+ else:
+@@ -577,6 +581,8 @@ foo(bar=baz, bax)
+ position_end = 1
+ if PYPY:
+ column = 6
++ elif ver >= (3, 9):
++ column = 13
+ else:
+ column = 7
+ # Column has been "fixed" since 3.2.4 and 3.3.1
diff --git a/gnu/packages/patches/python-random2-getrandbits-test.patch b/gnu/packages/patches/python-random2-getrandbits-test.patch
new file mode 100644
index 0000000000..4f6c56027a
--- /dev/null
+++ b/gnu/packages/patches/python-random2-getrandbits-test.patch
@@ -0,0 +1,23 @@
+From 1bac6355d9c65de847cc445d782c466778b94fbd Mon Sep 17 00:00:00 2001
+From: "Robert T. McGibbon" <rmcgibbo@gmail.com>
+Date: Sun, 9 May 2021 11:18:23 -0400
+Subject: [PATCH] Update tests for python3.9
+
+---
+ src/tests.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/tests.py b/src/tests.py
+index d918891..4f2c3de 100644
+--- a/src/tests.py
++++ b/src/tests.py
+@@ -448,7 +448,8 @@ def test_genrandbits(self):
+ self.assertRaises(TypeError, self.gen.getrandbits)
+ self.assertRaises(TypeError, self.gen.getrandbits, 'a')
+ self.assertRaises(TypeError, self.gen.getrandbits, 1, 2)
+- self.assertRaises(ValueError, self.gen.getrandbits, 0)
++ if sys.version_info < (3, 9):
++ self.assertRaises(ValueError, self.gen.getrandbits, 0)
+ self.assertRaises(ValueError, self.gen.getrandbits, -1)
+
+ def test_randbelow_logic(self, _log=log, int=int):
diff --git a/gnu/packages/patches/python-testtools.patch b/gnu/packages/patches/python-testtools.patch
deleted file mode 100644
index 42536e50f9..0000000000
--- a/gnu/packages/patches/python-testtools.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-https://github.com/testing-cabal/testtools/commit/29004731f9c480b7c44a9c2605513d50d372898f.patch
-Should be fixed in the next release
-
-From 29004731f9c480b7c44a9c2605513d50d372898f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
-Date: Thu, 17 May 2018 17:52:26 +0200
-Subject: [PATCH] Fix the tests on Python 3.7
-
-Exception's repr got changed not to include trailing comma
-
-Fixes https://github.com/testing-cabal/testtools/issues/270
----
- .travis.yml | 1 +
- testtools/tests/matchers/test_exception.py | 11 +++++++++--
- 2 files changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/.travis.yml b/.travis.yml
-index 7f1f4db7..784608e0 100644
---- a/.travis.yml
-+++ b/.travis.yml
-@@ -5,6 +5,7 @@ python:
- - "3.4"
- - "3.5"
- - "3.6"
-+ - "3.7-dev"
- - "pypy"
-
- install:
-diff --git a/testtools/tests/matchers/test_exception.py b/testtools/tests/matchers/test_exception.py
-index 6cd80af1..acd39252 100644
---- a/testtools/tests/matchers/test_exception.py
-+++ b/testtools/tests/matchers/test_exception.py
-@@ -32,15 +32,22 @@ class TestMatchesExceptionInstanceInterface(TestCase, TestMatchersInterface):
- matches_matches = [error_foo]
- matches_mismatches = [error_bar, error_base_foo]
-
-+ if sys.version_info >= (3, 7):
-+ # exception's repr has changed
-+ _e = ''
-+ else:
-+ _e = ','
-+
- str_examples = [
-- ("MatchesException(Exception('foo',))",
-+ ("MatchesException(Exception('foo'%s))" % _e,
- MatchesException(Exception('foo')))
- ]
- describe_examples = [
- ("%r is not a %r" % (Exception, ValueError),
- error_base_foo,
- MatchesException(ValueError("foo"))),
-- ("ValueError('bar',) has different arguments to ValueError('foo',).",
-+ ("ValueError('bar'%s) has different arguments to ValueError('foo'%s)."
-+ % (_e, _e),
- error_bar,
- MatchesException(ValueError("foo"))),
- ]
diff --git a/gnu/packages/patches/python-typing-inspect-fix.patch b/gnu/packages/patches/python-typing-inspect-fix.patch
new file mode 100644
index 0000000000..e6e28981b7
--- /dev/null
+++ b/gnu/packages/patches/python-typing-inspect-fix.patch
@@ -0,0 +1,38 @@
+From 16919e21936179e53df2f376c8b59b5fc44bd2dd Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Fri, 15 Jan 2021 09:22:52 -0500
+Subject: [PATCH] Fix for Python 3.9+.
+
+Fixes <https://github.com/ilevkivskyi/typing_inspect/issues/60>.
+
+Based on an idea in
+https://github.com/ilevkivskyi/typing_inspect/issues/60#issuecomment-683187584.
+---
+ typing_inspect.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/typing_inspect.py b/typing_inspect.py
+index 1ca68ed..31d05ee 100644
+--- a/typing_inspect.py
++++ b/typing_inspect.py
+@@ -21,7 +21,7 @@ LEGACY_TYPING = False
+
+ if NEW_TYPING:
+ from typing import (
+- Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, ForwardRef
++ Generic, Callable, Union, TypeVar, ClassVar, Tuple, _GenericAlias, _SpecialGenericAlias, ForwardRef
+ )
+ from typing_extensions import Literal
+ else:
+@@ -75,7 +75,7 @@ def is_generic_type(tp):
+ """
+ if NEW_TYPING:
+ return (isinstance(tp, type) and issubclass(tp, Generic) or
+- isinstance(tp, _GenericAlias) and
++ (isinstance(tp, _GenericAlias) or isinstance(tp, _SpecialGenericAlias)) and
+ tp.__origin__ not in (Union, tuple, ClassVar, collections.abc.Callable))
+ return (isinstance(tp, GenericMeta) and not
+ isinstance(tp, (CallableMeta, TupleMeta)))
+--
+2.29.2
+
diff --git a/gnu/packages/patches/python-werkzeug-tests.patch b/gnu/packages/patches/python-werkzeug-tests.patch
new file mode 100644
index 0000000000..4eca53f30c
--- /dev/null
+++ b/gnu/packages/patches/python-werkzeug-tests.patch
@@ -0,0 +1,58 @@
+Do not leave open files behind as this triggers 'ResourceWarning' and leads
+these tests to fail.
+
+--- Werkzeug-1.0.1/tests/test_datastructures.py 2020-03-31 19:48:06.000000000 +0200
++++ Werkzeug-1.0.1/tests/test_datastructures.py 2021-11-21 18:19:11.304369878 +0100
+@@ -1238,9 +1238,10 @@
+ def test_save_to_pathlib_dst(self, tmp_path):
+ src = tmp_path / "src.txt"
+ src.write_text(u"test")
+- storage = self.storage_class(src.open("rb"))
+- dst = tmp_path / "dst.txt"
+- storage.save(dst)
++ with src.open("rb") as input:
++ storage = self.storage_class(input)
++ dst = tmp_path / "dst.txt"
++ storage.save(dst)
+ assert dst.read_text() == "test"
+
+ def test_save_to_bytes_io(self):
+@@ -1251,11 +1252,12 @@
+
+ def test_save_to_file(self, tmp_path):
+ path = tmp_path / "file.data"
+- storage = self.storage_class(io.BytesIO(b"one\ntwo"))
+- with path.open("wb") as dst:
+- storage.save(dst)
+- with path.open("rb") as src:
+- assert src.read() == b"one\ntwo"
++ with io.BytesIO(b"one\ntwo") as input:
++ storage = self.storage_class(input)
++ with path.open("wb") as dst:
++ storage.save(dst)
++ with path.open("rb") as src:
++ assert src.read() == b"one\ntwo"
+
+
+ @pytest.mark.parametrize("ranges", ([(0, 1), (-5, None)], [(5, None)]))
+--- Werkzeug-1.0.1/tests/test_formparser.py 2020-03-31 19:48:06.000000000 +0200
++++ Werkzeug-1.0.1/tests/test_formparser.py 2021-11-21 22:11:43.654622751 +0100
+@@ -27,7 +27,7 @@
+ from werkzeug.test import create_environ
+ from werkzeug.wrappers import Request
+ from werkzeug.wrappers import Response
+-
++import warnings
+
+ @Request.application
+ def form_data_consumer(request):
+@@ -242,6 +244,9 @@
+
+ class TestMultiPart(object):
+ def test_basic(self):
++ # Ignore leaked file descriptor of unknown origin.
++ warnings.filterwarnings(action="ignore", message="unclosed", category=ResourceWarning)
++
+ resources = join(dirname(__file__), "multipart")
+ client = Client(form_data_consumer, Response)
+
diff --git a/gnu/packages/patches/qtwebkit-fix-building-with-bison-3.7.patch b/gnu/packages/patches/qtwebkit-fix-building-with-bison-3.7.patch
new file mode 100644
index 0000000000..ddaf8e2849
--- /dev/null
+++ b/gnu/packages/patches/qtwebkit-fix-building-with-bison-3.7.patch
@@ -0,0 +1,54 @@
+Fix build with Bison 3.7
+
+https://bugs.gentoo.org/736499
+
+Patch copied from upstream source repository:
+
+https://github.com/qtwebkit/qtwebkit/commit/d92b11fea65364fefa700249bd3340e0cd4c5b31
+
+From d92b11fea65364fefa700249bd3340e0cd4c5b31 Mon Sep 17 00:00:00 2001
+From: Dmitry Shachnev <mitya57@gmail.com>
+Date: Tue, 4 Aug 2020 21:04:06 +0300
+Subject: [PATCH] Let Bison generate the header directly, to fix build with
+ Bison 3.7
+
+Starting with Bison 3.7, the generated C++ file #include's the header
+by default, instead of duplicating it. So we should not delete it.
+
+Remove the code to add #ifdef guards to the header, since Bison adds
+them itself since version 2.6.3.
+---
+ Source/WebCore/css/makegrammar.pl | 21 +--------------------
+ 1 file changed, 1 insertion(+), 20 deletions(-)
+
+diff --git a/Source/WebCore/css/makegrammar.pl b/Source/WebCore/css/makegrammar.pl
+index 5d63b08102eb5..9435701c70612 100644
+--- a/Source/WebCore/css/makegrammar.pl
++++ b/Source/WebCore/css/makegrammar.pl
+@@ -73,25 +73,6 @@
+ }
+
+ my $fileBase = File::Spec->join($outputDir, $filename);
+-my @bisonCommand = ($bison, "-d", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp");
++my @bisonCommand = ($bison, "--defines=$fileBase.h", "-p", $symbolsPrefix, $grammarFilePath, "-o", "$fileBase.cpp");
+ push @bisonCommand, "--no-lines" if $^O eq "MSWin32"; # Work around bug in bison >= 3.0 on Windows where it puts backslashes into #line directives.
+ system(@bisonCommand) == 0 or die;
+-
+-open HEADER, ">$fileBase.h" or die;
+-print HEADER << "EOF";
+-#ifndef CSSGRAMMAR_H
+-#define CSSGRAMMAR_H
+-EOF
+-
+-open HPP, "<$fileBase.cpp.h" or open HPP, "<$fileBase.hpp" or die;
+-while (<HPP>) {
+- print HEADER;
+-}
+-close HPP;
+-
+-print HEADER "#endif\n";
+-close HEADER;
+-
+-unlink("$fileBase.cpp.h");
+-unlink("$fileBase.hpp");
+-
diff --git a/gnu/packages/patches/qtwebkit-fix-building-with-glib-2.68.patch b/gnu/packages/patches/qtwebkit-fix-building-with-glib-2.68.patch
new file mode 100644
index 0000000000..63840f4bbc
--- /dev/null
+++ b/gnu/packages/patches/qtwebkit-fix-building-with-glib-2.68.patch
@@ -0,0 +1,21 @@
+Fix building with glib 2.68:
+
+https://github.com/qtwebkit/qtwebkit/issues/1057
+
+Patch copied from upstream pull request:
+
+https://github.com/qtwebkit/qtwebkit/pull/1058/commits/5b698ba3faffd4e198a45be9fe74f53307395e4b
+
+diff -aurN qtwebkit-5.212.0-alpha4/Source/WTF/wtf/glib/GRefPtr.h qtwebkit-5.212.0-alpha4-mod/Source/WTF/wtf/glib/GRefPtr.h
+--- qtwebkit-5.212.0-alpha4/Source/WTF/wtf/glib/GRefPtr.h 2020-03-04 18:16:37.000000000 +0100
++++ qtwebkit-5.212.0-alpha4-mod/Source/WTF/wtf/glib/GRefPtr.h 2021-04-05 06:58:44.763328636 +0200
+@@ -29,9 +29,6 @@
+ #include <wtf/RefPtr.h>
+ #include <algorithm>
+
+-extern "C" void g_object_unref(gpointer);
+-extern "C" gpointer g_object_ref_sink(gpointer);
+-
+ namespace WTF {
+
+ enum GRefPtrAdoptType { GRefPtrAdopt };
diff --git a/gnu/packages/patches/qtwebkit-fix-building-with-icu-68.patch b/gnu/packages/patches/qtwebkit-fix-building-with-icu-68.patch
new file mode 100644
index 0000000000..acbfc4c4c8
--- /dev/null
+++ b/gnu/packages/patches/qtwebkit-fix-building-with-icu-68.patch
@@ -0,0 +1,152 @@
+Fix building with ICU > 68.
+
+https://bugs.gentoo.org/753260
+
+Patch adapted from Gentoo:
+
+https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=335f29d266c5b169ff1e781f9851a3a203f3198c
+
+From 335f29d266c5b169ff1e781f9851a3a203f3198c Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <asturm@gentoo.org>
+Date: Fri, 6 Nov 2020 09:22:15 +0100
+Subject: dev-qt/qtwebkit: Fix build with ICU-68
+
+Thanks-to: Lars Wendler <polynomial-c@gentoo.org>
+Closes: https://bugs.gentoo.org/753260
+Package-Manager: Portage-3.0.9, Repoman-3.0.2
+Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
+---
+ .../qtwebkit-5.212.0_pre20200309-icu-68.patch | 120 +++++++++++++++++++++
+ 1 file changed, 120 insertions(+)
+ create mode 100644 dev-qt/qtwebkit/files/qtwebkit-5.212.0_pre20200309-icu-68.patch
+
+(limited to 'dev-qt/qtwebkit/files/qtwebkit-5.212.0_pre20200309-icu-68.patch')
+
+diff --git a/Source/WebCore/platform/text/TextCodecICU.cpp b/Source/WebCore/platform/text/TextCodecICU.cpp
+index dd6ff06..e0f4bd7 100644
+--- a/Source/WebCore/platform/text/TextCodecICU.cpp
++++ b/Source/WebCore/platform/text/TextCodecICU.cpp
+@@ -308,7 +308,7 @@ void TextCodecICU::createICUConverter() const
+ m_converterICU = ucnv_open(m_canonicalConverterName, &err);
+ ASSERT(U_SUCCESS(err));
+ if (m_converterICU)
+- ucnv_setFallback(m_converterICU, TRUE);
++ ucnv_setFallback(m_converterICU, true);
+ }
+
+ int TextCodecICU::decodeToBuffer(UChar* target, UChar* targetLimit, const char*& source, const char* sourceLimit, int32_t* offsets, bool flush, UErrorCode& err)
+diff --git a/Source/WebCore/platform/text/icu/UTextProvider.h b/Source/WebCore/platform/text/icu/UTextProvider.h
+index c254fc4..6d1e1cb 100644
+--- a/Source/WebCore/platform/text/icu/UTextProvider.h
++++ b/Source/WebCore/platform/text/icu/UTextProvider.h
+@@ -80,12 +80,12 @@ inline bool uTextAccessInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int
+ // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
+ ASSERT(offset < std::numeric_limits<int32_t>::max());
+ text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
+- isAccessible = TRUE;
++ isAccessible = true;
+ return true;
+ }
+ if (nativeIndex >= nativeLength && text->chunkNativeLimit == nativeLength) {
+ text->chunkOffset = text->chunkLength;
+- isAccessible = FALSE;
++ isAccessible = false;
+ return true;
+ }
+ } else {
+@@ -94,12 +94,12 @@ inline bool uTextAccessInChunkOrOutOfRange(UText* text, int64_t nativeIndex, int
+ // Ensure chunk offset is well formed if computed offset exceeds int32_t range.
+ ASSERT(offset < std::numeric_limits<int32_t>::max());
+ text->chunkOffset = offset < std::numeric_limits<int32_t>::max() ? static_cast<int32_t>(offset) : 0;
+- isAccessible = TRUE;
++ isAccessible = true;
+ return true;
+ }
+ if (nativeIndex <= 0 && !text->chunkNativeStart) {
+ text->chunkOffset = 0;
+- isAccessible = FALSE;
++ isAccessible = false;
+ return true;
+ }
+ }
+diff --git a/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp b/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp
+index cd6852c..6a864b1 100644
+--- a/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp
++++ b/Source/WebCore/platform/text/icu/UTextProviderLatin1.cpp
+@@ -100,23 +100,23 @@ static UBool uTextLatin1Access(UText* uText, int64_t index, UBool forward)
+ if (index < uText->chunkNativeLimit && index >= uText->chunkNativeStart) {
+ // Already inside the buffer. Set the new offset.
+ uText->chunkOffset = static_cast<int32_t>(index - uText->chunkNativeStart);
+- return TRUE;
++ return true;
+ }
+ if (index >= length && uText->chunkNativeLimit == length) {
+ // Off the end of the buffer, but we can't get it.
+ uText->chunkOffset = static_cast<int32_t>(index - uText->chunkNativeStart);
+- return FALSE;
++ return false;
+ }
+ } else {
+ if (index <= uText->chunkNativeLimit && index > uText->chunkNativeStart) {
+ // Already inside the buffer. Set the new offset.
+ uText->chunkOffset = static_cast<int32_t>(index - uText->chunkNativeStart);
+- return TRUE;
++ return true;
+ }
+ if (!index && !uText->chunkNativeStart) {
+ // Already at the beginning; can't go any farther.
+ uText->chunkOffset = 0;
+- return FALSE;
++ return false;
+ }
+ }
+
+@@ -144,7 +144,7 @@ static UBool uTextLatin1Access(UText* uText, int64_t index, UBool forward)
+
+ uText->nativeIndexingLimit = uText->chunkLength;
+
+- return TRUE;
++ return true;
+ }
+
+ static int32_t uTextLatin1Extract(UText* uText, int64_t start, int64_t limit, UChar* dest, int32_t destCapacity, UErrorCode* status)
+@@ -336,7 +336,7 @@ static int64_t uTextLatin1ContextAwareNativeLength(UText* text)
+ static UBool uTextLatin1ContextAwareAccess(UText* text, int64_t nativeIndex, UBool forward)
+ {
+ if (!text->context)
+- return FALSE;
++ return false;
+ int64_t nativeLength = uTextLatin1ContextAwareNativeLength(text);
+ UBool isAccessible;
+ if (uTextAccessInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
+@@ -356,7 +356,7 @@ static UBool uTextLatin1ContextAwareAccess(UText* text, int64_t nativeIndex, UBo
+ ASSERT(newContext == UTextProviderContext::PriorContext);
+ textLatin1ContextAwareSwitchToPriorContext(text, nativeIndex, nativeLength, forward);
+ }
+- return TRUE;
++ return true;
+ }
+
+ static int32_t uTextLatin1ContextAwareExtract(UText*, int64_t, int64_t, UChar*, int32_t, UErrorCode* errorCode)
+diff --git a/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp b/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp
+index 7aaac48..9ae0d36 100644
+--- a/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp
++++ b/Source/WebCore/platform/text/icu/UTextProviderUTF16.cpp
+@@ -125,7 +125,7 @@ static inline int64_t uTextUTF16ContextAwareNativeLength(UText* text)
+ static UBool uTextUTF16ContextAwareAccess(UText* text, int64_t nativeIndex, UBool forward)
+ {
+ if (!text->context)
+- return FALSE;
++ return false;
+ int64_t nativeLength = uTextUTF16ContextAwareNativeLength(text);
+ UBool isAccessible;
+ if (uTextAccessInChunkOrOutOfRange(text, nativeIndex, nativeLength, forward, isAccessible))
+@@ -145,7 +145,7 @@ static UBool uTextUTF16ContextAwareAccess(UText* text, int64_t nativeIndex, UBoo
+ ASSERT(newContext == UTextProviderContext::PriorContext);
+ textUTF16ContextAwareSwitchToPriorContext(text, nativeIndex, nativeLength, forward);
+ }
+- return TRUE;
++ return true;
+ }
+
+ static int32_t uTextUTF16ContextAwareExtract(UText*, int64_t, int64_t, UChar*, int32_t, UErrorCode* errorCode)
diff --git a/gnu/packages/patches/qtwebkit-fix-building-with-python-3.9.patch b/gnu/packages/patches/qtwebkit-fix-building-with-python-3.9.patch
new file mode 100644
index 0000000000..9f9674de33
--- /dev/null
+++ b/gnu/packages/patches/qtwebkit-fix-building-with-python-3.9.patch
@@ -0,0 +1,35 @@
+Fix building with Python 3.9:
+
+https://github.com/qtwebkit/qtwebkit/issues/993
+
+Patch copied from upstream source repository:
+
+https://github.com/qtwebkit/qtwebkit/commit/78360c01c796b6260bf828bc9c8a0ef73c5132fd
+
+From 78360c01c796b6260bf828bc9c8a0ef73c5132fd Mon Sep 17 00:00:00 2001
+From: Konstantin Tokarev <annulen@yandex.ru>
+Date: Wed, 3 Jun 2020 15:01:42 +0300
+Subject: [PATCH] Fix compilation with Python 3.9: avoid passing encoding to
+ json.load()
+
+In Python 2.7 UTF-8 is assumed by default, while in Python 3 this argument
+is not supported.
+
+Change-Id: Ic459d60a6b20bc1838d8771bc36ac41614fe61a9
+---
+ Source/JavaScriptCore/generate-bytecode-files | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Source/JavaScriptCore/generate-bytecode-files b/Source/JavaScriptCore/generate-bytecode-files
+index c5dab429c7b0f..af3431275ecf9 100644
+--- a/Source/JavaScriptCore/generate-bytecode-files
++++ b/Source/JavaScriptCore/generate-bytecode-files
+@@ -163,7 +163,7 @@ if __name__ == "__main__":
+ initBytecodesFile = openOrExit(initASMFileName, "w")
+
+ try:
+- bytecodeSections = json.load(bytecodeFile, encoding = "utf-8")
++ bytecodeSections = json.load(bytecodeFile)
+ except:
+ print("Unexpected error parsing {0}: {1}".format(bytecodeJSONFile, sys.exc_info()))
+
diff --git a/gnu/packages/patches/range-v3-build-with-gcc10.patch b/gnu/packages/patches/range-v3-build-with-gcc10.patch
new file mode 100644
index 0000000000..a5d5b33523
--- /dev/null
+++ b/gnu/packages/patches/range-v3-build-with-gcc10.patch
@@ -0,0 +1,122 @@
+From 0487cca29e352e8f16bbd91fda38e76e39a0ed28 Mon Sep 17 00:00:00 2001
+From: Louis Dionne <ldionne.2@gmail.com>
+Date: Tue, 15 Jun 2021 14:40:01 -0400
+Subject: [PATCH] Work around broken integration with latest libc++. (#1635)
+
+* Work around broken integration with latest libc++.
+
+In newer versions of libc++, the base template of std::iterator_traits
+provides a member typedef called __primary_template which is an alias
+to the std::iterator_traits specialization itself. This fix works with
+both the old version of libc++ and the new one.
+
+Fixes issue #1633.
+
+* Fix is_std_iterator_traits_specialized_v on MSVC
+
+It used to pretend that std::iterator_traits<T*> is a user-defined
+specialization, which isn't the case. This is due to MSVC's
+iterator_traits<T*> specialization not posing as the base template.
+---
+ include/std/detail/associated_types.hpp | 22 +++++++++++-----
+ test/CMakeLists.txt | 1 +
+ test/bug1633.cpp | 34 +++++++++++++++++++++++++
+ 3 files changed, 51 insertions(+), 6 deletions(-)
+ create mode 100644 test/bug1633.cpp
+
+diff --git a/include/std/detail/associated_types.hpp b/include/std/detail/associated_types.hpp
+index b642166d4..449a3f91c 100644
+--- a/include/std/detail/associated_types.hpp
++++ b/include/std/detail/associated_types.hpp
+@@ -265,11 +265,22 @@ namespace ranges
+ template<typename I>
+ char is_std_iterator_traits_specialized_impl_(void *);
+ #elif defined(_LIBCPP_VERSION)
+- template<typename I, bool B>
+- char (
+- &is_std_iterator_traits_specialized_impl_(std::__iterator_traits<I, B> *))[2];
++ // In older versions of libc++, the base template inherits from std::__iterator_traits<typename, bool>.
++ template<template<typename, bool> class IteratorTraitsBase, typename I, bool B>
++ char (&libcpp_iterator_traits_base_impl(IteratorTraitsBase<I, B> *))[2];
++ template<template<typename, bool> class IteratorTraitsBase, typename I>
++ char libcpp_iterator_traits_base_impl(void *);
++
++ // In newer versions, the base template has only one template parameter and provides the
++ // __primary_template typedef which aliases the iterator_traits specialization.
++ template<template<typename> class, typename I>
++ char (&libcpp_iterator_traits_base_impl(typename std::iterator_traits<I>::__primary_template *))[2];
++ template<template<typename> class, typename I>
++ char libcpp_iterator_traits_base_impl(void *);
++
+ template<typename I>
+- char is_std_iterator_traits_specialized_impl_(void *);
++ auto is_std_iterator_traits_specialized_impl_(std::iterator_traits<I>* traits)
++ -> decltype(libcpp_iterator_traits_base_impl<std::__iterator_traits, I>(traits));
+ #elif defined(_MSVC_STL_VERSION)
+ template<typename I>
+ char (&is_std_iterator_traits_specialized_impl_(
+@@ -287,14 +298,13 @@ namespace ranges
+ RANGES_INLINE_VAR constexpr bool is_std_iterator_traits_specialized_v =
+ 1 == sizeof(is_std_iterator_traits_specialized_impl_<I>(
+ static_cast<std::iterator_traits<I> *>(nullptr)));
+-
++#endif
+ // The standard iterator_traits<T *> specialization(s) do not count
+ // as user-specialized. This will no longer be necessary in C++20.
+ // This helps with `T volatile*` and `void *`.
+ template<typename T>
+ RANGES_INLINE_VAR constexpr bool is_std_iterator_traits_specialized_v<T *> =
+ false;
+-#endif
+ } // namespace detail
+ /// \endcond
+ } // namespace ranges
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 889f314af..2c2b7c09c 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -19,3 +19,4 @@ rv3_add_test(test.bug474 bug474 bug474.cpp)
+ rv3_add_test(test.bug566 bug566 bug566.cpp)
+ rv3_add_test(test.bug1322 bug1322 bug1322.cpp)
+ rv3_add_test(test.bug1335 bug1335 bug1335.cpp)
++rv3_add_test(test.bug1633 bug1633 bug1633.cpp)
+diff --git a/test/bug1633.cpp b/test/bug1633.cpp
+new file mode 100644
+index 000000000..be52420ad
+--- /dev/null
++++ b/test/bug1633.cpp
+@@ -0,0 +1,34 @@
++// Range v3 library
++//
++// Use, modification and distribution is subject to the
++// Boost Software License, Version 1.0. (See accompanying
++// file LICENSE_1_0.txt or copy at
++// http://www.boost.org/LICENSE_1_0.txt)
++//
++// Project home: https://github.com/ericniebler/range-v3
++
++#include <cstddef>
++#include <iterator>
++#include <range/v3/iterator.hpp>
++
++struct X { };
++
++namespace std {
++ template<> struct iterator_traits<X> { };
++}
++
++struct Y {
++ using difference_type = std::ptrdiff_t;
++ using value_type = int;
++ using pointer = int*;
++ using reference = int&;
++ using iterator_category = std::forward_iterator_tag;
++};
++
++static_assert(ranges::detail::is_std_iterator_traits_specialized_v<X>, "");
++static_assert(!ranges::detail::is_std_iterator_traits_specialized_v<Y>, "");
++static_assert(!ranges::detail::is_std_iterator_traits_specialized_v<int*>, "");
++
++int main()
++{
++}
diff --git a/gnu/packages/patches/rust-1.19-mrustc.patch b/gnu/packages/patches/rust-1.19-mrustc.patch
deleted file mode 100644
index 261162172e..0000000000
--- a/gnu/packages/patches/rust-1.19-mrustc.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-See https://github.com/thepowersgang/mrustc/archive/v0.8.0.tar.gz
-
---- rustc-1.19.0-src-orig/src/libcore/intrinsics.rs
-+++ rustc-1.19.0-src/src/libcore/intrinsics.rs
-@@ -678,5 +678,9 @@
- pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
-
-+ /// Obtain the length of a slice pointer
-+ #[cfg(rust_compiler="mrustc")]
-+ pub fn mrustc_slice_len<T>(pointer: *const [T]) -> usize;
-+
- /// Gets a static string slice containing the name of a type.
- pub fn type_name<T: ?Sized>() -> &'static str;
-
---- rustc-1.19.0-src-orig/src/libcore/slice/mod.rs
-+++ rustc-1.19.0-src/src/libcore/slice/mod.rs
-@@ -413,6 +413,8 @@
- #[inline]
- fn len(&self) -> usize {
-- unsafe {
-- mem::transmute::<&[T], Repr<T>>(self).len
-- }
-+ #[cfg(not(rust_compiler="mrustc"))]
-+ let rv = unsafe { mem::transmute::<&[T], Repr<T>>(self).len };
-+ #[cfg(rust_compiler="mrustc")]
-+ let rv = unsafe { ::intrinsics::mrustc_slice_len(self) };
-+ rv
- }
diff --git a/gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch b/gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch
deleted file mode 100644
index a2bad55117..0000000000
--- a/gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-GDB responds with some overly detailed lines - which makes the tests fail.
-Patch rust to accept those instead.
-See <https://github.com/rust-lang/rust/issues/54178>.
-diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs
---- orig/rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs 2018-09-13 10:24:33.775565159 +0200
-+++ rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs 2018-09-13 10:25:56.322513658 +0200
-@@ -19,36 +19,36 @@
-
- // gdb-command:print eight_bytes1
- // gdbg-check:$1 = {{RUST$ENUM$DISR = Variant1, __0 = 100}, {RUST$ENUM$DISR = Variant1, __0 = 100}}
--// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum::Variant1(100)
-+// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100)
-
- // gdb-command:print four_bytes1
- // gdbg-check:$2 = {{RUST$ENUM$DISR = Variant1, __0 = 101}, {RUST$ENUM$DISR = Variant1, __0 = 101}}
--// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum::Variant1(101)
-+// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101)
-
- // gdb-command:print two_bytes1
- // gdbg-check:$3 = {{RUST$ENUM$DISR = Variant1, __0 = 102}, {RUST$ENUM$DISR = Variant1, __0 = 102}}
--// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum::Variant1(102)
-+// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102)
-
- // gdb-command:print one_byte1
- // gdbg-check:$4 = {{RUST$ENUM$DISR = Variant1, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant1, __0 = 65 'A'}}
--// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum::Variant1(65)
-+// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65)
-
-
- // gdb-command:print eight_bytes2
- // gdbg-check:$5 = {{RUST$ENUM$DISR = Variant2, __0 = 100}, {RUST$ENUM$DISR = Variant2, __0 = 100}}
--// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum::Variant2(100)
-+// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100)
-
- // gdb-command:print four_bytes2
- // gdbg-check:$6 = {{RUST$ENUM$DISR = Variant2, __0 = 101}, {RUST$ENUM$DISR = Variant2, __0 = 101}}
--// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum::Variant2(101)
-+// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101)
-
- // gdb-command:print two_bytes2
- // gdbg-check:$7 = {{RUST$ENUM$DISR = Variant2, __0 = 102}, {RUST$ENUM$DISR = Variant2, __0 = 102}}
--// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum::Variant2(102)
-+// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102)
-
- // gdb-command:print one_byte2
- // gdbg-check:$8 = {{RUST$ENUM$DISR = Variant2, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant2, __0 = 65 'A'}}
--// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum::Variant2(65)
-+// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65)
-
- // gdb-command:continue
-
-diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs
---- orig/rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs 2018-09-13 10:24:33.775565159 +0200
-+++ rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs 2018-09-13 10:27:43.353108111 +0200
-@@ -19,15 +19,15 @@
-
- // gdb-command:print case1
- // gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
--// gdbr-check:$1 = generic_struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
-+// gdbr-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
-
- // gdb-command:print case2
- // gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
--// gdbr-check:$2 = generic_struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
-+// gdbr-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153}
-
- // gdb-command:print case3
- // gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
--// gdbr-check:$3 = generic_struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
-+// gdbr-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897}
-
- // gdb-command:print univariant
- // gdbg-check:$4 = {{a = -1}}
-diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs
---- orig/rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs 2018-09-13 10:24:33.775565159 +0200
-+++ rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs 2018-09-13 10:28:26.328546298 +0200
-@@ -21,15 +21,15 @@
-
- // gdb-command:print case1
- // gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
--// gdbr-check:$1 = generic_tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
-+// gdbr-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868)
-
- // gdb-command:print case2
- // gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
--// gdbr-check:$2 = generic_tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
-+// gdbr-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153)
-
- // gdb-command:print case3
- // gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
--// gdbr-check:$3 = generic_tuple_style_enum::Regular::Case3(0, 6438275382588823897)
-+// gdbr-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897)
-
- // gdb-command:print univariant
- // gdbg-check:$4 = {{__0 = -1}}
---- orig/rustc-1.25.0-src/src/test/debuginfo/nil-enum.rs 2018-09-13 10:24:33.783565071 +0200
-+++ rustc-1.25.0-src/src/test/debuginfo/nil-enum.rs 2018-10-26 18:19:20.404564587 +0200
-@@ -17,11 +17,11 @@
-
- // gdb-command:print first
- // gdbg-check:$1 = {<No data fields>}
--// gdbr-check:$1 = <error reading variable>
-+// gdbr-check:$1 = nil_enum::ANilEnum
-
- // gdb-command:print second
- // gdbg-check:$2 = {<No data fields>}
--// gdbr-check:$2 = <error reading variable>
-+// gdbr-check:$2 = nil_enum::AnotherNilEnum
-
- #![allow(unused_variables)]
- #![feature(omit_gdb_pretty_printer_section)]
diff --git a/gnu/packages/patches/rust-1.30-gdb-llvm.patch b/gnu/packages/patches/rust-1.30-gdb-llvm.patch
deleted file mode 100644
index e8f0acc8b4..0000000000
--- a/gnu/packages/patches/rust-1.30-gdb-llvm.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-Tweak some gdb tests which were broken during LLVM upgrades.
-This has been subsequently fixed upstream in later rustc versions,
-but still needed to bootstrap some earlier versions of the compiler.
-
-diff -r -u rustc-1.30.1-src-orig/src/test/debuginfo/borrowed-c-style-enum.rs rustc-1.30.1-src/src/test/debuginfo/borrowed-c-style-enum.rs
---- rustc-1.30.1-src-orig/src/test/debuginfo/borrowed-c-style-enum.rs 2019-02-04 12:49:34.055483896 -0800
-+++ rustc-1.30.1-src/src/test/debuginfo/borrowed-c-style-enum.rs 2019-02-04 13:01:10.915950356 -0800
-@@ -18,15 +18,15 @@
-
- // gdb-command:print *the_a_ref
- // gdbg-check:$1 = TheA
--// gdbr-check:$1 = borrowed_c_style_enum::ABC::TheA
-+// gdbr-check:$1 = borrowed_c_style_enum::TheA
-
- // gdb-command:print *the_b_ref
- // gdbg-check:$2 = TheB
--// gdbr-check:$2 = borrowed_c_style_enum::ABC::TheB
-+// gdbr-check:$2 = borrowed_c_style_enum::TheB
-
- // gdb-command:print *the_c_ref
- // gdbg-check:$3 = TheC
--// gdbr-check:$3 = borrowed_c_style_enum::ABC::TheC
-+// gdbr-check:$3 = borrowed_c_style_enum::TheC
-
-
- // === LLDB TESTS ==================================================================================
-diff -r -u rustc-1.30.1-src-orig/src/test/debuginfo/c-style-enum-in-composite.rs rustc-1.30.1-src/src/test/debuginfo/c-style-enum-in-composite.rs
---- rustc-1.30.1-src-orig/src/test/debuginfo/c-style-enum-in-composite.rs 2019-02-04 12:49:34.051483727 -0800
-+++ rustc-1.30.1-src/src/test/debuginfo/c-style-enum-in-composite.rs 2019-02-04 13:02:00.981997525 -0800
-@@ -19,31 +19,31 @@
-
- // gdb-command:print tuple_interior_padding
- // gdbg-check:$1 = {__0 = 0, __1 = OneHundred}
--// gdbr-check:$1 = (0, c_style_enum_in_composite::AnEnum::OneHundred)
-+// gdbr-check:$1 = (0, c_style_enum_in_composite::OneHundred)
-
- // gdb-command:print tuple_padding_at_end
- // gdbg-check:$2 = {__0 = {__0 = 1, __1 = OneThousand}, __1 = 2}
--// gdbr-check:$2 = ((1, c_style_enum_in_composite::AnEnum::OneThousand), 2)
-+// gdbr-check:$2 = ((1, c_style_enum_in_composite::OneThousand), 2)
-
- // gdb-command:print tuple_different_enums
- // gdbg-check:$3 = {__0 = OneThousand, __1 = MountainView, __2 = OneMillion, __3 = Vienna}
--// gdbr-check:$3 = (c_style_enum_in_composite::AnEnum::OneThousand, c_style_enum_in_composite::AnotherEnum::MountainView, c_style_enum_in_composite::AnEnum::OneMillion, c_style_enum_in_composite::AnotherEnum::Vienna)
-+// gdbr-check:$3 = (c_style_enum_in_composite::OneThousand, c_style_enum_in_composite::MountainView, c_style_enum_in_composite::OneMillion, c_style_enum_in_composite::Vienna)
-
- // gdb-command:print padded_struct
- // gdbg-check:$4 = {a = 3, b = OneMillion, c = 4, d = Toronto, e = 5}
--// gdbr-check:$4 = c_style_enum_in_composite::PaddedStruct {a: 3, b: c_style_enum_in_composite::AnEnum::OneMillion, c: 4, d: c_style_enum_in_composite::AnotherEnum::Toronto, e: 5}
-+// gdbr-check:$4 = c_style_enum_in_composite::PaddedStruct {a: 3, b: c_style_enum_in_composite::OneMillion, c: 4, d: c_style_enum_in_composite::Toronto, e: 5}
-
- // gdb-command:print packed_struct
- // gdbg-check:$5 = {a = 6, b = OneHundred, c = 7, d = Vienna, e = 8}
--// gdbr-check:$5 = c_style_enum_in_composite::PackedStruct {a: 6, b: c_style_enum_in_composite::AnEnum::OneHundred, c: 7, d: c_style_enum_in_composite::AnotherEnum::Vienna, e: 8}
-+// gdbr-check:$5 = c_style_enum_in_composite::PackedStruct {a: 6, b: c_style_enum_in_composite::OneHundred, c: 7, d: c_style_enum_in_composite::Vienna, e: 8}
-
- // gdb-command:print non_padded_struct
- // gdbg-check:$6 = {a = OneMillion, b = MountainView, c = OneThousand, d = Toronto}
--// gdbr-check:$6 = c_style_enum_in_composite::NonPaddedStruct {a: c_style_enum_in_composite::AnEnum::OneMillion, b: c_style_enum_in_composite::AnotherEnum::MountainView, c: c_style_enum_in_composite::AnEnum::OneThousand, d: c_style_enum_in_composite::AnotherEnum::Toronto}
-+// gdbr-check:$6 = c_style_enum_in_composite::NonPaddedStruct {a: c_style_enum_in_composite::OneMillion, b: c_style_enum_in_composite::MountainView, c: c_style_enum_in_composite::OneThousand, d: c_style_enum_in_composite::Toronto}
-
- // gdb-command:print struct_with_drop
- // gdbg-check:$7 = {__0 = {a = OneHundred, b = Vienna}, __1 = 9}
--// gdbr-check:$7 = (c_style_enum_in_composite::StructWithDrop {a: c_style_enum_in_composite::AnEnum::OneHundred, b: c_style_enum_in_composite::AnotherEnum::Vienna}, 9)
-+// gdbr-check:$7 = (c_style_enum_in_composite::StructWithDrop {a: c_style_enum_in_composite::OneHundred, b: c_style_enum_in_composite::Vienna}, 9)
-
- // === LLDB TESTS ==================================================================================
-
-diff -r -u rustc-1.30.1-src-orig/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs rustc-1.30.1-src/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs
---- rustc-1.30.1-src-orig/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs 2019-02-04 12:49:34.043483393 -0800
-+++ rustc-1.30.1-src/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs 2019-02-04 13:02:17.954691634 -0800
-@@ -27,15 +27,15 @@
-
- // gdb-command: print c_style_enum1
- // gdbg-check:$3 = CStyleEnumVar1
--// gdbr-check:$3 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnum::CStyleEnumVar1
-+// gdbr-check:$3 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnumVar1
-
- // gdb-command: print c_style_enum2
- // gdbg-check:$4 = CStyleEnumVar2
--// gdbr-check:$4 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnum::CStyleEnumVar2
-+// gdbr-check:$4 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnumVar2
-
- // gdb-command: print c_style_enum3
- // gdbg-check:$5 = CStyleEnumVar3
--// gdbr-check:$5 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnum::CStyleEnumVar3
-+// gdbr-check:$5 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnumVar3
-
- #![allow(dead_code, unused_variables)]
diff --git a/gnu/packages/patches/rust-1.45-linker-locale.patch b/gnu/packages/patches/rust-1.45-linker-locale.patch
deleted file mode 100644
index 40220e8e77..0000000000
--- a/gnu/packages/patches/rust-1.45-linker-locale.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Patch will be included upstream in 1.47: https://github.com/rust-lang/rust/pull/74416
-diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs
-index e64aafa599f..12575ac4358 100644
---- a/src/librustc_codegen_ssa/back/linker.rs
-+++ b/src/librustc_codegen_ssa/back/linker.rs
-@@ -28,7 +28,7 @@ use rustc_target::spec::{LinkOutputKind, LinkerFlavor, LldFlavor};
- pub fn disable_localization(linker: &mut Command) {
- // No harm in setting both env vars simultaneously.
- // Unix-style linkers.
-- linker.env("LC_ALL", "C");
-+ linker.env("LC_ALL", "en_US.UTF-8");
- // MSVC's `link.exe`.
- linker.env("VSLANG", "1033");
- }
diff --git a/gnu/packages/patches/rust-1.48-linker-locale.patch b/gnu/packages/patches/rust-1.48-linker-locale.patch
deleted file mode 100644
index d06dcbe682..0000000000
--- a/gnu/packages/patches/rust-1.48-linker-locale.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-https://github.com/rust-lang/rust/pull/74416
-diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
-index 3df956c465e..f45fee45be4 100644
---- a/compiler/rustc_codegen_ssa/src/back/linker.rs
-+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
-@@ -28,7 +28,7 @@
- pub fn disable_localization(linker: &mut Command) {
- // No harm in setting both env vars simultaneously.
- // Unix-style linkers.
-- linker.env("LC_ALL", "C");
-+ linker.env("LC_ALL", "en_US.UTF-8");
- // MSVC's `link.exe`.
- linker.env("VSLANG", "1033");
- }
diff --git a/gnu/packages/patches/rust-bootstrap-stage0-test.patch b/gnu/packages/patches/rust-bootstrap-stage0-test.patch
deleted file mode 100644
index e8484903e5..0000000000
--- a/gnu/packages/patches/rust-bootstrap-stage0-test.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-Bootstrap tests failed with local stage0 cargo and rustc
-Backported changes from https://github.com/rust-lang/rust/pull/51977
-
-From 0834d9d771e912f51deca6c25699e44734624546 Mon Sep 17 00:00:00 2001
-From: Nikolai Merinov <nikolai.merinov@member.fsf.org>
-Date: Mon, 2 Jul 2018 01:45:35 +0500
-Subject: [PATCH] bootstrap: tests should use rustc from config.toml
-
-Tests should always use "rustc" and "cargo" from config.toml instead
-of assuming that stage0 binaries was downloaded to build directory.
----
- src/bootstrap/bootstrap.py | 2 ++
- src/bootstrap/config.rs | 6 ++----
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
-index 487440becf..1701f7b83a 100644
---- a/src/bootstrap/bootstrap.py
-+++ b/src/bootstrap/bootstrap.py
-@@ -788,6 +788,8 @@ def bootstrap(help_triggered):
- env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
- env["BOOTSTRAP_PYTHON"] = sys.executable
- env["BUILD_DIR"] = build.build_dir
-+ env["CARGO"] = build.cargo()
-+ env["RUSTC"] = build.rustc()
- run(args, env=env, verbose=build.verbose)
-
-
-diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
-index 6dd6291be2..d1a0deb583 100644
---- a/src/bootstrap/config.rs
-+++ b/src/bootstrap/config.rs
-@@ -23,7 +23,6 @@ use std::cmp;
-
- use num_cpus;
- use toml;
--use util::exe;
- use cache::{INTERNER, Interned};
- use flags::Flags;
- pub use flags::Subcommand;
-@@ -362,9 +361,8 @@ impl Config {
- config.src = Config::path_from_python("SRC");
- config.out = Config::path_from_python("BUILD_DIR");
-
-- let stage0_root = config.out.join(&config.build).join("stage0/bin");
-- config.initial_rustc = stage0_root.join(exe("rustc", &config.build));
-- config.initial_cargo = stage0_root.join(exe("cargo", &config.build));
-+ config.initial_rustc = Config::path_from_python("RUSTC");
-+ config.initial_cargo = Config::path_from_python("CARGO");
-
- config
- }
---
-2.17.1
-
diff --git a/gnu/packages/patches/rust-reproducible-builds.patch b/gnu/packages/patches/rust-reproducible-builds.patch
deleted file mode 100644
index ef7bf53b5d..0000000000
--- a/gnu/packages/patches/rust-reproducible-builds.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From b9ca108fcae2b738ca3f0c88c84ae5dc5a6f843f Mon Sep 17 00:00:00 2001
-From: Tim Ryan <id@timryan.org>
-Date: Mon, 14 May 2018 06:22:21 -0400
-Subject: [PATCH] Support reproducible builds by forcing window.search to use
- stable key ordering. (#692)
-See <https://github.com/rust-lang-nursery/mdBook/pull/692>
----
- src/vendor/mdbook/src/renderer/html_handlebars/search.rs | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/src/vendor/mdbook/src/renderer/html_handlebars/search.rs b/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
-index d49772f8b..1ee66a511 100644
---- a/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
-+++ b/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
-@@ -205,6 +205,10 @@ fn write_to_js(index: Index, search_config: &Search) -> Result<String> {
- searchoptions,
- index,
- };
-+
-+ // By converting to serde_json::Value as an intermediary, we use a
-+ // BTreeMap internally and can force a stable ordering of map keys.
-+ let json_contents = serde_json::to_value(&json_contents)?;
- let json_contents = serde_json::to_string(&json_contents)?;
-
- Ok(format!("window.search = {};", json_contents))
diff --git a/gnu/packages/patches/rustc-1.39.0-src.patch b/gnu/packages/patches/rustc-1.39.0-src.patch
new file mode 100644
index 0000000000..7859bd44d5
--- /dev/null
+++ b/gnu/packages/patches/rustc-1.39.0-src.patch
@@ -0,0 +1,99 @@
+# This modified patch is to disable the hunk applying to LLVM, unbundled in Guix.
+
+# Add mrustc slice length intrinsics
+--- src/libcore/intrinsics.rs
++++ src/libcore/intrinsics.rs
+@@ -685,4 +685,8 @@
+ pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
+
++ /// Obtain the length of a slice pointer
++ #[cfg(rust_compiler="mrustc")]
++ pub fn mrustc_slice_len<T>(pointer: *const [T]) -> usize;
++
+ /// Gets a static string slice containing the name of a type.
+ pub fn type_name<T: ?Sized>() -> &'static str;
+
+--- src/libcore/slice/mod.rs
++++ src/libcore/slice/mod.rs
+@@ -68,5 +68,8 @@
+ pub const fn len(&self) -> usize {
+- unsafe {
+- crate::ptr::Repr { rust: self }.raw.len
+- }
++ #[cfg(not(rust_compiler="mrustc"))]
++ #[cfg_attr(not(bootstrap), allow_internal_unstable(const_fn_union))]
++ const fn len_inner<T>(s: &[T]) -> usize { unsafe { crate::ptr::Repr { rust: s }.raw.len } };
++ #[cfg(rust_compiler="mrustc")]
++ const fn len_inner<T>(s: &[T]) -> usize { unsafe { crate::intrinsics::mrustc_slice_len(s) } }
++ len_inner(self)
+ }
+#
+# Static-link rustc_codegen_llvm so the generated rustc is standalone
+# > Note: Interacts with `rustc-1.39.0-overrides.toml`
+#
+--- src/librustc_interface/util.rs
++++ src/librustc_interface/util.rs
+@@ -421,2 +421,4 @@
+ pub fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<dyn CodegenBackend> {
++ #[cfg(rust_compiler="mrustc")]
++ { if(backend_name == "llvm") { extern "Rust" { fn __rustc_codegen_backend() -> Box<dyn CodegenBackend>; } return || unsafe { __rustc_codegen_backend() } } }
+ // For now we only allow this function to be called once as it'll dlopen a
+# Disable most architecture intrinsics
+--- src/stdarch/crates/std_detect/src/detect/mod.rs
++++ src/stdarch/crates/std_detect/src/detect/mod.rs
+@@ -74,4 +74,7 @@
+ // this run-time detection logic is never called.
+ #[path = "os/other.rs"]
+ mod os;
++ } else if #[cfg(rust_compiler="mrustc")] {
++ #[path = "os/other.rs"]
++ mod os;
+ } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
+--- vendor/ppv-lite86/src/lib.rs
++++ vendor/ppv-lite86/src/lib.rs
+@@ -12,10 +12,10 @@
+-#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
++#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler="mrustc")))]
+ pub mod x86_64;
+-#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
++#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler="mrustc")))]
+ use self::x86_64 as arch;
+
+-#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
++#[cfg(any(miri, rust_compiler="mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
+ pub mod generic;
+-#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
++#[cfg(any(miri, rust_compiler="mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
+ use self::generic as arch;
+
+# diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
+# index da9d9d5bfdc0..3d47471f0ef0 100644
+# --- src/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
+# +++ src/llvm-project/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
+# @@ -16,6 +16,8 @@
+# #include "llvm/Demangle/DemangleConfig.h"
+# #include "llvm/Demangle/StringView.h"
+# #include <array>
+# +#include <cstdint>
+# +#include <string>
+
+# namespace llvm {
+# namespace itanium_demangle {
+##
+## gcc (used by mrustc) has 16-byte uint128_t alignment, while rustc uses 8
+##
+#--- src/libsyntax/ast.rs
+#+++ src/libsyntax/ast.rs
+#@@ -986,2 +986,2 @@
+#-#[cfg(target_arch = "x86_64")]
+#-static_assert_size!(Expr, 96);
+#+//#[cfg(target_arch = "x86_64")]
+#+//static_assert_size!(Expr, 96);
+#--- src/librustc/ty/sty.rs
+#+++ src/librustc/ty/sty.rs
+#@@ -2258,2 +2258,2 @@
+#-#[cfg(target_arch = "x86_64")]
+#-static_assert_size!(Const<'_>, 40);
+#+//#[cfg(target_arch = "x86_64")]
+#+//static_assert_size!(Const<'_>, 40);
+
diff --git a/gnu/packages/patches/scalapack-blacs-mpi-deprecations.patch b/gnu/packages/patches/scalapack-blacs-mpi-deprecations.patch
deleted file mode 100644
index 6ec1b8f21f..0000000000
--- a/gnu/packages/patches/scalapack-blacs-mpi-deprecations.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-From f11c3f094ed5ca727ec819983425b6641db8227c Mon Sep 17 00:00:00 2001
-From: Eric Bavier <bavier@member.fsf.org>
-Date: Wed, 13 Feb 2019 09:32:11 -0600
-Subject: [PATCH] BLACS: Remove use of long-deprecated MPI1 functions.
-
-* BLACS/SRC/blacs_get_.c: 'MPI_Attr_get' -> 'MPI_Comm_get_attr'.
-* BLACS/SRC/cgamn2d_.c, BLACS/SRC/cgamx2d_.c, BLACS/SRC/dgamn2d_.c,
-BLACS/SRC/dgamx2d_.c, BLACS/SRC/igamn2d_.c, BLACS/SRC/igamx2d_.c,
-BLACS/SRC/sgamn2d_.c, BLACS/SRC/sgamx2d_.c, BLACS/SRC/zgamn2d_.c,
-BLACS/SRC/zgamx2d_.c: 'MPI_Type_struct' -> 'MPI_Type_create_struct'.
----
- BLACS/SRC/blacs_get_.c | 2 +-
- BLACS/SRC/cgamn2d_.c | 2 +-
- BLACS/SRC/cgamx2d_.c | 2 +-
- BLACS/SRC/dgamn2d_.c | 2 +-
- BLACS/SRC/dgamx2d_.c | 2 +-
- BLACS/SRC/igamn2d_.c | 2 +-
- BLACS/SRC/igamx2d_.c | 2 +-
- BLACS/SRC/sgamn2d_.c | 2 +-
- BLACS/SRC/sgamx2d_.c | 2 +-
- BLACS/SRC/zgamn2d_.c | 2 +-
- BLACS/SRC/zgamx2d_.c | 2 +-
- 11 files changed, 11 insertions(+), 11 deletions(-)
-
-diff --git a/BLACS/SRC/blacs_get_.c b/BLACS/SRC/blacs_get_.c
-index e979767..d4b04cf 100644
---- a/BLACS/SRC/blacs_get_.c
-+++ b/BLACS/SRC/blacs_get_.c
-@@ -23,7 +23,7 @@ F_VOID_FUNC blacs_get_(int *ConTxt, int *what, int *val)
- case SGET_MSGIDS:
- if (BI_COMM_WORLD == NULL) Cblacs_pinfo(val, &val[1]);
- iptr = &val[1];
-- ierr=MPI_Attr_get(MPI_COMM_WORLD, MPI_TAG_UB, (BVOID **) &iptr,val);
-+ ierr=MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_TAG_UB, (BVOID **) &iptr,val);
- val[0] = 0;
- val[1] = *iptr;
- break;
-diff --git a/BLACS/SRC/cgamn2d_.c b/BLACS/SRC/cgamn2d_.c
-index 2db6ccb..6958f32 100644
---- a/BLACS/SRC/cgamn2d_.c
-+++ b/BLACS/SRC/cgamn2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC cgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/cgamx2d_.c b/BLACS/SRC/cgamx2d_.c
-index 707c0b6..f802d01 100644
---- a/BLACS/SRC/cgamx2d_.c
-+++ b/BLACS/SRC/cgamx2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC cgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/dgamn2d_.c b/BLACS/SRC/dgamn2d_.c
-index dff23b4..a2627ac 100644
---- a/BLACS/SRC/dgamn2d_.c
-+++ b/BLACS/SRC/dgamn2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC dgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/dgamx2d_.c b/BLACS/SRC/dgamx2d_.c
-index a51f731..2a644d0 100644
---- a/BLACS/SRC/dgamx2d_.c
-+++ b/BLACS/SRC/dgamx2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC dgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/igamn2d_.c b/BLACS/SRC/igamn2d_.c
-index 16bc003..f6a7859 100644
---- a/BLACS/SRC/igamn2d_.c
-+++ b/BLACS/SRC/igamn2d_.c
-@@ -218,7 +218,7 @@ F_VOID_FUNC igamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/igamx2d_.c b/BLACS/SRC/igamx2d_.c
-index 8165cbe..a7cfcc6 100644
---- a/BLACS/SRC/igamx2d_.c
-+++ b/BLACS/SRC/igamx2d_.c
-@@ -218,7 +218,7 @@ F_VOID_FUNC igamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/sgamn2d_.c b/BLACS/SRC/sgamn2d_.c
-index d6c95e5..569c797 100644
---- a/BLACS/SRC/sgamn2d_.c
-+++ b/BLACS/SRC/sgamn2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC sgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/sgamx2d_.c b/BLACS/SRC/sgamx2d_.c
-index 4b0af6f..8897ece 100644
---- a/BLACS/SRC/sgamx2d_.c
-+++ b/BLACS/SRC/sgamx2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC sgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/zgamn2d_.c b/BLACS/SRC/zgamn2d_.c
-index 9de2b23..37897df 100644
---- a/BLACS/SRC/zgamn2d_.c
-+++ b/BLACS/SRC/zgamn2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC zgamn2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
-diff --git a/BLACS/SRC/zgamx2d_.c b/BLACS/SRC/zgamx2d_.c
-index 414c381..0e9d474 100644
---- a/BLACS/SRC/zgamx2d_.c
-+++ b/BLACS/SRC/zgamx2d_.c
-@@ -221,7 +221,7 @@ F_VOID_FUNC zgamx2d_(int *ConTxt, F_CHAR scope, F_CHAR top, int *m, int *n,
- {
- #endif
- i = 2;
-- ierr=MPI_Type_struct(i, len, disp, dtypes, &MyType);
-+ ierr=MPI_Type_create_struct(i, len, disp, dtypes, &MyType);
- ierr=MPI_Type_commit(&MyType);
- bp->N = bp2->N = 1;
- bp->dtype = bp2->dtype = MyType;
---
-2.20.1
-
diff --git a/gnu/packages/patches/scalapack-gcc-10-compilation.patch b/gnu/packages/patches/scalapack-gcc-10-compilation.patch
new file mode 100644
index 0000000000..cd6fb61cdf
--- /dev/null
+++ b/gnu/packages/patches/scalapack-gcc-10-compilation.patch
@@ -0,0 +1,5684 @@
+Fix Scalapack compilation with GCC 10+.
+
+Patches from <https://github.com/Reference-ScaLAPACK/scalapack/pull/26>.
+
+From 9c909f06cf51a3d00252323ce52aba46cc64ab41 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tiziano=20M=C3=BCller?= <tiziano.mueller@chem.uzh.ch>
+Date: Thu, 25 Jun 2020 18:36:46 +0200
+Subject: [PATCH] fix argument mismatches in the SRC
+
+---
+ SRC/pclarf.f | 80 +++++++++++++++++-----------------
+ SRC/pclarfc.f | 88 ++++++++++++++++++-------------------
+ SRC/pclarz.f | 111 ++++++++++++++++++++++++-----------------------
+ SRC/pclarzc.f | 115 +++++++++++++++++++++++++------------------------
+ SRC/pclattrs.f | 55 +++++++++++------------
+ SRC/pclawil.f | 53 +++++++++++------------
+ SRC/pctrevc.f | 20 +++++----
+ SRC/pdhseqr.f | 36 ++++++++--------
+ SRC/pdlacon.f | 36 ++++++++--------
+ SRC/pdlarf.f | 80 +++++++++++++++++-----------------
+ SRC/pdlarz.f | 100 +++++++++++++++++++++---------------------
+ SRC/pdlawil.f | 48 ++++++++++-----------
+ SRC/pdstebz.f | 20 ++++-----
+ SRC/pdtrord.f | 43 +++++++++++-------
+ SRC/pdtrsen.f | 24 ++++++-----
+ SRC/pshseqr.f | 36 ++++++++--------
+ SRC/pslacon.f | 36 +++++++++-------
+ SRC/pslarf.f | 80 +++++++++++++++++-----------------
+ SRC/pslarz.f | 100 +++++++++++++++++++++---------------------
+ SRC/pslawil.f | 50 +++++++++++----------
+ SRC/psstebz.f | 20 ++++-----
+ SRC/pstrord.f | 45 +++++++++++--------
+ SRC/pstrsen.f | 22 ++++++----
+ SRC/pzlarf.f | 80 +++++++++++++++++-----------------
+ SRC/pzlarfc.f | 88 ++++++++++++++++++-------------------
+ SRC/pzlarz.f | 103 +++++++++++++++++++++----------------------
+ SRC/pzlarzc.f | 111 ++++++++++++++++++++++++-----------------------
+ SRC/pzlattrs.f | 55 +++++++++++------------
+ SRC/pzlawil.f | 49 +++++++++++----------
+ SRC/pztrevc.f | 20 +++++----
+ 30 files changed, 927 insertions(+), 877 deletions(-)
+
+diff --git a/SRC/pclarf.f b/SRC/pclarf.f
+index f941e46..371f710 100644
+--- a/SRC/pclarf.f
++++ b/SRC/pclarf.f
+@@ -242,7 +242,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ $ IOFFV, IPW, IROFF, IVCOL, IVROW, JJC, JJV, LDC,
+ $ LDV, MYCOL, MYROW, MP, NCC, NCV, NPCOL, NPROW,
+ $ NQ, RDEST
+- COMPLEX TAULOC
++ COMPLEX TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, CCOPY, CGEBR2D, CGEBS2D,
+@@ -336,7 +336,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -345,7 +345,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -363,8 +363,8 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -379,9 +379,9 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYCOL.EQ.ICCOL ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -398,7 +398,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, V( IOFFV ), 1,
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), V( IOFFV ), 1,
+ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -421,9 +421,9 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = MP+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -441,7 +441,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK, 1,
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -471,7 +471,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -480,7 +480,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -500,8 +500,8 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL CGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -516,18 +516,18 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( JJV )
+ CALL CGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MP+1
+ CALL CGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -547,8 +547,8 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL CGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -577,9 +577,9 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYROW.EQ.ICROW ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -597,7 +597,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFV.GT.0 .AND. IOFFC.GT.0 )
+- $ CALL CGERC( MP, NQ, -TAULOC, WORK, 1,
++ $ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC ),
+ $ LDC )
+ END IF
+@@ -621,9 +621,9 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = NQ+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -641,8 +641,8 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -667,7 +667,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -676,7 +676,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -694,8 +694,8 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -720,18 +720,18 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( IIV )
+ CALL CGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQ+1
+ CALL CGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -750,8 +750,8 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ $ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -770,7 +770,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -779,7 +779,7 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -797,8 +797,8 @@ SUBROUTINE PCLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pclarfc.f b/SRC/pclarfc.f
+index d6a2d3b..f84c493 100644
+--- a/SRC/pclarfc.f
++++ b/SRC/pclarfc.f
+@@ -242,7 +242,7 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ $ IOFFV, IPW, IROFF, IVCOL, IVROW, JJC, JJV, LDC,
+ $ LDV, MYCOL, MYROW, MP, NCC, NCV, NPCOL, NPROW,
+ $ NQ, RDEST
+- COMPLEX TAULOC
++ COMPLEX TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, CCOPY, CGEBR2D, CGEBS2D,
+@@ -336,17 +336,17 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL CGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAULOC, 1, IVROW, MYCOL )
+- TAULOC = CONJG( TAULOC )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -364,8 +364,8 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -380,9 +380,9 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYCOL.EQ.ICCOL ) THEN
+ *
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -399,7 +399,7 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, V( IOFFV ), 1,
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), V( IOFFV ), 1,
+ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -422,9 +422,9 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = MP+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -442,7 +442,7 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK, 1,
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -472,17 +472,17 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL CGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, TAULOC,
+ $ 1, IVROW, MYCOL )
+- TAULOC = CONJG( TAULOC )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -500,8 +500,8 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ), 1,
+- $ C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -516,18 +516,18 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( JJV )
+ CALL CGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ IPW = MP+1
+ CALL CGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -545,8 +545,8 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ), 1,
+- $ C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -575,9 +575,9 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYROW.EQ.ICROW ) THEN
+ *
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -594,7 +594,7 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK, 1,
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -617,9 +617,9 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = NQ+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -637,8 +637,8 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -663,17 +663,17 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ CALL CGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC,
+ $ 1, MYROW, IVCOL )
+- TAULOC = CONJG( TAULOC )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -691,8 +691,8 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -716,18 +716,18 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( IIV )
+ CALL CGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ IPW = NQ+1
+ CALL CGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -745,8 +745,8 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -765,17 +765,17 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ CALL CGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC, 1,
+ $ MYROW, IVCOL )
+- TAULOC = CONJG( TAULOC )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -793,8 +793,8 @@ SUBROUTINE PCLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL CGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pclarz.f b/SRC/pclarz.f
+index 9ba730c..673860a 100644
+--- a/SRC/pclarz.f
++++ b/SRC/pclarz.f
+@@ -251,7 +251,7 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ IVCOL, IVROW, JJC1, JJC2, JJV, LDC, LDV, MPC2,
+ $ MPV, MYCOL, MYROW, NCC, NCV, NPCOL, NPROW,
+ $ NQC2, NQV, RDEST
+- COMPLEX TAULOC
++ COMPLEX TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, CAXPY, CCOPY, CGEBR2D,
+@@ -370,7 +370,7 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -379,7 +379,7 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -402,9 +402,9 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -420,9 +420,9 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYCOL.EQ.ICCOL2 ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -445,11 +445,11 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK,
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK,
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, V( IOFFV ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), V( IOFFV ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -471,9 +471,9 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = MPV+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -496,10 +496,10 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -530,16 +530,16 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+- CALL CGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, TAULOC,
+- $ 1, IVROW, MYCOL )
++ CALL CGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1,
++ $ TAULOC( 1 ), 1, IVROW, MYCOL )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -562,10 +562,10 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -580,18 +580,18 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( JJV )
+ CALL CGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MPV+1
+ CALL CGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -614,10 +614,10 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -646,9 +646,9 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYROW.EQ.ICROW2 ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -669,13 +669,13 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ ICCOL2 )
+ *
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK, 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK, 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( MPC2.GT.0 .AND. NQV.GT.0 )
+- $ CALL CGERC( MPC2, NQV, -TAULOC, WORK, 1,
++ $ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC2 ),
+ $ LDC )
+ END IF
+@@ -699,9 +699,9 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = NQV+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -720,13 +720,14 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ),
+ $ RDEST, ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
+- $ C( IOFFC1 ), 1 )
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ),
++ $ WORK( IPW ), 1, WORK, 1,
++ $ C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -751,16 +752,16 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+- CALL CGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC,
+- $ 1, MYROW, IVCOL )
++ CALL CGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1,
++ $ TAULOC( 1 ), 1, MYROW, IVCOL )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -779,13 +780,13 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -809,18 +810,18 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( IIV )
+ CALL CGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQV+1
+ CALL CGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -840,13 +841,13 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -865,7 +866,7 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -874,7 +875,7 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -893,13 +894,13 @@ SUBROUTINE PCLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pclarzc.f b/SRC/pclarzc.f
+index f1bc21e..b6d3b6d 100644
+--- a/SRC/pclarzc.f
++++ b/SRC/pclarzc.f
+@@ -251,7 +251,7 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ IVCOL, IVROW, JJC1, JJC2, JJV, LDC, LDV, MPC2,
+ $ MPV, MYCOL, MYROW, NCC, NCV, NPCOL, NPROW,
+ $ NQC2, NQV, RDEST
+- COMPLEX TAULOC
++ COMPLEX TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, CAXPY, CCOPY, CGEBR2D,
+@@ -370,17 +370,17 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL CGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAULOC, 1, IVROW, MYCOL )
+- TAULOC = CONJG( TAULOC )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -403,9 +403,9 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -421,9 +421,9 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYCOL.EQ.ICCOL2 ) THEN
+ *
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -446,11 +446,11 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK,
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK,
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, V( IOFFV ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), V( IOFFV ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -472,9 +472,9 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = MPV+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -497,10 +497,10 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -531,17 +531,17 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL CGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, TAULOC,
+ $ 1, IVROW, MYCOL )
+- TAULOC = CONJG( TAULOC )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -564,10 +564,10 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -582,18 +582,18 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( JJV )
+ CALL CGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ IPW = MPV+1
+ CALL CGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -616,10 +616,10 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL CAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL CAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL CGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -648,9 +648,9 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYROW.EQ.ICROW2 ) THEN
+ *
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -671,12 +671,12 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ ICCOL2 )
+ *
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK, 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK, 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK, 1,
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -699,9 +699,9 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = NQV+1
+ CALL CGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -720,13 +720,14 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ),
+ $ RDEST, ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
+- $ C( IOFFC1 ), 1 )
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ),
++ $ WORK( IPW ), 1, WORK, 1,
++ $ C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -751,17 +752,17 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ CALL CGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC,
+ $ 1, MYROW, IVCOL )
+- TAULOC = CONJG( TAULOC )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -780,13 +781,13 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -810,18 +811,18 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( IIV )
+ CALL CGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = CONJG( TAU( IIV ) )
++ TAULOC( 1 ) = CONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ IPW = NQV+1
+ CALL CGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = CONJG( WORK( IPW ) )
++ TAULOC( 1 ) = CONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -841,13 +842,13 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -866,17 +867,17 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL CGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = CONJG( TAU( JJV ) )
++ TAULOC( 1 ) = CONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+- CALL CGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC, 1,
+- $ MYROW, IVCOL )
+- TAULOC = CONJG( TAULOC )
++ CALL CGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1,
++ $ TAULOC( 1 ), 1, MYROW, IVCOL )
++ TAULOC( 1 ) = CONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -895,13 +896,13 @@ SUBROUTINE PCLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL CAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL CAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL CGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL CGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pclattrs.f b/SRC/pclattrs.f
+index c744aea..0d12a8b 100644
+--- a/SRC/pclattrs.f
++++ b/SRC/pclattrs.f
+@@ -271,7 +271,8 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ $ JINC, JLAST, LDA, LDX, MB, MYCOL, MYROW, NB,
+ $ NPCOL, NPROW, RSRC
+ REAL BIGNUM, GROW, REC, SMLNUM, TJJ, TMAX, TSCAL,
+- $ XBND, XJ, XMAX
++ $ XBND, XJ
++ REAL XMAX( 1 )
+ COMPLEX CSUMJ, TJJS, USCAL, XJTMP, ZDUM
+ * ..
+ * .. External Functions ..
+@@ -391,11 +392,11 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ * Compute a bound on the computed solution vector to see if the
+ * Level 2 PBLAS routine PCTRSV can be used.
+ *
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ CALL PCAMAX( N, ZDUM, IMAX, X, IX, JX, DESCX, 1 )
+- XMAX = CABS2( ZDUM )
++ XMAX( 1 ) = CABS2( ZDUM )
+ CALL SGSUM2D( CONTXT, 'Row', ' ', 1, 1, XMAX, 1, -1, -1 )
+- XBND = XMAX
++ XBND = XMAX( 1 )
+ *
+ IF( NOTRAN ) THEN
+ *
+@@ -590,16 +591,16 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ *
+ * Use a Level 1 PBLAS solve, scaling intermediate results.
+ *
+- IF( XMAX.GT.BIGNUM*HALF ) THEN
++ IF( XMAX( 1 ).GT.BIGNUM*HALF ) THEN
+ *
+ * Scale X so that its components are less than or equal to
+ * BIGNUM in absolute value.
+ *
+- SCALE = ( BIGNUM*HALF ) / XMAX
++ SCALE = ( BIGNUM*HALF ) / XMAX( 1 )
+ CALL PCSSCAL( N, SCALE, X, IX, JX, DESCX, 1 )
+- XMAX = BIGNUM
++ XMAX( 1 ) = BIGNUM
+ ELSE
+- XMAX = XMAX*TWO
++ XMAX( 1 ) = XMAX( 1 )*TWO
+ END IF
+ *
+ IF( NOTRAN ) THEN
+@@ -651,7 +652,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ * X( J ) = CLADIV( X( J ), TJJS )
+@@ -682,7 +683,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ * X( J ) = CLADIV( X( J ), TJJS )
+ * XJ = CABS1( X( J ) )
+@@ -706,7 +707,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ XJTMP = CONE
+ XJ = ONE
+ SCALE = ZERO
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ END IF
+ 90 CONTINUE
+ *
+@@ -715,7 +716,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ *
+ IF( XJ.GT.ONE ) THEN
+ REC = ONE / XJ
+- IF( CNORM( J ).GT.( BIGNUM-XMAX )*REC ) THEN
++ IF( CNORM( J ).GT.( BIGNUM-XMAX( 1 ) )*REC ) THEN
+ *
+ * Scale x by 1/(2*abs(x(j))).
+ *
+@@ -724,7 +725,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+ END IF
+- ELSE IF( XJ*CNORM( J ).GT.( BIGNUM-XMAX ) ) THEN
++ ELSE IF( XJ*CNORM( J ).GT.( BIGNUM-XMAX( 1 ) ) ) THEN
+ *
+ * Scale x by 1/2.
+ *
+@@ -743,7 +744,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCAXPY( J-1, ZDUM, A, IA, JA+J-1, DESCA, 1, X,
+ $ IX, JX, DESCX, 1 )
+ CALL PCAMAX( J-1, ZDUM, IMAX, X, IX, JX, DESCX, 1 )
+- XMAX = CABS1( ZDUM )
++ XMAX( 1 ) = CABS1( ZDUM )
+ CALL SGSUM2D( CONTXT, 'Row', ' ', 1, 1, XMAX, 1,
+ $ -1, -1 )
+ END IF
+@@ -757,7 +758,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCAXPY( N-J, ZDUM, A, IA+J, JA+J-1, DESCA, 1,
+ $ X, IX+J, JX, DESCX, 1 )
+ CALL PCAMAX( N-J, ZDUM, I, X, IX+J, JX, DESCX, 1 )
+- XMAX = CABS1( ZDUM )
++ XMAX( 1 ) = CABS1( ZDUM )
+ CALL SGSUM2D( CONTXT, 'Row', ' ', 1, 1, XMAX, 1,
+ $ -1, -1 )
+ END IF
+@@ -785,7 +786,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ END IF
+ XJ = CABS1( XJTMP )
+ USCAL = CMPLX( TSCAL )
+- REC = ONE / MAX( XMAX, ONE )
++ REC = ONE / MAX( XMAX( 1 ), ONE )
+ IF( CNORM( J ).GT.( BIGNUM-XJ )*REC ) THEN
+ *
+ * If x(j) could overflow, scale x by 1/(2*XMAX).
+@@ -820,7 +821,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ *
+@@ -924,7 +925,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ * X( J ) = CLADIV( X( J ), TJJS )
+@@ -945,7 +946,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ * X( J ) = CLADIV( X( J ), TJJS )
+ XJTMP = CLADIV( XJTMP, TJJS )
+@@ -966,7 +967,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ END IF
+ XJTMP = CONE
+ SCALE = ZERO
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ END IF
+ 110 CONTINUE
+ ELSE
+@@ -981,7 +982,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ X( IROWX ) = XJTMP
+ END IF
+ END IF
+- XMAX = MAX( XMAX, CABS1( XJTMP ) )
++ XMAX( 1 ) = MAX( XMAX( 1 ), CABS1( XJTMP ) )
+ 120 CONTINUE
+ *
+ ELSE
+@@ -1004,7 +1005,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ END IF
+ XJ = CABS1( XJTMP )
+ USCAL = TSCAL
+- REC = ONE / MAX( XMAX, ONE )
++ REC = ONE / MAX( XMAX( 1 ), ONE )
+ IF( CNORM( J ).GT.( BIGNUM-XJ )*REC ) THEN
+ *
+ * If x(j) could overflow, scale x by 1/(2*XMAX).
+@@ -1039,7 +1040,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ *
+@@ -1145,7 +1146,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ * X( J ) = CLADIV( X( J ), TJJS )
+@@ -1164,7 +1165,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PCSSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ * X( J ) = CLADIV( X( J ), TJJS )
+ XJTMP = CLADIV( XJTMP, TJJS )
+@@ -1181,7 +1182,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ $ X( IROWX ) = CONE
+ XJTMP = CONE
+ SCALE = ZERO
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ END IF
+ 130 CONTINUE
+ ELSE
+@@ -1194,7 +1195,7 @@ SUBROUTINE PCLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ IF( ( MYROW.EQ.ITMP1X ) .AND. ( MYCOL.EQ.ITMP2X ) )
+ $ X( IROWX ) = XJTMP
+ END IF
+- XMAX = MAX( XMAX, CABS1( XJTMP ) )
++ XMAX( 1 ) = MAX( XMAX( 1 ), CABS1( XJTMP ) )
+ 140 CONTINUE
+ END IF
+ SCALE = SCALE / TSCAL
+diff --git a/SRC/pclawil.f b/SRC/pclawil.f
+index 24a49b9..b33b3b1 100644
+--- a/SRC/pclawil.f
++++ b/SRC/pclawil.f
+@@ -124,11 +124,10 @@ SUBROUTINE PCLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ $ MODKM1, MYCOL, MYROW, NPCOL, NPROW, NUM, RIGHT,
+ $ RSRC, UP
+ REAL S
+- COMPLEX CDUM, H11, H12, H21, H22, H33S, H44S, V1, V2,
+- $ V3
++ COMPLEX CDUM, H22, H33S, H44S, V1, V2
+ * ..
+ * .. Local Arrays ..
+- COMPLEX BUF( 4 )
++ COMPLEX BUF( 4 ), V3( 1 ), H11( 1 ), H12( 1 ), H21( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, CGERV2D, CGESD2D
+@@ -181,18 +180,18 @@ SUBROUTINE PCLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( NPCOL.GT.1 ) THEN
+ CALL CGERV2D( CONTXT, 1, 1, V3, 1, MYROW, LEFT )
+ ELSE
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ IF( NUM.GT.1 ) THEN
+ CALL CGERV2D( CONTXT, 4, 1, BUF, 4, UP, LEFT )
+- H11 = BUF( 1 )
+- H21 = BUF( 2 )
+- H12 = BUF( 3 )
++ H11( 1 ) = BUF( 1 )
++ H21( 1 ) = BUF( 2 )
++ H12( 1 ) = BUF( 3 )
+ H22 = BUF( 4 )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+ END IF
+ END IF
+@@ -223,22 +222,22 @@ SUBROUTINE PCLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ CALL INFOG2L( M+2, M+2, DESCA, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, RSRC, JSRC )
+ IF( NUM.GT.1 ) THEN
+- CALL CGERV2D( CONTXT, 1, 1, H11, 1, UP, LEFT )
++ CALL CGERV2D( CONTXT, 1, 1, H11( 1 ), 1, UP, LEFT )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
+ END IF
+ IF( NPROW.GT.1 ) THEN
+ CALL CGERV2D( CONTXT, 1, 1, H12, 1, UP, MYCOL )
+ ELSE
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ END IF
+ IF( NPCOL.GT.1 ) THEN
+- CALL CGERV2D( CONTXT, 1, 1, H21, 1, MYROW, LEFT )
++ CALL CGERV2D( CONTXT, 1, 1, H21( 1 ), 1, MYROW, LEFT )
+ ELSE
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
+ END IF
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ END IF
+ IF( ( MYROW.NE.II ) .OR. ( MYCOL.NE.JJ ) )
+@@ -247,24 +246,24 @@ SUBROUTINE PCLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( MODKM1.GT.1 ) THEN
+ CALL INFOG2L( M+2, M+2, DESCA, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, RSRC, JSRC )
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ *
+- H44S = H44 - H11
+- H33S = H33 - H11
+- V1 = ( H33S*H44S-H43H34 ) / H21 + H12
+- V2 = H22 - H11 - H33S - H44S
+- S = CABS1( V1 ) + CABS1( V2 ) + CABS1( V3 )
++ H44S = H44 - H11( 1 )
++ H33S = H33 - H11( 1 )
++ V1 = ( H33S*H44S-H43H34 ) / H21( 1 ) + H12( 1 )
++ V2 = H22 - H11( 1 ) - H33S - H44S
++ S = CABS1( V1 ) + CABS1( V2 ) + CABS1( V3( 1 ) )
+ V1 = V1 / S
+ V2 = V2 / S
+- V3 = V3 / S
++ V3( 1 ) = V3( 1 ) / S
+ V( 1 ) = V1
+ V( 2 ) = V2
+- V( 3 ) = V3
++ V( 3 ) = V3( 1 )
+ *
+ RETURN
+ *
+diff --git a/SRC/pctrevc.f b/SRC/pctrevc.f
+index d0a3043..bf6c52b 100644
+--- a/SRC/pctrevc.f
++++ b/SRC/pctrevc.f
+@@ -218,11 +218,12 @@ SUBROUTINE PCTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ $ ITMP2, J, K, KI, LDT, LDVL, LDVR, LDW, MB,
+ $ MYCOL, MYROW, NB, NPCOL, NPROW, RSRC
+ REAL SELF
+- REAL OVFL, REMAXD, SCALE, SMIN, SMLNUM, ULP, UNFL
++ REAL OVFL, REMAXD, SCALE, SMLNUM, ULP, UNFL
+ COMPLEX CDUM, REMAXC, SHIFT
+ * ..
+ * .. Local Arrays ..
+ INTEGER DESCW( DLEN_ )
++ REAL SMIN( 1 )
+ * ..
+ * .. External Functions ..
+ LOGICAL LSAME
+@@ -355,13 +356,13 @@ SUBROUTINE PCTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ $ GO TO 70
+ END IF
+ *
+- SMIN = ZERO
++ SMIN( 1 ) = ZERO
+ SHIFT = CZERO
+ CALL INFOG2L( KI, KI, DESCT, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, ITMP1, ITMP2 )
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ SHIFT = T( ( ICOL-1 )*LDT+IROW )
+- SMIN = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
++ SMIN( 1 ) = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
+ END IF
+ CALL SGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SMIN, 1, -1, -1 )
+ CALL CGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SHIFT, 1, -1, -1 )
+@@ -396,8 +397,9 @@ SUBROUTINE PCTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ T( ( ICOL-1 )*LDT+IROW ) = T( ( ICOL-1 )*LDT+IROW ) -
+ $ SHIFT
+- IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN ) THEN
+- T( ( ICOL-1 )*LDT+IROW ) = CMPLX( SMIN )
++ IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN( 1 ) )
++ $ THEN
++ T( ( ICOL-1 )*LDT+IROW ) = CMPLX( SMIN( 1 ) )
+ END IF
+ END IF
+ 50 CONTINUE
+@@ -467,13 +469,13 @@ SUBROUTINE PCTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ $ GO TO 110
+ END IF
+ *
+- SMIN = ZERO
++ SMIN( 1 ) = ZERO
+ SHIFT = CZERO
+ CALL INFOG2L( KI, KI, DESCT, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, ITMP1, ITMP2 )
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ SHIFT = T( ( ICOL-1 )*LDT+IROW )
+- SMIN = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
++ SMIN( 1 ) = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
+ END IF
+ CALL SGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SMIN, 1, -1, -1 )
+ CALL CGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SHIFT, 1, -1, -1 )
+@@ -507,8 +509,8 @@ SUBROUTINE PCTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ T( ( ICOL-1 )*LDT+IROW ) = T( ( ICOL-1 )*LDT+IROW ) -
+ $ SHIFT
+- IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN )
+- $ T( ( ICOL-1 )*LDT+IROW ) = CMPLX( SMIN )
++ IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN( 1 ) )
++ $ T( ( ICOL-1 )*LDT+IROW ) = CMPLX( SMIN( 1 ) )
+ END IF
+ 90 CONTINUE
+ *
+diff --git a/SRC/pdhseqr.f b/SRC/pdhseqr.f
+index ffc3652..6e0f751 100644
+--- a/SRC/pdhseqr.f
++++ b/SRC/pdhseqr.f
+@@ -259,11 +259,12 @@ SUBROUTINE PDHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ $ HRSRC4, HCSRC4, LIWKOPT
+ LOGICAL INITZ, LQUERY, WANTT, WANTZ, PAIR, BORDER
+ DOUBLE PRECISION TMP1, TMP2, TMP3, TMP4, DUM1, DUM2, DUM3,
+- $ DUM4, ELEM1, ELEM2, ELEM3, ELEM4,
++ $ DUM4, ELEM1, ELEM4,
+ $ CS, SN, ELEM5, TMP, LWKOPT
+ * ..
+ * .. Local Arrays ..
+ INTEGER DESCH2( DLEN_ )
++ DOUBLE PRECISION ELEM2( 1 ), ELEM3( 1 )
+ * ..
+ * .. External Functions ..
+ INTEGER PILAENVX, NUMROC, ICEIL
+@@ -566,28 +567,28 @@ SUBROUTINE PDHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ IF( MYROW.EQ.HRSRC1 .AND. MYCOL.EQ.HCSRC1 ) THEN
+ ELEM1 = H((JLOC1-1)*LLDH+ILOC1)
+ IF( K.LT.N ) THEN
+- ELEM3 = H((JLOC1-1)*LLDH+ILOC1+1)
++ ELEM3( 1 ) = H((JLOC1-1)*LLDH+ILOC1+1)
+ ELSE
+- ELEM3 = ZERO
++ ELEM3( 1 ) = ZERO
+ END IF
+- IF( ELEM3.NE.ZERO ) THEN
+- ELEM2 = H((JLOC1)*LLDH+ILOC1)
++ IF( ELEM3( 1 ).NE.ZERO ) THEN
++ ELEM2( 1 ) = H((JLOC1)*LLDH+ILOC1)
+ ELEM4 = H((JLOC1)*LLDH+ILOC1+1)
+- CALL DLANV2( ELEM1, ELEM2, ELEM3, ELEM4,
+- $ WR( K ), WI( K ), WR( K+1 ), WI( K+1 ),
+- $ SN, CS )
++ CALL DLANV2( ELEM1, ELEM2( 1 ), ELEM3( 1 ),
++ $ ELEM4, WR( K ), WI( K ), WR( K+1 ),
++ $ WI( K+1 ), SN, CS )
+ PAIR = .TRUE.
+ ELSE
+ IF( K.GT.1 ) THEN
+ TMP = H((JLOC1-2)*LLDH+ILOC1)
+ IF( TMP.NE.ZERO ) THEN
+ ELEM1 = H((JLOC1-2)*LLDH+ILOC1-1)
+- ELEM2 = H((JLOC1-1)*LLDH+ILOC1-1)
+- ELEM3 = H((JLOC1-2)*LLDH+ILOC1)
++ ELEM2( 1 ) = H((JLOC1-1)*LLDH+ILOC1-1)
++ ELEM3( 1 ) = H((JLOC1-2)*LLDH+ILOC1)
+ ELEM4 = H((JLOC1-1)*LLDH+ILOC1)
+- CALL DLANV2( ELEM1, ELEM2, ELEM3,
+- $ ELEM4, WR( K-1 ), WI( K-1 ),
+- $ WR( K ), WI( K ), SN, CS )
++ CALL DLANV2( ELEM1, ELEM2( 1 ),
++ $ ELEM3( 1 ), ELEM4, WR( K-1 ),
++ $ WI( K-1 ), WR( K ), WI( K ), SN, CS )
+ ELSE
+ WR( K ) = ELEM1
+ END IF
+@@ -620,12 +621,12 @@ SUBROUTINE PDHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ CALL INFOG2L( K+1, K+1, DESCH, NPROW, NPCOL, MYROW, MYCOL,
+ $ ILOC4, JLOC4, HRSRC4, HCSRC4 )
+ IF( MYROW.EQ.HRSRC2 .AND. MYCOL.EQ.HCSRC2 ) THEN
+- ELEM2 = H((JLOC2-1)*LLDH+ILOC2)
++ ELEM2( 1 ) = H((JLOC2-1)*LLDH+ILOC2)
+ IF( HRSRC1.NE.HRSRC2 .OR. HCSRC1.NE.HCSRC2 )
+ $ CALL DGESD2D( ICTXT, 1, 1, ELEM2, 1, HRSRC1, HCSRC1)
+ END IF
+ IF( MYROW.EQ.HRSRC3 .AND. MYCOL.EQ.HCSRC3 ) THEN
+- ELEM3 = H((JLOC3-1)*LLDH+ILOC3)
++ ELEM3( 1 ) = H((JLOC3-1)*LLDH+ILOC3)
+ IF( HRSRC1.NE.HRSRC3 .OR. HCSRC1.NE.HCSRC3 )
+ $ CALL DGESD2D( ICTXT, 1, 1, ELEM3, 1, HRSRC1, HCSRC1)
+ END IF
+@@ -651,8 +652,9 @@ SUBROUTINE PDHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ ELEM5 = WORK(2)
+ IF( ELEM5.EQ.ZERO ) THEN
+ IF( WR( K ).EQ.ZERO .AND. WI( K ).EQ.ZERO ) THEN
+- CALL DLANV2( ELEM1, ELEM2, ELEM3, ELEM4, WR( K ),
+- $ WI( K ), WR( K+1 ), WI( K+1 ), SN, CS )
++ CALL DLANV2( ELEM1, ELEM2( 1 ), ELEM3( 1 ), ELEM4,
++ $ WR( K ), WI( K ), WR( K+1 ), WI( K+1 ), SN,
++ $ CS )
+ ELSEIF( WR( K+1 ).EQ.ZERO .AND. WI( K+1 ).EQ.ZERO )
+ $ THEN
+ WR( K+1 ) = ELEM4
+diff --git a/SRC/pdlacon.f b/SRC/pdlacon.f
+index b625d97..74b9eab 100644
+--- a/SRC/pdlacon.f
++++ b/SRC/pdlacon.f
+@@ -160,10 +160,10 @@ SUBROUTINE PDLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ INTEGER I, ICTXT, IFLAG, IIVX, IMAXROW, IOFFVX, IROFF,
+ $ ITER, IVXCOL, IVXROW, J, JLAST, JJVX, JUMP,
+ $ K, MYCOL, MYROW, NP, NPCOL, NPROW
+- DOUBLE PRECISION ALTSGN, ESTOLD, JLMAX, TEMP, XMAX
++ DOUBLE PRECISION ALTSGN, ESTOLD, JLMAX, XMAX
+ * ..
+ * .. Local Arrays ..
+- DOUBLE PRECISION WORK( 2 )
++ DOUBLE PRECISION ESTWORK( 1 ), TEMP( 1 ), WORK( 2 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, DCOPY, DGEBR2D, DGEBS2D,
+@@ -184,6 +184,7 @@ SUBROUTINE PDLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ *
+ * Get grid parameters.
+ *
++ ESTWORK( 1 ) = EST
+ ICTXT = DESCX( CTXT_ )
+ CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
+ *
+@@ -215,21 +216,21 @@ SUBROUTINE PDLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ IF( N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+ V( IOFFVX ) = X( IOFFVX )
+- EST = ABS( V( IOFFVX ) )
+- CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1 )
++ ESTWORK( 1 ) = ABS( V( IOFFVX ) )
++ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1 )
+ ELSE
+- CALL DGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1,
++ CALL DGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1,
+ $ IVXROW, MYCOL )
+ END IF
+ * ... QUIT
+ GO TO 150
+ END IF
+- CALL PDASUM( N, EST, X, IX, JX, DESCX, 1 )
++ CALL PDASUM( N, ESTWORK( 1 ), X, IX, JX, DESCX, 1 )
+ IF( DESCX( M_ ).EQ.1 .AND. N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+- CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1 )
++ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1 )
+ ELSE
+- CALL DGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1,
++ CALL DGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1,
+ $ IVXROW, MYCOL )
+ END IF
+ END IF
+@@ -281,13 +282,13 @@ SUBROUTINE PDLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ *
+ 70 CONTINUE
+ CALL DCOPY( NP, X( IOFFVX ), 1, V( IOFFVX ), 1 )
+- ESTOLD = EST
+- CALL PDASUM( N, EST, V, IV, JV, DESCV, 1 )
++ ESTOLD = ESTWORK( 1 )
++ CALL PDASUM( N, ESTWORK( 1 ), V, IV, JV, DESCV, 1 )
+ IF( DESCV( M_ ).EQ.1 .AND. N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+- CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1 )
++ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1 )
+ ELSE
+- CALL DGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1,
++ CALL DGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1,
+ $ IVXROW, MYCOL )
+ END IF
+ END IF
+@@ -305,7 +306,7 @@ SUBROUTINE PDLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ * REPEATED SIGN VECTOR DETECTED, HENCE ALGORITHM HAS CONVERGED.
+ * ALONG WITH IT, TEST FOR CYCLING.
+ *
+- IF( IFLAG.EQ.0 .OR. EST.LE.ESTOLD )
++ IF( IFLAG.EQ.0 .OR. ESTWORK( 1 ).LE.ESTOLD )
+ $ GO TO 120
+ *
+ DO 100 I = IOFFVX, IOFFVX+NP-1
+@@ -361,7 +362,7 @@ SUBROUTINE PDLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ * X HAS BEEN OVERWRITTEN BY A*X
+ *
+ 140 CONTINUE
+- CALL PDASUM( N, TEMP, X, IX, JX, DESCX, 1 )
++ CALL PDASUM( N, TEMP( 1 ), X, IX, JX, DESCX, 1 )
+ IF( DESCX( M_ ).EQ.1 .AND. N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, TEMP, 1 )
+@@ -370,15 +371,16 @@ SUBROUTINE PDLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ $ IVXROW, MYCOL )
+ END IF
+ END IF
+- TEMP = TWO*( TEMP / DBLE( 3*N ) )
+- IF( TEMP.GT.EST ) THEN
++ TEMP( 1 ) = TWO*( TEMP( 1 ) / DBLE( 3*N ) )
++ IF( TEMP( 1 ).GT.ESTWORK( 1 ) ) THEN
+ CALL DCOPY( NP, X( IOFFVX ), 1, V( IOFFVX ), 1 )
+- EST = TEMP
++ ESTWORK( 1 ) = TEMP( 1 )
+ END IF
+ *
+ 150 CONTINUE
+ KASE = 0
+ *
++ EST = ESTWORK( 1 )
+ RETURN
+ *
+ * End of PDLACON
+diff --git a/SRC/pdlarf.f b/SRC/pdlarf.f
+index 29da1ac..41368d6 100644
+--- a/SRC/pdlarf.f
++++ b/SRC/pdlarf.f
+@@ -241,7 +241,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ $ IOFFV, IPW, IROFF, IVCOL, IVROW, JJC, JJV, LDC,
+ $ LDV, MYCOL, MYROW, MP, NCC, NCV, NPCOL, NPROW,
+ $ NQ, RDEST
+- DOUBLE PRECISION TAULOC
++ DOUBLE PRECISION TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, DCOPY, DGEBR2D, DGEBS2D,
+@@ -335,7 +335,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -344,7 +344,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -362,8 +362,8 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL DGER( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -378,9 +378,9 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYCOL.EQ.ICCOL ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -397,8 +397,8 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL DGER( MP, NQ, -TAULOC, V( IOFFV ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL DGER( MP, NQ, -TAULOC( 1 ), V( IOFFV ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -420,9 +420,9 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = MP+1
+ CALL DGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -440,7 +440,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL DGER( MP, NQ, -TAULOC, WORK, 1,
++ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -470,7 +470,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -479,7 +479,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -499,8 +499,8 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL DGER( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -515,18 +515,18 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( JJV )
+ CALL DGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MP+1
+ CALL DGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -546,8 +546,8 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL DGER( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -576,9 +576,9 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYROW.EQ.ICROW ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -596,7 +596,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFV.GT.0 .AND. IOFFC.GT.0 )
+- $ CALL DGER( MP, NQ, -TAULOC, WORK, 1,
++ $ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -619,9 +619,9 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = NQ+1
+ CALL DGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -639,7 +639,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL DGER( MP, NQ, -TAULOC, WORK( IPW ), 1,
++ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -665,7 +665,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL DGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -674,7 +674,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -692,8 +692,8 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL DGER( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -718,18 +718,18 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( IIV )
+ CALL DGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQ+1
+ CALL DGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -748,8 +748,8 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL DGER( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ $ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -768,7 +768,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL DGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -777,7 +777,7 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -795,8 +795,8 @@ SUBROUTINE PDLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL DGER( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL DGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1, WORK,
++ $ 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pdlarz.f b/SRC/pdlarz.f
+index b91282c..f45c137 100644
+--- a/SRC/pdlarz.f
++++ b/SRC/pdlarz.f
+@@ -250,7 +250,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ IVCOL, IVROW, JJC1, JJC2, JJV, LDC, LDV, MPC2,
+ $ MPV, MYCOL, MYROW, NCC, NCV, NPCOL, NPROW,
+ $ NQC2, NQV, RDEST
+- DOUBLE PRECISION TAULOC
++ DOUBLE PRECISION TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, DAXPY, DCOPY, DGEBR2D,
+@@ -369,7 +369,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -378,7 +378,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -401,9 +401,9 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL DAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL DAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL DGER( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL DGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -419,9 +419,9 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYCOL.EQ.ICCOL2 ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -444,11 +444,11 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL DAXPY( NQC2, -TAULOC, WORK,
++ $ CALL DAXPY( NQC2, -TAULOC( 1 ), WORK,
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL DGER( MPV, NQC2, -TAULOC, V( IOFFV ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL DGER( MPV, NQC2, -TAULOC( 1 ), V( IOFFV ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -470,9 +470,9 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = MPV+1
+ CALL DGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -495,10 +495,10 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL DAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL DAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL DGER( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL DGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -529,7 +529,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL DGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -538,7 +538,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -561,10 +561,10 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL DAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL DAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL DGER( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL DGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -579,18 +579,18 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( JJV )
+ CALL DGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MPV+1
+ CALL DGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -613,10 +613,10 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL DAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL DAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL DGER( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL DGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -645,9 +645,9 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYROW.EQ.ICROW2 ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -668,13 +668,13 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ ICCOL2 )
+ *
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL DAXPY( MPC2, -TAULOC, WORK, 1,
++ $ CALL DAXPY( MPC2, -TAULOC( 1 ), WORK, 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( MPC2.GT.0 .AND. NQV.GT.0 )
+- $ CALL DGER( MPC2, NQV, -TAULOC, WORK, 1,
++ $ CALL DGER( MPC2, NQV, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC2 ),
+ $ LDC )
+ END IF
+@@ -698,9 +698,9 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = NQV+1
+ CALL DGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -719,13 +719,13 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ),
+ $ RDEST, ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL DAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
+- $ C( IOFFC1 ), 1 )
++ $ CALL DAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL DGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL DGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -750,7 +750,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL DGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -759,7 +759,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -778,12 +778,12 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL DAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL DAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL DGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
++ CALL DGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -808,18 +808,18 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( IIV )
+ CALL DGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQV+1
+ CALL DGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -839,13 +839,13 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL DAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL DAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL DGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL DGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -864,7 +864,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL DGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -873,7 +873,7 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -892,13 +892,13 @@ SUBROUTINE PDLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL DAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL DAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL DGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL DGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pdlawil.f b/SRC/pdlawil.f
+index 90a4d74..e8bc3a0 100644
+--- a/SRC/pdlawil.f
++++ b/SRC/pdlawil.f
+@@ -120,10 +120,10 @@ SUBROUTINE PDLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ INTEGER CONTXT, DOWN, HBL, ICOL, IROW, JSRC, LDA, LEFT,
+ $ MODKM1, MYCOL, MYROW, NPCOL, NPROW, NUM, RIGHT,
+ $ RSRC, UP
+- DOUBLE PRECISION H11, H12, H21, H22, H33S, H44S, S, V1, V2, V3
++ DOUBLE PRECISION H22, H33S, H44S, S, V1, V2
+ * ..
+ * .. Local Arrays ..
+- DOUBLE PRECISION BUF( 4 )
++ DOUBLE PRECISION BUF( 4 ), H11( 1 ), H12( 1 ), H21( 1 ), V3( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, DGERV2D, DGESD2D, INFOG2L
+@@ -170,18 +170,18 @@ SUBROUTINE PDLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( NPCOL.GT.1 ) THEN
+ CALL DGERV2D( CONTXT, 1, 1, V3, 1, MYROW, LEFT )
+ ELSE
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ IF( NUM.GT.1 ) THEN
+ CALL DGERV2D( CONTXT, 4, 1, BUF, 4, UP, LEFT )
+- H11 = BUF( 1 )
+- H21 = BUF( 2 )
+- H12 = BUF( 3 )
++ H11( 1 ) = BUF( 1 )
++ H21( 1 ) = BUF( 2 )
++ H12( 1 ) = BUF( 3 )
+ H22 = BUF( 4 )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+ END IF
+ END IF
+@@ -214,20 +214,20 @@ SUBROUTINE PDLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( NUM.GT.1 ) THEN
+ CALL DGERV2D( CONTXT, 1, 1, H11, 1, UP, LEFT )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
+ END IF
+ IF( NPROW.GT.1 ) THEN
+ CALL DGERV2D( CONTXT, 1, 1, H12, 1, UP, MYCOL )
+ ELSE
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ END IF
+ IF( NPCOL.GT.1 ) THEN
+ CALL DGERV2D( CONTXT, 1, 1, H21, 1, MYROW, LEFT )
+ ELSE
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
+ END IF
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ END IF
+ IF( ( MYROW.NE.II ) .OR. ( MYCOL.NE.JJ ) )
+@@ -236,24 +236,24 @@ SUBROUTINE PDLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( MODKM1.GT.1 ) THEN
+ CALL INFOG2L( M+2, M+2, DESCA, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, RSRC, JSRC )
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ *
+- H44S = H44 - H11
+- H33S = H33 - H11
+- V1 = ( H33S*H44S-H43H34 ) / H21 + H12
+- V2 = H22 - H11 - H33S - H44S
+- S = ABS( V1 ) + ABS( V2 ) + ABS( V3 )
++ H44S = H44 - H11( 1 )
++ H33S = H33 - H11( 1 )
++ V1 = ( H33S*H44S-H43H34 ) / H21( 1 ) + H12( 1 )
++ V2 = H22 - H11( 1 ) - H33S - H44S
++ S = ABS( V1 ) + ABS( V2 ) + ABS( V3( 1 ) )
+ V1 = V1 / S
+ V2 = V2 / S
+- V3 = V3 / S
++ V3( 1 ) = V3( 1 ) / S
+ V( 1 ) = V1
+ V( 2 ) = V2
+- V( 3 ) = V3
++ V( 3 ) = V3( 1 )
+ *
+ RETURN
+ *
+diff --git a/SRC/pdstebz.f b/SRC/pdstebz.f
+index e7006f9..bf4dacc 100644
+--- a/SRC/pdstebz.f
++++ b/SRC/pdstebz.f
+@@ -246,14 +246,14 @@ SUBROUTINE PDSTEBZ( ICTXT, RANGE, ORDER, N, VL, VU, IL, IU,
+ $ ITMP2, J, JB, K, LAST, LEXTRA, LREQ, MYCOL,
+ $ MYROW, NALPHA, NBETA, NCMP, NEIGINT, NEXT, NGL,
+ $ NGLOB, NGU, NINT, NPCOL, NPROW, OFFSET,
+- $ ONEDCONTEXT, P, PREV, REXTRA, RREQ, SELF,
+- $ TORECV
++ $ ONEDCONTEXT, P, PREV, REXTRA, RREQ, SELF
+ DOUBLE PRECISION ALPHA, ATOLI, BETA, BNORM, DRECV, DSEND, GL,
+ $ GU, INITVL, INITVU, LSAVE, MID, PIVMIN, RELTOL,
+ $ SAFEMN, TMP1, TMP2, TNORM, ULP
+ * ..
+ * .. Local Arrays ..
+ INTEGER IDUM( 5, 2 )
++ INTEGER TORECV( 1, 1 )
+ * ..
+ * .. Executable Statements ..
+ * This is just to keep ftnchek happy
+@@ -784,14 +784,14 @@ SUBROUTINE PDSTEBZ( ICTXT, RANGE, ORDER, N, VL, VU, IL, IU,
+ ELSE
+ CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', 1, 1, TORECV, 1, 0,
+ $ I-1 )
+- IF( TORECV.NE.0 ) THEN
+- CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV, 1, IWORK,
+- $ TORECV, 0, I-1 )
+- CALL DGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV, 1, WORK,
+- $ TORECV, 0, I-1 )
+- CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV, 1,
+- $ IWORK( N+1 ), TORECV, 0, I-1 )
+- DO 120 J = 1, TORECV
++ IF( TORECV( 1, 1 ).NE.0 ) THEN
++ CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV( 1, 1 ), 1,
++ $ IWORK, TORECV( 1, 1 ), 0, I-1 )
++ CALL DGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV( 1, 1 ), 1,
++ $ WORK, TORECV( 1, 1 ), 0, I-1 )
++ CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV( 1, 1 ), 1,
++ $ IWORK( N+1 ), TORECV( 1, 1 ), 0, I-1 )
++ DO 120 J = 1, TORECV( 1, 1 )
+ W( IWORK( J ) ) = WORK( J )
+ IBLOCK( IWORK( J ) ) = IWORK( N+J )
+ 120 CONTINUE
+diff --git a/SRC/pdtrord.f b/SRC/pdtrord.f
+index 1f37d8e..3870574 100644
+--- a/SRC/pdtrord.f
++++ b/SRC/pdtrord.f
+@@ -328,12 +328,13 @@ SUBROUTINE PDTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ $ EAST, WEST, ILOC4, SOUTH, NORTH, INDXS,
+ $ ITT, JTT, ILEN, DLEN, INDXE, TRSRC1, TCSRC1,
+ $ TRSRC2, TCSRC2, ILOS, DIR, TLIHI, TLILO, TLSEL,
+- $ ROUND, LAST, WIN0S, WIN0E, WINE, MMAX, MMIN
++ $ ROUND, LAST, WIN0S, WIN0E, WINE
+ DOUBLE PRECISION ELEM, ELEM1, ELEM2, ELEM3, ELEM4, SN, CS, TMP,
+ $ ELEM5
+ * ..
+ * .. Local Arrays ..
+- INTEGER IBUFF( 8 ), IDUM1( 1 ), IDUM2( 1 )
++ INTEGER IBUFF( 8 ), IDUM1( 1 ), IDUM2( 1 ), MMAX( 1 ),
++ $ MMIN( 1 ), INFODUM( 1 )
+ * ..
+ * .. External Functions ..
+ LOGICAL LSAME
+@@ -483,16 +484,16 @@ SUBROUTINE PDTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ END IF
+ IF( SELECT(K).NE.0 ) M = M + 1
+ 10 CONTINUE
+- MMAX = M
+- MMIN = M
++ MMAX( 1 ) = M
++ MMIN( 1 ) = M
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, MMAX, 1, -1,
+ $ -1, -1, -1, -1 )
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMN2D( ICTXT, 'All', TOP, 1, 1, MMIN, 1, -1,
+ $ -1, -1, -1, -1 )
+- IF( MMAX.GT.MMIN ) THEN
+- M = MMAX
++ IF( MMAX( 1 ).GT.MMIN( 1 ) ) THEN
++ M = MMAX( 1 )
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMX2D( ICTXT, 'All', TOP, N, 1, SELECT, N,
+ $ -1, -1, -1, -1, -1 )
+@@ -520,9 +521,11 @@ SUBROUTINE PDTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ *
+ * Global maximum on info.
+ *
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1, -1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1, -1, -1,
+ $ -1, -1 )
++ INFO = INFODUM( 1 )
++ END IF
+ *
+ * Return if some argument is incorrect.
+ *
+@@ -1576,9 +1579,11 @@ SUBROUTINE PDTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * experienced a failure in the reordering.
+ *
+ MYIERR = IERR
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, IERR, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ IERR = INFODUM( 1 )
++ END IF
+ *
+ IF( IERR.NE.0 ) THEN
+ *
+@@ -1586,9 +1591,11 @@ SUBROUTINE PDTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * to swap.
+ *
+ IF( MYIERR.NE.0 ) INFO = MAX(1,I+KKS-1)
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ INFO = INFODUM( 1 )
++ END IF
+ GO TO 300
+ END IF
+ *
+@@ -3245,9 +3252,11 @@ SUBROUTINE PDTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * experienced a failure in the reordering.
+ *
+ MYIERR = IERR
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, IERR, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ IERR = INFODUM( 1 )
++ END IF
+ *
+ IF( IERR.NE.0 ) THEN
+ *
+@@ -3255,9 +3264,11 @@ SUBROUTINE PDTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * to swap.
+ *
+ IF( MYIERR.NE.0 ) INFO = MAX(1,I+KKS-1)
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ IERR = INFODUM( 1 )
++ END IF
+ GO TO 300
+ END IF
+ *
+diff --git a/SRC/pdtrsen.f b/SRC/pdtrsen.f
+index 78c5599..c65ea91 100644
+--- a/SRC/pdtrsen.f
++++ b/SRC/pdtrsen.f
+@@ -354,13 +354,15 @@ SUBROUTINE PDTRSEN( JOB, COMPQ, SELECT, PARA, N, T, IT, JT,
+ LOGICAL LQUERY, WANTBH, WANTQ, WANTS, WANTSP
+ INTEGER ICOFFT12, ICTXT, IDUM1, IDUM2, IERR, ILOC1,
+ $ IPW1, ITER, ITT, JLOC1, JTT, K, LIWMIN, LLDT,
+- $ LLDQ, LWMIN, MMAX, MMIN, MYROW, MYCOL, N1, N2,
++ $ LLDQ, LWMIN, MYROW, MYCOL, N1, N2,
+ $ NB, NOEXSY, NPCOL, NPROCS, NPROW, SPACE,
+ $ T12ROWS, T12COLS, TCOLS, TCSRC, TROWS, TRSRC,
+ $ WRK1, IWRK1, WRK2, IWRK2, WRK3, IWRK3
+- DOUBLE PRECISION DPDUM1, ELEM, EST, SCALE, RNORM
++ DOUBLE PRECISION ELEM, EST, SCALE, RNORM
+ * .. Local Arrays ..
+- INTEGER DESCT12( DLEN_ ), MBNB2( 2 )
++ INTEGER DESCT12( DLEN_ ), MBNB2( 2 ), MMAX( 1 ),
++ $ MMIN( 1 )
++ DOUBLE PRECISION DPDUM1( 1 )
+ * ..
+ * .. External Functions ..
+ LOGICAL LSAME
+@@ -521,16 +523,16 @@ SUBROUTINE PDTRSEN( JOB, COMPQ, SELECT, PARA, N, T, IT, JT,
+ END IF
+ IF( SELECT(K) ) M = M + 1
+ 10 CONTINUE
+- MMAX = M
+- MMIN = M
++ MMAX( 1 ) = M
++ MMIN( 1 ) = M
+ IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, MMAX, 1, -1,
+- $ -1, -1, -1, -1 )
++ $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, MMAX( 1 ), 1,
++ $ -1, -1, -1, -1, -1 )
+ IF( NPROCS.GT.1 )
+- $ CALL IGAMN2D( ICTXT, 'All', TOP, 1, 1, MMIN, 1, -1,
+- $ -1, -1, -1, -1 )
+- IF( MMAX.GT.MMIN ) THEN
+- M = MMAX
++ $ CALL IGAMN2D( ICTXT, 'All', TOP, 1, 1, MMIN( 1 ), 1,
++ $ -1, -1, -1, -1, -1 )
++ IF( MMAX( 1 ).GT.MMIN( 1 ) ) THEN
++ M = MMAX( 1 )
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMX2D( ICTXT, 'All', TOP, N, 1, IWORK, N,
+ $ -1, -1, -1, -1, -1 )
+diff --git a/SRC/pshseqr.f b/SRC/pshseqr.f
+index 10eb24a..e8ecea9 100644
+--- a/SRC/pshseqr.f
++++ b/SRC/pshseqr.f
+@@ -259,11 +259,12 @@ SUBROUTINE PSHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ $ HRSRC4, HCSRC4, LIWKOPT
+ LOGICAL INITZ, LQUERY, WANTT, WANTZ, PAIR, BORDER
+ REAL TMP1, TMP2, TMP3, TMP4, DUM1, DUM2, DUM3,
+- $ DUM4, ELEM1, ELEM2, ELEM3, ELEM4,
++ $ DUM4, ELEM1, ELEM4,
+ $ CS, SN, ELEM5, TMP, LWKOPT
+ * ..
+ * .. Local Arrays ..
+ INTEGER DESCH2( DLEN_ )
++ REAL ELEM2( 1 ), ELEM3( 1 )
+ * ..
+ * .. External Functions ..
+ INTEGER PILAENVX, NUMROC, ICEIL
+@@ -566,28 +567,28 @@ SUBROUTINE PSHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ IF( MYROW.EQ.HRSRC1 .AND. MYCOL.EQ.HCSRC1 ) THEN
+ ELEM1 = H((JLOC1-1)*LLDH+ILOC1)
+ IF( K.LT.N ) THEN
+- ELEM3 = H((JLOC1-1)*LLDH+ILOC1+1)
++ ELEM3( 1 ) = H((JLOC1-1)*LLDH+ILOC1+1)
+ ELSE
+- ELEM3 = ZERO
++ ELEM3( 1 ) = ZERO
+ END IF
+- IF( ELEM3.NE.ZERO ) THEN
+- ELEM2 = H((JLOC1)*LLDH+ILOC1)
++ IF( ELEM3( 1 ).NE.ZERO ) THEN
++ ELEM2( 1 ) = H((JLOC1)*LLDH+ILOC1)
+ ELEM4 = H((JLOC1)*LLDH+ILOC1+1)
+- CALL SLANV2( ELEM1, ELEM2, ELEM3, ELEM4,
+- $ WR( K ), WI( K ), WR( K+1 ), WI( K+1 ),
+- $ SN, CS )
++ CALL SLANV2( ELEM1, ELEM2( 1 ), ELEM3( 1 ),
++ $ ELEM4, WR( K ), WI( K ), WR( K+1 ),
++ $ WI( K+1 ), SN, CS )
+ PAIR = .TRUE.
+ ELSE
+ IF( K.GT.1 ) THEN
+ TMP = H((JLOC1-2)*LLDH+ILOC1)
+ IF( TMP.NE.ZERO ) THEN
+ ELEM1 = H((JLOC1-2)*LLDH+ILOC1-1)
+- ELEM2 = H((JLOC1-1)*LLDH+ILOC1-1)
+- ELEM3 = H((JLOC1-2)*LLDH+ILOC1)
++ ELEM2( 1 ) = H((JLOC1-1)*LLDH+ILOC1-1)
++ ELEM3( 1 ) = H((JLOC1-2)*LLDH+ILOC1)
+ ELEM4 = H((JLOC1-1)*LLDH+ILOC1)
+- CALL SLANV2( ELEM1, ELEM2, ELEM3,
+- $ ELEM4, WR( K-1 ), WI( K-1 ),
+- $ WR( K ), WI( K ), SN, CS )
++ CALL SLANV2( ELEM1, ELEM2( 1 ),
++ $ ELEM3( 1 ), ELEM4, WR( K-1 ),
++ $ WI( K-1 ), WR( K ), WI( K ), SN, CS )
+ ELSE
+ WR( K ) = ELEM1
+ END IF
+@@ -620,12 +621,12 @@ SUBROUTINE PSHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ CALL INFOG2L( K+1, K+1, DESCH, NPROW, NPCOL, MYROW, MYCOL,
+ $ ILOC4, JLOC4, HRSRC4, HCSRC4 )
+ IF( MYROW.EQ.HRSRC2 .AND. MYCOL.EQ.HCSRC2 ) THEN
+- ELEM2 = H((JLOC2-1)*LLDH+ILOC2)
++ ELEM2( 1 ) = H((JLOC2-1)*LLDH+ILOC2)
+ IF( HRSRC1.NE.HRSRC2 .OR. HCSRC1.NE.HCSRC2 )
+ $ CALL SGESD2D( ICTXT, 1, 1, ELEM2, 1, HRSRC1, HCSRC1)
+ END IF
+ IF( MYROW.EQ.HRSRC3 .AND. MYCOL.EQ.HCSRC3 ) THEN
+- ELEM3 = H((JLOC3-1)*LLDH+ILOC3)
++ ELEM3( 1 ) = H((JLOC3-1)*LLDH+ILOC3)
+ IF( HRSRC1.NE.HRSRC3 .OR. HCSRC1.NE.HCSRC3 )
+ $ CALL SGESD2D( ICTXT, 1, 1, ELEM3, 1, HRSRC1, HCSRC1)
+ END IF
+@@ -651,8 +652,9 @@ SUBROUTINE PSHSEQR( JOB, COMPZ, N, ILO, IHI, H, DESCH, WR, WI, Z,
+ ELEM5 = WORK(2)
+ IF( ELEM5.EQ.ZERO ) THEN
+ IF( WR( K ).EQ.ZERO .AND. WI( K ).EQ.ZERO ) THEN
+- CALL SLANV2( ELEM1, ELEM2, ELEM3, ELEM4, WR( K ),
+- $ WI( K ), WR( K+1 ), WI( K+1 ), SN, CS )
++ CALL SLANV2( ELEM1, ELEM2( 1 ), ELEM3( 1 ), ELEM4,
++ $ WR( K ), WI( K ), WR( K+1 ), WI( K+1 ), SN,
++ $ CS )
+ ELSEIF( WR( K+1 ).EQ.ZERO .AND. WI( K+1 ).EQ.ZERO )
+ $ THEN
+ WR( K+1 ) = ELEM4
+diff --git a/SRC/pslacon.f b/SRC/pslacon.f
+index 20d27ff..673bf1a 100644
+--- a/SRC/pslacon.f
++++ b/SRC/pslacon.f
+@@ -160,10 +160,12 @@ SUBROUTINE PSLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ INTEGER I, ICTXT, IFLAG, IIVX, IMAXROW, IOFFVX, IROFF,
+ $ ITER, IVXCOL, IVXROW, J, JLAST, JJVX, JUMP,
+ $ K, MYCOL, MYROW, NP, NPCOL, NPROW
+- REAL ALTSGN, ESTOLD, JLMAX, TEMP, XMAX
++ REAL ALTSGN, ESTOLD, JLMAX, XMAX
+ * ..
+ * .. Local Arrays ..
+ REAL WORK( 2 )
++ REAL ESTWORK( 1 )
++ REAL TEMP( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, IGSUM2D, INFOG2L, PSAMAX,
+@@ -184,6 +186,7 @@ SUBROUTINE PSLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ *
+ * Get grid parameters.
+ *
++ ESTWORK( 1 ) = EST
+ ICTXT = DESCX( CTXT_ )
+ CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
+ *
+@@ -215,21 +218,21 @@ SUBROUTINE PSLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ IF( N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+ V( IOFFVX ) = X( IOFFVX )
+- EST = ABS( V( IOFFVX ) )
+- CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1 )
++ ESTWORK( 1 ) = ABS( V( IOFFVX ) )
++ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1 )
+ ELSE
+- CALL SGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1,
++ CALL SGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1,
+ $ IVXROW, MYCOL )
+ END IF
+ * ... QUIT
+ GO TO 150
+ END IF
+- CALL PSASUM( N, EST, X, IX, JX, DESCX, 1 )
++ CALL PSASUM( N, ESTWORK( 1 ), X, IX, JX, DESCX, 1 )
+ IF( DESCX( M_ ).EQ.1 .AND. N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+- CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1 )
++ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1 )
+ ELSE
+- CALL SGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1,
++ CALL SGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1,
+ $ IVXROW, MYCOL )
+ END IF
+ END IF
+@@ -281,13 +284,13 @@ SUBROUTINE PSLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ *
+ 70 CONTINUE
+ CALL SCOPY( NP, X( IOFFVX ), 1, V( IOFFVX ), 1 )
+- ESTOLD = EST
+- CALL PSASUM( N, EST, V, IV, JV, DESCV, 1 )
++ ESTOLD = ESTWORK( 1 )
++ CALL PSASUM( N, ESTWORK( 1 ), V, IV, JV, DESCV, 1 )
+ IF( DESCV( M_ ).EQ.1 .AND. N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+- CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1 )
++ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1 )
+ ELSE
+- CALL SGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, EST, 1,
++ CALL SGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, ESTWORK, 1,
+ $ IVXROW, MYCOL )
+ END IF
+ END IF
+@@ -305,7 +308,7 @@ SUBROUTINE PSLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ * REPEATED SIGN VECTOR DETECTED, HENCE ALGORITHM HAS CONVERGED.
+ * ALONG WITH IT, TEST FOR CYCLING.
+ *
+- IF( IFLAG.EQ.0 .OR. EST.LE.ESTOLD )
++ IF( IFLAG.EQ.0 .OR. ESTWORK( 1 ).LE.ESTOLD )
+ $ GO TO 120
+ *
+ DO 100 I = IOFFVX, IOFFVX+NP-1
+@@ -361,7 +364,7 @@ SUBROUTINE PSLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ * X HAS BEEN OVERWRITTEN BY A*X
+ *
+ 140 CONTINUE
+- CALL PSASUM( N, TEMP, X, IX, JX, DESCX, 1 )
++ CALL PSASUM( N, TEMP( 1 ), X, IX, JX, DESCX, 1 )
+ IF( DESCX( M_ ).EQ.1 .AND. N.EQ.1 ) THEN
+ IF( MYROW.EQ.IVXROW ) THEN
+ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, TEMP, 1 )
+@@ -370,15 +373,16 @@ SUBROUTINE PSLACON( N, V, IV, JV, DESCV, X, IX, JX, DESCX, ISGN,
+ $ IVXROW, MYCOL )
+ END IF
+ END IF
+- TEMP = TWO*( TEMP / REAL( 3*N ) )
+- IF( TEMP.GT.EST ) THEN
++ TEMP( 1 ) = TWO*( TEMP( 1 ) / REAL( 3*N ) )
++ IF( TEMP( 1 ).GT.ESTWORK( 1 ) ) THEN
+ CALL SCOPY( NP, X( IOFFVX ), 1, V( IOFFVX ), 1 )
+- EST = TEMP
++ ESTWORK( 1 ) = TEMP( 1 )
+ END IF
+ *
+ 150 CONTINUE
+ KASE = 0
+ *
++ EST = ESTWORK( 1 )
+ RETURN
+ *
+ * End of PSLACON
+diff --git a/SRC/pslarf.f b/SRC/pslarf.f
+index c1d3a15..39de0ed 100644
+--- a/SRC/pslarf.f
++++ b/SRC/pslarf.f
+@@ -241,7 +241,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ $ IOFFV, IPW, IROFF, IVCOL, IVROW, JJC, JJV, LDC,
+ $ LDV, MYCOL, MYROW, MP, NCC, NCV, NPCOL, NPROW,
+ $ NQ, RDEST
+- REAL TAULOC
++ REAL TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, PB_TOPGET, PBSTRNV,
+@@ -335,7 +335,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -344,7 +344,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -362,8 +362,8 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL SGER( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -378,9 +378,9 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYCOL.EQ.ICCOL ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -397,8 +397,8 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL SGER( MP, NQ, -TAULOC, V( IOFFV ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL SGER( MP, NQ, -TAULOC( 1 ), V( IOFFV ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -420,9 +420,9 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = MP+1
+ CALL SGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -440,7 +440,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL SGER( MP, NQ, -TAULOC, WORK, 1,
++ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -470,7 +470,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -479,7 +479,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -499,8 +499,8 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL SGER( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -515,18 +515,18 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( JJV )
+ CALL SGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MP+1
+ CALL SGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -546,8 +546,8 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL SGER( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -576,9 +576,9 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYROW.EQ.ICROW ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -596,7 +596,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFV.GT.0 .AND. IOFFC.GT.0 )
+- $ CALL SGER( MP, NQ, -TAULOC, WORK, 1,
++ $ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -619,9 +619,9 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = NQ+1
+ CALL SGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -639,7 +639,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL SGER( MP, NQ, -TAULOC, WORK( IPW ), 1,
++ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -665,7 +665,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL SGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -674,7 +674,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -692,8 +692,8 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL SGER( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1
++ $ , WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -718,18 +718,18 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( IIV )
+ CALL SGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQ+1
+ CALL SGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -748,8 +748,8 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL SGER( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ $ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -768,7 +768,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL SGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -777,7 +777,7 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -795,8 +795,8 @@ SUBROUTINE PSLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL SGER( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL SGER( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1, WORK,
++ $ 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pslarz.f b/SRC/pslarz.f
+index aa70db7..8901530 100644
+--- a/SRC/pslarz.f
++++ b/SRC/pslarz.f
+@@ -250,7 +250,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ IVCOL, IVROW, JJC1, JJC2, JJV, LDC, LDV, MPC2,
+ $ MPV, MYCOL, MYROW, NCC, NCV, NPCOL, NPROW,
+ $ NQC2, NQV, RDEST
+- REAL TAULOC
++ REAL TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, PB_TOPGET, PBSTRNV,
+@@ -369,7 +369,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -378,7 +378,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -401,9 +401,9 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL SAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL SAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL SGER( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL SGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -419,9 +419,9 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYCOL.EQ.ICCOL2 ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -444,11 +444,11 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL SAXPY( NQC2, -TAULOC, WORK,
++ $ CALL SAXPY( NQC2, -TAULOC( 1 ), WORK,
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL SGER( MPV, NQC2, -TAULOC, V( IOFFV ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL SGER( MPV, NQC2, -TAULOC( 1 ), V( IOFFV ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -470,9 +470,9 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = MPV+1
+ CALL SGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -495,10 +495,10 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL SAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL SAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL SGER( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL SGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -529,7 +529,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -538,7 +538,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -561,10 +561,10 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL SAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL SAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL SGER( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL SGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -579,18 +579,18 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( JJV )
+ CALL SGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MPV+1
+ CALL SGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -613,10 +613,10 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL SAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL SAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL SGER( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL SGER( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -645,9 +645,9 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYROW.EQ.ICROW2 ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -668,13 +668,13 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ ICCOL2 )
+ *
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL SAXPY( MPC2, -TAULOC, WORK, 1,
++ $ CALL SAXPY( MPC2, -TAULOC( 1 ), WORK, 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( MPC2.GT.0 .AND. NQV.GT.0 )
+- $ CALL SGER( MPC2, NQV, -TAULOC, WORK, 1,
++ $ CALL SGER( MPC2, NQV, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC2 ),
+ $ LDC )
+ END IF
+@@ -698,9 +698,9 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = NQV+1
+ CALL SGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -719,13 +719,13 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ),
+ $ RDEST, ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL SAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
+- $ C( IOFFC1 ), 1 )
++ $ CALL SAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL SGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL SGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -750,7 +750,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL SGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -759,7 +759,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -778,12 +778,12 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL SAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL SAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL SGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
++ CALL SGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -808,18 +808,18 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( IIV )
+ CALL SGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQV+1
+ CALL SGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -839,13 +839,13 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL SAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL SAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL SGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL SGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -864,7 +864,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL SGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -873,7 +873,7 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -892,13 +892,13 @@ SUBROUTINE PSLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL SAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL SAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL SGER( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL SGER( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pslawil.f b/SRC/pslawil.f
+index e04c16b..671e08e 100644
+--- a/SRC/pslawil.f
++++ b/SRC/pslawil.f
+@@ -120,10 +120,14 @@ SUBROUTINE PSLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ INTEGER CONTXT, DOWN, HBL, ICOL, IROW, JSRC, LDA, LEFT,
+ $ MODKM1, MYCOL, MYROW, NPCOL, NPROW, NUM, RIGHT,
+ $ RSRC, UP
+- REAL H11, H12, H21, H22, H33S, H44S, S, V1, V2, V3
++ REAL H22, H33S, H44S, S, V1, V2
+ * ..
+ * .. Local Arrays ..
+ REAL BUF( 4 )
++ REAL H11( 1 )
++ REAL H12( 1 )
++ REAL H21( 1 )
++ REAL V3( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, SGERV2D, SGESD2D, INFOG2L
+@@ -170,18 +174,18 @@ SUBROUTINE PSLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( NPCOL.GT.1 ) THEN
+ CALL SGERV2D( CONTXT, 1, 1, V3, 1, MYROW, LEFT )
+ ELSE
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ IF( NUM.GT.1 ) THEN
+ CALL SGERV2D( CONTXT, 4, 1, BUF, 4, UP, LEFT )
+- H11 = BUF( 1 )
+- H21 = BUF( 2 )
+- H12 = BUF( 3 )
++ H11( 1 ) = BUF( 1 )
++ H21( 1 ) = BUF( 2 )
++ H12( 1 ) = BUF( 3 )
+ H22 = BUF( 4 )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+ END IF
+ END IF
+@@ -214,20 +218,20 @@ SUBROUTINE PSLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( NUM.GT.1 ) THEN
+ CALL SGERV2D( CONTXT, 1, 1, H11, 1, UP, LEFT )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
+ END IF
+ IF( NPROW.GT.1 ) THEN
+ CALL SGERV2D( CONTXT, 1, 1, H12, 1, UP, MYCOL )
+ ELSE
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ END IF
+ IF( NPCOL.GT.1 ) THEN
+ CALL SGERV2D( CONTXT, 1, 1, H21, 1, MYROW, LEFT )
+ ELSE
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
+ END IF
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ END IF
+ IF( ( MYROW.NE.II ) .OR. ( MYCOL.NE.JJ ) )
+@@ -236,24 +240,24 @@ SUBROUTINE PSLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( MODKM1.GT.1 ) THEN
+ CALL INFOG2L( M+2, M+2, DESCA, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, RSRC, JSRC )
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ *
+- H44S = H44 - H11
+- H33S = H33 - H11
+- V1 = ( H33S*H44S-H43H34 ) / H21 + H12
+- V2 = H22 - H11 - H33S - H44S
+- S = ABS( V1 ) + ABS( V2 ) + ABS( V3 )
++ H44S = H44 - H11( 1 )
++ H33S = H33 - H11( 1 )
++ V1 = ( H33S*H44S-H43H34 ) / H21( 1 ) + H12( 1 )
++ V2 = H22 - H11( 1 ) - H33S - H44S
++ S = ABS( V1 ) + ABS( V2 ) + ABS( V3( 1 ) )
+ V1 = V1 / S
+ V2 = V2 / S
+- V3 = V3 / S
++ V3( 1 ) = V3( 1 ) / S
+ V( 1 ) = V1
+ V( 2 ) = V2
+- V( 3 ) = V3
++ V( 3 ) = V3( 1 )
+ *
+ RETURN
+ *
+diff --git a/SRC/psstebz.f b/SRC/psstebz.f
+index a8a2496..7e588a9 100644
+--- a/SRC/psstebz.f
++++ b/SRC/psstebz.f
+@@ -244,14 +244,14 @@ SUBROUTINE PSSTEBZ( ICTXT, RANGE, ORDER, N, VL, VU, IL, IU,
+ $ ITMP2, J, JB, K, LAST, LEXTRA, LREQ, MYCOL,
+ $ MYROW, NALPHA, NBETA, NCMP, NEIGINT, NEXT, NGL,
+ $ NGLOB, NGU, NINT, NPCOL, NPROW, OFFSET,
+- $ ONEDCONTEXT, P, PREV, REXTRA, RREQ, SELF,
+- $ TORECV
++ $ ONEDCONTEXT, P, PREV, REXTRA, RREQ, SELF
+ REAL ALPHA, ATOLI, BETA, BNORM, DRECV, DSEND, GL,
+ $ GU, INITVL, INITVU, LSAVE, MID, PIVMIN, RELTOL,
+ $ SAFEMN, TMP1, TMP2, TNORM, ULP
+ * ..
+ * .. Local Arrays ..
+ INTEGER IDUM( 5, 2 )
++ INTEGER TORECV( 1, 1 )
+ * ..
+ * .. Executable Statements ..
+ * This is just to keep ftnchek happy
+@@ -774,14 +774,14 @@ SUBROUTINE PSSTEBZ( ICTXT, RANGE, ORDER, N, VL, VU, IL, IU,
+ ELSE
+ CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', 1, 1, TORECV, 1, 0,
+ $ I-1 )
+- IF( TORECV.NE.0 ) THEN
+- CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV, 1, IWORK,
+- $ TORECV, 0, I-1 )
+- CALL SGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV, 1, WORK,
+- $ TORECV, 0, I-1 )
+- CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV, 1,
+- $ IWORK( N+1 ), TORECV, 0, I-1 )
+- DO 120 J = 1, TORECV
++ IF( TORECV( 1, 1 ).NE.0 ) THEN
++ CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV( 1, 1 ), 1,
++ $ IWORK, TORECV( 1, 1 ), 0, I-1 )
++ CALL SGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV( 1, 1 ), 1,
++ $ WORK, TORECV( 1, 1 ), 0, I-1 )
++ CALL IGEBR2D( ONEDCONTEXT, 'ALL', ' ', TORECV( 1, 1 ), 1,
++ $ IWORK( N+1 ), TORECV( 1, 1 ), 0, I-1 )
++ DO 120 J = 1, TORECV( 1, 1 )
+ W( IWORK( J ) ) = WORK( J )
+ IBLOCK( IWORK( J ) ) = IWORK( N+J )
+ 120 CONTINUE
+diff --git a/SRC/pstrord.f b/SRC/pstrord.f
+index 3562242..5cdb549 100644
+--- a/SRC/pstrord.f
++++ b/SRC/pstrord.f
+@@ -328,12 +328,13 @@ SUBROUTINE PSTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ $ EAST, WEST, ILOC4, SOUTH, NORTH, INDXS,
+ $ ITT, JTT, ILEN, DLEN, INDXE, TRSRC1, TCSRC1,
+ $ TRSRC2, TCSRC2, ILOS, DIR, TLIHI, TLILO, TLSEL,
+- $ ROUND, LAST, WIN0S, WIN0E, WINE, MMAX, MMIN
++ $ ROUND, LAST, WIN0S, WIN0E, WINE
+ REAL ELEM, ELEM1, ELEM2, ELEM3, ELEM4, SN, CS, TMP,
+ $ ELEM5
+ * ..
+ * .. Local Arrays ..
+- INTEGER IBUFF( 8 ), IDUM1( 1 ), IDUM2( 1 )
++ INTEGER IBUFF( 8 ), IDUM1( 1 ), IDUM2( 1 ), MMAX( 1 ),
++ $ MMIN( 1 ), INFODUM( 1 )
+ * ..
+ * .. External Functions ..
+ LOGICAL LSAME
+@@ -483,16 +484,16 @@ SUBROUTINE PSTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ END IF
+ IF( SELECT(K).NE.0 ) M = M + 1
+ 10 CONTINUE
+- MMAX = M
+- MMIN = M
++ MMAX( 1 ) = M
++ MMIN( 1 ) = M
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, MMAX, 1, -1,
+ $ -1, -1, -1, -1 )
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMN2D( ICTXT, 'All', TOP, 1, 1, MMIN, 1, -1,
+ $ -1, -1, -1, -1 )
+- IF( MMAX.GT.MMIN ) THEN
+- M = MMAX
++ IF( MMAX( 1 ).GT.MMIN( 1 ) ) THEN
++ M = MMAX( 1 )
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMX2D( ICTXT, 'All', TOP, N, 1, SELECT, N,
+ $ -1, -1, -1, -1, -1 )
+@@ -520,9 +521,11 @@ SUBROUTINE PSTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ *
+ * Global maximum on info.
+ *
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1, -1, -1,
+- $ -1, -1 )
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1, -1,
++ $ -1, -1, -1 )
++ INFO = INFODUM( 1 )
++ END IF
+ *
+ * Return if some argument is incorrect.
+ *
+@@ -1576,9 +1579,11 @@ SUBROUTINE PSTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * experienced a failure in the reordering.
+ *
+ MYIERR = IERR
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, IERR, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ IERR = INFODUM( 1 )
++ END IF
+ *
+ IF( IERR.NE.0 ) THEN
+ *
+@@ -1586,9 +1591,11 @@ SUBROUTINE PSTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * to swap.
+ *
+ IF( MYIERR.NE.0 ) INFO = MAX(1,I+KKS-1)
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ INFO = INFODUM( 1 )
++ END IF
+ GO TO 300
+ END IF
+ *
+@@ -3245,9 +3252,11 @@ SUBROUTINE PSTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * experienced a failure in the reordering.
+ *
+ MYIERR = IERR
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, IERR, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ IERR = INFODUM( 1 )
++ END IF
+ *
+ IF( IERR.NE.0 ) THEN
+ *
+@@ -3255,9 +3264,11 @@ SUBROUTINE PSTRORD( COMPQ, SELECT, PARA, N, T, IT, JT,
+ * to swap.
+ *
+ IF( MYIERR.NE.0 ) INFO = MAX(1,I+KKS-1)
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1,
+ $ -1, -1, -1, -1 )
++ INFO = INFODUM( 1 )
++ END IF
+ GO TO 300
+ END IF
+ *
+diff --git a/SRC/pstrsen.f b/SRC/pstrsen.f
+index 6219bdb..1922e8f 100644
+--- a/SRC/pstrsen.f
++++ b/SRC/pstrsen.f
+@@ -354,13 +354,15 @@ SUBROUTINE PSTRSEN( JOB, COMPQ, SELECT, PARA, N, T, IT, JT,
+ LOGICAL LQUERY, WANTBH, WANTQ, WANTS, WANTSP
+ INTEGER ICOFFT12, ICTXT, IDUM1, IDUM2, IERR, ILOC1,
+ $ IPW1, ITER, ITT, JLOC1, JTT, K, LIWMIN, LLDT,
+- $ LLDQ, LWMIN, MMAX, MMIN, MYROW, MYCOL, N1, N2,
++ $ LLDQ, LWMIN, MYROW, MYCOL, N1, N2,
+ $ NB, NOEXSY, NPCOL, NPROCS, NPROW, SPACE,
+ $ T12ROWS, T12COLS, TCOLS, TCSRC, TROWS, TRSRC,
+ $ WRK1, IWRK1, WRK2, IWRK2, WRK3, IWRK3
+- REAL DPDUM1, ELEM, EST, SCALE, RNORM
++ REAL ELEM, EST, SCALE, RNORM
+ * .. Local Arrays ..
+- INTEGER DESCT12( DLEN_ ), MBNB2( 2 )
++ INTEGER DESCT12( DLEN_ ), MBNB2( 2 ), MMAX( 1 ),
++ $ MMIN( 1 ), INFODUM( 1 )
++ REAL DPDUM1( 1 )
+ * ..
+ * .. External Functions ..
+ LOGICAL LSAME
+@@ -521,16 +523,16 @@ SUBROUTINE PSTRSEN( JOB, COMPQ, SELECT, PARA, N, T, IT, JT,
+ END IF
+ IF( SELECT(K) ) M = M + 1
+ 10 CONTINUE
+- MMAX = M
+- MMIN = M
++ MMAX( 1 ) = M
++ MMIN( 1 ) = M
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, MMAX, 1, -1,
+ $ -1, -1, -1, -1 )
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMN2D( ICTXT, 'All', TOP, 1, 1, MMIN, 1, -1,
+ $ -1, -1, -1, -1 )
+- IF( MMAX.GT.MMIN ) THEN
+- M = MMAX
++ IF( MMAX( 1 ).GT.MMIN( 1 ) ) THEN
++ M = MMAX( 1 )
+ IF( NPROCS.GT.1 )
+ $ CALL IGAMX2D( ICTXT, 'All', TOP, N, 1, IWORK, N,
+ $ -1, -1, -1, -1, -1 )
+@@ -602,9 +604,11 @@ SUBROUTINE PSTRSEN( JOB, COMPQ, SELECT, PARA, N, T, IT, JT,
+ *
+ * Global maximum on info
+ *
+- IF( NPROCS.GT.1 )
+- $ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFO, 1, -1, -1, -1,
++ IF( NPROCS.GT.1 ) THEN
++ CALL IGAMX2D( ICTXT, 'All', TOP, 1, 1, INFODUM, 1, -1, -1, -1,
+ $ -1, -1 )
++ INFO = INFODUM( 1 )
++ END IF
+ *
+ * Return if some argument is incorrect
+ *
+diff --git a/SRC/pzlarf.f b/SRC/pzlarf.f
+index df65912..7bff287 100644
+--- a/SRC/pzlarf.f
++++ b/SRC/pzlarf.f
+@@ -242,7 +242,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ $ IOFFV, IPW, IROFF, IVCOL, IVROW, JJC, JJV, LDC,
+ $ LDV, MYCOL, MYROW, MP, NCC, NCV, NPCOL, NPROW,
+ $ NQ, RDEST
+- COMPLEX*16 TAULOC
++ COMPLEX*16 TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, PB_TOPGET, PBZTRNV,
+@@ -336,7 +336,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -345,7 +345,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -363,8 +363,8 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -379,9 +379,9 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYCOL.EQ.ICCOL ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -398,7 +398,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, V( IOFFV ), 1,
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), V( IOFFV ), 1,
+ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -421,9 +421,9 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = MP+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -441,7 +441,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK, 1,
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -471,7 +471,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -480,7 +480,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -500,8 +500,8 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL ZGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -516,18 +516,18 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( JJV )
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MP+1
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -547,8 +547,8 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL ZGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ $ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -577,9 +577,9 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYROW.EQ.ICROW ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -597,7 +597,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFV.GT.0 .AND. IOFFC.GT.0 )
+- $ CALL ZGERC( MP, NQ, -TAULOC, WORK, 1,
++ $ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC ),
+ $ LDC )
+ END IF
+@@ -621,9 +621,9 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = NQ+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -641,8 +641,8 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -667,7 +667,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -676,7 +676,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -694,8 +694,8 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -720,18 +720,18 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( IIV )
+ CALL ZGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQ+1
+ CALL ZGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -750,8 +750,8 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( IOFFC.GT.0 )
+- $ CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ $ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -770,7 +770,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -779,7 +779,7 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -797,8 +797,8 @@ SUBROUTINE PZLARF( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pzlarfc.f b/SRC/pzlarfc.f
+index eb469fc..ddd7ec6 100644
+--- a/SRC/pzlarfc.f
++++ b/SRC/pzlarfc.f
+@@ -242,7 +242,7 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ $ IOFFV, IPW, IROFF, IVCOL, IVROW, JJC, JJV, LDC,
+ $ LDV, MYCOL, MYROW, MP, NCC, NCV, NPCOL, NPROW,
+ $ NQ, RDEST
+- COMPLEX*16 TAULOC
++ COMPLEX*16 TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, PB_TOPGET, PBZTRNV,
+@@ -336,17 +336,17 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAULOC, 1, IVROW, MYCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -364,8 +364,8 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -380,9 +380,9 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYCOL.EQ.ICCOL ) THEN
+ *
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -399,7 +399,7 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, V( IOFFV ), 1,
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), V( IOFFV ), 1,
+ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -422,9 +422,9 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = MP+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -442,7 +442,7 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK, 1,
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -472,17 +472,17 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, TAULOC,
+ $ 1, IVROW, MYCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -500,8 +500,8 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ), 1,
+- $ C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -516,18 +516,18 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( JJV )
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ IPW = MP+1
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -545,8 +545,8 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - v * w'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK, 1, WORK( IPW ), 1,
+- $ C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -575,9 +575,9 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ IF( MYROW.EQ.ICROW ) THEN
+ *
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -594,7 +594,7 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK, 1,
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC ), LDC )
+ END IF
+ *
+@@ -617,9 +617,9 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ IPW = NQ+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -637,8 +637,8 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -663,17 +663,17 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC,
+ $ 1, MYROW, IVCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -691,8 +691,8 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+@@ -716,18 +716,18 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ WORK(IPW) = TAU( IIV )
+ CALL ZGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ IPW = NQ+1
+ CALL ZGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -745,8 +745,8 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ ELSE
+@@ -765,17 +765,17 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC, 1,
+ $ MYROW, IVCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -793,8 +793,8 @@ SUBROUTINE PZLARFC( SIDE, M, N, V, IV, JV, DESCV, INCV, TAU,
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MP, NQ, -TAULOC, WORK( IPW ), 1, WORK, 1,
+- $ C( IOFFC ), LDC )
++ CALL ZGERC( MP, NQ, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pzlarz.f b/SRC/pzlarz.f
+index fefc133..abf6288 100644
+--- a/SRC/pzlarz.f
++++ b/SRC/pzlarz.f
+@@ -251,7 +251,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ IVCOL, IVROW, JJC1, JJC2, JJV, LDC, LDV, MPC2,
+ $ MPV, MYCOL, MYROW, NCC, NCV, NPCOL, NPROW,
+ $ NQC2, NQV, RDEST
+- COMPLEX*16 TAULOC
++ COMPLEX*16 TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, PB_TOPGET, PBZTRNV,
+@@ -370,7 +370,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -379,7 +379,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -402,9 +402,9 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -420,9 +420,9 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYCOL.EQ.ICCOL2 ) THEN
+ *
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -445,11 +445,11 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK,
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK,
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, V( IOFFV ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), V( IOFFV ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -471,9 +471,9 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = MPV+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -496,10 +496,10 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -530,7 +530,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+@@ -539,7 +539,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -562,10 +562,10 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -580,18 +580,18 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( JJV )
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+ IPW = MPV+1
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -614,10 +614,10 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -646,9 +646,9 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYROW.EQ.ICROW2 ) THEN
+ *
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -669,13 +669,13 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ ICCOL2 )
+ *
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK, 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK, 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+ IF( MPC2.GT.0 .AND. NQV.GT.0 )
+- $ CALL ZGERC( MPC2, NQV, -TAULOC, WORK, 1,
++ $ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC2 ),
+ $ LDC )
+ END IF
+@@ -699,9 +699,9 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = NQV+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -720,13 +720,14 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ),
+ $ RDEST, ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
+- $ C( IOFFC1 ), 1 )
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ),
++ $ WORK( IPW ), 1, WORK, 1,
++ $ C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -751,7 +752,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -760,7 +761,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -779,13 +780,13 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -809,18 +810,18 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( IIV )
+ CALL ZGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = TAU( IIV )
++ TAULOC( 1 ) = TAU( IIV )
+ *
+ ELSE
+ *
+ IPW = NQV+1
+ CALL ZGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = WORK( IPW )
++ TAULOC( 1 ) = WORK( IPW )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -840,13 +841,13 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -865,7 +866,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = TAU( JJV )
++ TAULOC( 1 ) = TAU( JJV )
+ *
+ ELSE
+ *
+@@ -874,7 +875,7 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -893,13 +894,13 @@ SUBROUTINE PZLARZ( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pzlarzc.f b/SRC/pzlarzc.f
+index 936caec..2c574ff 100644
+--- a/SRC/pzlarzc.f
++++ b/SRC/pzlarzc.f
+@@ -251,7 +251,7 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ IVCOL, IVROW, JJC1, JJC2, JJV, LDC, LDV, MPC2,
+ $ MPV, MYCOL, MYROW, NCC, NCV, NPCOL, NPROW,
+ $ NQC2, NQV, RDEST
+- COMPLEX*16 TAULOC
++ COMPLEX*16 TAULOC( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, PB_TOPGET, PBZTRNV,
+@@ -370,17 +370,17 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAULOC, 1, IVROW, MYCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -403,9 +403,9 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -421,9 +421,9 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYCOL.EQ.ICCOL2 ) THEN
+ *
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -446,11 +446,11 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK,
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK,
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, V( IOFFV ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), V( IOFFV ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -472,9 +472,9 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = MPV+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, MYROW,
+ $ IVCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -497,10 +497,10 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ),
+ $ LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1,
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
+ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -531,17 +531,17 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1,
+ $ TAU( IIV ), 1 )
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, TAULOC,
+ $ 1, IVROW, MYCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -564,10 +564,10 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -582,18 +582,18 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( JJV )
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ IPW = MPV+1
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ROWBTOP, IPW, 1, WORK,
+ $ IPW, MYROW, IVCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C )' * v
+ *
+@@ -616,10 +616,10 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ * sub( C ) := sub( C ) - v * w'
+ *
+ IF( MYROW.EQ.ICROW1 )
+- $ CALL ZAXPY( NQC2, -TAULOC, WORK( IPW ),
++ $ CALL ZAXPY( NQC2, -TAULOC( 1 ), WORK( IPW ),
+ $ MAX( 1, NQC2 ), C( IOFFC1 ), LDC )
+- CALL ZGERC( MPV, NQC2, -TAULOC, WORK, 1, WORK( IPW ),
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPV, NQC2, -TAULOC( 1 ), WORK, 1,
++ $ WORK( IPW ), 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -648,9 +648,9 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ IF( MYROW.EQ.ICROW2 ) THEN
+ *
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -671,12 +671,12 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ ICCOL2 )
+ *
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK, 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK, 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK, 1,
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK, 1,
+ $ V( IOFFV ), LDV, C( IOFFC2 ), LDC )
+ END IF
+ *
+@@ -699,9 +699,9 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ IPW = NQV+1
+ CALL ZGERV2D( ICTXT, IPW, 1, WORK, IPW, IVROW,
+ $ MYCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -720,13 +720,14 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ),
+ $ RDEST, ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
+- $ C( IOFFC1 ), 1 )
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ),
++ $ WORK( IPW ), 1, WORK, 1,
++ $ C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -751,17 +752,17 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1,
+ $ TAU( JJV ), 1 )
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC,
+ $ 1, MYROW, IVCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -780,13 +781,13 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1,
+- $ WORK, 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ),
++ $ 1, WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+@@ -810,18 +811,18 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ WORK( IPW ) = TAU( IIV )
+ CALL ZGEBS2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW )
+- TAULOC = DCONJG( TAU( IIV ) )
++ TAULOC( 1 ) = DCONJG( TAU( IIV ) )
+ *
+ ELSE
+ *
+ IPW = NQV+1
+ CALL ZGEBR2D( ICTXT, 'Columnwise', COLBTOP, IPW, 1,
+ $ WORK, IPW, IVROW, MYCOL )
+- TAULOC = DCONJG( WORK( IPW ) )
++ TAULOC( 1 ) = DCONJG( WORK( IPW ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -841,13 +842,13 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ ELSE
+@@ -866,17 +867,17 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ *
+ CALL ZGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, TAU( JJV ),
+ $ 1 )
+- TAULOC = DCONJG( TAU( JJV ) )
++ TAULOC( 1 ) = DCONJG( TAU( JJV ) )
+ *
+ ELSE
+ *
+ CALL ZGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, TAULOC, 1,
+ $ MYROW, IVCOL )
+- TAULOC = DCONJG( TAULOC )
++ TAULOC( 1 ) = DCONJG( TAULOC( 1 ) )
+ *
+ END IF
+ *
+- IF( TAULOC.NE.ZERO ) THEN
++ IF( TAULOC( 1 ).NE.ZERO ) THEN
+ *
+ * w := sub( C ) * v
+ *
+@@ -895,13 +896,13 @@ SUBROUTINE PZLARZC( SIDE, M, N, L, V, IV, JV, DESCV, INCV, TAU, C,
+ $ WORK( IPW ), MAX( 1, MPC2 ), RDEST,
+ $ ICCOL2 )
+ IF( MYCOL.EQ.ICCOL1 )
+- $ CALL ZAXPY( MPC2, -TAULOC, WORK( IPW ), 1,
++ $ CALL ZAXPY( MPC2, -TAULOC( 1 ), WORK( IPW ), 1,
+ $ C( IOFFC1 ), 1 )
+ *
+ * sub( C ) := sub( C ) - w * v'
+ *
+- CALL ZGERC( MPC2, NQV, -TAULOC, WORK( IPW ), 1, WORK,
+- $ 1, C( IOFFC2 ), LDC )
++ CALL ZGERC( MPC2, NQV, -TAULOC( 1 ), WORK( IPW ), 1,
++ $ WORK, 1, C( IOFFC2 ), LDC )
+ END IF
+ *
+ END IF
+diff --git a/SRC/pzlattrs.f b/SRC/pzlattrs.f
+index 819e476..5a54209 100644
+--- a/SRC/pzlattrs.f
++++ b/SRC/pzlattrs.f
+@@ -271,8 +271,9 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ $ JINC, JLAST, LDA, LDX, MB, MYCOL, MYROW, NB,
+ $ NPCOL, NPROW, RSRC
+ DOUBLE PRECISION BIGNUM, GROW, REC, SMLNUM, TJJ, TMAX, TSCAL,
+- $ XBND, XJ, XMAX
++ $ XBND, XJ
+ COMPLEX*16 CSUMJ, TJJS, USCAL, XJTMP, ZDUM
++ DOUBLE PRECISION XMAX( 1 )
+ * ..
+ * .. External Functions ..
+ LOGICAL LSAME
+@@ -391,11 +392,11 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ * Compute a bound on the computed solution vector to see if the
+ * Level 2 PBLAS routine PZTRSV can be used.
+ *
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ CALL PZAMAX( N, ZDUM, IMAX, X, IX, JX, DESCX, 1 )
+- XMAX = CABS2( ZDUM )
++ XMAX( 1 ) = CABS2( ZDUM )
+ CALL DGSUM2D( CONTXT, 'Row', ' ', 1, 1, XMAX, 1, -1, -1 )
+- XBND = XMAX
++ XBND = XMAX( 1 )
+ *
+ IF( NOTRAN ) THEN
+ *
+@@ -590,16 +591,16 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ *
+ * Use a Level 1 PBLAS solve, scaling intermediate results.
+ *
+- IF( XMAX.GT.BIGNUM*HALF ) THEN
++ IF( XMAX( 1 ).GT.BIGNUM*HALF ) THEN
+ *
+ * Scale X so that its components are less than or equal to
+ * BIGNUM in absolute value.
+ *
+- SCALE = ( BIGNUM*HALF ) / XMAX
++ SCALE = ( BIGNUM*HALF ) / XMAX( 1 )
+ CALL PZDSCAL( N, SCALE, X, IX, JX, DESCX, 1 )
+- XMAX = BIGNUM
++ XMAX( 1 ) = BIGNUM
+ ELSE
+- XMAX = XMAX*TWO
++ XMAX( 1 ) = XMAX( 1 )*TWO
+ END IF
+ *
+ IF( NOTRAN ) THEN
+@@ -651,7 +652,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ * X( J ) = ZLADIV( X( J ), TJJS )
+@@ -682,7 +683,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ * X( J ) = ZLADIV( X( J ), TJJS )
+ * XJ = CABS1( X( J ) )
+@@ -706,7 +707,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ XJTMP = CONE
+ XJ = ONE
+ SCALE = ZERO
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ END IF
+ 90 CONTINUE
+ *
+@@ -715,7 +716,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ *
+ IF( XJ.GT.ONE ) THEN
+ REC = ONE / XJ
+- IF( CNORM( J ).GT.( BIGNUM-XMAX )*REC ) THEN
++ IF( CNORM( J ).GT.( BIGNUM-XMAX( 1 ) )*REC ) THEN
+ *
+ * Scale x by 1/(2*abs(x(j))).
+ *
+@@ -724,7 +725,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+ END IF
+- ELSE IF( XJ*CNORM( J ).GT.( BIGNUM-XMAX ) ) THEN
++ ELSE IF( XJ*CNORM( J ).GT.( BIGNUM-XMAX( 1 ) ) ) THEN
+ *
+ * Scale x by 1/2.
+ *
+@@ -743,7 +744,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZAXPY( J-1, ZDUM, A, IA, JA+J-1, DESCA, 1, X,
+ $ IX, JX, DESCX, 1 )
+ CALL PZAMAX( J-1, ZDUM, IMAX, X, IX, JX, DESCX, 1 )
+- XMAX = CABS1( ZDUM )
++ XMAX( 1 ) = CABS1( ZDUM )
+ CALL DGSUM2D( CONTXT, 'Row', ' ', 1, 1, XMAX, 1,
+ $ -1, -1 )
+ END IF
+@@ -757,7 +758,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZAXPY( N-J, ZDUM, A, IA+J, JA+J-1, DESCA, 1,
+ $ X, IX+J, JX, DESCX, 1 )
+ CALL PZAMAX( N-J, ZDUM, I, X, IX+J, JX, DESCX, 1 )
+- XMAX = CABS1( ZDUM )
++ XMAX( 1 ) = CABS1( ZDUM )
+ CALL DGSUM2D( CONTXT, 'Row', ' ', 1, 1, XMAX, 1,
+ $ -1, -1 )
+ END IF
+@@ -785,7 +786,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ END IF
+ XJ = CABS1( XJTMP )
+ USCAL = DCMPLX( TSCAL )
+- REC = ONE / MAX( XMAX, ONE )
++ REC = ONE / MAX( XMAX( 1 ), ONE )
+ IF( CNORM( J ).GT.( BIGNUM-XJ )*REC ) THEN
+ *
+ * If x(j) could overflow, scale x by 1/(2*XMAX).
+@@ -820,7 +821,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ *
+@@ -924,7 +925,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ * X( J ) = ZLADIV( X( J ), TJJS )
+@@ -945,7 +946,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ * X( J ) = ZLADIV( X( J ), TJJS )
+ XJTMP = ZLADIV( XJTMP, TJJS )
+@@ -966,7 +967,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ END IF
+ XJTMP = CONE
+ SCALE = ZERO
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ END IF
+ 110 CONTINUE
+ ELSE
+@@ -981,7 +982,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ X( IROWX ) = XJTMP
+ END IF
+ END IF
+- XMAX = MAX( XMAX, CABS1( XJTMP ) )
++ XMAX( 1 ) = MAX( XMAX( 1 ), CABS1( XJTMP ) )
+ 120 CONTINUE
+ *
+ ELSE
+@@ -1004,7 +1005,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ END IF
+ XJ = CABS1( XJTMP )
+ USCAL = TSCAL
+- REC = ONE / MAX( XMAX, ONE )
++ REC = ONE / MAX( XMAX( 1 ), ONE )
+ IF( CNORM( J ).GT.( BIGNUM-XJ )*REC ) THEN
+ *
+ * If x(j) could overflow, scale x by 1/(2*XMAX).
+@@ -1039,7 +1040,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ *
+@@ -1145,7 +1146,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ END IF
+ * X( J ) = ZLADIV( X( J ), TJJS )
+@@ -1164,7 +1165,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ CALL PZDSCAL( N, REC, X, IX, JX, DESCX, 1 )
+ XJTMP = XJTMP*REC
+ SCALE = SCALE*REC
+- XMAX = XMAX*REC
++ XMAX( 1 ) = XMAX( 1 )*REC
+ END IF
+ * X( J ) = ZLADIV( X( J ), TJJS )
+ XJTMP = ZLADIV( XJTMP, TJJS )
+@@ -1181,7 +1182,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ $ X( IROWX ) = CONE
+ XJTMP = CONE
+ SCALE = ZERO
+- XMAX = ZERO
++ XMAX( 1 ) = ZERO
+ END IF
+ 130 CONTINUE
+ ELSE
+@@ -1194,7 +1195,7 @@ SUBROUTINE PZLATTRS( UPLO, TRANS, DIAG, NORMIN, N, A, IA, JA,
+ IF( ( MYROW.EQ.ITMP1X ) .AND. ( MYCOL.EQ.ITMP2X ) )
+ $ X( IROWX ) = XJTMP
+ END IF
+- XMAX = MAX( XMAX, CABS1( XJTMP ) )
++ XMAX( 1 ) = MAX( XMAX( 1 ), CABS1( XJTMP ) )
+ 140 CONTINUE
+ END IF
+ SCALE = SCALE / TSCAL
+diff --git a/SRC/pzlawil.f b/SRC/pzlawil.f
+index e89a9a3..7e502ef 100644
+--- a/SRC/pzlawil.f
++++ b/SRC/pzlawil.f
+@@ -124,11 +124,10 @@ SUBROUTINE PZLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ $ MODKM1, MYCOL, MYROW, NPCOL, NPROW, NUM, RIGHT,
+ $ RSRC, UP
+ DOUBLE PRECISION S
+- COMPLEX*16 CDUM, H11, H12, H21, H22, H33S, H44S, V1, V2,
+- $ V3
++ COMPLEX*16 CDUM, H22, H33S, H44S, V1, V2
+ * ..
+ * .. Local Arrays ..
+- COMPLEX*16 BUF( 4 )
++ COMPLEX*16 BUF( 4 ), H11( 1 ), H12( 1 ), H21( 1 ), V3( 1 )
+ * ..
+ * .. External Subroutines ..
+ EXTERNAL BLACS_GRIDINFO, INFOG2L, ZGERV2D, ZGESD2D
+@@ -181,18 +180,18 @@ SUBROUTINE PZLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( NPCOL.GT.1 ) THEN
+ CALL ZGERV2D( CONTXT, 1, 1, V3, 1, MYROW, LEFT )
+ ELSE
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ IF( NUM.GT.1 ) THEN
+ CALL ZGERV2D( CONTXT, 4, 1, BUF, 4, UP, LEFT )
+- H11 = BUF( 1 )
+- H21 = BUF( 2 )
+- H12 = BUF( 3 )
++ H11( 1 ) = BUF( 1 )
++ H21( 1 ) = BUF( 2 )
++ H12( 1 ) = BUF( 3 )
+ H22 = BUF( 4 )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+ END IF
+ END IF
+@@ -225,20 +224,20 @@ SUBROUTINE PZLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( NUM.GT.1 ) THEN
+ CALL ZGERV2D( CONTXT, 1, 1, H11, 1, UP, LEFT )
+ ELSE
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
+ END IF
+ IF( NPROW.GT.1 ) THEN
+ CALL ZGERV2D( CONTXT, 1, 1, H12, 1, UP, MYCOL )
+ ELSE
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ END IF
+ IF( NPCOL.GT.1 ) THEN
+ CALL ZGERV2D( CONTXT, 1, 1, H21, 1, MYROW, LEFT )
+ ELSE
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
+ END IF
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ END IF
+ IF( ( MYROW.NE.II ) .OR. ( MYCOL.NE.JJ ) )
+@@ -247,24 +246,24 @@ SUBROUTINE PZLAWIL( II, JJ, M, A, DESCA, H44, H33, H43H34, V )
+ IF( MODKM1.GT.1 ) THEN
+ CALL INFOG2L( M+2, M+2, DESCA, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, RSRC, JSRC )
+- H11 = A( ( ICOL-3 )*LDA+IROW-2 )
+- H21 = A( ( ICOL-3 )*LDA+IROW-1 )
+- H12 = A( ( ICOL-2 )*LDA+IROW-2 )
++ H11( 1 ) = A( ( ICOL-3 )*LDA+IROW-2 )
++ H21( 1 ) = A( ( ICOL-3 )*LDA+IROW-1 )
++ H12( 1 ) = A( ( ICOL-2 )*LDA+IROW-2 )
+ H22 = A( ( ICOL-2 )*LDA+IROW-1 )
+- V3 = A( ( ICOL-2 )*LDA+IROW )
++ V3( 1 ) = A( ( ICOL-2 )*LDA+IROW )
+ END IF
+ *
+- H44S = H44 - H11
+- H33S = H33 - H11
+- V1 = ( H33S*H44S-H43H34 ) / H21 + H12
+- V2 = H22 - H11 - H33S - H44S
+- S = CABS1( V1 ) + CABS1( V2 ) + CABS1( V3 )
++ H44S = H44 - H11( 1 )
++ H33S = H33 - H11( 1 )
++ V1 = ( H33S*H44S-H43H34 ) / H21( 1 ) + H12( 1 )
++ V2 = H22 - H11( 1 ) - H33S - H44S
++ S = CABS1( V1 ) + CABS1( V2 ) + CABS1( V3( 1 ) )
+ V1 = V1 / S
+ V2 = V2 / S
+- V3 = V3 / S
++ V3( 1 ) = V3( 1 ) / S
+ V( 1 ) = V1
+ V( 2 ) = V2
+- V( 3 ) = V3
++ V( 3 ) = V3( 1 )
+ *
+ RETURN
+ *
+diff --git a/SRC/pztrevc.f b/SRC/pztrevc.f
+index 0536475..3b27286 100644
+--- a/SRC/pztrevc.f
++++ b/SRC/pztrevc.f
+@@ -218,11 +218,12 @@ SUBROUTINE PZTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ $ ITMP2, J, K, KI, LDT, LDVL, LDVR, LDW, MB,
+ $ MYCOL, MYROW, NB, NPCOL, NPROW, RSRC
+ REAL SELF
+- DOUBLE PRECISION OVFL, REMAXD, SCALE, SMIN, SMLNUM, ULP, UNFL
++ DOUBLE PRECISION OVFL, REMAXD, SCALE, SMLNUM, ULP, UNFL
+ COMPLEX*16 CDUM, REMAXC, SHIFT
+ * ..
+ * .. Local Arrays ..
+ INTEGER DESCW( DLEN_ )
++ DOUBLE PRECISION SMIN( 1 )
+ * ..
+ * .. External Functions ..
+ LOGICAL LSAME
+@@ -355,13 +356,13 @@ SUBROUTINE PZTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ $ GO TO 70
+ END IF
+ *
+- SMIN = ZERO
++ SMIN( 1 ) = ZERO
+ SHIFT = CZERO
+ CALL INFOG2L( KI, KI, DESCT, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, ITMP1, ITMP2 )
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ SHIFT = T( ( ICOL-1 )*LDT+IROW )
+- SMIN = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
++ SMIN( 1 ) = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
+ END IF
+ CALL DGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SMIN, 1, -1, -1 )
+ CALL ZGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SHIFT, 1, -1, -1 )
+@@ -396,8 +397,9 @@ SUBROUTINE PZTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ T( ( ICOL-1 )*LDT+IROW ) = T( ( ICOL-1 )*LDT+IROW ) -
+ $ SHIFT
+- IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN ) THEN
+- T( ( ICOL-1 )*LDT+IROW ) = DCMPLX( SMIN )
++ IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN( 1 ) )
++ $ THEN
++ T( ( ICOL-1 )*LDT+IROW ) = DCMPLX( SMIN( 1 ) )
+ END IF
+ END IF
+ 50 CONTINUE
+@@ -467,13 +469,13 @@ SUBROUTINE PZTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ $ GO TO 110
+ END IF
+ *
+- SMIN = ZERO
++ SMIN( 1 ) = ZERO
+ SHIFT = CZERO
+ CALL INFOG2L( KI, KI, DESCT, NPROW, NPCOL, MYROW, MYCOL,
+ $ IROW, ICOL, ITMP1, ITMP2 )
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ SHIFT = T( ( ICOL-1 )*LDT+IROW )
+- SMIN = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
++ SMIN( 1 ) = MAX( ULP*( CABS1( SHIFT ) ), SMLNUM )
+ END IF
+ CALL DGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SMIN, 1, -1, -1 )
+ CALL ZGSUM2D( CONTXT, 'ALL', ' ', 1, 1, SHIFT, 1, -1, -1 )
+@@ -507,8 +509,8 @@ SUBROUTINE PZTREVC( SIDE, HOWMNY, SELECT, N, T, DESCT, VL, DESCVL,
+ IF( ( MYROW.EQ.ITMP1 ) .AND. ( MYCOL.EQ.ITMP2 ) ) THEN
+ T( ( ICOL-1 )*LDT+IROW ) = T( ( ICOL-1 )*LDT+IROW ) -
+ $ SHIFT
+- IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN )
+- $ T( ( ICOL-1 )*LDT+IROW ) = DCMPLX( SMIN )
++ IF( CABS1( T( ( ICOL-1 )*LDT+IROW ) ).LT.SMIN( 1 ) )
++ $ T( ( ICOL-1 )*LDT+IROW ) = DCMPLX( SMIN( 1 ) )
+ END IF
+ 90 CONTINUE
+ *
+
+From 189c84001bcd564296a475c5c757afc9f337e828 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tiziano=20M=C3=BCller?= <tiziano.mueller@chem.uzh.ch>
+Date: Thu, 25 Jun 2020 18:37:34 +0200
+Subject: [PATCH] use -std=legacy for tests with GCC-10+
+
+---
+ BLACS/TESTING/CMakeLists.txt | 10 +++++++---
+ PBLAS/TESTING/CMakeLists.txt | 7 ++++---
+ PBLAS/TIMING/CMakeLists.txt | 5 +++--
+ TESTING/EIG/CMakeLists.txt | 3 +++
+ TESTING/LIN/CMakeLists.txt | 4 ++++
+ 5 files changed, 21 insertions(+), 8 deletions(-)
+
+diff --git a/BLACS/TESTING/CMakeLists.txt b/BLACS/TESTING/CMakeLists.txt
+index d8846b5..4e91ac2 100644
+--- a/BLACS/TESTING/CMakeLists.txt
++++ b/BLACS/TESTING/CMakeLists.txt
+@@ -1,10 +1,14 @@
+-set(FTestObj
++set(FTestObj
+ blacstest.f btprim.f tools.f)
+
++if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
++ set_source_files_properties(blacstest.f PROPERTIES COMPILE_FLAGS "-std=legacy")
++endif()
++
+ add_executable(xFbtest ${FTestObj})
+ target_link_libraries(xFbtest scalapack)
+
+-set(CTestObj
++set(CTestObj
+ Cbt.c)
+
+ set_property(
+@@ -46,4 +50,4 @@ add_test(xFbtest
+ -DRUNTIMEDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
+ -DSOURCEDIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/runtest.cmake
+- )
+\ No newline at end of file
++ )
+diff --git a/PBLAS/TESTING/CMakeLists.txt b/PBLAS/TESTING/CMakeLists.txt
+index e60f5e4..ee77091 100644
+--- a/PBLAS/TESTING/CMakeLists.txt
++++ b/PBLAS/TESTING/CMakeLists.txt
+@@ -10,7 +10,7 @@ set (zpbtcom pzblastst.f dlamch.f ${pbtcom})
+
+ set_property(
+ SOURCE ${PblasErrorHandler}
+- APPEND PROPERTY COMPILE_DEFINITIONS TestingPblas
++ APPEND PROPERTY COMPILE_DEFINITIONS TestingPblas
+ )
+
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${SCALAPACK_BINARY_DIR}/PBLAS/TESTING)
+@@ -74,5 +74,6 @@ add_test(dpb3tst ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ./dpb3tst)
+ add_test(cpb3tst ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ./cpb3tst)
+ add_test(zpb3tst ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ./zpb3tst)
+
+-
+-
++if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
++ set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy" ) # local to this directory
++endif()
+diff --git a/PBLAS/TIMING/CMakeLists.txt b/PBLAS/TIMING/CMakeLists.txt
+index 763330f..208bbc3 100644
+--- a/PBLAS/TIMING/CMakeLists.txt
++++ b/PBLAS/TIMING/CMakeLists.txt
+@@ -74,5 +74,6 @@ add_test(dpb3tim ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ./dpb3tim)
+ add_test(cpb3tim ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ./cpb3tim)
+ add_test(zpb3tim ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ./zpb3tim)
+
+-
+-
++if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
++ set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy" ) # local to this directory
++endif()
+diff --git a/TESTING/EIG/CMakeLists.txt b/TESTING/EIG/CMakeLists.txt
+index 97c7036..19a1f34 100644
+--- a/TESTING/EIG/CMakeLists.txt
++++ b/TESTING/EIG/CMakeLists.txt
+@@ -97,3 +97,6 @@ target_link_libraries(xzheevr scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+ target_link_libraries(xshseqr scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+ target_link_libraries(xdhseqr scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+
++if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
++ set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy" ) # local to this directory
++endif()
+diff --git a/TESTING/LIN/CMakeLists.txt b/TESTING/LIN/CMakeLists.txt
+index 55a53e9..65f169b 100644
+--- a/TESTING/LIN/CMakeLists.txt
++++ b/TESTING/LIN/CMakeLists.txt
+@@ -110,3 +110,7 @@ target_link_libraries(xsls scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+ target_link_libraries(xdls scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+ target_link_libraries(xcls scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
+ target_link_libraries(xzls scalapack ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
++
++if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
++ set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -std=legacy" ) # local to this directory
++endif()
diff --git a/gnu/packages/patches/strace-readlink-tests.patch b/gnu/packages/patches/strace-readlink-tests.patch
new file mode 100644
index 0000000000..dd5ee98703
--- /dev/null
+++ b/gnu/packages/patches/strace-readlink-tests.patch
@@ -0,0 +1,46 @@
+Prevent strace's "readlink" and "readlinkat" tests from failing due to the
+additional system call made by glibc with the patch "glibc-dl-cache.patch"
+applied (introduced in commit 52564e9).
+
+These changes cause strace to report during these tests only system calls on
+files contained in the test directory, effectively filtering out the
+additional readlink/readlinkat call on "/proc/self/exe" and allowing the tests
+to complete as normal.
+
+diff --git a/tests/gen_tests.in b/tests/gen_tests.in
+index 8b4e2e9..cc3ca63 100644
+--- a/tests/gen_tests.in
++++ b/tests/gen_tests.in
+@@ -623,8 +623,8 @@ quotactl-xfs-v -v -e trace=quotactl
+ read-write -a15 -eread=0,5 -ewrite=1,4 -e trace=read,write -P read-write-tmpfile -P /dev/zero -P /dev/null
+ readahead -a1
+ readdir -a16
+-readlink -xx
+-readlinkat -xx
++readlink -xx --trace-path=test.readlink.link
++readlinkat -xx --trace-path=test.readlinkat.link
+ reboot -s 256
+ recv-MSG_TRUNC -a26 -e trace=recv
+ recvfrom -a35
+diff --git a/tests/readlink.gen.test b/tests/readlink.gen.test
+index 4263234..418691b 100755
+--- a/tests/readlink.gen.test
++++ b/tests/readlink.gen.test
+@@ -1,4 +1,4 @@
+ #!/bin/sh -efu
+-# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx ); do not edit.
++# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlink -xx --trace-path=test.readlink.link); do not edit.
+ . "${srcdir=.}/init.sh"
+-run_strace_match_diff -xx
++run_strace_match_diff -xx --trace-path=test.readlink.link
+diff --git a/tests/readlinkat.gen.test b/tests/readlinkat.gen.test
+index d7de993..a48d590 100755
+--- a/tests/readlinkat.gen.test
++++ b/tests/readlinkat.gen.test
+@@ -1,4 +1,4 @@
+ #!/bin/sh -efu
+-# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx ); do not edit.
++# Generated by ./tests/gen_tests.sh from ./tests/gen_tests.in (readlinkat -xx --trace-path=test.readlinkat.link); do not edit.
+ . "${srcdir=.}/init.sh"
+-run_strace_match_diff -xx
++run_strace_match_diff -xx --trace-path=test.readlinkat.link
diff --git a/gnu/packages/patches/syslinux-gcc10.patch b/gnu/packages/patches/syslinux-gcc10.patch
new file mode 100644
index 0000000000..8d3750b36e
--- /dev/null
+++ b/gnu/packages/patches/syslinux-gcc10.patch
@@ -0,0 +1,87 @@
+Taken from Gentoo and adapted to fix the build using GCC 10. See:
+https://bugs.gentoo.org/705730.
+
+--- a/mk/com32.mk
++++ b/mk/com32.mk
+@@ -47,6 +47,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ ifeq ($(FWCLASS),EFI)
+ GCCOPT += -mno-red-zone
+--- a/mk/elf.mk
++++ b/mk/elf.mk
+@@ -42,6 +42,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ com32 = $(topdir)/com32
+ core = $(topdir)/core
+--- a/mk/embedded.mk
++++ b/mk/embedded.mk
+@@ -51,6 +51,7 @@ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+ GCCOPT += $(call gcc_ok,-fvisibility=hidden)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
+
+--- a/mk/lib.mk
++++ b/mk/lib.mk
+@@ -28,6 +28,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ INCLUDE = -I$(SRC)
+ STRIP = strip --strip-all -R .comment -R .note
+--- a/mk/efi.mk
++++ b/mk/efi.mk
+@@ -7,7 +7,7 @@ core = $(topdir)/core
+ # Set up architecture specifics; for cross compilation, set ARCH as apt
+ # gnuefi sets up architecture specifics in ia32 or x86_64 sub directories
+ # set up the LIBDIR and EFIINC for building for the appropriate architecture
+-GCCOPT := $(call gcc_ok,-fno-stack-protector,)
++GCCOPT := $(call gcc_ok,-fno-stack-protector,) $(call gcc_ok,-fcommon)
+ EFIINC = $(objdir)/include/efi
+ LIBDIR = $(objdir)/lib
+
+diff --git a/dos/string.h b/dos/string.h
+index f648de2..a502132 100644
+--- a/dos/string.h
++++ b/dos/string.h
+@@ -5,12 +5,13 @@
+ #ifndef _STRING_H
+ #define _STRING_H
+
++#include <stddef.h>
++
+ /* Standard routines */
+ #define memcpy(a,b,c) __builtin_memcpy(a,b,c)
+ #define memmove(a,b,c) __builtin_memmove(a,b,c)
+ #define memset(a,b,c) __builtin_memset(a,b,c)
+ #define strcpy(a,b) __builtin_strcpy(a,b)
+-#define strlen(a) __builtin_strlen(a)
+
+ /* This only returns true or false */
+ static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
+@@ -21,6 +22,13 @@ static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
+ return rv;
+ }
+
++static inline size_t strlen(const char *s)
++{
++ size_t len = 0;
++ while (*s++) len++;
++ return len;
++}
++
+ extern char *strchr(const char *s, int c);
+
+ #endif /* _STRING_H */ \ No newline at end of file
diff --git a/gnu/packages/patches/syslinux-strip-gnu-property.patch b/gnu/packages/patches/syslinux-strip-gnu-property.patch
new file mode 100644
index 0000000000..c656bbeedd
--- /dev/null
+++ b/gnu/packages/patches/syslinux-strip-gnu-property.patch
@@ -0,0 +1,31 @@
+Taken from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414.
+
+Author: Lukas Schwaighofer <lukas@schwaighofer.name>
+Description: Strip the .note.gnu.property section for the mbr. This section is
+ added since binutils Debian version 2.31.1-2 and causes mbr.bin to grow in
+ size beyond what can fit into the master boot record.
+---
+ mbr/i386/mbr.ld | 1 +
+ mbr/x86_64/mbr.ld | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/mbr/i386/mbr.ld b/mbr/i386/mbr.ld
+index d14ba80..5368346 100644
+--- a/mbr/i386/mbr.ld
++++ b/mbr/i386/mbr.ld
+@@ -70,4 +70,5 @@ SECTIONS
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ /DISCARD/ : { *(.note.GNU-stack) }
++ /DISCARD/ : { *(.note.gnu.property) }
+ }
+diff --git a/mbr/x86_64/mbr.ld b/mbr/x86_64/mbr.ld
+index ae27d49..b8c0d89 100644
+--- a/mbr/x86_64/mbr.ld
++++ b/mbr/x86_64/mbr.ld
+@@ -69,4 +69,5 @@ SECTIONS
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ /DISCARD/ : { *(.note.GNU-stack) }
++ /DISCARD/ : { *(.note.gnu.property) }
+ }
diff --git a/gnu/packages/patches/tcl-fix-cross-compilation.patch b/gnu/packages/patches/tcl-fix-cross-compilation.patch
deleted file mode 100644
index 00c36b8f27..0000000000
--- a/gnu/packages/patches/tcl-fix-cross-compilation.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From f7fa48c4c75a1e748dc5071e709c0b62ff739eaa Mon Sep 17 00:00:00 2001
-From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
-Date: Mon, 9 Dec 2019 10:02:20 +0000
-Subject: [PATCH] Fix [abd4abedd2]: Failed to build tk 8.6.10 with cross
- compile
-
-Patch taken from upstream to fix cross-compilation. To be removed on next Tcl release.
-
----
- compat/strtol.c | 2 +-
- compat/strtoul.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/compat/strtol.c b/compat/strtol.c
-index b7f69196ce2..811006a64c3 100644
---- a/compat/strtol.c
-+++ b/compat/strtol.c
-@@ -53,7 +53,7 @@ strtol(
- */
-
- p = string;
-- while (TclIsSpaceProc(*p)) {
-+ while (isspace(UCHAR(*p))) {
- p += 1;
- }
-
-diff --git a/compat/strtoul.c b/compat/strtoul.c
-index e37eb05f823..15587f1da1a 100644
---- a/compat/strtoul.c
-+++ b/compat/strtoul.c
-@@ -74,7 +74,7 @@ strtoul(
- */
-
- p = string;
-- while (TclIsSpaceProc(*p)) {
-+ while (isspace(UCHAR(*p))) {
- p += 1;
- }
- if (*p == '-') {
diff --git a/gnu/packages/patches/tcsh-fix-autotest.patch b/gnu/packages/patches/tcsh-fix-autotest.patch
index 200867cb9b..9f5790641b 100644
--- a/gnu/packages/patches/tcsh-fix-autotest.patch
+++ b/gnu/packages/patches/tcsh-fix-autotest.patch
@@ -63,17 +63,6 @@
AT_DATA([comment2.csh],
[[echo testing...@%:@\
---- tests/subst.at
-+++ tests/subst.at
-@@ -54,7 +54,7 @@ AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
- , [1
- ])
-
--AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo "echo ~$(id -un)/foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl
-+AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo "echo ~$(id -un)//foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl
- | wc -l | tr -d ' \t'], , [1
- ])
-
--- tests/variables.at
+++ tests/variables.at
@@ -666,7 +666,8 @@ set listflags=(-xA $cwd/args.sh)
diff --git a/gnu/packages/patches/texlive-bin-poppler-0.83.patch b/gnu/packages/patches/texlive-bin-poppler-0.83.patch
deleted file mode 100644
index 5e57e3efac..0000000000
--- a/gnu/packages/patches/texlive-bin-poppler-0.83.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-Fix build with Poppler 0.83 and later.
-
-Taken from Arch Linux, but adjusted to patch the versioned Poppler
-files, as upstream applies it after copying them in place.
-https://git.archlinux.org/svntogit/packages.git/tree/trunk/texlive-poppler-0.83.patch?h=packages/texlive-bin
-
-diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
---- texlive-source-orig/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
-+++ texlive-source/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc
-@@ -723,7 +723,7 @@
- #endif
- // initialize
- if (!isInit) {
-- globalParams = new GlobalParams();
-+ globalParams.reset(new GlobalParams());
- globalParams->setErrQuiet(false);
- isInit = true;
- }
-@@ -1108,6 +1108,5 @@
- delete_document(p);
- }
- // see above for globalParams
-- delete globalParams;
- }
- }
-diff -ru texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
---- texlive-source-orig/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
-+++ texlive-source/texk/web2c/pdftexdir/pdftosrc-poppler0.76.0.cc
-@@ -79,7 +79,7 @@
- exit(1);
- }
- fileName = new GString(argv[1]);
-- globalParams = new GlobalParams();
-+ globalParams.reset(new GlobalParams());
- doc = new PDFDoc(fileName);
- if (!doc->isOk()) {
- fprintf(stderr, "Invalid PDF file\n");
-@@ -100,7 +100,7 @@
- if (objnum == 0) {
- srcStream = catalogDict.dictLookup("SourceObject");
- static char const_SourceFile[] = "SourceFile";
-- if (!srcStream.isStream(const_SourceFile)) {
-+ if (!srcStream.isDict(const_SourceFile)) {
- fprintf(stderr, "No SourceObject found\n");
- exit(1);
- }
-@@ -202,5 +202,4 @@
- fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
- fclose(outfile);
- delete doc;
-- delete globalParams;
- }
diff --git a/gnu/packages/patches/texlive-bin-poppler-0.86.patch b/gnu/packages/patches/texlive-bin-poppler-0.86.patch
deleted file mode 100644
index b1adca657b..0000000000
--- a/gnu/packages/patches/texlive-bin-poppler-0.86.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Fix build with Poppler 0.86 and later.
-
-Taken from Arch Linux, but adjusted to patch the versioned Poppler
-files, as upstream applies it after copying them in place.
-https://git.archlinux.org/svntogit/packages.git/tree/trunk/texlive-poppler-0.86.patch?h=packages/texlive-bin
-
---- a/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc 2020-03-03 21:11:35.102711802 +0000
-+++ b/texk/web2c/pdftexdir/pdftoepdf-poppler0.76.0.cc 2020-03-03 21:13:13.057420111 +0000
-@@ -757,7 +757,7 @@
- if (page_name) {
- // get page by name
- GString name(page_name);
-- LinkDest *link = pdf_doc->doc->findDest(&name);
-+ LinkDest *link = pdf_doc->doc->findDest(&name).get();
- if (link == 0 || !link->isOk())
- pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
- Ref ref = link->getPageRef();
diff --git a/gnu/packages/patches/tor-sandbox-i686.patch b/gnu/packages/patches/tor-sandbox-i686.patch
new file mode 100644
index 0000000000..34b0a053b1
--- /dev/null
+++ b/gnu/packages/patches/tor-sandbox-i686.patch
@@ -0,0 +1,36 @@
+This patch fixes sandboxing on i686 by allowing 'statx'. Without this,
+'src/test/test_include.sh' would fail.
+
+Patch adapted from:
+
+ https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/480
+
+From 001d880d1082f5d124e10554e2718e407c7e88c6 Mon Sep 17 00:00:00 2001
+From: Simon South <simon@simonsouth.net>
+Date: Fri, 5 Nov 2021 10:10:10 -0400
+Subject: [PATCH] sandbox: Allow "statx" syscall on i386 for glibc 2.33
+
+glibc versions 2.33 and newer use the modern "statx" system call in their
+implementations of stat() and opendir() for Linux on i386. Prevent failures in
+the sandbox unit tests by modifying the sandbox to allow this system call
+without restriction on i386 when it is available, and update the test suite to
+skip the "sandbox/stat_filename" test in this case as it is certain to fail.
+---
+ src/lib/sandbox/sandbox.c | 3 +++
+ src/test/test_sandbox.c | 7 ++++---
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/lib/sandbox/sandbox.c b/src/lib/sandbox/sandbox.c
+index fb02a345ab..a15f99ad76 100644
+--- a/src/lib/sandbox/sandbox.c
++++ b/src/lib/sandbox/sandbox.c
+@@ -252,6 +252,9 @@ static int filter_nopar_gen[] = {
+ SCMP_SYS(sigreturn),
+ #endif
+ SCMP_SYS(stat),
++#if defined(__i386__) && defined(__NR_statx)
++ SCMP_SYS(statx),
++#endif
+ SCMP_SYS(uname),
+ SCMP_SYS(wait4),
+ SCMP_SYS(write),
diff --git a/gnu/packages/patches/transmission-remote-gtk-fix-appstream.patch b/gnu/packages/patches/transmission-remote-gtk-fix-appstream.patch
deleted file mode 100644
index e7d4c8bb86..0000000000
--- a/gnu/packages/patches/transmission-remote-gtk-fix-appstream.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-Fix a bug related to AppStream:
-
-https://github.com/transmission-remote-gtk/transmission-remote-gtk/issues/95
-
-Patch adapted from upstream source repository:
-
-https://github.com/transmission-remote-gtk/transmission-remote-gtk/commit/89259ff90c703c7fe6768b5317803b9aa5b5ab8c
-
-From 89259ff90c703c7fe6768b5317803b9aa5b5ab8c Mon Sep 17 00:00:00 2001
-From: Alan <alan-github@eth0.org.uk>
-Date: Tue, 17 Nov 2020 01:26:22 +0000
-Subject: [PATCH] fix screenshot and add OARS rating so appdata validates
-
----
- README.md | 5 ++---
- data/io.github.TransmissionRemoteGtk.appdata.xml.in | 5 +++--
- 2 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/README.md b/README.md
-index 4306cc7..d38314b 100644
---- a/README.md
-+++ b/README.md
-@@ -6,13 +6,12 @@ the Transmission BitTorrent client, using its HTTP RPC protocol.
-
- # DEPENDENCIES
-
--The following packages are required dependencies:
-+The following packages are required dependencies (debian/ubuntu).
-
- ```bash
--autoconf-archive appstream-glib intltool
-+libgtk-3-dev automake autoconf gcc libgeoip-dev gettext autoconf-archive libappstream-dev appstream-util libcurl4-openssl-dev libjson-glib-dev
- ```
-
--
- # BUILDING
-
- Optionally install `libgeoip` and its headers to see the country
-diff --git a/data/io.github.TransmissionRemoteGtk.appdata.xml.in b/data/io.github.TransmissionRemoteGtk.appdata.xml.in
-index fc35a8f..1476c2a 100644
---- a/data/io.github.TransmissionRemoteGtk.appdata.xml.in
-+++ b/data/io.github.TransmissionRemoteGtk.appdata.xml.in
-@@ -7,6 +7,7 @@
- <translation type="gettext">transmission-remote-gtk</translation>
- <name>Transmission Remote</name>
- <developer_name>Transmission Remote Gtk Team</developer_name>
-+ <content_rating type="oars-1.1" />
- <summary>Remotely manage the Transmission BitTorrent client</summary>
- <url type="homepage">https://github.com/transmission-remote-gtk/transmission-remote-gtk</url>
- <url type="bugtracker">https://github.com/transmission-remote-gtk/transmission-remote-gtk/issues</url>
-@@ -23,8 +24,8 @@
- </ul>
- </description>
- <screenshots>
-- <screenshot height="576" width="1024" type="default">
-- <image>http://eth0.org.uk/~alan/transmission-remote-gtk-1.1.1.png</image>
-+ <screenshot height="512" width="973" type="default">
-+ <image>https://community.linuxmint.com/img/screenshots/transmission-remote-gtk.png</image>
- </screenshot>
- </screenshots>
- <releases>
diff --git a/gnu/packages/patches/vigra-python-compat.patch b/gnu/packages/patches/vigra-python-compat.patch
deleted file mode 100644
index 63c6abb326..0000000000
--- a/gnu/packages/patches/vigra-python-compat.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Fix build with Boost + Python 3.7.
-
-Taken from upstream:
-https://github.com/ukoethe/vigra/commit/a6fa62663c6a6b752ed0707e95f643e25867a0f9
-
-diff --git a/vigranumpy/src/core/vigranumpycore.cxx b/vigranumpy/src/core/vigranumpycore.cxx
-index ec38d3636..c81c6ae52 100644
---- a/vigranumpy/src/core/vigranumpycore.cxx
-+++ b/vigranumpy/src/core/vigranumpycore.cxx
-@@ -61,7 +61,7 @@ UInt32 pychecksum(python::str const & s)
- return checksum(data, size);
- #else
- Py_ssize_t size = 0;
-- char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size);
-+ const char * data = PyUnicode_AsUTF8AndSize(s.ptr(), &size);
- return checksum(data, size);
- #endif
- }
diff --git a/gnu/packages/patches/xf86-video-mach64-bool-to-boolean.patch b/gnu/packages/patches/xf86-video-mach64-bool-to-boolean.patch
new file mode 100644
index 0000000000..b85acdd401
--- /dev/null
+++ b/gnu/packages/patches/xf86-video-mach64-bool-to-boolean.patch
@@ -0,0 +1,79 @@
+From ff1a69144735298d1a190fa23b3ae5747e914859 Mon Sep 17 00:00:00 2001
+From: Josselin Poiret <dev@jpoiret.xyz>
+Date: Thu, 18 Nov 2021 13:18:25 +0000
+Subject: [PATCH] Rename bool to boolean for OptionInfoRec.
+
+* src/aticonfig.c: Change uses of .value.bool to .value.boolean
+---
+ src/aticonfig.c | 38 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/src/aticonfig.c b/src/aticonfig.c
+index 621e79e..8ea0c6e 100644
+--- a/src/aticonfig.c
++++ b/src/aticonfig.c
+@@ -311,42 +311,42 @@ ATIProcessOptions
+
+ (void)memcpy(PublicOption, ATIPublicOptions, ATIPublicOptionSize);
+
+-# define ProbeSparse PublicOption[ATI_OPTION_PROBE_SPARSE].value.bool
+-# define Accel PublicOption[ATI_OPTION_ACCEL].value.bool
+-# define BIOSDisplay PrivateOption[ATI_OPTION_BIOS_DISPLAY].value.bool
+-# define Blend PrivateOption[ATI_OPTION_BLEND].value.bool
+-# define CRTDisplay PublicOption[ATI_OPTION_CRT_DISPLAY].value.bool
+-# define CRTScreen PrivateOption[ATI_OPTION_CRT_SCREEN].value.bool
+-# define CSync PublicOption[ATI_OPTION_CSYNC].value.bool
+-# define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool
+-# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool
++# define ProbeSparse PublicOption[ATI_OPTION_PROBE_SPARSE].value.boolean
++# define Accel PublicOption[ATI_OPTION_ACCEL].value.boolean
++# define BIOSDisplay PrivateOption[ATI_OPTION_BIOS_DISPLAY].value.boolean
++# define Blend PrivateOption[ATI_OPTION_BLEND].value.boolean
++# define CRTDisplay PublicOption[ATI_OPTION_CRT_DISPLAY].value.boolean
++# define CRTScreen PrivateOption[ATI_OPTION_CRT_SCREEN].value.boolean
++# define CSync PublicOption[ATI_OPTION_CSYNC].value.boolean
++# define Devel PrivateOption[ATI_OPTION_DEVEL].value.boolean
++# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.boolean
+
+ #ifdef XF86DRI_DEVEL
+
+-# define IsPCI PublicOption[ATI_OPTION_IS_PCI].value.bool
++# define IsPCI PublicOption[ATI_OPTION_IS_PCI].value.boolean
+ # define DMAMode PublicOption[ATI_OPTION_DMA_MODE].value.str
+ # define AGPMode PublicOption[ATI_OPTION_AGP_MODE].value.num
+ # define AGPSize PublicOption[ATI_OPTION_AGP_SIZE].value.num
+-# define LocalTex PublicOption[ATI_OPTION_LOCAL_TEXTURES].value.bool
++# define LocalTex PublicOption[ATI_OPTION_LOCAL_TEXTURES].value.boolean
+ # define BufferSize PublicOption[ATI_OPTION_BUFFER_SIZE].value.num
+
+ #endif /* XF86DRI_DEVEL */
+
+ #ifdef TV_OUT
+
+-# define TvOut PublicOption[ATI_OPTION_TV_OUT].value.bool
++# define TvOut PublicOption[ATI_OPTION_TV_OUT].value.boolean
+ # define TvStd PublicOption[ATI_OPTION_TV_STD].value.str
+
+ #endif /* TV_OUT */
+
+-# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool
+-# define TestCacheMMIO PublicOption[ATI_OPTION_TEST_MMIO_CACHE].value.bool
+-# define PanelDisplay PublicOption[ATI_OPTION_PANEL_DISPLAY].value.bool
+-# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool
+-# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool
++# define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.boolean
++# define TestCacheMMIO PublicOption[ATI_OPTION_TEST_MMIO_CACHE].value.boolean
++# define PanelDisplay PublicOption[ATI_OPTION_PANEL_DISPLAY].value.boolean
++# define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.boolean
++# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.boolean
+ # define AccelMethod PublicOption[ATI_OPTION_ACCELMETHOD].value.str
+-# define RenderAccel PublicOption[ATI_OPTION_RENDER_ACCEL].value.bool
+-# define LCDSync PrivateOption[ATI_OPTION_LCDSYNC].value.bool
++# define RenderAccel PublicOption[ATI_OPTION_RENDER_ACCEL].value.boolean
++# define LCDSync PrivateOption[ATI_OPTION_LCDSYNC].value.boolean
+
+ # define ReferenceClock \
+ PublicOption[ATI_OPTION_REFERENCE_CLOCK].value.freq.freq
+--
+2.33.1
+
diff --git a/gnu/packages/patches/xf86-video-nouveau-fixup-ABI.patch b/gnu/packages/patches/xf86-video-nouveau-fixup-ABI.patch
new file mode 100644
index 0000000000..a18e3f8ab9
--- /dev/null
+++ b/gnu/packages/patches/xf86-video-nouveau-fixup-ABI.patch
@@ -0,0 +1,64 @@
+From e80e73ced69b15662103d0fd6837db4ce6c6eb5b Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Mon, 13 Jul 2020 09:20:15 +1000
+Subject: [PATCH] nouveau: fixup driver for new X server ABI
+
+---
+ src/compat-api.h | 4 ++++
+ src/nouveau_exa.c | 2 +-
+ src/nv_driver.c | 6 +++---
+ 3 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/compat-api.h b/src/compat-api.h
+index fde2f4b..8a1fcf9 100644
+--- a/src/compat-api.h
++++ b/src/compat-api.h
+@@ -102,4 +102,8 @@
+
+ #endif
+
++#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2)
++#define secondary_dst slave_dst
++#endif
++
+ #endif
+diff --git a/src/nouveau_exa.c b/src/nouveau_exa.c
+index 55df6f8..db3b112 100644
+--- a/src/nouveau_exa.c
++++ b/src/nouveau_exa.c
+@@ -157,7 +157,7 @@ nouveau_exa_destroy_pixmap(ScreenPtr pScreen, void *priv)
+
+ #ifdef NOUVEAU_PIXMAP_SHARING
+ static Bool
+-nouveau_exa_share_pixmap_backing(PixmapPtr ppix, ScreenPtr slave, void **handle_p)
++nouveau_exa_share_pixmap_backing(PixmapPtr ppix, ScreenPtr secondary, void **handle_p)
+ {
+ struct nouveau_bo *bo = nouveau_pixmap_bo(ppix);
+ struct nouveau_pixmap *nvpix = nouveau_pixmap(ppix);
+diff --git a/src/nv_driver.c b/src/nv_driver.c
+index e72a6b6..f9ab4af 100644
+--- a/src/nv_driver.c
++++ b/src/nv_driver.c
+@@ -559,16 +559,16 @@ redisplay_dirty(ScreenPtr screen, PixmapDirtyUpdatePtr dirty)
+ {
+ RegionRec pixregion;
+
+- PixmapRegionInit(&pixregion, dirty->slave_dst);
++ PixmapRegionInit(&pixregion, dirty->secondary_dst);
+
+- DamageRegionAppend(&dirty->slave_dst->drawable, &pixregion);
++ DamageRegionAppend(&dirty->secondary_dst->drawable, &pixregion);
+ #ifdef HAS_DIRTYTRACKING_ROTATION
+ PixmapSyncDirtyHelper(dirty);
+ #else
+ PixmapSyncDirtyHelper(dirty, &pixregion);
+ #endif
+
+- DamageRegionProcessPending(&dirty->slave_dst->drawable);
++ DamageRegionProcessPending(&dirty->secondary_dst->drawable);
+ RegionUninit(&pixregion);
+ }
+
+--
+2.33.1
+
diff --git a/gnu/packages/patches/xygrib-fix-finding-data.patch b/gnu/packages/patches/xygrib-fix-finding-data.patch
new file mode 100644
index 0000000000..0b718b0eff
--- /dev/null
+++ b/gnu/packages/patches/xygrib-fix-finding-data.patch
@@ -0,0 +1,131 @@
+This is a backport of the commits in PR 235 (“Fixes for packaging on
+linux-like systems”), which was merged upstream:
+
+https://github.com/opengribs/XyGrib/pull/235
+
+It fixes finding resources such as icons, maps and translations installed in
+the data directory. This patch has been merged upstream and can be removed
+with the next release.
+
+Sightly adapted to find openjpg-2.4.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 64059ab65dae..00cc5d6aea6f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,9 @@ set(VERSION_PATCH 6)
+ set(XYGRIB_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
+ set(XYGRIB_VERSION_DATE "2019-07-05")
+
++option(GNU_PACKAGE "Install into GNU standard directories" OFF)
++option(GEN_TRANSLATIONS "Generate translations" ON)
++
+ set(CMAKE_VERBOSE_MAKEFILE ON)
+
+ # Find includes in corresponding build directories
+@@ -25,7 +28,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(CMAKE_CXX_STANDARD 11)
+ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
+ if(UNIX AND NOT APPLE)
+-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC")
++add_compile_options(-Wall -fPIC)
+ endif()
+
+ # Add support for address etc sanitizers, part 1/2 (other half after ADD_EXECUTABLE)
+@@ -108,17 +111,12 @@ find_path(OPENJPEG_INCLUDE_DIR
+ ~/Library/Frameworks/include
+ /Library/Frameworks/include
+ /usr/local/include
+- /usr/local/include/openjpeg-2.3
+- /usr/include/openjpeg-2.3
+- /usr/local/include/openjpeg-2.1
+- /usr/include/openjpeg-2.1
+- /usr/local/include/openjpeg-2.2
+- /usr/include/openjpeg-2.2
+ /usr/include
+ /sw/include # Fink
+ /opt/local/include # DarwinPorts
+ /opt/csw/include # Blastwave
+ /opt/include
++ PATH_SUFFIXES openjpeg-2.4 openjpeg-2.3 openjpeg-2.2 openjpeg-2.1
+ REQUIRED
+ )
+ include_directories(${OPENJPEG_INCLUDE_DIR})
+@@ -212,22 +210,24 @@ include_directories(${PNG_INCLUDE_DIR})
+ configure_file(cmake/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/Version.h)
+ include_directories(${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include)
+
+-if(APPLE)
+-set(PREFIX_BIN ${PROJECT_NAME})
+-set(PREFIX_PKGDATA ${PROJECT_NAME})
+-endif()
+-if(WIN32)
+-set(PREFIX_BIN ".")
+-set(PREFIX_PKGDATA ".")
+-endif()
+-if(UNIX AND NOT APPLE)
+-# This is not exactly a good idea on linux - the code should be changed so that the executable would go to /usr/local/bin and the data to /usr/local/share/XyGrib
+-set(PREFIX_BIN ${PROJECT_NAME})
+-set(PREFIX_PKGDATA ${PROJECT_NAME})
++if(GNU_PACKAGE)
++ include(GNUInstallDirs)
++ set(PREFIX_BIN ${CMAKE_INSTALL_FULL_BINDIR})
++ set(PREFIX_PKGDATA ${CMAKE_INSTALL_FULL_DATADIR}/openGribs/${PROJECT_NAME})
++else()
++ if(WIN32)
++ set(PREFIX_BIN ".")
++ set(PREFIX_PKGDATA ".")
++ else()
++ set(PREFIX_BIN ${PROJECT_NAME})
++ set(PREFIX_PKGDATA ${PROJECT_NAME})
++ endif()
+ endif()
+
+ add_subdirectory(src)
+-add_subdirectory(data/tr)
++if(GEN_TRANSLATIONS)
++ add_subdirectory(data/tr)
++endif()
+
+ # Installation
+ # macOS bundle parameters
+@@ -241,4 +241,14 @@ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STR
+ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_BUNDLE_VERSION "${XYGRIB_VERSION}")
+ set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_COPYRIGHT "${PROJECT_NAME} Authors")
+ # Install data
+-install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA})
++install(DIRECTORY data DESTINATION ${PREFIX_PKGDATA}
++ PATTERN "CMakeFiles" EXCLUDE
++ PATTERN "CMakeLists.txt" EXCLUDE
++ PATTERN "Makefile" EXCLUDE
++ PATTERN "cmake_install.cmake" EXCLUDE)
++if(GNU_PACKAGE)
++ install(FILES debian/xygrib.desktop
++ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
++ install(FILES debian/xygrib.png
++ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pixmaps)
++endif()
+diff --git a/INSTALL.md b/INSTALL.md
+index 2c9d3ab4da03..1190cc780182 100644
+--- a/INSTALL.md
++++ b/INSTALL.md
+@@ -22,7 +22,19 @@ https://gihub.com/opengribs/XyGrib/releases or on https://opengribs.org in the d
+ - openSUSE Tumbleweed: `sudo zypper install gcc git cmake libqt5-qtbase-devel libpng-devel openjpeg2-devel libnova-devel libproj-devel zlib-devel libbz2-devel
+
+ ## Build and package
++### Options
+
++XyGrib has two CMake options
++- GNU_PACKAGE (DEFAULT: OFF)
++```
++Files will be installed in GNU standard installation directories such as prefix/bin and prefix/share.
++Packagers are recommended to test this option.
++```
++- GEN_TRANSLATION (DEFAULT: ON)
++```
++Create targets to generate translation files.
++Turning this off removes the need for qt-linguist, part of qttools qt5 submodule, during build.
++```
+ ### macOS
+
+ - Get the source
diff --git a/gnu/packages/patches/zstd-CVE-2021-24031_CVE-2021-24032.patch b/gnu/packages/patches/zstd-CVE-2021-24031_CVE-2021-24032.patch
deleted file mode 100644
index 48b5eb18eb..0000000000
--- a/gnu/packages/patches/zstd-CVE-2021-24031_CVE-2021-24032.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-Description: fix race condition allowing attackers to access destination file
- This commit addresses https://github.com/facebook/zstd/issues/2491.
- .
- Note that a downside of this solution is that it is global: `umask()` affects
- all file creation calls in the process. I believe this is safe since
- `fileio.c` functions should only ever be used in the zstd binary, and these
- are (almost) the only files ever created by zstd, and AIUI they're only
- created in a single thread. So we can get away with messing with global state.
- .
- Note that this doesn't change the permissions of files created by `dibio.c`.
- I'm not sure what those should be...
-Author: W. Felix Handte <w@felixhandte.com>
-Origin: upstream
-Bug: https://github.com/facebook/zstd/issues/2491
-Bug-Debian: https://github.com/facebook/zstd/issues/2491
-Applied-Upstream: commit:a774c5797399040af62db21d8a9b9769e005430e
-Reviewed-by: Étienne Mollier <etienne.mollier@mailoo.org>
-Last-Update: 2021-03-03
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/programs/fileio.c
-+++ b/programs/fileio.c
-@@ -606,11 +606,11 @@ FIO_openDstFile(FIO_prefs_t* const prefs
- FIO_remove(dstFileName);
- } }
-
-- { FILE* const f = fopen( dstFileName, "wb" );
-+ { const int old_umask = UTIL_umask(0177); /* u-x,go-rwx */
-+ FILE* const f = fopen( dstFileName, "wb" );
-+ UTIL_umask(old_umask);
- if (f == NULL) {
- DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno));
-- } else if(srcFileName != NULL && strcmp (srcFileName, stdinmark)) {
-- chmod(dstFileName, 00600);
- }
- return f;
- }
---- a/programs/util.c
-+++ b/programs/util.c
-@@ -54,6 +54,15 @@ int UTIL_getFileStat(const char* infilen
- return 1;
- }
-
-+int UTIL_umask(int mode) {
-+#if PLATFORM_POSIX_VERSION > 0
-+ return umask(mode);
-+#else
-+ /* do nothing, fake return value */
-+ return mode;
-+#endif
-+}
-+
- int UTIL_setFileStat(const char *filename, stat_t *statbuf)
- {
- int res = 0;
---- a/programs/util.h
-+++ b/programs/util.h
-@@ -136,6 +136,10 @@ int UTIL_isSameFile(const char* file1, c
- int UTIL_compareStr(const void *p1, const void *p2);
- int UTIL_isCompressedFile(const char* infilename, const char *extensionList[]);
- const char* UTIL_getFileExtension(const char* infilename);
-+/**
-+ * Wraps umask(). Does nothing when the platform doesn't have that concept.
-+ */
-+int UTIL_umask(int mode);
-
- #ifndef _MSC_VER
- U32 UTIL_isFIFO(const char* infilename);
diff --git a/gnu/packages/patches/zziplib-CVE-2018-16548.patch b/gnu/packages/patches/zziplib-CVE-2018-16548.patch
deleted file mode 100644
index a17c6a9768..0000000000
--- a/gnu/packages/patches/zziplib-CVE-2018-16548.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-The following 3 patches applied to 0.13.69 in this order, combined:
-https://github.com/gdraheim/zziplib/commit/9411bde3e4a70a81ff3ffd256b71927b2d90dcbb.patch
-https://github.com/gdraheim/zziplib/commit/d2e5d5c53212e54a97ad64b793a4389193fec687.patch
-https://github.com/gdraheim/zziplib/commit/0e1dadb05c1473b9df2d7b8f298dab801778ef99.patch
-
-diff --git a/test/test.zip b/test/test.zip
-index 2c992ea..952d475 100644
-Binary files a/test/test.zip and b/test/test.zip differ
-diff --git a/zzip/zip.c b/zzip/zip.c
-index 14e2e06..f97a40a 100644
---- a/zzip/zip.c
-+++ b/zzip/zip.c
-@@ -472,9 +472,15 @@ __zzip_parse_root_directory(int fd,
- } else
- {
- if (io->fd.seeks(fd, zz_rootseek + zz_offset, SEEK_SET) < 0)
-+ {
-+ free(hdr0);
- return ZZIP_DIR_SEEK;
-+ }
- if (io->fd.read(fd, &dirent, sizeof(dirent)) < __sizeof(dirent))
-+ {
-+ free(hdr0);
- return ZZIP_DIR_READ;
-+ }
- d = &dirent;
- }
-
-@@ -574,11 +580,18 @@ __zzip_parse_root_directory(int fd,
-
- if (hdr_return)
- *hdr_return = hdr0;
-+ else
-+ {
-+ /* If it is not assigned to *hdr_return, it will never be free()'d */
-+ free(hdr0);
-+ }
- } /* else zero (sane) entries */
-+ else
-+ free(hdr0);
- # ifndef ZZIP_ALLOW_MODULO_ENTRIES
-- return (entries != zz_entries ? ZZIP_CORRUPTED : 0);
-+ return (entries != zz_entries) ? ZZIP_CORRUPTED : 0;
- # else
-- return ((entries & (unsigned)0xFFFF) != zz_entries ? ZZIP_CORRUPTED : 0);
-+ return ((entries & (unsigned)0xFFFF) != zz_entries) ? ZZIP_CORRUPTED : 0;
- # endif
- }
-