From 6e7be7d37abfb70098e4ce64c3508d992145d9c8 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sun, 6 May 2018 20:11:40 +0200 Subject: gnu: strace: Fix build failure on Linux-Libre 4.16. * gnu/packages/patches/strace-kernel-4.16.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/linux.scm (strace)][source](patches): New field. --- gnu/packages/patches/strace-kernel-4.16.patch | 92 +++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 gnu/packages/patches/strace-kernel-4.16.patch (limited to 'gnu/packages/patches') diff --git a/gnu/packages/patches/strace-kernel-4.16.patch b/gnu/packages/patches/strace-kernel-4.16.patch new file mode 100644 index 0000000000..e86d3be439 --- /dev/null +++ b/gnu/packages/patches/strace-kernel-4.16.patch @@ -0,0 +1,92 @@ +Fix test failure when using Linux-Libre >= 4.16. + +Taken from upstream: +https://github.com/strace/strace/commit/bcff87c31c0f27c678a43d6b7f67dab363a974fa + +From bcff87c31c0f27c678a43d6b7f67dab363a974fa Mon Sep 17 00:00:00 2001 +From: Masatake YAMATO +Date: Wed, 2 May 2018 17:11:07 +0900 +Subject: [PATCH] tests/ioctl_kvm_run.c: handle cpuid at the end of vcpu dentry + +Since Linux 4.16, kernel appends the cpuid as suffix to the entry +for a kvm vcpu in /proc/$pid/fd like: + + anon_inode:kvm-vcpu:0 + +That was + + anon_inode:kvm-vcpu + +This kernel change causes the test case failure on newer kernels. +Update the test to deal with the new name as well as the old one. + +* tests/ioctl_kvm_run.c: Include unistd.h for using readlink(2). +(vcpu_dev_should_have_cpuid): New function for detecting whether +a proc entry for given fd has the cpuid suffix or not. +(main): Trim vcpu_dev to remove the cpuid suffix if needed. +(vcpu_dev): Remove const modifier. +--- + tests/ioctl_kvm_run.c | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/tests/ioctl_kvm_run.c b/tests/ioctl_kvm_run.c +index 179461430..e1bef5796 100644 +--- a/tests/ioctl_kvm_run.c ++++ b/tests/ioctl_kvm_run.c +@@ -40,6 +40,7 @@ + # include + # include + # include ++# include + # include + + static int +@@ -56,7 +57,7 @@ kvm_ioctl(int fd, unsigned long cmd, const char *cmd_str, void *arg) + + static const char dev[] = "/dev/kvm"; + static const char vm_dev[] = "anon_inode:kvm-vm"; +-static const char vcpu_dev[] = "anon_inode:kvm-vcpu"; ++static char vcpu_dev[] = "anon_inode:kvm-vcpu:0"; + static size_t page_size; + + extern const char code[]; +@@ -165,6 +166,23 @@ run_kvm(const int vcpu_fd, struct kvm_run *const run, const size_t mmap_size, + } + } + ++static int ++vcpu_dev_should_have_cpuid(int fd) ++{ ++ int r = 0; ++ char *filename = NULL; ++ char buf[sizeof(vcpu_dev)]; ++ ++ if (asprintf(&filename, "/proc/%d/fd/%d", getpid(), fd) < 0) ++ error_msg_and_fail("asprintf"); ++ ++ if (readlink(filename, buf, sizeof(buf)) == sizeof(buf) - 1 ++ && (memcmp(buf, vcpu_dev, sizeof(buf) - 1) == 0)) ++ r = 1; ++ free(filename); ++ return r; ++} ++ + int + main(void) + { +@@ -208,6 +226,15 @@ main(void) + (unsigned long) page_size, (unsigned long) page_size, mem); + + int vcpu_fd = KVM_IOCTL(vm_fd, KVM_CREATE_VCPU, NULL); ++ if (!vcpu_dev_should_have_cpuid(vcpu_fd)) ++ /* ++ * This is an older kernel that doesn't place a cpuid ++ * at the end of the dentry associated with vcpu_fd. ++ * Trim the cpuid part of vcpu_dev like: ++ * "anon_inode:kvm-vcpu:0" -> "anon_inode:kvm-vcpu" ++ */ ++ vcpu_dev[strlen (vcpu_dev) - 2] = '\0'; ++ + printf("ioctl(%d<%s>, KVM_CREATE_VCPU, 0) = %d<%s>\n", + vm_fd, vm_dev, vcpu_fd, vcpu_dev); + -- cgit 1.4.1 From e554d43dfcd4f9a3e34fc2d0ebca47b06f99b2fe Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 7 May 2018 02:06:25 +0530 Subject: gnu: wesnoth: Update to 1.14.0. * gnu/packages/patches/wesnoth-fix-std-bad-cast.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/games.scm (wesnoth): Update to 1.14.0. [source]: Add wesnoth-fix-std-bad-cast.patch to patches. [arguments]: Remove "-DENABLE_STRICT_COMPILATION=OFF" configure flag. [inputs]: Remove sdl-image, sdl-mixer, sdl-net and sdl-ttf. Add openssl and sdl-union of sdl2, sdl2-image, sdl2-mixer and sdl2-ttf. [home-page]: Use HTTPS URI. (wesnoth-server)[inputs]: Remove sdl-net. Add icu4c, openssl and sdl2. [arguments]: Remove delete-data phase. Since wesnoth 1.14.0, configure flag "-DENABLE_GAME=OFF" disables installation of game assets. --- gnu/local.mk | 1 + gnu/packages/games.scm | 39 ++++--------- .../patches/wesnoth-fix-std-bad-cast.patch | 67 ++++++++++++++++++++++ 3 files changed, 80 insertions(+), 27 deletions(-) create mode 100644 gnu/packages/patches/wesnoth-fix-std-bad-cast.patch (limited to 'gnu/packages/patches') diff --git a/gnu/local.mk b/gnu/local.mk index bd99883462..6d6663f8b8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1158,6 +1158,7 @@ dist_patch_DATA = \ %D%/packages/patches/wavpack-CVE-2018-7253.patch \ %D%/packages/patches/wavpack-CVE-2018-7254.patch \ %D%/packages/patches/weechat-python.patch \ + %D%/packages/patches/wesnoth-fix-std-bad-cast.patch \ %D%/packages/patches/wicd-bitrate-none-fix.patch \ %D%/packages/patches/wicd-get-selected-profile-fix.patch \ %D%/packages/patches/wicd-urwid-1.3.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index e4f87a6c46..b2d106e907 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -1809,7 +1809,7 @@ falling, themeable graphics and sounds, and replays.") (define-public wesnoth (package (name "wesnoth") - (version "1.12.6") + (version "1.14.0") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/wesnoth/wesnoth-" @@ -1818,17 +1818,11 @@ falling, themeable graphics and sounds, and replays.") name "-" version ".tar.bz2")) (sha256 (base32 - "0kifp6g1dsr16m6ngjq2hx19h851fqg326ps3krnhpyix963h3x5")))) + "09niq53y17faizhmd98anx3dha7hvacvj9a0a64lg8wn915cm0bw")) + (patches (search-patches "wesnoth-fix-std-bad-cast.patch")))) (build-system cmake-build-system) (arguments - '(#:tests? #f ; no check target - #:configure-flags - ;; XXX: Failed to compile with '-Werror=old-style-cast'. - ;; boost/mpl/assert.hpp:313:58: error: - ;; use of old-style cast [-Werror=old-style-cast] - ;; [...] - ;; cc1plus: all warnings being treated as errors - '("-DENABLE_STRICT_COMPILATION=OFF"))) + `(#:tests? #f)) ; no check target (native-inputs `(("gettext" ,gettext-minimal) ("pkg-config" ,pkg-config))) @@ -1837,12 +1831,10 @@ falling, themeable graphics and sounds, and replays.") ("dbus" ,dbus) ("fribidi" ,fribidi) ("libvorbis" ,libvorbis) + ("openssl" ,openssl) ("pango" ,pango) - ("sdl-image" ,sdl-image) - ("sdl-mixer" ,sdl-mixer) - ("sdl-net" ,sdl-net) - ("sdl-ttf" ,sdl-ttf))) - (home-page "http://www.wesnoth.org/") + ("sdl-union" ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf))))) + (home-page "https://www.wesnoth.org/") (synopsis "Turn-based strategy game") (description "The Battle for Wesnoth is a fantasy, turn based tactical strategy game, @@ -1861,19 +1853,12 @@ next campaign.") (name "wesnoth-server") (inputs `(("boost" ,boost) - ("sdl-net" ,sdl-net))) + ("icu4c" ,icu4c) + ("openssl" ,openssl) + ("sdl2" ,sdl2))) (arguments - (append - (substitute-keyword-arguments (package-arguments wesnoth) - ((#:configure-flags configure-flags) - `(append ,configure-flags (list "-DENABLE_GAME=OFF")))) - `(#:phases - (modify-phases %standard-phases - ;; Delete game assets not required by the server. - (add-after 'install 'delete-data - (lambda* (#:key outputs #:allow-other-keys) - (delete-file-recursively (string-append (assoc-ref outputs "out") - "/share/wesnoth")))))))) + `(#:configure-flags '("-DENABLE_GAME=OFF") + ,@(package-arguments wesnoth))) (synopsis "Dedicated @emph{Battle for Wesnoth} server") (description "This package contains a dedicated server for @emph{The Battle for Wesnoth}."))) diff --git a/gnu/packages/patches/wesnoth-fix-std-bad-cast.patch b/gnu/packages/patches/wesnoth-fix-std-bad-cast.patch new file mode 100644 index 0000000000..18328ed018 --- /dev/null +++ b/gnu/packages/patches/wesnoth-fix-std-bad-cast.patch @@ -0,0 +1,67 @@ +From 18e5ea50a7136cb3686c5a7c51c111ccce73dc54 Mon Sep 17 00:00:00 2001 +From: Iris Morelle +Date: Sun, 6 May 2018 16:10:42 -0300 +Subject: [PATCH] i18n: Blind fix attempt for std::bad_cast being thrown on + Windows + +Several reports on Steam and our forums point at std::bad_cast being +thrown when accessing Preferences and the Multiplayer menu amongst +others. It's possible that the locale configuration on those systems is +not quite right, and compare() and icompare() are able to throw +std::bad_cast when this happens as they both use std::use_facet(). + +Note that much like the macOS/iOS version of icompare(), this stopgap +patch doesn't attempt to provide any form of case-insensitive fallback +and just uses a case-sensitive comparison instead. +--- + src/gettext_boost.cpp | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +diff --git a/src/gettext_boost.cpp b/src/gettext_boost.cpp +index 3cc7690d5ef..fb04ffeea90 100644 +--- a/src/gettext_boost.cpp ++++ b/src/gettext_boost.cpp +@@ -423,7 +423,19 @@ void set_language(const std::string& language, const std::vector* / + int compare(const std::string& s1, const std::string& s2) + { + std::lock_guard lock(get_mutex()); +- return std::use_facet>(get_manager().get_locale()).compare(s1.c_str(), s1.c_str() + s1.size(), s2.c_str(), s2.c_str() + s2.size()); ++ ++ try { ++ return std::use_facet>(get_manager().get_locale()).compare(s1.c_str(), s1.c_str() + s1.size(), s2.c_str(), s2.c_str() + s2.size()); ++ } catch(const std::bad_cast&) { ++ static bool bad_cast_once = false; ++ ++ if(!bad_cast_once) { ++ ERR_G << "locale set-up for compare() is broken, falling back to std::string::compare()\n"; ++ bad_cast_once = true; ++ } ++ ++ return s1.compare(s2); ++ } + } + + int icompare(const std::string& s1, const std::string& s2) +@@ -433,8 +445,21 @@ int icompare(const std::string& s1, const std::string& s2) + return compare(s1, s2); + #else + std::lock_guard lock(get_mutex()); +- return std::use_facet>(get_manager().get_locale()).compare( ++ ++ try { ++ return std::use_facet>(get_manager().get_locale()).compare( + bl::collator_base::secondary, s1, s2); ++ } catch(const std::bad_cast&) { ++ static bool bad_cast_once = false; ++ ++ if(!bad_cast_once) { ++ ERR_G << "locale set-up for icompare() is broken, falling back to std::string::compare()\n"; ++ bad_cast_once = true; ++ } ++ ++ // FIXME: not even lazily case-insensitive ++ return s1.compare(s2); ++ } + #endif + } + -- cgit 1.4.1