From c05c1910dbd630304e06020d27d4b72bb0502088 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Mon, 3 Dec 2018 17:29:58 -0500 Subject: gnu: Beets: Fix compatibility with Python 3.7. * gnu/packages/patches/beets-python-3.7-fix.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/music.scm (beets)[source]: Use it. --- gnu/packages/patches/beets-python-3.7-fix.patch | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 gnu/packages/patches/beets-python-3.7-fix.patch (limited to 'gnu/packages/patches') diff --git a/gnu/packages/patches/beets-python-3.7-fix.patch b/gnu/packages/patches/beets-python-3.7-fix.patch new file mode 100644 index 0000000000..43707cd9d0 --- /dev/null +++ b/gnu/packages/patches/beets-python-3.7-fix.patch @@ -0,0 +1,57 @@ +Fix compatibility issue with Python 3.7: + +https://github.com/beetbox/beets/issues/2978 + +Patch copied from upstream source repository: + +https://github.com/beetbox/beets/commit/15d44f02a391764da1ce1f239caef819f08beed8 + +From 15d44f02a391764da1ce1f239caef819f08beed8 Mon Sep 17 00:00:00 2001 +From: Adrian Sampson +Date: Sun, 22 Jul 2018 12:34:19 -0400 +Subject: [PATCH] Fix Python 3.7 compatibility (#2978) + +--- + beets/autotag/hooks.py | 8 +++++++- + docs/changelog.rst | 2 ++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/beets/autotag/hooks.py b/beets/autotag/hooks.py +index 3615a9333..1c62a54c5 100644 +--- a/beets/autotag/hooks.py ++++ b/beets/autotag/hooks.py +@@ -31,6 +31,12 @@ + + log = logging.getLogger('beets') + ++# The name of the type for patterns in re changed in Python 3.7. ++try: ++ Pattern = re._pattern_type ++except AttributeError: ++ Pattern = re.Pattern ++ + + # Classes used to represent candidate options. + +@@ -433,7 +439,7 @@ def _eq(self, value1, value2): + be a compiled regular expression, in which case it will be + matched against `value2`. + """ +- if isinstance(value1, re._pattern_type): ++ if isinstance(value1, Pattern): + return bool(value1.match(value2)) + return value1 == value2 + +#diff --git a/docs/changelog.rst b/docs/changelog.rst +#index be6de2904..d487f31f5 100644 +#--- a/docs/changelog.rst +#+++ b/docs/changelog.rst +#@@ -19,6 +19,8 @@ New features: +# +# Fixes: +# +#+* Fix compatibility Python 3.7 and its change to a name in the ``re`` module. +#+ :bug:`2978` +# * R128 normalization tags are now properly deleted from files when the values +# are missing. +# Thanks to :user:`autrimpo`. -- cgit 1.4.1 From c16c119d0a7894c42bbe816ec381a0f458f26e6a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 4 Dec 2018 22:55:46 +0100 Subject: gnu: quilt: Use shorter file names for patches. We were reaching the 99-character limit of POSIX tar. * gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch: Rename to... * gnu/packages/patches/quilt-getopt-nondigit-param.patch: ... this. * gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch: Rename to... * gnu/packages/patches/quilt-getopt-second-separator.patch: ... this. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/patchutils.scm (quilt)[source](patches): Likewise. --- gnu/local.mk | 4 +- ...pat-getopt-fix-option-with-nondigit-param.patch | 45 ----------------- .../quilt-compat-getopt-fix-second-separator.patch | 58 ---------------------- .../patches/quilt-getopt-nondigit-param.patch | 45 +++++++++++++++++ .../patches/quilt-getopt-second-separator.patch | 58 ++++++++++++++++++++++ gnu/packages/patchutils.scm | 4 +- 6 files changed, 107 insertions(+), 107 deletions(-) delete mode 100644 gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch delete mode 100644 gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch create mode 100644 gnu/packages/patches/quilt-getopt-nondigit-param.patch create mode 100644 gnu/packages/patches/quilt-getopt-second-separator.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 53a3547559..d2407bb80e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1119,8 +1119,8 @@ dist_patch_DATA = \ %D%/packages/patches/quagga-reproducible-build.patch \ %D%/packages/patches/quickswitch-fix-dmenu-check.patch \ %D%/packages/patches/quilt-test-fix-regex.patch \ - %D%/packages/patches/quilt-compat-getopt-fix-second-separator.patch \ - %D%/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch \ + %D%/packages/patches/quilt-getopt-nondigit-param.patch \ + %D%/packages/patches/quilt-getopt-second-separator.patch \ %D%/packages/patches/qtwebkit-pbutils-include.patch \ %D%/packages/patches/randomjungle-disable-static-build.patch \ %D%/packages/patches/rapicorn-isnan.patch \ diff --git a/gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch b/gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch deleted file mode 100644 index 6bbec67e75..0000000000 --- a/gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Jean Delvare -Subject: compat/getopt: Allow non-digit parameter embedded in short option - -The compatibility getopt script allows only digit parameters to be -embedded in short options. Util-linux's getopt implementation does -not have such a restriction and allows any parameter to be embedded -in short options. As a consequence, using the compatibility getopt -script would choke for example on "-pab", which is a legal option -of the "quilt refresh" command. - -Remove the limitation on digits so that the compatibility getopt -script allows what util-linux allows. This fixes the second half -of bug #54772: -https://savannah.nongnu.org/bugs/index.php?54772 - -As a side note, this feature of the compatibility script was broken -anyway, as it would output the digits in reverse order. - -Signed-off-by: Jean Delvare ---- - compat/getopt.in | 13 ++++--------- - 1 file changed, 4 insertions(+), 9 deletions(-) - ---- quilt.orig/compat/getopt.in 2018-10-03 16:05:56.818667040 +0200 -+++ quilt/compat/getopt.in 2018-10-03 16:12:17.624841732 +0200 -@@ -108,15 +108,10 @@ foreach my $word (@words) { - if (scalar(@letters) == 0) { - $need_param = $letter; - } else { -- # short options can have numerical args -- # embedded in the short option list: -UO -- die "unexpected character after option $letter" -- if ($letters[$#letters] !~ /[0-9]/); -- my @digits; -- while (scalar(@letters) && ($letters[$#letters] =~ /[0-9]/)) { -- push @digits, pop @letters; -- } -- push @options, quote_word(join('', reverse @digits)); -+ # short options can have args -+ # embedded in the short option list -+ push @options, quote_word(join('', reverse @letters)); -+ @letters = (); - } - } - } diff --git a/gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch b/gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch deleted file mode 100644 index cde2c8d41c..0000000000 --- a/gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch +++ /dev/null @@ -1,58 +0,0 @@ -From: Jean Delvare -Subject: compat/getopt: Handle a second separator - -getopt can be passed 2 '--' separators. The first one tells that -getopt options are over and target program options start. The second -one tells that the target program's options are over and following -arguments should be treated as non-options even if they look like -options. - -This second separator was not handled, causing the compatibility -getopt script to treat the following arguments as options, eventually -failing one way or another. - -Properly detect and handle the second separator. This fixes the first -half of bug #54772: -https://savannah.nongnu.org/bugs/index.php?54772 - -Signed-off-by: Jean Delvare ---- - compat/getopt.in | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - ---- quilt.orig/compat/getopt.in 2018-10-03 15:23:21.147620172 +0200 -+++ quilt/compat/getopt.in 2018-10-03 16:05:56.818667040 +0200 -@@ -8,12 +8,12 @@ - - use strict; - --my $opts; -+my $opts = ''; - my @words; - my $found_sep = 0; - - foreach my $arg (@ARGV) { -- if ($arg eq '--') { -+ if (!$found_sep && $arg eq '--') { - $found_sep = 1; - } - else { -@@ -62,10 +62,17 @@ sub quote_word - return "'$word'"; - } - -+# there can be a second separator, to inhibit processing following arguments -+# as options -+$found_sep = 0; - foreach my $word (@words) { -+ if ($word eq '--') { -+ $found_sep = 1; -+ next; -+ } - - # allow '-' to be an option value -- if (!$need_param && $word !~ /^-./) { -+ if ($found_sep || (!$need_param && $word !~ /^-./)) { - push @barewords, quote_word($word); - next; - } diff --git a/gnu/packages/patches/quilt-getopt-nondigit-param.patch b/gnu/packages/patches/quilt-getopt-nondigit-param.patch new file mode 100644 index 0000000000..6bbec67e75 --- /dev/null +++ b/gnu/packages/patches/quilt-getopt-nondigit-param.patch @@ -0,0 +1,45 @@ +From: Jean Delvare +Subject: compat/getopt: Allow non-digit parameter embedded in short option + +The compatibility getopt script allows only digit parameters to be +embedded in short options. Util-linux's getopt implementation does +not have such a restriction and allows any parameter to be embedded +in short options. As a consequence, using the compatibility getopt +script would choke for example on "-pab", which is a legal option +of the "quilt refresh" command. + +Remove the limitation on digits so that the compatibility getopt +script allows what util-linux allows. This fixes the second half +of bug #54772: +https://savannah.nongnu.org/bugs/index.php?54772 + +As a side note, this feature of the compatibility script was broken +anyway, as it would output the digits in reverse order. + +Signed-off-by: Jean Delvare +--- + compat/getopt.in | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +--- quilt.orig/compat/getopt.in 2018-10-03 16:05:56.818667040 +0200 ++++ quilt/compat/getopt.in 2018-10-03 16:12:17.624841732 +0200 +@@ -108,15 +108,10 @@ foreach my $word (@words) { + if (scalar(@letters) == 0) { + $need_param = $letter; + } else { +- # short options can have numerical args +- # embedded in the short option list: -UO +- die "unexpected character after option $letter" +- if ($letters[$#letters] !~ /[0-9]/); +- my @digits; +- while (scalar(@letters) && ($letters[$#letters] =~ /[0-9]/)) { +- push @digits, pop @letters; +- } +- push @options, quote_word(join('', reverse @digits)); ++ # short options can have args ++ # embedded in the short option list ++ push @options, quote_word(join('', reverse @letters)); ++ @letters = (); + } + } + } diff --git a/gnu/packages/patches/quilt-getopt-second-separator.patch b/gnu/packages/patches/quilt-getopt-second-separator.patch new file mode 100644 index 0000000000..cde2c8d41c --- /dev/null +++ b/gnu/packages/patches/quilt-getopt-second-separator.patch @@ -0,0 +1,58 @@ +From: Jean Delvare +Subject: compat/getopt: Handle a second separator + +getopt can be passed 2 '--' separators. The first one tells that +getopt options are over and target program options start. The second +one tells that the target program's options are over and following +arguments should be treated as non-options even if they look like +options. + +This second separator was not handled, causing the compatibility +getopt script to treat the following arguments as options, eventually +failing one way or another. + +Properly detect and handle the second separator. This fixes the first +half of bug #54772: +https://savannah.nongnu.org/bugs/index.php?54772 + +Signed-off-by: Jean Delvare +--- + compat/getopt.in | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- quilt.orig/compat/getopt.in 2018-10-03 15:23:21.147620172 +0200 ++++ quilt/compat/getopt.in 2018-10-03 16:05:56.818667040 +0200 +@@ -8,12 +8,12 @@ + + use strict; + +-my $opts; ++my $opts = ''; + my @words; + my $found_sep = 0; + + foreach my $arg (@ARGV) { +- if ($arg eq '--') { ++ if (!$found_sep && $arg eq '--') { + $found_sep = 1; + } + else { +@@ -62,10 +62,17 @@ sub quote_word + return "'$word'"; + } + ++# there can be a second separator, to inhibit processing following arguments ++# as options ++$found_sep = 0; + foreach my $word (@words) { ++ if ($word eq '--') { ++ $found_sep = 1; ++ next; ++ } + + # allow '-' to be an option value +- if (!$need_param && $word !~ /^-./) { ++ if ($found_sep || (!$need_param && $word !~ /^-./)) { + push @barewords, quote_word($word); + next; + } diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm index fa5ad62e44..b655399345 100644 --- a/gnu/packages/patchutils.scm +++ b/gnu/packages/patchutils.scm @@ -102,8 +102,8 @@ listing the files modified by a patch.") (base32 "06b816m2gz9jfif7k9v2hrm7fz76zjg5pavf7hd3ifybwn4cgjzn")) (patches (search-patches "quilt-test-fix-regex.patch" - "quilt-compat-getopt-fix-second-separator.patch" - "quilt-compat-getopt-fix-option-with-nondigit-param.patch")))) + "quilt-getopt-second-separator.patch" + "quilt-getopt-nondigit-param.patch")))) (build-system gnu-build-system) (native-inputs `(("gettext" ,gnu-gettext))) -- cgit 1.4.1 From 4163f2467bce1a6123f0da1c49e88751d93e634b Mon Sep 17 00:00:00 2001 From: Stefan Stefanović Date: Sat, 24 Nov 2018 06:40:39 +0100 Subject: gnu: elogind: Update to 239.2. * gnu/packages/freedesktop.scm (elogind): Update to 239.2. [source](patches): Remove elogind-glibc-2.27.patch. [source](snippet): Remove snippet. [arguments]: <#:tests?>: Enable tests. <#:configure-flags>: Adjust build paths. Disable some tests. <#:make-flags>: Remove argument. <#:phases>[patch-locale-header]: Remove phase. <#:phases>[clean-runpath]: Add phase. <#:phases>[bootstrap]: Remove phase. <#:phases>[fix-pkttyagent-path]: Add phase. <#:phases>[fix-service-file]: Remove phase. <#:phases>[add-libcap-to-search-path]: Remove phase. <#:phases>[remove-uaccess-tag]: Remove phase. <#:phases>[change-pid-file-path]: Add phase. [build-system]: Switch to meson-build-system. [native-inputs]: Sort native-inputs list. Remove gperf package version constraint. Remove: autoconf, automake, libtool, intltool. Add: docbook-xml-4.2. [inputs]: Remove: linux-libre-headers. * gnu/packages/patches/elogind-glibc-2.27.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove patch file. Signed-off-by: Marius Bakke --- gnu/local.mk | 1 - gnu/packages/freedesktop.scm | 126 +++++++++----------------- gnu/packages/patches/elogind-glibc-2.27.patch | 22 ----- 3 files changed, 43 insertions(+), 106 deletions(-) delete mode 100644 gnu/packages/patches/elogind-glibc-2.27.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 53a3547559..a400e6223e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -666,7 +666,6 @@ dist_patch_DATA = \ %D%/packages/patches/dropbear-CVE-2018-15599.patch \ %D%/packages/patches/dvd+rw-tools-add-include.patch \ %D%/packages/patches/elfutils-tests-ptrace.patch \ - %D%/packages/patches/elogind-glibc-2.27.patch \ %D%/packages/patches/einstein-build.patch \ %D%/packages/patches/emacs-exec-path.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \ diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm index af8297a75f..ff74c79f90 100644 --- a/gnu/packages/freedesktop.scm +++ b/gnu/packages/freedesktop.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2017 Brendan Tildesley ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Pierre Neidhardt +;;; Copyright © 2018 Stefan Stefanović ;;; ;;; This file is part of GNU Guix. ;;; @@ -227,7 +228,7 @@ the freedesktop.org XDG Base Directory specification.") (define-public elogind (package (name "elogind") - (version "232.4") + (version "239.2") (source (origin (method git-fetch) (uri (git-reference @@ -236,101 +237,60 @@ the freedesktop.org XDG Base Directory specification.") (file-name (git-file-name name version)) (sha256 (base32 - "06qqs6yfcwg8aiinqqvy5374pys6sspmvsrqz93c724hqq38d93z")) - (patches (search-patches "elogind-glibc-2.27.patch")) - (modules '((guix build utils))) - (snippet - '(begin - (use-modules (guix build utils)) - (substitute* "Makefile.am" - ;; Avoid validation against DTD because the DTDs for - ;; both doctype 4.2 and 4.5 are needed. - (("XSLTPROC_FLAGS = ") "XSLTPROC_FLAGS = --novalid")) - #t)))) - (build-system gnu-build-system) + "17khwbzqmkfd3hcscs51kzdpvq9p2llm08vbpsdhy9yxgwfzlfa6")))) + (build-system meson-build-system) (arguments - `(#:tests? #f ;FIXME: "make check" in the "po" directory fails. - #:configure-flags - (list (string-append "--with-udevrulesdir=" - (assoc-ref %outputs "out") - "/lib/udev/rules.d") - - ;; Let elogind be its own cgroup controller, rather than relying - ;; on systemd or OpenRC. By default, 'configure' makes an - ;; incorrect guess. - "--with-cgroup-controller=elogind" - - (string-append "--with-rootprefix=" - (assoc-ref %outputs "out")) - (string-append "--with-rootlibexecdir=" - (assoc-ref %outputs "out") - "/libexec/elogind") - ;; These are needed to ensure that lto linking works. - "RANLIB=gcc-ranlib" - "AR=gcc-ar" - "NM=gcc-nm") - #:make-flags '("PKTTYAGENT=/run/current-system/profile/bin/pkttyagent") + `(#:configure-flags + (let* ((out (assoc-ref %outputs "out")) + (sysconf (string-append out "/etc")) + (libexec (string-append out "/libexec/elogind")) + (dbuspolicy (string-append out "/etc/dbus-1/system.d")) + (shepherd (assoc-ref %build-inputs "shepherd")) + (halt-path (string-append shepherd "/sbin/halt")) + (kexec-path "") ;not available in Guix yet + (poweroff-path (string-append shepherd "/sbin/shutdown")) + (reboot-path (string-append shepherd "/sbin/reboot"))) + (list + (string-append "-Drootprefix=" out) + (string-append "-Dsysconfdir=" sysconf) + (string-append "-Drootlibexecdir=" libexec) + (string-append "-Ddbuspolicydir=" dbuspolicy) + (string-append "-Dc_link_args=-Wl,-rpath=" libexec) + (string-append "-Dcpp_link_args=-Wl,-rpath=" libexec) + (string-append "-Dhalt-path=" halt-path) + (string-append "-Dkexec-path=" kexec-path) + (string-append "-Dpoweroff-path=" poweroff-path) + (string-append "-Dreboot-path=" reboot-path) + "-Dcgroup-controller=elogind" + ;; Disable some tests. + "-Dtests=false" + "-Dslow-tests=false")) #:phases (modify-phases %standard-phases - (add-after 'unpack 'patch-locale-header + (add-after 'unpack 'fix-pkttyagent-path (lambda _ - ;; Fix compilation with glibc >= 2.26, which removed xlocale.h. - ;; This can be removed for elogind 234. - (substitute* "src/basic/parse-util.c" - (("xlocale\\.h") "locale.h")) + (substitute* "meson.build" + (("join_paths\\(bindir, 'pkttyagent'\\)") + "'\"/run/current-system/profile/bin/pkttyagent\"'")) #t)) - (replace 'bootstrap + (add-after 'unpack 'change-pid-file-path (lambda _ - (invoke "intltoolize" "--force" "--automake") - (invoke "autoreconf" "-vif"))) - (add-before 'build 'fix-service-file - (lambda* (#:key outputs #:allow-other-keys) - ;; Fix the file name of the 'elogind' binary in the D-Bus - ;; '.service' file. - (substitute* "src/login/org.freedesktop.login1.service" - (("^Exec=.*") - (string-append "Exec=" (assoc-ref %outputs "out") - "/libexec/elogind/elogind\n"))) - #t)) - (add-after 'install 'add-libcap-to-search-path - (lambda* (#:key inputs outputs #:allow-other-keys) - ;; Add a missing '-L' for libcap in libelogind.la. See - ;; . - (let ((libcap (assoc-ref inputs "libcap")) - (out (assoc-ref outputs "out"))) - (substitute* (string-append out "/lib/libelogind.la") - (("-lcap") - (string-append "-L" libcap "/lib -lcap"))) - #t))) - (add-after 'unpack 'remove-uaccess-tag - (lambda _ - ;; systemd supports a "uaccess" built-in tag, but eudev currently - ;; doesn't. This leads to eudev warnings that we'd rather not - ;; see, so remove the reference to "uaccess." - (substitute* "src/login/73-seat-late.rules.in" - (("^TAG==\"uaccess\".*" line) - (string-append "# " line "\n"))) + (substitute* "src/login/elogind.c" + (("\"/run/elogind.pid\"") "\"/run/systemd/elogind.pid\"")) #t))))) (native-inputs - `(("autoconf" ,autoconf) - ("automake" ,automake) - ("libtool" ,libtool) - ("intltool" ,intltool) - ("gettext" ,gettext-minimal) - ("python" ,python) + `(("docbook-xml" ,docbook-xml) + ("docbook-xml-4.2" ,docbook-xml-4.2) ("docbook-xsl" ,docbook-xsl) - ("docbook-xml" ,docbook-xml) - ("xsltproc" ,libxslt) - ("m4" ,m4) + ("gettext" ,gettext-minimal) + ("gperf" ,gperf) ("libxml2" ,libxml2) ;for XML_CATALOG_FILES + ("m4" ,m4) ("pkg-config" ,pkg-config) - - ;; Use gperf 3.0 to work around - ;; . - ("gperf" ,gperf-3.0))) + ("python" ,python) + ("xsltproc" ,libxslt))) (inputs `(("linux-pam" ,linux-pam) - ("linux-libre-headers" ,linux-libre-headers) ("libcap" ,libcap) ("shepherd" ,shepherd) ;for 'halt' and 'reboot', invoked ;when pressing the power button diff --git a/gnu/packages/patches/elogind-glibc-2.27.patch b/gnu/packages/patches/elogind-glibc-2.27.patch deleted file mode 100644 index 4ade587b5e..0000000000 --- a/gnu/packages/patches/elogind-glibc-2.27.patch +++ /dev/null @@ -1,22 +0,0 @@ -Look for memfd_create in sys/mman.h instead of linux/memfd.h. -Needed to build with glibc-2.27. - ---- a/configure.ac 1969-12-31 19:00:00.000000000 -0500 -+++ b/configure.ac 2018-03-27 23:54:15.414589005 -0400 -@@ -360,7 +360,7 @@ - # ------------------------------------------------------------------------------ - - AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) --AC_CHECK_HEADERS([linux/memfd.h], [], []) -+AC_CHECK_HEADERS([sys/mman.h], [], []) - - AC_CHECK_HEADERS([printf.h], [have_printf_h=yes], [have_printf_h=no]) - AS_IF([test x$have_printf_h = xyes], [ -@@ -395,6 +395,7 @@ - [], [], [[ - #include - #include -+#include - #include - #include - #include -- cgit 1.4.1 From e6c28113e6d74c713f8d77bd3d8a543e6871a413 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Thu, 6 Dec 2018 15:12:51 -0500 Subject: gnu: QEMU: Fix CVE-2018-16847 and CVE-2018-16867. * gnu/packages/patches/qemu-CVE-2018-16847.patch, gnu/packages/patches/qemu-CVE-2018-16867.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/virtualization.scm (qemu)[source]: Use them. --- gnu/local.mk | 2 + gnu/packages/patches/qemu-CVE-2018-16847.patch | 158 +++++++++++++++++++++++++ gnu/packages/patches/qemu-CVE-2018-16867.patch | 49 ++++++++ gnu/packages/virtualization.scm | 2 + 4 files changed, 211 insertions(+) create mode 100644 gnu/packages/patches/qemu-CVE-2018-16847.patch create mode 100644 gnu/packages/patches/qemu-CVE-2018-16867.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index a400e6223e..a35e5ae7e3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1111,6 +1111,8 @@ dist_patch_DATA = \ %D%/packages/patches/python-unittest2-remove-argparse.patch \ %D%/packages/patches/python-waitress-fix-tests.patch \ %D%/packages/patches/qemu-glibc-2.27.patch \ + %D%/packages/patches/qemu-CVE-2018-16847.patch \ + %D%/packages/patches/qemu-CVE-2018-16867.patch \ %D%/packages/patches/qt4-ldflags.patch \ %D%/packages/patches/qtbase-use-TZDIR.patch \ %D%/packages/patches/qtscript-disable-tests.patch \ diff --git a/gnu/packages/patches/qemu-CVE-2018-16847.patch b/gnu/packages/patches/qemu-CVE-2018-16847.patch new file mode 100644 index 0000000000..c76bdf764a --- /dev/null +++ b/gnu/packages/patches/qemu-CVE-2018-16847.patch @@ -0,0 +1,158 @@ +Fix CVE-2018-16847: + +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16847 + +Patch copied from upstream source repository: + +https://git.qemu.org/?p=qemu.git;a=commitdiff;h=87ad860c622cc8f8916b5232bd8728c08f938fce + +From 87ad860c622cc8f8916b5232bd8728c08f938fce Mon Sep 17 00:00:00 2001 +From: Paolo Bonzini +Date: Tue, 20 Nov 2018 19:41:48 +0100 +Subject: [PATCH] nvme: fix out-of-bounds access to the CMB +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Because the CMB BAR has a min_access_size of 2, if you read the last +byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one +error. This is CVE-2018-16847. + +Another way to fix this might be to register the CMB as a RAM memory +region, which would also be more efficient. However, that might be a +change for big-endian machines; I didn't think this through and I don't +know how real hardware works. Add a basic testcase for the CMB in case +somebody does this change later on. + +Cc: Keith Busch +Cc: qemu-block@nongnu.org +Reported-by: Li Qiang +Reviewed-by: Li Qiang +Tested-by: Li Qiang +Signed-off-by: Paolo Bonzini +Reviewed-by: Philippe Mathieu-Daudé +Tested-by: Philippe Mathieu-Daudé +Signed-off-by: Kevin Wolf +--- + hw/block/nvme.c | 2 +- + tests/Makefile.include | 2 +- + tests/nvme-test.c | 68 +++++++++++++++++++++++++++++++++++------- + 3 files changed, 60 insertions(+), 12 deletions(-) + +diff --git a/hw/block/nvme.c b/hw/block/nvme.c +index 28d284346dd..8c35cab2b43 100644 +--- a/hw/block/nvme.c ++++ b/hw/block/nvme.c +@@ -1201,7 +1201,7 @@ static const MemoryRegionOps nvme_cmb_ops = { + .write = nvme_cmb_write, + .endianness = DEVICE_LITTLE_ENDIAN, + .impl = { +- .min_access_size = 2, ++ .min_access_size = 1, + .max_access_size = 8, + }, + }; +diff --git a/tests/Makefile.include b/tests/Makefile.include +index 613242bc6ef..fb0b449c02a 100644 +--- a/tests/Makefile.include ++++ b/tests/Makefile.include +@@ -730,7 +730,7 @@ tests/test-hmp$(EXESUF): tests/test-hmp.o + tests/machine-none-test$(EXESUF): tests/machine-none-test.o + tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y) + tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y) +-tests/nvme-test$(EXESUF): tests/nvme-test.o ++tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y) + tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o + tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o + tests/ac97-test$(EXESUF): tests/ac97-test.o +diff --git a/tests/nvme-test.c b/tests/nvme-test.c +index 7674a446e4f..2700ba838aa 100644 +--- a/tests/nvme-test.c ++++ b/tests/nvme-test.c +@@ -8,25 +8,73 @@ + */ + + #include "qemu/osdep.h" ++#include "qemu/units.h" + #include "libqtest.h" ++#include "libqos/libqos-pc.h" ++ ++static QOSState *qnvme_start(const char *extra_opts) ++{ ++ QOSState *qs; ++ const char *arch = qtest_get_arch(); ++ const char *cmd = "-drive id=drv0,if=none,file=null-co://,format=raw " ++ "-device nvme,addr=0x4.0,serial=foo,drive=drv0 %s"; ++ ++ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { ++ qs = qtest_pc_boot(cmd, extra_opts ? : ""); ++ global_qtest = qs->qts; ++ return qs; ++ } ++ ++ g_printerr("nvme tests are only available on x86\n"); ++ exit(EXIT_FAILURE); ++} ++ ++static void qnvme_stop(QOSState *qs) ++{ ++ qtest_shutdown(qs); ++} + +-/* Tests only initialization so far. TODO: Replace with functional tests */ + static void nop(void) + { ++ QOSState *qs; ++ ++ qs = qnvme_start(NULL); ++ qnvme_stop(qs); + } + +-int main(int argc, char **argv) ++static void nvmetest_cmb_test(void) + { +- int ret; ++ const int cmb_bar_size = 2 * MiB; ++ QOSState *qs; ++ QPCIDevice *pdev; ++ QPCIBar bar; + +- g_test_init(&argc, &argv, NULL); +- qtest_add_func("/nvme/nop", nop); ++ qs = qnvme_start("-global nvme.cmb_size_mb=2"); ++ pdev = qpci_device_find(qs->pcibus, QPCI_DEVFN(4,0)); ++ g_assert(pdev != NULL); ++ ++ qpci_device_enable(pdev); ++ bar = qpci_iomap(pdev, 2, NULL); ++ ++ qpci_io_writel(pdev, bar, 0, 0xccbbaa99); ++ g_assert_cmpint(qpci_io_readb(pdev, bar, 0), ==, 0x99); ++ g_assert_cmpint(qpci_io_readw(pdev, bar, 0), ==, 0xaa99); ++ ++ /* Test partially out-of-bounds accesses. */ ++ qpci_io_writel(pdev, bar, cmb_bar_size - 1, 0x44332211); ++ g_assert_cmpint(qpci_io_readb(pdev, bar, cmb_bar_size - 1), ==, 0x11); ++ g_assert_cmpint(qpci_io_readw(pdev, bar, cmb_bar_size - 1), !=, 0x2211); ++ g_assert_cmpint(qpci_io_readl(pdev, bar, cmb_bar_size - 1), !=, 0x44332211); ++ g_free(pdev); + +- qtest_start("-drive id=drv0,if=none,file=null-co://,format=raw " +- "-device nvme,drive=drv0,serial=foo"); +- ret = g_test_run(); ++ qnvme_stop(qs); ++} + +- qtest_end(); ++int main(int argc, char **argv) ++{ ++ g_test_init(&argc, &argv, NULL); ++ qtest_add_func("/nvme/nop", nop); ++ qtest_add_func("/nvme/cmb_test", nvmetest_cmb_test); + +- return ret; ++ return g_test_run(); + } +-- +2.19.2 + diff --git a/gnu/packages/patches/qemu-CVE-2018-16867.patch b/gnu/packages/patches/qemu-CVE-2018-16867.patch new file mode 100644 index 0000000000..1403d8e0f8 --- /dev/null +++ b/gnu/packages/patches/qemu-CVE-2018-16867.patch @@ -0,0 +1,49 @@ +Fix CVE-2018-16867: + +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16867 +https://seclists.org/oss-sec/2018/q4/202 + +Patch copied from upstream source repository: + +https://git.qemu.org/?p=qemu.git;a=commitdiff;h=c52d46e041b42bb1ee6f692e00a0abe37a9659f6 + +From c52d46e041b42bb1ee6f692e00a0abe37a9659f6 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Mon, 3 Dec 2018 11:10:45 +0100 +Subject: [PATCH] usb-mtp: outlaw slashes in filenames +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Slash is unix directory separator, so they are not allowed in filenames. +Note this also stops the classic escape via "../". + +Fixes: CVE-2018-16867 +Reported-by: Michael Hanselmann +Signed-off-by: Gerd Hoffmann +Reviewed-by: Philippe Mathieu-Daudé +Message-id: 20181203101045.27976-3-kraxel@redhat.com +--- + hw/usb/dev-mtp.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c +index 0f6a9702ef1..100b7171f4e 100644 +--- a/hw/usb/dev-mtp.c ++++ b/hw/usb/dev-mtp.c +@@ -1719,6 +1719,12 @@ static void usb_mtp_write_metadata(MTPState *s) + + filename = utf16_to_str(dataset->length, dataset->filename); + ++ if (strchr(filename, '/')) { ++ usb_mtp_queue_result(s, RES_PARAMETER_NOT_SUPPORTED, d->trans, ++ 0, 0, 0, 0); ++ return; ++ } ++ + o = usb_mtp_object_lookup_name(p, filename, dataset->length); + if (o != NULL) { + next_handle = o->handle; +-- +2.19.2 + diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index 2f8e541d40..0502bb38c4 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -100,6 +100,8 @@ (method url-fetch) (uri (string-append "https://download.qemu.org/qemu-" version ".tar.xz")) + (patches (search-patches "qemu-CVE-2018-16847.patch" + "qemu-CVE-2018-16867.patch")) (sha256 (base32 "04sp3f1gp4bdb913jf7fw761njaqp2l32wgipp1sapmxx17zcyld")))) -- cgit 1.4.1 From 8d65ae44ac9492b17266aa1bbe04d562e904946a Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sat, 8 Dec 2018 00:43:36 +0100 Subject: gnu: GCC@6: Update to 6.5.0. * gnu/packages/patches/gcc-libsanitizer-fix.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. * gnu/packages/gcc.scm (gcc-6): Update to 6.5.0. [source](patches): Drop obsolete patches. [source](snippet): Remove. --- gnu/local.mk | 1 - gnu/packages/gcc.scm | 24 +---- gnu/packages/patches/gcc-libsanitizer-fix.patch | 113 ------------------------ 3 files changed, 4 insertions(+), 134 deletions(-) delete mode 100644 gnu/packages/patches/gcc-libsanitizer-fix.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index 52451b8c38..ae3aee7c21 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -715,7 +715,6 @@ dist_patch_DATA = \ %D%/packages/patches/gcc-4.8-libsanitizer-fix.patch \ %D%/packages/patches/gcc-4.9-libsanitizer-fix.patch \ %D%/packages/patches/gcc-4.9-libsanitizer-ustat.patch \ - %D%/packages/patches/gcc-libsanitizer-fix.patch \ %D%/packages/patches/gcc-libsanitizer-ustat.patch \ %D%/packages/patches/gcc-libvtv-runpath.patch \ %D%/packages/patches/gcc-strmov-store-file-names.patch \ diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 8207104174..fb06b53474 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -461,34 +461,18 @@ Go. It also includes runtime support libraries for these languages.") (define-public gcc-6 (package (inherit gcc-5) - (version "6.4.0") + (version "6.5.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.xz")) (sha256 (base32 - "1m0lr7938lw5d773dkvwld90hjlcq2282517d1gwvrfzmwgg42w5")) - (patches (search-patches "gcc-libsanitizer-fix.patch" - "gcc-libsanitizer-ustat.patch" - "gcc-strmov-store-file-names.patch" + "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby")) + (patches (search-patches "gcc-strmov-store-file-names.patch" "gcc-6-source-date-epoch-1.patch" "gcc-6-source-date-epoch-2.patch" - "gcc-5.0-libvtv-runpath.patch")) - (modules '((guix build utils))) - ;; This is required for building with glibc-2.26. - ;; This can be removed when gcc-6.5.0 is released. - ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712 - (snippet - '(begin - (for-each - (lambda (dir) - (substitute* (string-append "libgcc/config/" - dir "/linux-unwind.h") - (("struct ucontext") "ucontext_t"))) - '("aarch64" "alpha" "bfin" "i386" "m68k" "nios2" - "pa" "sh" "tilepro" "xtensa")) - #t)))) + "gcc-5.0-libvtv-runpath.patch")))) (inputs `(("isl" ,isl) ,@(package-inputs gcc-4.7))) diff --git a/gnu/packages/patches/gcc-libsanitizer-fix.patch b/gnu/packages/patches/gcc-libsanitizer-fix.patch deleted file mode 100644 index 67aa44bed4..0000000000 --- a/gnu/packages/patches/gcc-libsanitizer-fix.patch +++ /dev/null @@ -1,113 +0,0 @@ -https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=8937b94d1a643fd9760714642296d034a45254a8 -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066 - -This patch can be removed when gcc-6.5.0 is released - -From 8937b94d1a643fd9760714642296d034a45254a8 Mon Sep 17 00:00:00 2001 -From: doko -Date: Thu, 7 Sep 2017 07:15:24 +0000 -Subject: [PATCH] 2017-09-07 Matthias Klose - - Backported from mainline - 2017-07-14 Jakub Jelinek - - PR sanitizer/81066 - * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969. - * sanitizer_common/sanitizer_linux.cc: Likewise. - * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise. - * tsan/tsan_platform_linux.cc: Likewise. - - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@251828 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - libsanitizer/ChangeLog | 11 +++++++++++ - libsanitizer/sanitizer_common/sanitizer_linux.cc | 3 +-- - libsanitizer/sanitizer_common/sanitizer_linux.h | 4 +--- - .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc | 2 +- - libsanitizer/tsan/tsan_platform_linux.cc | 2 +- - 5 files changed, 15 insertions(+), 7 deletions(-) - -diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog -index 252cd09..d988b28 100644 ---- a/libsanitizer/ChangeLog -+++ b/libsanitizer/ChangeLog -@@ -1,3 +1,14 @@ -+2017-09-07 Matthias Klose -+ -+ Backported from mainline -+ 2017-07-14 Jakub Jelinek -+ -+ PR sanitizer/81066 -+ * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969. -+ * sanitizer_common/sanitizer_linux.cc: Likewise. -+ * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise. -+ * tsan/tsan_platform_linux.cc: Likewise. -+ - 2017-07-04 Release Manager - - * GCC 6.4.0 released. -diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc -index 2cefa20..223d9c6 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_linux.cc -+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc -@@ -546,8 +546,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) { - } - #endif - --uptr internal_sigaltstack(const struct sigaltstack *ss, -- struct sigaltstack *oss) { -+uptr internal_sigaltstack(const void *ss, void *oss) { - return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss); - } - -diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h -index 4497702..1594058 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_linux.h -+++ b/libsanitizer/sanitizer_common/sanitizer_linux.h -@@ -19,7 +19,6 @@ - #include "sanitizer_platform_limits_posix.h" - - struct link_map; // Opaque type returned by dlopen(). --struct sigaltstack; - - namespace __sanitizer { - // Dirent structure for getdents(). Note that this structure is different from -@@ -28,8 +27,7 @@ struct linux_dirent; - - // Syscall wrappers. - uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count); --uptr internal_sigaltstack(const struct sigaltstack* ss, -- struct sigaltstack* oss); -+uptr internal_sigaltstack(const void* ss, void* oss); - uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set, - __sanitizer_sigset_t *oldset); - void internal_sigfillset(__sanitizer_sigset_t *set); -diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc -index c919e4f..014162af 100644 ---- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc -+++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc -@@ -267,7 +267,7 @@ static int TracerThread(void* argument) { - - // Alternate stack for signal handling. - InternalScopedBuffer handler_stack_memory(kHandlerStackSize); -- struct sigaltstack handler_stack; -+ stack_t handler_stack; - internal_memset(&handler_stack, 0, sizeof(handler_stack)); - handler_stack.ss_sp = handler_stack_memory.data(); - handler_stack.ss_size = kHandlerStackSize; -diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc -index 09cec5f..908f4fe 100644 ---- a/libsanitizer/tsan/tsan_platform_linux.cc -+++ b/libsanitizer/tsan/tsan_platform_linux.cc -@@ -291,7 +291,7 @@ bool IsGlobalVar(uptr addr) { - int ExtractResolvFDs(void *state, int *fds, int nfd) { - #if SANITIZER_LINUX - int cnt = 0; -- __res_state *statp = (__res_state*)state; -+ struct __res_state *statp = (struct __res_state*)state; - for (int i = 0; i < MAXNS && cnt < nfd; i++) { - if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1) - fds[cnt++] = statp->_u._ext.nssocks[i]; --- -2.9.3 - -- cgit 1.4.1