diff options
Diffstat (limited to 'gnu/packages/patches')
35 files changed, 3174 insertions, 283 deletions
diff --git a/gnu/packages/patches/audacity-ffmpeg-fallback.patch b/gnu/packages/patches/audacity-ffmpeg-fallback.patch new file mode 100644 index 0000000000..b78956070a --- /dev/null +++ b/gnu/packages/patches/audacity-ffmpeg-fallback.patch @@ -0,0 +1,66 @@ +From 3c20057d0cbbbed453a692d4dd4589d865808024 Mon Sep 17 00:00:00 2001 +From: Liliana Marie Prikler <liliana.prikler@gmail.com> +Date: Sat, 29 Jan 2022 10:44:44 +0100 +Subject: [PATCH] Add pkg-config fallback for locating ffmpeg. + +Audacity >=3.1.0 no longer links against ffmpeg, but instead dynamically loads +it. This dynamic loading mechanism fails to properly locate libraries outside +of LD_LIBRARY_PATH. + +See <https://issues.guix.gnu.org/53591>. +--- + libraries/lib-ffmpeg-support/CMakeLists.txt | 8 ++++++++ + libraries/lib-ffmpeg-support/FFmpegFunctions.cpp | 12 ++++++++++++ + 2 files changed, 20 insertions(+) + +diff --git a/libraries/lib-ffmpeg-support/CMakeLists.txt b/libraries/lib-ffmpeg-support/CMakeLists.txt +index 8c5f06d7c..00810e4d0 100644 +--- a/libraries/lib-ffmpeg-support/CMakeLists.txt ++++ b/libraries/lib-ffmpeg-support/CMakeLists.txt +@@ -1,5 +1,7 @@ + + if (${_OPT}use_ffmpeg) ++ pkg_check_modules(FFMPEG libavcodec libavformat libavutil) ++ + set( SOURCES + FFmpegTypes.h + +@@ -100,6 +102,12 @@ if (${_OPT}use_ffmpeg) + list(APPEND DEFINITIONS PRIVATE _DARWIN_C_SOURCE ) + endif() + ++ if (FFMPEG_FOUND) ++ pkg_get_variable(LIBAVCODEC_LIBDIR libavcodec libdir) ++ list(APPEND DEFINITIONS PRIVATE ++ "-DFFMPEG_PC_LIBDIR=\"${LIBAVCODEC_LIBDIR}\"") ++ endif() ++ + audacity_library( lib-ffmpeg-support "${SOURCES}" "${LIBRARIES}" + "${DEFINITIONS}" "" + ) +diff --git a/libraries/lib-ffmpeg-support/FFmpegFunctions.cpp b/libraries/lib-ffmpeg-support/FFmpegFunctions.cpp +index 66d085a0b..4eeb4aed3 100644 +--- a/libraries/lib-ffmpeg-support/FFmpegFunctions.cpp ++++ b/libraries/lib-ffmpeg-support/FFmpegFunctions.cpp +@@ -238,6 +238,18 @@ struct FFmpegFunctions::Private final + if (library->IsLoaded()) + return library; + ++#if defined(FFMPEG_PC_LIBDIR) ++ { ++ static const wxString libdir{FFMPEG_PC_LIBDIR}; ++ const wxString fullName = wxFileName(libdir, libraryName).GetFullPath(); ++ ++ auto library = std::make_shared<wxDynamicLibrary>(fullName); ++ ++ if (library->IsLoaded()) ++ return library; ++ } ++#endif ++ + // Loading has failed. + // wxLogSysError doesn't report errors correctly on *NIX + #if defined(_WIN32) +-- +2.34.0 + diff --git a/gnu/packages/patches/bloomberg-bde-cmake-module-path.patch b/gnu/packages/patches/bloomberg-bde-cmake-module-path.patch new file mode 100644 index 0000000000..b08ca5eac0 --- /dev/null +++ b/gnu/packages/patches/bloomberg-bde-cmake-module-path.patch @@ -0,0 +1,16 @@ +This package requires CMAKE_MODULE_PATH be set by the calling process. This +patch uses the CMAKE_PREFIX_PATH passed from Guix as the search path for +locating the bloomberg-bde-tools CMake modules. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,8 +1,6 @@ + cmake_minimum_required(VERSION 3.15) + +-if (NOT CMAKE_MODULE_PATH) +- message(FATAL "Please specify path to BDE cmake modules.") +-endif() ++string(REPLACE ":" "cmake/;" CMAKE_MODULE_PATH "$ENV{CMAKE_PREFIX_PATH}cmake/") + + get_filename_component(repoName ${CMAKE_CURRENT_LIST_DIR} NAME) + diff --git a/gnu/packages/patches/bloomberg-bde-tools-fix-install-path.patch b/gnu/packages/patches/bloomberg-bde-tools-fix-install-path.patch new file mode 100644 index 0000000000..a80c6c3ea3 --- /dev/null +++ b/gnu/packages/patches/bloomberg-bde-tools-fix-install-path.patch @@ -0,0 +1,95 @@ +Install shared libraries into "lib". Do not create symbolic links to static +libraries since only shared libraries are built. + +--- a/cmake/layers/ufid.cmake ++++ b/cmake/layers/ufid.cmake +@@ -6,10 +6,7 @@ bde_prefixed_override(ufid project_setup_install_opts) + function(ufid_project_setup_install_opts proj) + bde_assert_no_extra_args() + +- set(libPath "bin/so") +- if (${bde_ufid_is_64}) +- string(APPEND libPath "/64") +- endif() ++ set(libPath "lib") + + bde_struct_create( + installOpts +@@ -86,13 +83,6 @@ function(bde_create_ufid_symlink uor installOpts) + "${symlinkPrefix}/${symlinkDir}/${libLinkName}" + ) + +- install( +- CODE +- "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \ +- ${symlinkVal} ${symlinkFile})" +- COMPONENT "${component}-symlinks" +- ) +- + # This code creates compatibility symlinks + # WARNING: This is custom logic that has nothing to do with our build system. + # Some external build systems expect to find a variaty of ufids in dpkg. +@@ -110,14 +100,6 @@ function(bde_create_ufid_symlink uor installOpts) + symlinkFile + "${symlinkPrefix}/${symlinkDir}/${libLinkName}" + ) +- +- # IMPORTANT: symlinkFile is the same as above! +- install( +- CODE +- "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \ +- ${symlinkVal} ${symlinkFile})" +- COMPONENT "${component}-symlinks" +- ) + endif() + + if (${bde_ufid_is_pic}) +@@ -134,14 +116,6 @@ function(bde_create_ufid_symlink uor installOpts) + "${symlinkPrefix}/${symlinkDir}/${libLinkName}" + ) + +- # IMPORTANT: symlinkFile is the same as above! +- install( +- CODE +- "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \ +- ${symlinkVal} ${symlinkFile})" +- COMPONENT "${component}-pic-symlink-hack" +- ) +- + # And another one for "64" - remove "pic", add "64" + if (${bde_ufid_is_64}) + set(temp_ufid_flags ${install_ufid_flags}) +@@ -157,14 +131,6 @@ function(bde_create_ufid_symlink uor installOpts) + symlinkFile + "${symlinkPrefix}/${symlinkDir}/${libLinkName}" + ) +- +- # IMPORTANT: symlinkFile is the same as above! +- install( +- CODE +- "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \ +- ${symlinkVal} ${symlinkFile})" +- COMPONENT "${component}-pic-symlink-hack" +- ) + endif() + endif() + +@@ -177,18 +143,5 @@ function(bde_create_ufid_symlink uor installOpts) + symlinkReleaseFile + "${symlinkPrefix}/${symlinkDir}/${libReleaseLinkName}" + ) +- install( +- CODE +- "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \ +- ${symlinkVal} ${symlinkReleaseFile})" +- COMPONENT "${component}-release-symlink" +- ) +- install( +- CODE +- "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \ +- ${symlinkVal} ${symlinkReleaseFile})" +- COMPONENT "release-symlink" +- EXCLUDE_FROM_ALL +- ) + endif() + endfunction() diff --git a/gnu/packages/patches/coq-fix-envvars.patch b/gnu/packages/patches/coq-fix-envvars.patch index deecf5ce74..6c48224c64 100644 --- a/gnu/packages/patches/coq-fix-envvars.patch +++ b/gnu/packages/patches/coq-fix-envvars.patch @@ -1,63 +1,44 @@ -From ebe09fcac72b21d17c4e8fe6edc1b6076a4ae97c Mon Sep 17 00:00:00 2001 +From 0e76cda958a4d3e4bcbb96e171c26b6b3478c6c2 Mon Sep 17 00:00:00 2001 From: Julien Lepiller <julien@lepiller.eu> -Date: Sun, 21 Nov 2021 00:38:03 +0100 +Date: Thu, 10 Feb 2022 16:44:10 +0100 Subject: [PATCH] Fix environment variable usage. --- - checker/checker.ml | 2 ++ - lib/envars.ml | 26 ++++++++++++++++---------- - sysinit/coqargs.ml | 3 ++- - sysinit/coqloadpath.ml | 3 ++- - sysinit/coqloadpath.mli | 2 +- - tools/coqdep.ml | 2 +- - 6 files changed, 24 insertions(+), 14 deletions(-) + boot/env.ml | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) -diff --git a/checker/checker.ml b/checker/checker.ml -index f55ed9e8d6..3b797729ed 100644 ---- a/checker/checker.ml -+++ b/checker/checker.ml -@@ -104,6 +104,7 @@ let set_include d p = - (* Initializes the LoadPath *) - let init_load_path () = - let coqlib = Envars.coqlib () in -+ let coqcorelib = Envars.coqcorelib () in - let user_contrib = coqlib/"user-contrib" in - let xdg_dirs = Envars.xdg_dirs in - let coqpath = Envars.coqpath in -@@ -111,6 +112,7 @@ let init_load_path () = - CPath.choose_existing - [ CPath.make [ coqlib ; "plugins" ] - ; CPath.make [ coqlib ; ".."; "coq-core"; "plugins" ] -+ ; CPath.make [ coqcorelib ; "plugins" ] - ] |> function - | None -> - CErrors.user_err (Pp.str "Cannot find plugins directory") -diff --git a/lib/envars.ml b/lib/envars.ml -index 750bd60e71..c7affbd437 100644 ---- a/lib/envars.ml -+++ b/lib/envars.ml -@@ -127,15 +127,21 @@ let check_file_else ~dir ~file oth = - let guess_coqlib fail = - getenv_else "COQLIB" (fun () -> +diff --git a/boot/env.ml b/boot/env.ml +index e8521e7..d834a3a 100644 +--- a/boot/env.ml ++++ b/boot/env.ml +@@ -32,17 +32,29 @@ let fail_msg = + + let fail s = Format.eprintf "%s@\n%!" fail_msg; exit 1 + ++let path_to_list p = ++ let sep = if String.equal Sys.os_type "Win32" then ';' else ':' in ++ String.split_on_char sep p ++ + (* This code needs to be refactored, for now it is just what used to be in envvars *) + let guess_coqlib () = + Util.getenv_else "COQLIB" (fun () -> let prelude = "theories/Init/Prelude.vo" in -- check_file_else ~dir:Coq_config.coqlibsuffix ~file:prelude +- Util.check_file_else +- ~dir:Coq_config.coqlibsuffix +- ~file:prelude - (fun () -> -- if Sys.file_exists (Coq_config.coqlib / prelude) +- if Sys.file_exists (Filename.concat Coq_config.coqlib prelude) - then Coq_config.coqlib -- else -- fail "cannot guess a path for Coq libraries; please use -coqlib option \ -- or ensure you have installed the package containing Coq's stdlib (coq-stdlib in OPAM) \ -- If you intend to use Coq without a standard library, the -boot -noinit options must be used.") -- ) -+ let coqlibpath = getenv_else "COQLIBPATH" (fun () -> Coq_config.coqlibsuffix) in +- else fail ())) ++ let coqlibpath = Util.getenv_else "COQLIBPATH" (fun () -> Coq_config.coqlibsuffix) in + let paths = path_to_list coqlibpath in + let valid_paths = + List.filter -+ (fun dir -> (check_file_else ~dir:dir ~file:prelude (fun () -> "")) <> "") ++ (fun dir -> (Util.check_file_else ~dir:dir ~file:prelude (fun () -> "")) <> "") + paths in + match valid_paths with + | [] -> -+ if Sys.file_exists (Coq_config.coqlib / prelude) ++ if Sys.file_exists (Filename.concat Coq_config.coqlib prelude) + then Coq_config.coqlib + else + fail "cannot guess a path for Coq libraries; please use -coqlib option \ @@ -65,75 +46,8 @@ index 750bd60e71..c7affbd437 100644 + If you intend to use Coq without a standard library, the -boot -noinit options must be used." + | p::_ -> p) - let coqlib_ref : string option ref = ref None - let set_user_coqlib path = coqlib_ref := Some path -@@ -208,7 +214,7 @@ let xdg_dirs ~warn = - let print_config ?(prefix_var_name="") f coq_src_subdirs = - let open Printf in - fprintf f "%sCOQLIB=%s/\n" prefix_var_name (coqlib ()); -- fprintf f "%sCOQCORELIB=%s/\n" prefix_var_name (coqlib () / "../coq-core/"); -+ fprintf f "%sCOQCORELIB=%s/\n" prefix_var_name (coqcorelib ()); - fprintf f "%sDOCDIR=%s/\n" prefix_var_name (docdir ()); - fprintf f "%sOCAMLFIND=%s\n" prefix_var_name (ocamlfind ()); - fprintf f "%sCAMLFLAGS=%s\n" prefix_var_name Coq_config.caml_flags; -diff --git a/sysinit/coqargs.ml b/sysinit/coqargs.ml -index 00f70a5fea..8325623a63 100644 ---- a/sysinit/coqargs.ml -+++ b/sysinit/coqargs.ml -@@ -453,7 +453,8 @@ let build_load_path opts = - if opts.pre.boot then [],[] - else - let coqlib = Envars.coqlib () in -- Coqloadpath.init_load_path ~coqlib in -+ let coqcorelib = Envars.coqcorelib () in -+ Coqloadpath.init_load_path ~coqlib ~coqcorelib in - ml_path @ opts.pre.ml_includes , - vo_path @ opts.pre.vo_includes - -diff --git a/sysinit/coqloadpath.ml b/sysinit/coqloadpath.ml -index 95ae5da3de..a58cfe6928 100644 ---- a/sysinit/coqloadpath.ml -+++ b/sysinit/coqloadpath.ml -@@ -35,7 +35,7 @@ let build_userlib_path ~unix_path = - else [], [] - - (* LoadPath for Coq user libraries *) --let init_load_path ~coqlib = -+let init_load_path ~coqlib ~coqcorelib = - - let open Loadpath in - let user_contrib = coqlib/"user-contrib" in -@@ -50,6 +50,7 @@ let init_load_path ~coqlib = - CPath.choose_existing - [ CPath.make [ coqlib ; "plugins" ] - ; CPath.make [ coqlib ; ".."; "coq-core"; "plugins" ] -+ ; CPath.make [ coqcorelib ; "plugins" ] - ] |> function - | None -> - CErrors.user_err (Pp.str "Cannot find plugins directory") -diff --git a/sysinit/coqloadpath.mli b/sysinit/coqloadpath.mli -index d853e9ea54..43c6dfa134 100644 ---- a/sysinit/coqloadpath.mli -+++ b/sysinit/coqloadpath.mli -@@ -12,5 +12,5 @@ - includes (in-order) Coq's standard library, Coq's [user-contrib] - folder, and directories specified in [COQPATH] and [XDG_DIRS] *) - val init_load_path -- : coqlib:CUnix.physical_path -+ : coqlib:CUnix.physical_path -> coqcorelib:CUnix.physical_path - -> CUnix.physical_path list * Loadpath.vo_path list -diff --git a/tools/coqdep.ml b/tools/coqdep.ml -index c1c87993e1..6c78e10866 100644 ---- a/tools/coqdep.ml -+++ b/tools/coqdep.ml -@@ -33,7 +33,7 @@ let coqdep () = - let coqlib = Envars.coqlib () in - let coq_plugins_dir = Filename.concat (Envars.coqcorelib ()) "plugins" in - if not (Sys.file_exists coq_plugins_dir) then -- CErrors.user_err Pp.(str "coqdep: cannot find plugins directory for coqlib: " ++ str coqlib ++ fnl ()); -+ CErrors.user_err Pp.(str "coqdep: cannot find plugins directory " ++ str coq_plugins_dir ++ str " for coqlib: " ++ str coqlib ++ fnl ()); - CD.add_rec_dir_import CD.add_coqlib_known (coqlib//"theories") ["Coq"]; - CD.add_rec_dir_import CD.add_coqlib_known (coq_plugins_dir) ["Coq"]; - let user = coqlib//"user-contrib" in + (* Build layout uses coqlib = coqcorelib *) + let guess_coqcorelib lib = -- -2.33.1 +2.34.0 + diff --git a/gnu/packages/patches/cpulimit-with-glib-2.32.patch b/gnu/packages/patches/cpulimit-with-glib-2.32.patch new file mode 100644 index 0000000000..4c0bbaac7c --- /dev/null +++ b/gnu/packages/patches/cpulimit-with-glib-2.32.patch @@ -0,0 +1,35 @@ +From 4a4794e041edf85cb67b9fbba66ad1a22fdcaaec Mon Sep 17 00:00:00 2001 +From: Eric Bavier <bavier@posteo.net> +Date: Sat, 29 Jan 2022 00:10:20 -0600 +Subject: [PATCH] Fixes linux build with glibc-2.32. + +* cpulimit.c: Guard inclusion of <sys/sysctl.h> which is needed only for + __APPLE__ and is deprecated and unavailable starting with glibc-2.32. +--- + src/cpulimit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Submitted upstream at https://github.com/opsengine/cpulimit/pull/105 + +diff --git a/src/cpulimit.c b/src/cpulimit.c +index 50eabea..be8cf22 100644 +--- a/src/cpulimit.c ++++ b/src/cpulimit.c +@@ -38,13 +38,13 @@ + #include <string.h> + #include <sys/stat.h> + #include <sys/time.h> +-#include <sys/sysctl.h> + #include <sys/resource.h> + #include <sys/types.h> + #include <sys/wait.h> + + #ifdef __APPLE__ || __FREEBSD__ + #include <libgen.h> ++#include <sys/sysctl.h> + #endif + + #include "process_group.h" +-- +2.34.0 + diff --git a/gnu/packages/patches/crawl-upgrade-saves.patch b/gnu/packages/patches/crawl-upgrade-saves.patch index 4c0b3a427b..720a94f3e5 100644 --- a/gnu/packages/patches/crawl-upgrade-saves.patch +++ b/gnu/packages/patches/crawl-upgrade-saves.patch @@ -8,15 +8,15 @@ and crawl would never upgrade saves. diff -ur a/source/database.cc b/source/database.cc --- a/source/database.cc 2018-08-09 21:49:26.000000000 -0400 +++ b/source/database.cc 2018-10-07 18:06:41.022445789 -0400 -@@ -25,6 +25,7 @@ +@@ -24,6 +24,7 @@ + #include "stringutil.h" #include "syscalls.h" - #include "threads.h" #include "unicode.h" +#include "version.h" // TextDB handles dependency checking the db vs text files, creating the // db, loading, and destroying the DB. -@@ -55,6 +56,7 @@ +@@ -54,6 +55,7 @@ vector<string> _input_files; DBM* _db; string timestamp; @@ -62,16 +62,16 @@ diff -ur a/source/database.cc b/source/database.cc for (const string &file : _input_files) { string full_input_path = _directory + file; -@@ -245,7 +253,7 @@ +@@ -246,7 +254,7 @@ ts += buf; } -- if (no_files && timestamp.empty()) -+ if (no_files && timestamp.empty() && version.empty()) +- if (no_files) ++ if (no_files && version.empty()) { // No point in empty databases, although for simplicity keep ones // for disappeared translations for now. -@@ -313,7 +321,10 @@ +@@ -312,7 +320,10 @@ _store_text_db(full_input_path, _db); } } diff --git a/gnu/packages/patches/dunst-1.7.3-fix-crash.patch b/gnu/packages/patches/dunst-1.7.3-fix-crash.patch new file mode 100644 index 0000000000..8b51d820a4 --- /dev/null +++ b/gnu/packages/patches/dunst-1.7.3-fix-crash.patch @@ -0,0 +1,21 @@ +Author: Danny Milosavljevic <dannym@scratchpost.org> +Date: 2022-02-04 21:52:05 CET + +Fix crash if notification contains invalid pixbuf data. + +diff -ru /gnu/store/5885czxhmhkckjqj939b0hd6b6czizwb-dunst-1.7.3-checkout/src/notification.c 5885czxhmhkckjqj939b0hd6b6czizwb-dunst-1.7.3-checkout/src/notification.c +--- /gnu/store/5885czxhmhkckjqj939b0hd6b6czizwb-dunst-1.7.3-checkout/src/notification.c 1970-01-01 01:00:01.000000000 +0100 ++++ 5885czxhmhkckjqj939b0hd6b6czizwb-dunst-1.7.3-checkout/src/notification.c 2022-02-04 19:05:57.534906600 +0100 +@@ -359,8 +359,10 @@ + g_clear_pointer(&n->icon_id, g_free); + + GdkPixbuf *icon = icon_get_for_data(new_icon, &n->icon_id, draw_get_scale()); +- n->icon = gdk_pixbuf_to_cairo_surface(icon); +- g_object_unref(icon); ++ if (icon) { ++ n->icon = gdk_pixbuf_to_cairo_surface(icon); ++ g_object_unref(icon); ++ } + } + + /* see notification.h */ diff --git a/gnu/packages/patches/fenics-dolfin-algorithm.patch b/gnu/packages/patches/fenics-dolfin-algorithm.patch new file mode 100644 index 0000000000..e2a3148a64 --- /dev/null +++ b/gnu/packages/patches/fenics-dolfin-algorithm.patch @@ -0,0 +1,37 @@ +Fix compilation errors: + + dolfin/geometry/IntersectionConstruction.cpp: In static member function ‘static std::vector<dolfin::Point> dolfin::IntersectionConstruction::intersection_segment_segment_2d(const dolfin::Point&, const dolfin::Point&, const dolfin::Point&, const dolfin::Point&)’: + dolfin/geometry/IntersectionConstruction.cpp:442:24: error: ‘min_element’ is not a member of ‘std’; did you mean ‘tuple_element’? + 442 | const auto it = std::min_element(oo.begin(), oo.end()); + | ^~~~~~~~~~~ + | tuple_element + + dolfin/mesh/MeshFunction.h: In member function ‘std::vector<long unsigned int> dolfin::MeshFunction<T>::where_equal(T)’: + dolfin/mesh/MeshFunction.h:652:26: error: ‘count’ is not a member of ‘std’; did you mean ‘cout’? + 652 | std::size_t n = std::count(_values.get(), _values.get() + _size, value); + | ^~~~~ + | cout + +Submitted upstream at https://bitbucket.org/fenics-project/dolfin/issues/1128 + +--- a/dolfin/geometry/IntersectionConstruction.cpp ++++ b/dolfin/geometry/IntersectionConstruction.cpp +@@ -18,7 +18,8 @@ + // First added: 2014-02-03 + // Last changed: 2017-12-12 + ++#include <algorithm> + #include <iomanip> + #include <dolfin/mesh/MeshEntity.h> + #include "predicates.h" + +--- a/dolfin/mesh/MeshFunction.h ++++ b/dolfin/mesh/MeshFunction.h +@@ -24,6 +24,7 @@ + #ifndef __MESH_FUNCTION_H + #define __MESH_FUNCTION_H + ++#include <algorithm> + #include <map> + #include <vector> + diff --git a/gnu/packages/patches/fenics-dolfin-boost.patch b/gnu/packages/patches/fenics-dolfin-boost.patch new file mode 100644 index 0000000000..de56ebb9b3 --- /dev/null +++ b/gnu/packages/patches/fenics-dolfin-boost.patch @@ -0,0 +1,45 @@ +The `BOOST_LITTLE_ENDIAN` and `BOOST_BIG_ENDIAN` macros, along with the +"boost/detail/endian.hpp" header, were deprecated in boost 1.69.0 and finally +removed in boost 1.73.0. They are superseded by the BOOST_ENDIAN_LITTLE_BYTE +and BOOST_ENDIAN_BIG_BYTE macros and "boost/predef/other/endian.h" header. + +Deprecated: https://github.com/boostorg/predef/commit/32d4581c1689370444f2e565cfbb8421d5071807 +Removed: https://github.com/boostorg/predef/commit/aa6e232bf170ad8b856aff9e7c70334f77441c7f + +Adaptation of patch from https://bitbucket.org/fenics-project/dolfin/issues/1116 + +--- a/dolfin/io/VTKFile.cpp ++++ b/dolfin/io/VTKFile.cpp +@@ -20,7 +20,7 @@ + #include <vector> + #include <iomanip> + #include <boost/cstdint.hpp> +-#include <boost/detail/endian.hpp> ++#include <boost/predef/other/endian.h> + + #include "pugixml.hpp" + +@@ -614,9 +614,9 @@ + std::string endianness = ""; + if (encode_string == "binary") + { +- #if defined BOOST_LITTLE_ENDIAN ++ #if defined BOOST_ENDIAN_LITTLE_BYTE + endianness = "byte_order=\"LittleEndian\""; +- #elif defined BOOST_BIG_ENDIAN ++ #elif defined BOOST_ENDIAN_BIG_BYTE + endianness = "byte_order=\"BigEndian\"";; + #else + dolfin_error("VTKFile.cpp", + +--- a/dolfin/io/VTKWriter.cpp ++++ b/dolfin/io/VTKWriter.cpp +@@ -24,7 +24,6 @@ + #include <sstream> + #include <vector> + #include <iomanip> +-#include <boost/detail/endian.hpp> + + #include <dolfin/fem/GenericDofMap.h> + #include <dolfin/fem/FiniteElement.h> +
\ No newline at end of file diff --git a/gnu/packages/patches/fenics-dolfin-config-slepc.patch b/gnu/packages/patches/fenics-dolfin-config-slepc.patch new file mode 100644 index 0000000000..fa06179285 --- /dev/null +++ b/gnu/packages/patches/fenics-dolfin-config-slepc.patch @@ -0,0 +1,48 @@ +From https://bitbucket.org/fenics-project/dolfin/issues/1120 + +From f627a442350560e50dbbb11f7828b6d807369533 Mon Sep 17 00:00:00 2001 +From: Alexei Colin <acolin@isi.edu> +Date: Sun, 11 Apr 2021 20:40:00 -0400 +Subject: [PATCH] cmake: PETSc,SLEPc: match lowercase .pc pkg-config files + +Upstream has moved to lowercase. PETSc has kept the mixed-case file for +compatibility, but SLEPc hasn't. + +pkg_search_module takes multiple patterns and succeeds on first match, +so this commit is backward-compatible with older installations of PETSc, +SLEPc. + +--- + cmake/modules/FindPETSc.cmake | 2 +- + cmake/modules/FindSLEPc.cmake | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/modules/FindPETSc.cmake b/cmake/modules/FindPETSc.cmake +index 80faffdad..728a6ec30 100644 +--- a/cmake/modules/FindPETSc.cmake ++++ b/cmake/modules/FindPETSc.cmake +@@ -51,7 +51,7 @@ find_package(PkgConfig REQUIRED) + + # Find PETSc pkg-config file. Note: craypetsc_real is on Cray systems + set(ENV{PKG_CONFIG_PATH} "$ENV{CRAY_PETSC_PREFIX_DIR}/lib/pkgconfig:$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") +-pkg_search_module(PETSC craypetsc_real PETSc) ++pkg_search_module(PETSC craypetsc_real petsc PETSc) + + # Extract major, minor, etc from version string + if (PETSC_VERSION) +diff --git a/cmake/modules/FindSLEPc.cmake b/cmake/modules/FindSLEPc.cmake +index 327cffc23..dec26fcc4 100644 +--- a/cmake/modules/FindSLEPc.cmake ++++ b/cmake/modules/FindSLEPc.cmake +@@ -48,7 +48,7 @@ find_package(PkgConfig REQUIRED) + set(ENV{PKG_CONFIG_PATH} "$ENV{SLEPC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{SLEPC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_PATH} "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}:$ENV{PETSC_DIR}:$ENV{PKG_CONFIG_PATH}") +-pkg_search_module(SLEPC crayslepc_real SLEPc) ++pkg_search_module(SLEPC crayslepc_real slepc SLEPc) + + # Extract major, minor, etc from version string + if (SLEPC_VERSION) +-- +2.30.0 + diff --git a/gnu/packages/patches/fenics-dolfin-demo-init.patch b/gnu/packages/patches/fenics-dolfin-demo-init.patch new file mode 100644 index 0000000000..5a01320147 --- /dev/null +++ b/gnu/packages/patches/fenics-dolfin-demo-init.patch @@ -0,0 +1,39 @@ +Ensure MPI is initialized before getting rank, which may be called early by +Logger::write() via dolfin::info(). + +Fixes "MPI_Comm_rank called before MPI_INIT" error from +`demo_stokes-iterative_serial` and `demo_waveguide_serial` tests. + +Submitted upstream at https://bitbucket.org/fenics-project/dolfin/issues/1127 + +--- a/dolfin/common/MPI.cpp ++++ b/dolfin/common/MPI.cpp +@@ -143,6 +143,7 @@ MPI_Info& dolfin::MPIInfo::operator*() + unsigned int dolfin::MPI::rank(const MPI_Comm comm) + { + #ifdef HAS_MPI ++ SubSystemsManager::init_mpi(); + int rank; + MPI_Comm_rank(comm, &rank); + return rank; +diff --git a/dolfin/common/MPI.h b/dolfin/common/MPI.h +index b93f6df30..854114a3f 100644 +--- a/dolfin/common/MPI.h ++++ b/dolfin/common/MPI.h +@@ -102,12 +102,13 @@ namespace dolfin + /// communicator + void reset(MPI_Comm comm); + +- /// Return process rank for the communicator ++ /// Return process rank for the communicator. This function will ++ /// also initialize MPI if it hasn't already been initialised. + unsigned int rank() const; + + /// Return size of the group (number of processes) associated +- /// with the communicator. This function will also intialise MPI +- /// if it hasn't already been intialised. ++ /// with the communicator. This function will also initialise MPI ++ /// if it hasn't already been initialised. + unsigned int size() const; + + /// Set a barrier (synchronization point) diff --git a/gnu/packages/patches/ghc-4.patch b/gnu/packages/patches/ghc-4.patch new file mode 100644 index 0000000000..87484f575d --- /dev/null +++ b/gnu/packages/patches/ghc-4.patch @@ -0,0 +1,708 @@ +The GHC 4 runtime system was written before GCC 3.5 deprecated lvalue casts. +The runtime system's sources are littered with these casts, so early versions +of this patch were dedicated to rewriting those statements to a standards +compliant form. Unfortunately, this led to subtle breakage, so instead we +build with GCC 2.95. + +Problematic for newer versions of GCC is also the assembly in the bundled +sources of GMP 2.0.2, which spans multiple lines without escaping line breaks. + +TODO: We aren't yet using anything under ghc/compiler, so the patches there +aren't needed at this time. The intent was to ensure that the compiler +sources can be used even when they are interpreted by Hugs. + +TODO: There are some more problems with the Haskell sources. Some files have +too many commas (both at the end of the line and at the beginning of the next +line). Others use a trailing hash, which Hugs doesn't understand. + +TODO: Hugs doesn't understand "unsafe" in hslib/lang/Storable.lhs + +diff --git a/ghc/compiler/main/CmdLineOpts.lhs b/ghc/compiler/main/CmdLineOpts.lhs +index ca1b58d..074fcaf 100644 +--- a/ghc/compiler/main/CmdLineOpts.lhs ++++ b/ghc/compiler/main/CmdLineOpts.lhs +@@ -163,9 +163,9 @@ import Constants -- Default values for some flags + + import FastString ( headFS ) + import Maybes ( assocMaybe, firstJust, maybeToBool ) +-import Panic ( panic, panic# ) ++import Panic ( panic, panic' ) + +-#if __GLASGOW_HASKELL__ < 301 ++#if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ < 301 + import ArrBase ( Array(..) ) + #else + import PrelArr ( Array(..) ) +diff --git a/ghc/compiler/prelude/PrimOp.lhs b/ghc/compiler/prelude/PrimOp.lhs +index 7a0627d..59802c4 100644 +--- a/ghc/compiler/prelude/PrimOp.lhs ++++ b/ghc/compiler/prelude/PrimOp.lhs +@@ -502,7 +502,7 @@ tagOf_PrimOp UnblockAsyncExceptionsOp = ILIT(260) + tagOf_PrimOp DataToTagOp = ILIT(261) + tagOf_PrimOp TagToEnumOp = ILIT(262) + +-tagOf_PrimOp op = pprPanic# "tagOf_PrimOp: pattern-match" (ppr op) ++tagOf_PrimOp op = pprPanic' "tagOf_PrimOp: pattern-match" (ppr op) + + instance Eq PrimOp where + op1 == op2 = tagOf_PrimOp op1 _EQ_ tagOf_PrimOp op2 +diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs +index 19ad666..89d07cb 100644 +--- a/ghc/compiler/utils/Outputable.lhs ++++ b/ghc/compiler/utils/Outputable.lhs +@@ -42,8 +42,8 @@ module Outputable ( + + + -- error handling +- pprPanic, pprPanic#, pprError, pprTrace, assertPprPanic, warnPprTrace, +- trace, panic, panic#, assertPanic ++ pprPanic, pprPanic', pprError, pprTrace, assertPprPanic, warnPprTrace, ++ trace, panic, panic', assertPanic + ) where + + #include "HsVersions.h" +@@ -420,7 +420,7 @@ pprPanic = pprAndThen panic + pprError = pprAndThen error + pprTrace = pprAndThen trace + +-pprPanic# heading pretty_msg = panic# (show (doc PprDebug)) ++pprPanic' heading pretty_msg = panic' (show (doc PprDebug)) + where + doc = text heading <+> pretty_msg + +diff --git a/ghc/compiler/utils/Panic.lhs b/ghc/compiler/utils/Panic.lhs +index 907d8aa..37a2d87 100644 +--- a/ghc/compiler/utils/Panic.lhs ++++ b/ghc/compiler/utils/Panic.lhs +@@ -9,7 +9,7 @@ It's hard to put these functions anywhere else without causing + some unnecessary loops in the module dependency graph. + + \begin{code} +-module Panic ( panic, panic#, assertPanic, trace ) where ++module Panic ( panic, panic', assertPanic, trace ) where + + import IOExts ( trace ) + +@@ -27,8 +27,8 @@ panic x = error ("panic! (the `impossible' happened):\n\t" + -- what TAG_ is with GHC at the moment. Ugh. (Simon) + -- No, man -- Too Beautiful! (Will) + +-panic# :: String -> FAST_INT +-panic# s = case (panic s) of () -> ILIT(0) ++panic' :: String -> FAST_INT ++panic' s = case (panic s) of () -> ILIT(0) + + assertPanic :: String -> Int -> a + assertPanic file line = panic ("ASSERT failed! file " ++ file ++ ", line " ++ show line) +diff --git a/ghc/includes/PrimOps.h b/ghc/includes/PrimOps.h +index 8b8c2f9..7f43ab0 100644 +--- a/ghc/includes/PrimOps.h ++++ b/ghc/includes/PrimOps.h +@@ -893,6 +893,7 @@ EXTFUN_RTS(mkForeignObjzh_fast); + #define STG_SIG_ERR (-3) + #define STG_SIG_HAN (-4) + ++#include <signal.h> + extern StgInt sig_install (StgInt, StgInt, StgStablePtr, sigset_t *); + #define stg_sig_default(sig,mask) sig_install(sig,STG_SIG_DFL,0,(sigset_t *)mask) + #define stg_sig_ignore(sig,mask) sig_install(sig,STG_SIG_IGN,0,(sigset_t *)mask) +diff --git a/ghc/rts/RtsFlags.c b/ghc/rts/RtsFlags.c +index a05036f..9cd6c83 100644 +--- a/ghc/rts/RtsFlags.c ++++ b/ghc/rts/RtsFlags.c +@@ -1132,8 +1132,7 @@ process_gran_option(int arg, int *rts_argc, char *rts_argv[], rtsBool *error) + } else if (RtsFlags.GranFlags.proc > MAX_PROC || + RtsFlags.GranFlags.proc < 1) + { +- fprintf(stderr,"setupRtsFlags: no more than %u processors +-allowed\n", ++ fprintf(stderr,"setupRtsFlags: no more than %u processors allowed\n", + MAX_PROC); + *error = rtsTrue; + } +diff --git a/ghc/rts/gmp/longlong.h b/ghc/rts/gmp/longlong.h +index 382fcc0..0cf79fa 100644 +--- a/ghc/rts/gmp/longlong.h ++++ b/ghc/rts/gmp/longlong.h +@@ -106,7 +106,7 @@ MA 02111-1307, USA. */ + + #if (defined (__a29k__) || defined (_AM29K)) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("add %1,%4,%5 ++ __asm__ ("add %1,%4,%5\n\ + addc %0,%2,%3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -115,7 +115,7 @@ MA 02111-1307, USA. */ + "%r" ((USItype)(al)), \ + "rI" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("sub %1,%4,%5 ++ __asm__ ("sub %1,%4,%5\n\ + subc %0,%2,%3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -173,7 +173,7 @@ extern UDItype __udiv_qrnnd (); + + #if defined (__arm__) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("adds %1, %4, %5 ++ __asm__ ("adds %1, %4, %5\n\ + adc %0, %2, %3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -182,7 +182,7 @@ extern UDItype __udiv_qrnnd (); + "%r" ((USItype)(al)), \ + "rI" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("subs %1, %4, %5 ++ __asm__ ("subs %1, %4, %5\n\ + sbc %0, %2, %3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -191,18 +191,18 @@ extern UDItype __udiv_qrnnd (); + "r" ((USItype)(al)), \ + "rI" ((USItype)(bl))) + #define umul_ppmm(xh, xl, a, b) \ +- __asm__ ("%@ Inlined umul_ppmm +- mov %|r0, %2, lsr #16 +- mov %|r2, %3, lsr #16 +- bic %|r1, %2, %|r0, lsl #16 +- bic %|r2, %3, %|r2, lsl #16 +- mul %1, %|r1, %|r2 +- mul %|r2, %|r0, %|r2 +- mul %|r1, %0, %|r1 +- mul %0, %|r0, %0 +- adds %|r1, %|r2, %|r1 +- addcs %0, %0, #65536 +- adds %1, %1, %|r1, lsl #16 ++ __asm__ ("%@ Inlined umul_ppmm\n\ ++ mov %|r0, %2, lsr #16\n\ ++ mov %|r2, %3, lsr #16\n\ ++ bic %|r1, %2, %|r0, lsl #16\n\ ++ bic %|r2, %3, %|r2, lsl #16\n\ ++ mul %1, %|r1, %|r2\n\ ++ mul %|r2, %|r0, %|r2\n\ ++ mul %|r1, %0, %|r1\n\ ++ mul %0, %|r0, %0\n\ ++ adds %|r1, %|r2, %|r1\n\ ++ addcs %0, %0, #65536\n\ ++ adds %1, %1, %|r1, lsl #16\n\ + adc %0, %0, %|r1, lsr #16" \ + : "=&r" ((USItype)(xh)), \ + "=r" ((USItype)(xl)) \ +@@ -243,7 +243,7 @@ extern UDItype __udiv_qrnnd (); + + #if defined (__gmicro__) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("add.w %5,%1 ++ __asm__ ("add.w %5,%1\n\ + addx %3,%0" \ + : "=g" ((USItype)(sh)), \ + "=&g" ((USItype)(sl)) \ +@@ -252,7 +252,7 @@ extern UDItype __udiv_qrnnd (); + "%1" ((USItype)(al)), \ + "g" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("sub.w %5,%1 ++ __asm__ ("sub.w %5,%1\n\ + subx %3,%0" \ + : "=g" ((USItype)(sh)), \ + "=&g" ((USItype)(sl)) \ +@@ -282,7 +282,7 @@ extern UDItype __udiv_qrnnd (); + + #if defined (__hppa) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("add %4,%5,%1 ++ __asm__ ("add %4,%5,%1\n\ + addc %2,%3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -291,7 +291,7 @@ extern UDItype __udiv_qrnnd (); + "%rM" ((USItype)(al)), \ + "rM" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("sub %4,%5,%1 ++ __asm__ ("sub %4,%5,%1\n\ + subb %2,%3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -330,21 +330,21 @@ extern USItype __udiv_qrnnd (); + do { \ + USItype __tmp; \ + __asm__ ( \ +- "ldi 1,%0 +- extru,= %1,15,16,%%r0 ; Bits 31..16 zero? +- extru,tr %1,15,16,%1 ; No. Shift down, skip add. +- ldo 16(%0),%0 ; Yes. Perform add. +- extru,= %1,23,8,%%r0 ; Bits 15..8 zero? +- extru,tr %1,23,8,%1 ; No. Shift down, skip add. +- ldo 8(%0),%0 ; Yes. Perform add. +- extru,= %1,27,4,%%r0 ; Bits 7..4 zero? +- extru,tr %1,27,4,%1 ; No. Shift down, skip add. +- ldo 4(%0),%0 ; Yes. Perform add. +- extru,= %1,29,2,%%r0 ; Bits 3..2 zero? +- extru,tr %1,29,2,%1 ; No. Shift down, skip add. +- ldo 2(%0),%0 ; Yes. Perform add. +- extru %1,30,1,%1 ; Extract bit 1. +- sub %0,%1,%0 ; Subtract it. ++ "ldi 1,%0\n\ ++ extru,= %1,15,16,%%r0 ; Bits 31..16 zero?\n\ ++ extru,tr %1,15,16,%1 ; No. Shift down, skip add.\n\ ++ ldo 16(%0),%0 ; Yes. Perform add.\n\ ++ extru,= %1,23,8,%%r0 ; Bits 15..8 zero?\n\ ++ extru,tr %1,23,8,%1 ; No. Shift down, skip add.\n\ ++ ldo 8(%0),%0 ; Yes. Perform add.\n\ ++ extru,= %1,27,4,%%r0 ; Bits 7..4 zero?\n\ ++ extru,tr %1,27,4,%1 ; No. Shift down, skip add.\n\ ++ ldo 4(%0),%0 ; Yes. Perform add.\n\ ++ extru,= %1,29,2,%%r0 ; Bits 3..2 zero?\n\ ++ extru,tr %1,29,2,%1 ; No. Shift down, skip add.\n\ ++ ldo 2(%0),%0 ; Yes. Perform add.\n\ ++ extru %1,30,1,%1 ; Extract bit 1.\n\ ++ sub %0,%1,%0 ; Subtract it.\n\ + " : "=r" (count), "=r" (__tmp) : "1" (x)); \ + } while (0) + #endif /* hppa */ +@@ -392,7 +392,7 @@ extern USItype __udiv_qrnnd (); + + #if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("addl %5,%1 ++ __asm__ ("addl %5,%1\n\ + adcl %3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -401,7 +401,7 @@ extern USItype __udiv_qrnnd (); + "%1" ((USItype)(al)), \ + "g" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("subl %5,%1 ++ __asm__ ("subl %5,%1\n\ + sbbl %3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -514,7 +514,7 @@ extern USItype __udiv_qrnnd (); + + #if (defined (__mc68000__) || defined (__mc68020__) || defined (__NeXT__) || defined(mc68020)) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("add%.l %5,%1 ++ __asm__ ("add%.l %5,%1\n\ + addx%.l %3,%0" \ + : "=d" ((USItype)(sh)), \ + "=&d" ((USItype)(sl)) \ +@@ -523,7 +523,7 @@ extern USItype __udiv_qrnnd (); + "%1" ((USItype)(al)), \ + "g" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("sub%.l %5,%1 ++ __asm__ ("sub%.l %5,%1\n\ + subx%.l %3,%0" \ + : "=d" ((USItype)(sh)), \ + "=&d" ((USItype)(sl)) \ +@@ -562,27 +562,27 @@ extern USItype __udiv_qrnnd (); + #else /* not mc68020 */ + #define umul_ppmm(xh, xl, a, b) \ + do { USItype __umul_tmp1, __umul_tmp2; \ +- __asm__ ("| Inlined umul_ppmm +- move%.l %5,%3 +- move%.l %2,%0 +- move%.w %3,%1 +- swap %3 +- swap %0 +- mulu %2,%1 +- mulu %3,%0 +- mulu %2,%3 +- swap %2 +- mulu %5,%2 +- add%.l %3,%2 +- jcc 1f +- add%.l %#0x10000,%0 +-1: move%.l %2,%3 +- clr%.w %2 +- swap %2 +- swap %3 +- clr%.w %3 +- add%.l %3,%1 +- addx%.l %2,%0 ++ __asm__ ("| Inlined umul_ppmm\n\ ++ move%.l %5,%3\n\ ++ move%.l %2,%0\n\ ++ move%.w %3,%1\n\ ++ swap %3\n\ ++ swap %0\n\ ++ mulu %2,%1\n\ ++ mulu %3,%0\n\ ++ mulu %2,%3\n\ ++ swap %2\n\ ++ mulu %5,%2\n\ ++ add%.l %3,%2\n\ ++ jcc 1f\n\ ++ add%.l %#0x10000,%0\n\ ++1: move%.l %2,%3\n\ ++ clr%.w %2\n\ ++ swap %2\n\ ++ swap %3\n\ ++ clr%.w %3\n\ ++ add%.l %3,%1\n\ ++ addx%.l %2,%0\n\ + | End inlined umul_ppmm" \ + : "=&d" ((USItype)(xh)), "=&d" ((USItype)(xl)), \ + "=d" (__umul_tmp1), "=&d" (__umul_tmp2) \ +@@ -595,7 +595,7 @@ extern USItype __udiv_qrnnd (); + + #if defined (__m88000__) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("addu.co %1,%r4,%r5 ++ __asm__ ("addu.co %1,%r4,%r5\n\ + addu.ci %0,%r2,%r3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -604,7 +604,7 @@ extern USItype __udiv_qrnnd (); + "%rJ" ((USItype)(al)), \ + "rJ" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("subu.co %1,%r4,%r5 ++ __asm__ ("subu.co %1,%r4,%r5\n\ + subu.ci %0,%r2,%r3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -663,8 +663,8 @@ extern USItype __udiv_qrnnd (); + "d" ((USItype)(v))) + #else + #define umul_ppmm(w1, w0, u, v) \ +- __asm__ ("multu %2,%3 +- mflo %0 ++ __asm__ ("multu %2,%3\n\ ++ mflo %0\n\ + mfhi %1" \ + : "=d" ((USItype)(w0)), \ + "=d" ((USItype)(w1)) \ +@@ -685,8 +685,8 @@ extern USItype __udiv_qrnnd (); + "d" ((UDItype)(v))) + #else + #define umul_ppmm(w1, w0, u, v) \ +- __asm__ ("dmultu %2,%3 +- mflo %0 ++ __asm__ ("dmultu %2,%3\n\ ++ mflo %0\n\ + mfhi %1" \ + : "=d" ((UDItype)(w0)), \ + "=d" ((UDItype)(w1)) \ +@@ -855,7 +855,7 @@ extern USItype __udiv_qrnnd (); + + #if defined (__pyr__) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("addw %5,%1 ++ __asm__ ("addw %5,%1\n\ + addwc %3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -864,7 +864,7 @@ extern USItype __udiv_qrnnd (); + "%1" ((USItype)(al)), \ + "g" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("subw %5,%1 ++ __asm__ ("subw %5,%1\n\ + subwb %3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -877,7 +877,7 @@ extern USItype __udiv_qrnnd (); + ({union {UDItype __ll; \ + struct {USItype __h, __l;} __i; \ + } __xx; \ +- __asm__ ("movw %1,%R0 ++ __asm__ ("movw %1,%R0\n\ + uemul %2,%0" \ + : "=&r" (__xx.__ll) \ + : "g" ((USItype) (u)), \ +@@ -887,7 +887,7 @@ extern USItype __udiv_qrnnd (); + + #if defined (__ibm032__) /* RT/ROMP */ && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("a %1,%5 ++ __asm__ ("a %1,%5\n\ + ae %0,%3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -896,7 +896,7 @@ extern USItype __udiv_qrnnd (); + "%1" ((USItype)(al)), \ + "r" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("s %1,%5 ++ __asm__ ("s %1,%5\n\ + se %0,%3" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -908,25 +908,25 @@ extern USItype __udiv_qrnnd (); + do { \ + USItype __m0 = (m0), __m1 = (m1); \ + __asm__ ( \ +- "s r2,r2 +- mts r10,%2 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- m r2,%3 +- cas %0,r2,r0 ++ "s r2,r2\n\ ++ mts r10,%2\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ m r2,%3\n\ ++ cas %0,r2,r0\n\ + mfs r10,%1" \ + : "=r" ((USItype)(ph)), \ + "=r" ((USItype)(pl)) \ +@@ -957,8 +957,8 @@ extern USItype __udiv_qrnnd (); + #if defined (__sh2__) && W_TYPE_SIZE == 32 + #define umul_ppmm(w1, w0, u, v) \ + __asm__ ( \ +- "dmulu.l %2,%3 +- sts macl,%1 ++ "dmulu.l %2,%3\n\ ++ sts macl,%1\n\ + sts mach,%0" \ + : "=r" ((USItype)(w1)), \ + "=r" ((USItype)(w0)) \ +@@ -970,7 +970,7 @@ extern USItype __udiv_qrnnd (); + + #if defined (__sparc__) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("addcc %r4,%5,%1 ++ __asm__ ("addcc %r4,%5,%1\n\ + addx %r2,%3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -980,7 +980,7 @@ extern USItype __udiv_qrnnd (); + "rI" ((USItype)(bl)) \ + __CLOBBER_CC) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("subcc %r4,%5,%1 ++ __asm__ ("subcc %r4,%5,%1\n\ + subx %r2,%3,%0" \ + : "=r" ((USItype)(sh)), \ + "=&r" ((USItype)(sl)) \ +@@ -1027,44 +1027,44 @@ extern USItype __udiv_qrnnd (); + "r" ((USItype)(v))) + #define UMUL_TIME 5 + #define udiv_qrnnd(q, r, n1, n0, d) \ +- __asm__ ("! Inlined udiv_qrnnd +- wr %%g0,%2,%%y ! Not a delayed write for sparclite +- tst %%g0 +- divscc %3,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%%g1 +- divscc %%g1,%4,%0 +- rd %%y,%1 +- bl,a 1f +- add %1,%4,%1 ++ __asm__ ("! Inlined udiv_qrnnd\n\ ++ wr %%g0,%2,%%y ! Not a delayed write for sparclite\n\ ++ tst %%g0\n\ ++ divscc %3,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%%g1\n\ ++ divscc %%g1,%4,%0\n\ ++ rd %%y,%1\n\ ++ bl,a 1f\n\ ++ add %1,%4,%1\n\ + 1: ! End of inline udiv_qrnnd" \ + : "=r" ((USItype)(q)), \ + "=r" ((USItype)(r)) \ +@@ -1085,45 +1085,45 @@ extern USItype __udiv_qrnnd (); + /* Default to sparc v7 versions of umul_ppmm and udiv_qrnnd. */ + #ifndef umul_ppmm + #define umul_ppmm(w1, w0, u, v) \ +- __asm__ ("! Inlined umul_ppmm +- wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr +- sra %3,31,%%g2 ! Don't move this insn +- and %2,%%g2,%%g2 ! Don't move this insn +- andcc %%g0,0,%%g1 ! Don't move this insn +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,%3,%%g1 +- mulscc %%g1,0,%%g1 +- add %%g1,%%g2,%0 ++ __asm__ ("! Inlined umul_ppmm\n\ ++ wr %%g0,%2,%%y ! SPARC has 0-3 delay insn after a wr\n\ ++ sra %3,31,%%g2 ! Don't move this insn\n\ ++ and %2,%%g2,%%g2 ! Don't move this insn\n\ ++ andcc %%g0,0,%%g1 ! Don't move this insn\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,%3,%%g1\n\ ++ mulscc %%g1,0,%%g1\n\ ++ add %%g1,%%g2,%0\n\ + rd %%y,%1" \ + : "=r" ((USItype)(w1)), \ + "=r" ((USItype)(w0)) \ +@@ -1147,7 +1147,7 @@ extern USItype __udiv_qrnnd (); + + #if defined (__vax__) && W_TYPE_SIZE == 32 + #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ +- __asm__ ("addl2 %5,%1 ++ __asm__ ("addl2 %5,%1\n\ + adwc %3,%0" \ + : "=g" ((USItype)(sh)), \ + "=&g" ((USItype)(sl)) \ +@@ -1156,7 +1156,7 @@ extern USItype __udiv_qrnnd (); + "%1" ((USItype)(al)), \ + "g" ((USItype)(bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ +- __asm__ ("subl2 %5,%1 ++ __asm__ ("subl2 %5,%1\n\ + sbwc %3,%0" \ + : "=g" ((USItype)(sh)), \ + "=&g" ((USItype)(sl)) \ +diff --git a/ghc/lib/std/CPUTime.lhs b/ghc/lib/std/CPUTime.lhs +--- a/ghc/lib/std/CPUTime.lhs ++++ b/ghc/lib/std/CPUTime.lhs +@@ -9,6 +9,6 @@ + module CPUTime + ( + getCPUTime, -- :: IO Integer +- cpuTimePrecision -- :: Integer ++ cpuTimePrecision -- :: Integer + ) where + \end{code} +
\ No newline at end of file diff --git a/gnu/packages/patches/guile-fibers-wait-for-io-readiness.patch b/gnu/packages/patches/guile-fibers-wait-for-io-readiness.patch new file mode 100644 index 0000000000..d5d5cf44e6 --- /dev/null +++ b/gnu/packages/patches/guile-fibers-wait-for-io-readiness.patch @@ -0,0 +1,346 @@ +Scheme-GNUnet requires the new operations 'wait-until-port-readable-operation' +and 'wait-until-port-readable-operation' for communicating with services. +This patch has been previously submitted at <https://github.com/wingo/fibers/pull/50>, +on Sep 16, 2021. As of Feb 3, 2022, upstream has not responded yet. + +diff --git a/Makefile.am b/Makefile.am +index e2db57e..0134255 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -33,6 +33,7 @@ SOURCES = \ + fibers/deque.scm \ + fibers/epoll.scm \ + fibers/interrupts.scm \ ++ fibers/io-wakeup.scm \ + fibers/nameset.scm \ + fibers/operations.scm \ + fibers/posix-clocks.scm \ +@@ -67,6 +68,7 @@ TESTS = \ + tests/conditions.scm \ + tests/channels.scm \ + tests/foreign.scm \ ++ tests/io-wakeup.scm \ + tests/parameters.scm \ + tests/preemption.scm \ + tests/speedup.scm +diff --git a/fibers.texi b/fibers.texi +index 52f7177..0990c8f 100644 +--- a/fibers.texi ++++ b/fibers.texi +@@ -12,6 +12,7 @@ This manual is for Fibers (version @value{VERSION}, updated + @value{UPDATED}) + + Copyright 2016-2022 Andy Wingo ++Copyright 2021 Maxime Devos + + @quotation + @c For more information, see COPYING.docs in the fibers +@@ -453,6 +454,7 @@ of operations for channels and timers, and an internals interface. + * Channels:: Share memory by communicating. + * Timers:: Operations on time. + * Conditions:: Waiting for simple state changes. ++* Port Readiness:: Waiting until a port is ready for I/O. + * REPL Commands:: Experimenting with Fibers at the console. + * Schedulers and Tasks:: Fibers are built from lower-level primitives. + @end menu +@@ -722,6 +724,28 @@ signalled. Equivalent to @code{(perform-operation (wait-operation + cvar))}. + @end defun + ++@node Port Readiness ++@section Port Readiness ++ ++These two operations can be used on file ports to wait until ++they are readable or writable. Spurious wake-ups are possible. ++This is complementary to Guile's suspendable ports. ++ ++@example ++(use-modules (fibers io-wakeup)) ++@end example ++ ++@defun wait-until-port-readable-operation port ++Make an operation that will succeed with no values when the input ++port @var{port} becomes readable. For passive sockets, this operation ++succeeds when a connection becomes available. ++@end defun ++ ++@defun wait-until-port-writable-operation ++Make an operation that will succeed with no values when the output ++port @var{port} becomes writable. ++@end defun ++ + @node REPL Commands + @section REPL Commands + +diff --git a/fibers/io-wakeup.scm b/fibers/io-wakeup.scm +new file mode 100644 +index 0000000..5df03f1 +--- /dev/null ++++ b/fibers/io-wakeup.scm +@@ -0,0 +1,93 @@ ++;; Fibers: cooperative, event-driven user-space threads. ++ ++;;;; Copyright (C) 2016,2021 Free Software Foundation, Inc. ++;;;; Copyright (C) 2021 Maxime Devos ++;;;; ++;;;; 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++;;;; ++ ++(define-module (fibers io-wakeup) ++ #:use-module (fibers scheduler) ++ #:use-module (fibers operations) ++ #:use-module (ice-9 atomic) ++ #:use-module (ice-9 match) ++ #:use-module (ice-9 threads) ++ #:use-module (ice-9 ports internal) ++ #:export (wait-until-port-readable-operation ++ wait-until-port-writable-operation)) ++ ++(define *poll-sched* (make-atomic-box #f)) ++ ++(define (poll-sched) ++ (or (atomic-box-ref *poll-sched*) ++ (let ((sched (make-scheduler))) ++ (cond ++ ((atomic-box-compare-and-swap! *poll-sched* #f sched)) ++ (else ++ ;; FIXME: Would be nice to clean up this thread at some point. ++ (call-with-new-thread ++ (lambda () ++ (define (finished?) #f) ++ (run-scheduler sched finished?))) ++ sched))))) ++ ++;; These procedure are subject to spurious wakeups. ++ ++(define (readable? port) ++ "Test if PORT is writable." ++ (match (select (vector port) #() #() 0) ++ ((#() #() #()) #f) ++ ((#(_) #() #()) #t))) ++ ++(define (writable? port) ++ "Test if PORT is writable." ++ (match (select #() (vector port) #() 0) ++ ((#() #() #()) #f) ++ ((#() #(_) #()) #t))) ++ ++(define (make-wait-operation ready? schedule-when-ready port port-ready-fd this-procedure) ++ (make-base-operation #f ++ (lambda _ ++ (and (ready? port) values)) ++ (lambda (flag sched resume) ++ (define (commit) ++ (match (atomic-box-compare-and-swap! flag 'W 'S) ++ ('W (resume values)) ++ ('C (commit)) ++ ('S #f))) ++ (if sched ++ (schedule-when-ready ++ sched (port-ready-fd port) commit) ++ (schedule-task ++ (poll-sched) ++ (lambda () ++ (perform-operation (this-procedure port)) ++ (commit))))))) ++ ++(define (wait-until-port-readable-operation port) ++ "Make an operation that will succeed when PORT is readable." ++ (unless (input-port? port) ++ (error "refusing to wait forever for input on non-input port")) ++ (make-wait-operation readable? schedule-task-when-fd-readable port ++ port-read-wait-fd ++ wait-until-port-readable-operation)) ++ ++(define (wait-until-port-writable-operation port) ++ "Make an operation that will succeed when PORT is writable." ++ (unless (output-port? port) ++ (error "refusing to wait forever for output on non-output port")) ++ (make-wait-operation writable? schedule-task-when-fd-writable port ++ port-write-wait-fd ++ wait-until-port-writable-operation)) +diff --git a/tests/io-wakeup.scm b/tests/io-wakeup.scm +new file mode 100644 +index 0000000..c14fa81 +--- /dev/null ++++ b/tests/io-wakeup.scm +@@ -0,0 +1,167 @@ ++;; Fibers: cooperative, event-driven user-space threads. ++ ++;;;; Copyright (C) 2016 Free Software Foundation, Inc. ++;;;; Copyright (C) 2021 Maxime Devos ++;;;; ++;;;; 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++;;;; ++ ++(define-module (tests io-wakeup) ++ #:use-module (rnrs bytevectors) ++ #:use-module (ice-9 control) ++ #:use-module (ice-9 suspendable-ports) ++ #:use-module (ice-9 binary-ports) ++ #:use-module (fibers) ++ #:use-module (fibers io-wakeup) ++ #:use-module (fibers operations) ++ #:use-module (fibers timers)) ++ ++(define failed? #f) ++ ++(define-syntax-rule (assert-equal expected actual) ++ (let ((x expected)) ++ (format #t "assert ~s equal to ~s: " 'actual x) ++ (force-output) ++ (let ((y actual)) ++ (cond ++ ((equal? x y) (format #t "ok\n")) ++ (else ++ (format #t "no (got ~s)\n" y) ++ (set! failed? #t)))))) ++ ++(define-syntax-rule (assert-run-fibers-terminates exp) ++ (begin ++ (format #t "assert run-fibers on ~s terminates: " 'exp) ++ (force-output) ++ (let ((start (get-internal-real-time))) ++ (call-with-values (lambda () (run-fibers (lambda () exp))) ++ (lambda vals ++ (format #t "ok (~a s)\n" (/ (- (get-internal-real-time) start) ++ 1.0 internal-time-units-per-second)) ++ (apply values vals)))))) ++ ++(define-syntax-rule (assert-run-fibers-returns (expected ...) exp) ++ (begin ++ (call-with-values (lambda () (assert-run-fibers-terminates exp)) ++ (lambda run-fiber-return-vals ++ (assert-equal '(expected ...) run-fiber-return-vals))))) ++ ++ ++;; Note that theoretically, on very slow systems, SECONDS might need ++;; to be increased. However, readable/timeout? and writable/timeout? ++;; call this 5 times in a loop anyways, so the effective timeout is ++;; a fourth of a second, which should be plenty in practice. ++(define* (with-timeout op #:key (seconds 0.05) (wrap values)) ++ (choice-operation op ++ (wrap-operation (sleep-operation seconds) wrap))) ++ ++(define* (readable/timeout? port #:key (allowed-spurious 5)) ++ "Does waiting for readability time-out? ++Allow @var{allowed-spurious} spurious wakeups." ++ (or (perform-operation ++ (with-timeout ++ (wrap-operation (wait-until-port-readable-operation port) ++ (lambda () #f)) ++ #:wrap (lambda () #t))) ++ (and (> allowed-spurious 0) ++ (readable/timeout? port #:allowed-spurious ++ (- allowed-spurious 1))))) ++ ++(define* (writable/timeout? port #:key (allowed-spurious 5)) ++ "Does waiting for writability time-out? ++Allow @var{allowed-spurious} spurious wakeups." ++ (or (perform-operation ++ (with-timeout ++ (wrap-operation (wait-until-port-writable-operation port) ++ (lambda () #f)) ++ #:wrap (lambda () #t))) ++ (and (> allowed-spurious 0) ++ (writable/timeout? port #:allowed-spurious ++ (- allowed-spurious 1))))) ++ ++;; Tests: ++;; * wait-until-port-readable-operaton / wait-until-port-writable-operation ++;; blocks if the port isn't ready for input / output. ++;; ++;; This is tested with a pipe (read & write) ++;; and a listening socket (read, or accept in this case). ++;; ++;; Due to the possibility of spurious wakeups, ++;; a limited few spurious wakeups are tolerated. ++;; ++;; * these operations succeed if the port is ready for input / output. ++;; ++;; These are again tested with a pipe and a listening socket ++;; ++;; Blocking is detected with a small time-out. ++ ++(define (make-listening-socket) ++ (let ((server (socket PF_INET SOCK_DGRAM 0))) ++ (bind server AF_INET INADDR_LOOPBACK 0) ++ server)) ++ ++(let ((s (make-listening-socket))) ++ (assert-run-fibers-returns (#t) ++ (readable/timeout? s)) ++ (assert-equal #t (readable/timeout? s)) ++ (close s)) ++ ++(define (set-nonblocking! sock) ++ (let ((flags (fcntl sock F_GETFL))) ++ (fcntl sock F_SETFL (logior O_NONBLOCK flags)))) ++ ++(define-syntax-rule (with-pipes (A B) exp exp* ...) ++ (let* ((pipes (pipe)) ++ (A (car pipes)) ++ (B (cdr pipes))) ++ exp exp* ... ++ (close A) ++ (close B))) ++ ++(with-pipes (A B) ++ (setvbuf A 'none) ++ (setvbuf B 'none) ++ (assert-run-fibers-returns (#t) ++ (readable/timeout? A)) ++ (assert-equal #t (readable/timeout? A)) ++ ++ ;; The buffer is empty, so writability is expected. ++ (assert-run-fibers-returns (#f) ++ (writable/timeout? B)) ++ (assert-equal #f (writable/timeout? B)) ++ ++ ;; Fill the buffer ++ (set-nonblocking! B) ++ (let ((bv (make-bytevector 1024))) ++ (let/ec k ++ (parameterize ((current-write-waiter k)) ++ (let loop () ++ (put-bytevector B bv) ++ (loop))))) ++ ++ ;; As the buffer is full, writable/timeout? should return ++ ;; #t. ++ (assert-run-fibers-returns (#t) ++ (writable/timeout? B)) ++ ;; There's plenty to read now, so readable/timeout? should ++ ;; return #f. ++ (assert-run-fibers-returns (#f) ++ (readable/timeout? A))) ++ ++(exit (if failed? 1 0)) ++ ++;; Local Variables: ++;; eval: (put 'with-pipes 'scheme-indent-function 1) ++;; End: diff --git a/gnu/packages/patches/jami-images-loading.patch b/gnu/packages/patches/jami-images-loading.patch new file mode 100644 index 0000000000..caf9e1e198 --- /dev/null +++ b/gnu/packages/patches/jami-images-loading.patch @@ -0,0 +1,152 @@ +From be9dd0d0d8cb4556cd930edd783c0a1699565ac0 Mon Sep 17 00:00:00 2001 +From: kkostiuk <kateryna.kostiuk@savoirfairelinux.com> +Date: Mon, 1 Nov 2021 17:39:23 -0400 +Subject: [PATCH] conversation: fix long loading time for images + +Change-Id: Id88cfbd571f4b504f258758bd13b4e4a91bf1b49 +--- + .../DataTransferMessageDelegate.qml | 52 +++++++++++++++++-- + src/messagesadapter.cpp | 20 +++++-- + src/messagesadapter.h | 2 +- + 3 files changed, 66 insertions(+), 8 deletions(-) + +diff --git a/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml b/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml +index 7875e01..2e7dcc0 100644 +--- a/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml ++++ b/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml +@@ -252,10 +252,11 @@ Loader { + Loader { + id: localMediaCompLoader + anchors.right: isOutgoing ? parent.right : undefined ++ asynchronous: true + width: sourceComponent.width + height: sourceComponent.height + sourceComponent: mediaInfo.isImage !== undefined ? +- imageComp : ++ imageComp : mediaInfo.isAnimatedImage !== undefined ? animatedImageComp : + avComp + Component { + id: avComp +@@ -302,9 +303,9 @@ Loader { + } + } + Component { +- id: imageComp ++ id: animatedImageComp + AnimatedImage { +- id: img ++ id: animatedImg + anchors.right: isOutgoing ? parent.right : undefined + property real minSize: 192 + property real maxSize: 256 +@@ -327,6 +328,51 @@ Loader { + anchors.fill: parent + } + layer.enabled: true ++ layer.effect: OpacityMask { ++ maskSource: MessageBubble { ++ out: isOutgoing ++ type: seq ++ width: animatedImg.width ++ height: animatedImg.height ++ radius: msgRadius ++ } ++ } ++ HoverHandler { ++ target : parent ++ onHoveredChanged: { ++ localMediaMsgItem.hoveredLink = hovered ? animatedImg.source : "" ++ } ++ cursorShape: Qt.PointingHandCursor ++ } ++ } ++ } ++ ++ Component { ++ id: imageComp ++ Image { ++ id: img ++ anchors.right: isOutgoing ? parent.right : undefined ++ property real minSize: 192 ++ property real maxSize: 256 ++ cache: true ++ fillMode: Image.PreserveAspectCrop ++ mipmap: true ++ antialiasing: true ++ autoTransform: false ++ asynchronous: true ++ source: "file:///" + Body ++ property real aspectRatio: implicitWidth / implicitHeight ++ property real adjustedWidth: Math.min(maxSize, ++ Math.max(minSize, ++ innerContent.width - senderMargin)) ++ width: adjustedWidth ++ height: Math.ceil(adjustedWidth / aspectRatio) ++ Rectangle { ++ color: JamiTheme.previewImageBackgroundColor ++ z: -1 ++ anchors.fill: parent ++ } ++ layer.enabled: true + layer.effect: OpacityMask { + maskSource: MessageBubble { + out: isOutgoing +diff --git a/client-qt/src/messagesadapter.cpp b/client-qt/src/messagesadapter.cpp +index 91f8eed..ba38e53 100644 +--- a/client-qt/src/messagesadapter.cpp ++++ b/client-qt/src/messagesadapter.cpp +@@ -458,13 +458,24 @@ MessagesAdapter::conversationTypersUrlToName(const QSet<QString>& typersSet) + return nameList; + } + +-bool ++QVariantMap + MessagesAdapter::isLocalImage(const QString& msg) + { + QImageReader reader; + reader.setDecideFormatFromContent(true); + reader.setFileName(msg); +- return !reader.read().isNull(); ++ QByteArray fileFormat = reader.format(); ++ if (fileFormat == "gif") { ++ return {{"isAnimatedImage", true}}; ++ } ++ QList<QByteArray> supportedFormats = reader.supportedImageFormats(); ++ auto iterator = std::find_if(supportedFormats.begin(), ++ supportedFormats.end(), ++ [fileFormat](QByteArray format) { return format == fileFormat; }); ++ if (iterator != supportedFormats.end()) { ++ return {{"isImage", true}}; ++ } ++ return {{"isImage", false}}; + } + + QVariantMap +@@ -476,8 +487,9 @@ MessagesAdapter::getMediaInfo(const QString& msg) + "<%1 style='width:100%;height:%2;outline:none;background-color:#f1f3f4;" + "object-fit:cover;' " + "controls controlsList='nodownload' src='file://%3' type='%4'/></body>"; +- if (isLocalImage(msg)) { +- return {{"isImage", true}}; ++ QVariantMap fileInfo = isLocalImage(msg); ++ if (fileInfo["isImage"].toBool() || fileInfo["isAnimatedImage"].toBool()) { ++ return fileInfo; + } + QRegularExpression vPattern("[^\\s]+(.*?)\\.(avi|mov|webm|webp|rmvb)$", + QRegularExpression::CaseInsensitiveOption); +diff --git a/client-qt/src/messagesadapter.h b/client-qt/src/messagesadapter.h +index bfa4e62..1965c5e 100644 +--- a/client-qt/src/messagesadapter.h ++++ b/client-qt/src/messagesadapter.h +@@ -101,7 +101,7 @@ protected: + Q_INVOKABLE void deleteInteraction(const QString& interactionId); + Q_INVOKABLE void copyToDownloads(const QString& interactionId, const QString& displayName); + Q_INVOKABLE void userIsComposing(bool isComposing); +- Q_INVOKABLE bool isLocalImage(const QString& msg); ++ Q_INVOKABLE QVariantMap isLocalImage(const QString& msg); + Q_INVOKABLE QVariantMap getMediaInfo(const QString& msg); + Q_INVOKABLE bool isRemoteImage(const QString& msg); + Q_INVOKABLE QString getFormattedTime(const quint64 timestamp); +-- +GitLab + diff --git a/gnu/packages/patches/jami-libclient-audio-managers.patch b/gnu/packages/patches/jami-libclient-audio-managers.patch new file mode 100644 index 0000000000..1f8a5585e6 --- /dev/null +++ b/gnu/packages/patches/jami-libclient-audio-managers.patch @@ -0,0 +1,23 @@ +From f5e4619d02526d961c14012a6cae1a091aa149d4 Mon Sep 17 00:00:00 2001 +From: Sébastien Blin <sebastien.blin@savoirfairelinux.com> +Date: Thu, 27 Jan 2022 13:48:32 -0500 +Subject: [PATCH] misc: link getSupportedAudioManagers +q +Change-Id: I897e49cd131d3cbffef9fb1d5c9be3c0bc9bcb3f +GitLab: #495 +--- + +diff --git a/lrc/src/qtwrapper/configurationmanager_wrap.h b/lrc/src/qtwrapper/configurationmanager_wrap.h +index a680138..2807f8a 100644 +--- a/lrc/src/qtwrapper/configurationmanager_wrap.h ++++ b/lrc/src/qtwrapper/configurationmanager_wrap.h +@@ -526,8 +526,7 @@ + + QStringList getSupportedAudioManagers() + { +- QStringList temp; +- return temp; ++ return convertStringList(DRing::getSupportedAudioManagers()); + } + + QStringList getSupportedTlsMethod() diff --git a/gnu/packages/patches/jami-memory-usage.patch b/gnu/packages/patches/jami-memory-usage.patch new file mode 100644 index 0000000000..75fcde8d0a --- /dev/null +++ b/gnu/packages/patches/jami-memory-usage.patch @@ -0,0 +1,70 @@ +From e796b3325d95b5ddd6162b5513c8325210f41fc5 Mon Sep 17 00:00:00 2001 +From: Sébastien Blin <sebastien.blin@savoirfairelinux.com> +Date: Wed, 26 Jan 2022 11:37:07 -0500 +Subject: [PATCH] datatransferimage: improve memory usage + ++ Reduce listview caching' size by 50% ++ use sourceSize to compress images and speedup loading ++ use autoTransform: true to rotate images when needed + +Change-Id: Idf1babdc73f43aa6a79b89428c25c5d06856c0ef +GitLab: #649 +--- + +diff --git a/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml b/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml +index d017c03..ca5913e 100644 +--- a/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml ++++ b/client-qt/src/commoncomponents/DataTransferMessageDelegate.qml +@@ -255,9 +255,13 @@ + asynchronous: true + width: sourceComponent.width + height: sourceComponent.height +- sourceComponent: mediaInfo.isImage !== undefined ? +- imageComp : mediaInfo.isAnimatedImage !== undefined ? animatedImageComp : +- avComp ++ sourceComponent: { ++ if (mediaInfo.isImage) ++ return imageComp ++ if (mediaInfo.isAnimatedImage) ++ return animatedImageComp ++ return avComp ++ } + Component { + id: avComp + WebEngineView { +@@ -316,7 +320,7 @@ + fillMode: Image.PreserveAspectCrop + mipmap: true + antialiasing: true +- autoTransform: false ++ autoTransform: true + asynchronous: true + source: "file:///" + Body + property real aspectRatio: implicitWidth / implicitHeight +@@ -361,8 +365,10 @@ + fillMode: Image.PreserveAspectCrop + mipmap: true + antialiasing: true +- autoTransform: false ++ autoTransform: true + asynchronous: true ++ sourceSize.width: width ++ sourceSize.height: height + source: "file:///" + Body + property real aspectRatio: implicitWidth / implicitHeight + property real adjustedWidth: Math.min(maxSize, +diff --git a/client-qt/src/mainview/components/MessageListView.qml b/client-qt/src/mainview/components/MessageListView.qml +index 2b7c326..f65e67b 100644 +--- a/client-qt/src/mainview/components/MessageListView.qml ++++ b/client-qt/src/mainview/components/MessageListView.qml +@@ -174,8 +174,8 @@ + width: parent.width + // this offscreen caching is pretty huge + // displayMarginEnd may be removed +- displayMarginBeginning: 4096 +- displayMarginEnd: 4096 ++ displayMarginBeginning: 2048 ++ displayMarginEnd: 2048 + maximumFlickVelocity: 2048 + verticalLayoutDirection: ListView.BottomToTop + boundsBehavior: Flickable.StopAtBounds diff --git a/gnu/packages/patches/librecad-support-for-boost-1.76.patch b/gnu/packages/patches/librecad-support-for-boost-1.76.patch new file mode 100644 index 0000000000..aa352e669f --- /dev/null +++ b/gnu/packages/patches/librecad-support-for-boost-1.76.patch @@ -0,0 +1,17 @@ +Upstream commit e02f3580311d50b617427652ff77988f6bd62d9d adding Boost 1.76 +compatibility. + +diff --git a/librecad/src/lib/engine/rs_ellipse.cpp b/librecad/src/lib/engine/rs_ellipse.cpp +index 291f734ea..d47bf6ca4 100644 +--- a/librecad/src/lib/engine/rs_ellipse.cpp ++++ b/librecad/src/lib/engine/rs_ellipse.cpp +@@ -48,6 +48,9 @@ + #include <boost/version.hpp> + #include <boost/math/tools/roots.hpp> + #include <boost/math/special_functions/ellint_2.hpp> ++#if BOOST_VERSION > 104500 ++#include <boost/math/tools/tuple.hpp> ++#endif + #endif + + namespace{ diff --git a/gnu/packages/patches/mozjs60-riscv64-support.patch b/gnu/packages/patches/mozjs60-riscv64-support.patch new file mode 100644 index 0000000000..c9fa2ba9b3 --- /dev/null +++ b/gnu/packages/patches/mozjs60-riscv64-support.patch @@ -0,0 +1,122 @@ +This is a combination of several upstream patches which weren't accepted. +They were proposed by Fedora for spidermonkey 52 and were ultimately +accepted years later after some changes for a later version. It was +adapted slightly from both sets of patches to apply cleanly to mozjs-60. + +https://bugzilla.mozilla.org/show_bug.cgi?id=1318905 +https://bug1318905.bmoattachments.org/attachment.cgi?id=8812602 +https://bug1318905.bmoattachments.org/attachment.cgi?id=8812603 +https://bug1318905.bmoattachments.org/attachment.cgi?id=8812604 +https://phabricator.services.mozilla.com/D78623 +https://phabricator.services.mozilla.com/D78624 +https://phabricator.services.mozilla.com/D78625 + + +diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure +index 83b8d705..59131525 100644 +--- a/build/moz.configure/init.configure ++++ b/build/moz.configure/init.configure +@@ -676,6 +676,9 @@ def split_triplet(triplet, allow_unknown=False): + elif cpu == 'sh4': + canonical_cpu = 'sh4' + endianness = 'little' ++ elif cpu.startswith('riscv64'): ++ canonical_cpu = 'riscv64' ++ endianness = 'little' + elif allow_unknown: + canonical_cpu = cpu + endianness = 'unknown' +diff --git a/js/src/jit/AtomicOperations.h b/js/src/jit/AtomicOperations.h +index a8970b0d..6b947a3f 100644 +--- a/js/src/jit/AtomicOperations.h ++++ b/js/src/jit/AtomicOperations.h +@@ -375,7 +375,7 @@ AtomicOperations::isLockfreeJS(int32_t size) + # endif + #elif defined(__ppc__) || defined(__PPC__) + # include "jit/none/AtomicOperations-feeling-lucky.h" +-#elif defined(__sparc__) ++#elif defined(__sparc__) || defined(__riscv) + # include "jit/none/AtomicOperations-feeling-lucky.h" + #elif defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__) + # include "jit/none/AtomicOperations-feeling-lucky.h" +diff --git a/js/src/jit/none/AtomicOperations-feeling-lucky.h b/js/src/jit/none/AtomicOperations-feeling-lucky.h +index da572284..6ce40c89 100644 +--- a/js/src/jit/none/AtomicOperations-feeling-lucky.h ++++ b/js/src/jit/none/AtomicOperations-feeling-lucky.h +@@ -49,6 +49,12 @@ + # define GNUC_COMPATIBLE + #endif + ++#if defined(__riscv) && __riscv_xlen == 64 ++# define HAS_64BIT_ATOMICS ++# define HAS_64BIT_LOCKFREE ++# define GNUC_COMPATIBLE ++#endif ++ + #ifdef __sparc__ + # define GNUC_COMPATIBLE + # ifdef __LP64__ +diff --git a/js/src/jit/none/MacroAssembler-none.h b/js/src/jit/none/MacroAssembler-none.h +index 80143dc8..b430fedb 100644 +--- a/js/src/jit/none/MacroAssembler-none.h ++++ b/js/src/jit/none/MacroAssembler-none.h +@@ -402,6 +402,10 @@ class MacroAssemblerNone : public Assembler + #endif + }; + ++ struct AutoPrepareForPatching { ++ explicit AutoPrepareForPatching(MacroAssemblerNone&) {} ++ }; ++ + typedef MacroAssemblerNone MacroAssemblerSpecific; + + class ABIArgGenerator +diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp +index 06c24ed0..c3fed0df 100644 +--- a/mfbt/tests/TestPoisonArea.cpp ++++ b/mfbt/tests/TestPoisonArea.cpp +@@ -160,6 +160,9 @@ + #elif defined __aarch64__ + #define RETURN_INSTR 0xd65f03c0 /* ret */ + ++#elif defined __riscv ++#define RETURN_INSTR 0x80828082 /* ret; ret */ ++ + #elif defined __ia64 + struct ia64_instr { uint32_t mI[4]; }; + static const ia64_instr _return_instr = +diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py +index 33ae5a45..11a01d3b 100644 +--- a/python/mozbuild/mozbuild/configure/constants.py ++++ b/python/mozbuild/mozbuild/configure/constants.py +@@ -50,6 +50,7 @@ CPU_bitness = { + 'mips64': 64, + 'ppc': 32, + 'ppc64': 64, ++ 'riscv64': 64, + 's390': 32, + 's390x': 64, + 'sh4': 32, +@@ -82,6 +84,7 @@ CPU_preprocessor_checks = OrderedDict(( + ('s390', '__s390__'), + ('ppc64', '__powerpc64__'), + ('ppc', '__powerpc__'), ++ ('riscv64', '__riscv && __riscv_xlen == 64'), + ('Alpha', '__alpha__'), + ('hppa', '__hppa__'), + ('sparc64', '__sparc__ && __arch64__'), +diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py +index cb7ff709..9da41adf 100755 +--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py ++++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py +@@ -1165,6 +1165,10 @@ class LinuxCrossCompileToolchainTest(BaseToolchainTest): + 'sh4-unknown-linux-gnu': little_endian + { + '__sh__': 1, + }, ++ 'riscv64-unknown-linux-gnu': little_endian + { ++ '__riscv': 1, ++ '__riscv_xlen': 64, ++ }, + } + + PLATFORMS['powerpc64le-unknown-linux-gnu'] = \ diff --git a/gnu/packages/patches/ocaml-qcheck-fix-test-whitespace.patch b/gnu/packages/patches/ocaml-qcheck-fix-test-whitespace.patch deleted file mode 100644 index 012f5de31c..0000000000 --- a/gnu/packages/patches/ocaml-qcheck-fix-test-whitespace.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0cb666fffcbeb78c8c14d271b3ba65ea514bfc44 Mon Sep 17 00:00:00 2001 -From: Julien Lepiller <julien@lepiller.eu> -Date: Fri, 19 Nov 2021 03:03:21 +0100 -Subject: [PATCH] Fix whitespace issue in test - ---- - example/alcotest/output.txt.expected | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/example/alcotest/output.txt.expected b/example/alcotest/output.txt.expected -index bde0b83..9f1417c 100644 ---- a/example/alcotest/output.txt.expected -+++ b/example/alcotest/output.txt.expected -@@ -16,7 +16,6 @@ test `fail_sort_id` failed on ≥ 1 cases: [1; 0] (after 20 shrink steps) - [exception] test `fail_sort_id` failed on ≥ 1 cases: [1; 0] (after 20 shrink steps) - - -- - ────────────────────────────────────────────────────────────────────────────── - - 3 failures! 5 tests run. --- -2.33.1 - diff --git a/gnu/packages/patches/openboardview-use-system-utf8.patch b/gnu/packages/patches/openboardview-use-system-utf8.patch new file mode 100644 index 0000000000..25b5952bda --- /dev/null +++ b/gnu/packages/patches/openboardview-use-system-utf8.patch @@ -0,0 +1,48 @@ +From 251e23422f37c93a3f460fb660c5e5bfa8200d91 Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer <maxim.cournoyer@gmail.com> +Date: Sun, 2 Dec 2018 16:40:39 -0500 +Subject: [PATCH] build system: Allow using utf8.h from the system. + +--- + src/CMakeLists.txt | 12 ++++++++---- + src/openboardview/CMakeLists.txt | 1 + + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 90442ed..26d4a69 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -8,10 +8,14 @@ if(NOT WIN32 OR MINGW) + endif() + + ## utf8.h ## +-execute_process( +- COMMAND git submodule update --init src/utf8 +- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} +-) ++FIND_PATH(UTF8_INCLUDE_DIR utf8.h) ++if(NOT UTF8_INCLUDE_DIR) ++ execute_process( ++ COMMAND git submodule update --init src/utf8 ++ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ++ ) ++ set(UTF8_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/utf8) ++endif() + + ## zlib ## + find_package(ZLIB) +diff --git a/src/openboardview/CMakeLists.txt b/src/openboardview/CMakeLists.txt +index b0bdbe3..6c4564c 100644 +--- a/src/openboardview/CMakeLists.txt ++++ b/src/openboardview/CMakeLists.txt +@@ -44,6 +44,7 @@ include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${IMGUI_INCLUDE_DIRS} ++ ${UTF8_INCLUDE_DIR} + ${GLAD_INCLUDE_DIRS} + ${GTK_INCLUDE_DIRS} + ${OPENGL_INCLUDE_DIR} +-- +2.34.0 + diff --git a/gnu/packages/patches/openssl-3.0-c-rehash-in.patch b/gnu/packages/patches/openssl-3.0-c-rehash-in.patch new file mode 100644 index 0000000000..6871e9348c --- /dev/null +++ b/gnu/packages/patches/openssl-3.0-c-rehash-in.patch @@ -0,0 +1,18 @@ +This patch removes the explicit reference to the 'perl' binary, +such that OpenSSL does not retain a reference to Perl. + +The 'c_rehash' program is seldom used, but it is used nonetheless +to create symbolic links to certificates, for instance in the 'nss-certs' +package. + +diff --git a/tools/c_rehash.in b/tools/c_rehash.in +--- a/tools/c_rehash.in ++++ b/tools/c_rehash.in +@@ -1,4 +1,6 @@ +-#!{- $config{HASHBANGPERL} -} ++eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' ++ & eval 'exec perl -wS "$0" $argv:q' ++ if 0; + {- use OpenSSL::Util; -} + # {- join("\n# ", @autowarntext) -} + # Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. diff --git a/gnu/packages/patches/openssl-CVE-2019-1559.patch b/gnu/packages/patches/openssl-CVE-2019-1559.patch deleted file mode 100644 index 3e630037b5..0000000000 --- a/gnu/packages/patches/openssl-CVE-2019-1559.patch +++ /dev/null @@ -1,60 +0,0 @@ -From e9bbefbf0f24c57645e7ad6a5a71ae649d18ac8e Mon Sep 17 00:00:00 2001 -From: Matt Caswell <matt@openssl.org> -Date: Fri, 14 Dec 2018 07:28:30 +0000 -Subject: [PATCH] Go into the error state if a fatal alert is sent or received - -If an application calls SSL_shutdown after a fatal alert has occured and -then behaves different based on error codes from that function then the -application may be vulnerable to a padding oracle. - -CVE-2019-1559 - -Reviewed-by: Richard Levitte <levitte@openssl.org> ---- - ssl/d1_pkt.c | 1 + - ssl/s3_pkt.c | 10 +++++++--- - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c -index 23aa9db..c7fe977 100644 ---- a/ssl/d1_pkt.c -+++ b/ssl/d1_pkt.c -@@ -1309,6 +1309,7 @@ int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) - ERR_add_error_data(2, "SSL alert number ", tmp); - s->shutdown |= SSL_RECEIVED_SHUTDOWN; - SSL_CTX_remove_session(s->session_ctx, s->session); -+ s->state = SSL_ST_ERR; - return (0); - } else { - al = SSL_AD_ILLEGAL_PARAMETER; -diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c -index 6527df8..830b723 100644 ---- a/ssl/s3_pkt.c -+++ b/ssl/s3_pkt.c -@@ -1500,6 +1500,7 @@ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) - ERR_add_error_data(2, "SSL alert number ", tmp); - s->shutdown |= SSL_RECEIVED_SHUTDOWN; - SSL_CTX_remove_session(s->session_ctx, s->session); -+ s->state = SSL_ST_ERR; - return (0); - } else { - al = SSL_AD_ILLEGAL_PARAMETER; -@@ -1719,9 +1720,12 @@ int ssl3_send_alert(SSL *s, int level, int desc) - * protocol_version alerts */ - if (desc < 0) - return -1; -- /* If a fatal one, remove from cache */ -- if ((level == 2) && (s->session != NULL)) -- SSL_CTX_remove_session(s->session_ctx, s->session); -+ /* If a fatal one, remove from cache and go into the error state */ -+ if (level == SSL3_AL_FATAL) { -+ if (s->session != NULL) -+ SSL_CTX_remove_session(s->session_ctx, s->session); -+ s->state = SSL_ST_ERR; -+ } - - s->s3->alert_dispatch = 1; - s->s3->send_alert[0] = level; --- -2.7.4 - diff --git a/gnu/packages/patches/perl-5.14-autosplit-default-time.patch b/gnu/packages/patches/perl-5.14-autosplit-default-time.patch new file mode 100644 index 0000000000..e801ac9bfe --- /dev/null +++ b/gnu/packages/patches/perl-5.14-autosplit-default-time.patch @@ -0,0 +1,15 @@ +AutoSplit will fail to create an index for files whose modification time is 0 +because its default time for a non-existent index is 1. Set this default time +to -1 instead. + +--- perl-5.16.1/cpan/AutoLoader/lib/AutoSplit.pm.orig 2012-02-14 22:44:36.000000000 -0600 ++++ perl-5.16.1/cpan/AutoLoader/lib/AutoSplit.pm 2015-09-09 19:59:22.208708921 -0500 +@@ -361,7 +361,7 @@ + my($al_idx_file) = catfile($autodir, $modpname, $IndexFile); + + if ($check_mod_time){ +- my($al_ts_time) = (stat("$al_idx_file"))[9] || 1; ++ my($al_ts_time) = (stat("$al_idx_file"))[9] || -1; + if ($al_ts_time >= $pm_mod_time and + $al_ts_time >= $self_mod_time){ + print "AutoSplit skipped ($al_idx_file newer than $filename)\n" diff --git a/gnu/packages/patches/perl-5.14-module-pluggable-search.patch b/gnu/packages/patches/perl-5.14-module-pluggable-search.patch new file mode 100644 index 0000000000..bb2a57f7e5 --- /dev/null +++ b/gnu/packages/patches/perl-5.14-module-pluggable-search.patch @@ -0,0 +1,25 @@ +Fix core Perl module Module::Pluggable such that it can find plugins that live +in symlinked directories. + +Patch borrowed/adapted from Nixpkgs. + +--- perl-5.16.1/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm 2015-04-08 23:28:48.120164135 -0500 ++++ perl-5.16.1/cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm 2015-04-08 23:30:27.032166704 -0500 +@@ -164,7 +164,7 @@ + my $sp = catdir($dir, (split /::/, $searchpath)); + + # if it doesn't exist or it's not a dir then skip it +- next unless ( -e $sp && -d _ ); # Use the cached stat the second time ++ next unless ( -e $sp ); + + my @files = $self->find_files($sp); + +@@ -279,7 +279,7 @@ + (my $path = $File::Find::name) =~ s#^\\./##; + push @files, $path; + } +- }, $search_path ); ++ }, "$search_path/." ); + } + #chdir $cwd; + return @files; diff --git a/gnu/packages/patches/perl-5.14-no-sys-dirs.patch b/gnu/packages/patches/perl-5.14-no-sys-dirs.patch new file mode 100644 index 0000000000..3aba4d7529 --- /dev/null +++ b/gnu/packages/patches/perl-5.14-no-sys-dirs.patch @@ -0,0 +1,156 @@ +Don't long for headers and libraries in "traditional" locations. + +Patch from Nixpkgs by Eelco Dolstra <eelco.dolstra@logicblox.com>. + +diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure +--- perl-5.14.2-orig/Configure 2011-09-26 11:44:34.000000000 +0200 ++++ perl-5.14.2/Configure 2012-01-20 17:05:23.089223129 +0100 +@@ -106,15 +106,7 @@ + fi + + : Proper PATH setting +-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' +-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" +-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" +-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" +-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" +-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin" +-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" +-paths="$paths /sbin /usr/sbin /usr/libexec" +-paths="$paths /system/gnu_library/bin" ++paths='' + + for p in $paths + do +@@ -1311,8 +1303,7 @@ + archname='' + : 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" +-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include" ++locincpth="" + : + : no include file wanted by default + inclwanted='' +@@ -1328,17 +1319,12 @@ + archobjs='' + libnames='' + : change the next line if compiling for Xenix/286 on Xenix/386 +-xlibpth='/usr/lib/386 /lib/386' ++xlibpth='' + : Possible local library directories to search. +-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib" +-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib" ++loclibpth="" + + : general looking path for locating libraries +-glibpth="/lib /usr/lib $xlibpth" +-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib" +-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth" +-test -f /shlib/libc.so && glibpth="/shlib $glibpth" +-test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64" ++glibpth="" + + : Private path used by Configure to find libraries. Its value + : is prepended to libpth. This variable takes care of special +@@ -1371,8 +1357,6 @@ + libswanted="$libswanted 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 ! !'` +-glibpth="/usr/shlib $glibpth" + : Do not use vfork unless overridden by a hint file. + usevfork=false + +@@ -2380,7 +2364,6 @@ + zip + " + pth=`echo $PATH | sed -e "s/$p_/ /g"` +-pth="$pth /lib /usr/lib" + for file in $loclist; do + eval xxx=\$$file + case "$xxx" in +@@ -4785,7 +4768,7 @@ + : Set private lib path + case "$plibpth" in + '') if ./mips; then +- plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" ++ plibpth="$incpath/usr/lib" + fi;; + esac + case "$libpth" in +@@ -8390,13 +8373,8 @@ + echo " " + case "$sysman" in + '') +- syspath='/usr/share/man/man1 /usr/man/man1' +- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1" +- syspath="$syspath /usr/man/u_man/man1" +- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" +- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" +- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" +- sysman=`./loc . /usr/man/man1 $syspath` ++ syspath='' ++ sysman='' + ;; + esac + if $test -d "$sysman"; then +@@ -19721,9 +19699,10 @@ + case "$full_ar" in + '') full_ar=$ar ;; + esac ++full_ar=ar + + : Store the full pathname to the sed program for use in the C program +-full_sed=$sed ++full_sed=sed + + : see what type gids are declared as in the kernel + echo " " +diff -ru -x '*~' perl-5.14.2-orig/ext/Errno/Errno_pm.PL perl-5.14.2/ext/Errno/Errno_pm.PL +--- perl-5.14.2-orig/ext/Errno/Errno_pm.PL 2011-09-26 11:44:34.000000000 +0200 ++++ perl-5.14.2/ext/Errno/Errno_pm.PL 2012-01-20 17:02:07.938138311 +0100 +@@ -137,11 +137,7 @@ + if ($dep =~ /(\S+errno\.h)/) { + $file{$1} = 1; + } +- } elsif ($^O eq 'linux' && +- $Config{gccversion} ne '' && +- $Config{gccversion} !~ /intel/i +- # might be using, say, Intel's icc +- ) { ++ } elsif (0) { + # Some Linuxes have weird errno.hs which generate + # no #file or #line directives + my $linux_errno_h = -e '/usr/include/errno.h' ? +diff -ru -x '*~' perl-5.14.2-orig/hints/freebsd.sh perl-5.14.2/hints/freebsd.sh +--- perl-5.14.2-orig/hints/freebsd.sh 2011-09-19 15:18:22.000000000 +0200 ++++ perl-5.14.2/hints/freebsd.sh 2012-01-20 17:10:37.267924044 +0100 +@@ -118,21 +118,21 @@ + objformat=`/usr/bin/objformat` + if [ x$objformat = xaout ]; then + if [ -e /usr/lib/aout ]; then +- libpth="/usr/lib/aout /usr/local/lib /usr/lib" +- glibpth="/usr/lib/aout /usr/local/lib /usr/lib" ++ libpth="" ++ glibpth="" + fi + lddlflags='-Bshareable' + else +- libpth="/usr/lib /usr/local/lib" +- glibpth="/usr/lib /usr/local/lib" ++ libpth="" ++ glibpth="" + ldflags="-Wl,-E " + lddlflags="-shared " + fi + cccdlflags='-DPIC -fPIC' + ;; + *) +- libpth="/usr/lib /usr/local/lib" +- glibpth="/usr/lib /usr/local/lib" ++ libpth="" ++ glibpth="" + ldflags="-Wl,-E " + lddlflags="-shared " + cccdlflags='-DPIC -fPIC' diff --git a/gnu/packages/patches/polkit-CVE-2021-4034.patch b/gnu/packages/patches/polkit-CVE-2021-4034.patch new file mode 100644 index 0000000000..ca766cb3be --- /dev/null +++ b/gnu/packages/patches/polkit-CVE-2021-4034.patch @@ -0,0 +1,82 @@ +Fixes CVE-2021-4034, local privilege escalation with 'pkexec': + + https://www.openwall.com/lists/oss-security/2022/01/25/11 + +Patch from <https://gitlab.freedesktop.org/polkit/polkit/-/commit/a2bf5c9c83b6ae46cbd5c779d3055bff81ded683>. + +From a2bf5c9c83b6ae46cbd5c779d3055bff81ded683 Mon Sep 17 00:00:00 2001 +From: Jan Rybar <jrybar@redhat.com> +Date: Tue, 25 Jan 2022 17:21:46 +0000 +Subject: [PATCH] pkexec: local privilege escalation (CVE-2021-4034) + +--- + src/programs/pkcheck.c | 5 +++++ + src/programs/pkexec.c | 23 ++++++++++++++++++++--- + 2 files changed, 25 insertions(+), 3 deletions(-) + +diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c +index f1bb4e1..768525c 100644 +--- a/src/programs/pkcheck.c ++++ b/src/programs/pkcheck.c +@@ -363,6 +363,11 @@ main (int argc, char *argv[]) + local_agent_handle = NULL; + ret = 126; + ++ if (argc < 1) ++ { ++ exit(126); ++ } ++ + /* Disable remote file access from GIO. */ + setenv ("GIO_USE_VFS", "local", 1); + +diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c +index 7698c5c..84e5ef6 100644 +--- a/src/programs/pkexec.c ++++ b/src/programs/pkexec.c +@@ -488,6 +488,15 @@ main (int argc, char *argv[]) + pid_t pid_of_caller; + gpointer local_agent_handle; + ++ ++ /* ++ * If 'pkexec' is called THIS wrong, someone's probably evil-doing. Don't be nice, just bail out. ++ */ ++ if (argc<1) ++ { ++ exit(127); ++ } ++ + ret = 127; + authority = NULL; + subject = NULL; +@@ -614,10 +623,10 @@ main (int argc, char *argv[]) + + path = g_strdup (pwstruct.pw_shell); + if (!path) +- { ++ { + g_printerr ("No shell configured or error retrieving pw_shell\n"); + goto out; +- } ++ } + /* If you change this, be sure to change the if (!command_line) + case below too */ + command_line = g_strdup (path); +@@ -636,7 +645,15 @@ main (int argc, char *argv[]) + goto out; + } + g_free (path); +- argv[n] = path = s; ++ path = s; ++ ++ /* argc<2 and pkexec runs just shell, argv is guaranteed to be null-terminated. ++ * /-less shell shouldn't happen, but let's be defensive and don't write to null-termination ++ */ ++ if (argv[n] != NULL) ++ { ++ argv[n] = path; ++ } + } + if (access (path, F_OK) != 0) + { diff --git a/gnu/packages/patches/python-pytorch-1.9.0-system-libraries.patch b/gnu/packages/patches/python-pytorch-1.9.0-system-libraries.patch new file mode 100644 index 0000000000..76c06520f0 --- /dev/null +++ b/gnu/packages/patches/python-pytorch-1.9.0-system-libraries.patch @@ -0,0 +1,139 @@ +Use our own googletest rather than the bundled one. +Get NNPACK to use our own PeachPy rather than the bundled one. + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 5d57b9ca78..620cca4e60 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -644,11 +644,6 @@ if(BUILD_TEST OR BUILD_MOBILE_BENCHMARK OR BUILD_MOBILE_TEST) + # this shouldn't be necessary anymore. + get_property(INC_DIR_temp DIRECTORY PROPERTY INCLUDE_DIRECTORIES) + set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "") +- add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest) +- set_property(DIRECTORY PROPERTY INCLUDE_DIRECTORIES ${INC_DIR_temp}) +- +- include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googletest/include) +- include_directories(BEFORE SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../third_party/googletest/googlemock/include) + + # We will not need to test benchmark lib itself. + set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing as we don't need it.") +@@ -1485,7 +1480,7 @@ if(CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO AND NOT INTERN_DISABLE_ONNX) + endif() + set_property(TARGET onnx_proto PROPERTY IMPORTED_LOCATION ${ONNX_PROTO_LIBRARY}) + message("-- Found onnx: ${ONNX_LIBRARY} ${ONNX_PROTO_LIBRARY}") +- list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx) ++ list(APPEND Caffe2_DEPENDENCY_LIBS onnx_proto onnx onnx_optimizer) + endif() + include_directories(${FOXI_INCLUDE_DIRS}) + list(APPEND Caffe2_DEPENDENCY_LIBS foxi_loader) + +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index 50ebb224ce..5953d9ddf7 100644 +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -1632,7 +1632,7 @@ if(BUILD_TEST) + if(NOT MSVC) + add_executable(${test_name}_${CPU_CAPABILITY} "${test_src}" ../aten/src/ATen/native/quantized/affine_quantizer_base.cpp) + # TODO: Get rid of c10 dependency (which is only needed for the implementation of AT_ERROR) +- target_link_libraries(${test_name}_${CPU_CAPABILITY} c10 sleef gtest_main) ++ target_link_libraries(${test_name}_${CPU_CAPABILITY} c10 sleef gtest_main gtest) + if(USE_FBGEMM) + target_link_libraries(${test_name}_${CPU_CAPABILITY} fbgemm) + endif() +@@ -1655,7 +1655,7 @@ if(BUILD_TEST) + foreach(test_src ${Caffe2_CPU_TEST_SRCS}) + get_filename_component(test_name ${test_src} NAME_WE) + add_executable(${test_name} "${test_src}") +- target_link_libraries(${test_name} torch_library gtest_main) ++ target_link_libraries(${test_name} torch_library gtest_main gtest) + target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) + target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>) + target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) +@@ -1673,7 +1673,7 @@ if(BUILD_TEST) + foreach(test_src ${Caffe2_GPU_TEST_SRCS}) + get_filename_component(test_name ${test_src} NAME_WE) + cuda_add_executable(${test_name} "${test_src}") +- target_link_libraries(${test_name} torch_library gtest_main) ++ target_link_libraries(${test_name} torch_library gtest_main gtest) + target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) + target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) + add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) +@@ -1691,7 +1691,7 @@ if(BUILD_TEST) + foreach(test_src ${Caffe2_VULKAN_TEST_SRCS}) + get_filename_component(test_name ${test_src} NAME_WE) + add_executable(${test_name} "${test_src}") +- target_link_libraries(${test_name} torch_library gtest_main) ++ target_link_libraries(${test_name} torch_library gtest_main gtest) + target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) + target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE}) + add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) +@@ -1709,7 +1709,7 @@ if(BUILD_TEST) + foreach(test_src ${Caffe2_HIP_TEST_SRCS}) + get_filename_component(test_name ${test_src} NAME_WE) + add_executable(${test_name} "${test_src}") +- target_link_libraries(${test_name} torch_library gtest_main) ++ target_link_libraries(${test_name} torch_library gtest_main gtest) + target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>) + target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE}) + target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS}) + +diff --git a/torch/lib/c10d/test/CMakeLists.txt b/torch/lib/c10d/test/CMakeLists.txt +index b74d4b65f7..fc7c207505 100644 +--- a/torch/lib/c10d/test/CMakeLists.txt ++++ b/torch/lib/c10d/test/CMakeLists.txt +@@ -16,24 +16,24 @@ function(c10d_add_test test_src) + add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>) + endfunction() + +-c10d_add_test(FileStoreTest.cpp c10d gtest_main) +-c10d_add_test(TCPStoreTest.cpp c10d gtest_main) ++c10d_add_test(FileStoreTest.cpp c10d gtest_main gtest) ++c10d_add_test(TCPStoreTest.cpp c10d gtest_main gtest) + if(NOT WIN32) +- c10d_add_test(HashStoreTest.cpp c10d gtest_main) ++ c10d_add_test(HashStoreTest.cpp c10d gtest_main gtest) + endif() + + if(USE_CUDA) + if(USE_C10D_GLOO) +- c10d_add_test(ProcessGroupGlooTest.cpp c10d c10d_cuda_test gtest_main) +- c10d_add_test(ProcessGroupGlooAsyncTest.cpp c10d c10d_cuda_test gtest_main) ++ c10d_add_test(ProcessGroupGlooTest.cpp c10d c10d_cuda_test gtest_main gtest) ++ c10d_add_test(ProcessGroupGlooAsyncTest.cpp c10d c10d_cuda_test gtest_main gtest) + endif() + if(USE_C10D_NCCL) +- c10d_add_test(ProcessGroupNCCLTest.cpp c10d c10d_cuda_test gtest_main) ++ c10d_add_test(ProcessGroupNCCLTest.cpp c10d c10d_cuda_test gtest_main gtest) + c10d_add_test(ProcessGroupNCCLErrorsTest.cpp c10d c10d_cuda_test +- gtest_main) ++ gtest_main gtest) + endif() + else() + if(USE_C10D_GLOO) +- c10d_add_test(ProcessGroupGlooTest.cpp c10d gtest_main) ++ c10d_add_test(ProcessGroupGlooTest.cpp c10d gtest_main gtest) + endif() + endif() + +diff --git a/cmake/External/nnpack.cmake b/cmake/External/nnpack.cmake +index a41343cbb5..6075bdd0a4 100644 +--- a/cmake/External/nnpack.cmake ++++ b/cmake/External/nnpack.cmake +@@ -40,7 +40,7 @@ endif() + # (3) Android, iOS, Linux, macOS - supported + ############################################################################## + +-if(ANDROID OR IOS OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") ++if(FALSE) + message(STATUS "Brace yourself, we are building NNPACK") + set(CAFFE2_THIRD_PARTY_ROOT ${PROJECT_SOURCE_DIR}/third_party) + +@@ -114,6 +114,5 @@ endif() + # (4) Catch-all: not supported. + ############################################################################## + +-message(WARNING "Unknown platform - I don't know how to build NNPACK. " +- "See cmake/External/nnpack.cmake for details.") +-set(USE_NNPACK OFF) ++set(NNPACK_FOUND TRUE) ++set(USE_NNPACK ON) diff --git a/gnu/packages/patches/python-seaborn-2690.patch b/gnu/packages/patches/python-seaborn-2690.patch new file mode 100644 index 0000000000..4662d19c2d --- /dev/null +++ b/gnu/packages/patches/python-seaborn-2690.patch @@ -0,0 +1,268 @@ +This patch was adapted from the upstream pull request 2690. + +From ebd6812d48f5b8ed1ebb7d79bda0b2a7b9ae2812 Mon Sep 17 00:00:00 2001 +From: Michael Waskom <mwaskom@gmail.com> +Date: Sun, 31 Oct 2021 15:09:27 -0400 +Subject: [PATCH 1/4] Update boxplot tests for mpl3.5 compatability + +--- + seaborn/tests/test_categorical.py | 30 +++++++++++++++++++----------- + 1 file changed, 19 insertions(+), 11 deletions(-) + +diff --git a/seaborn/tests/test_categorical.py b/seaborn/tests/test_categorical.py +index d4e09b703..488fad2d6 100644 +--- a/seaborn/tests/test_categorical.py ++++ b/seaborn/tests/test_categorical.py +@@ -110,6 +110,11 @@ class CategoricalFixture: + df = pd.DataFrame(dict(y=y, g=g, h=h, u=u)) + x_df["W"] = g + ++ def get_box_artists(self, ax): ++ ++ # Exclude labeled patches, which are for the legend ++ return [p for p in ax.patches if not p.get_label()] ++ + + class TestCategoricalPlotter(CategoricalFixture): + +@@ -855,12 +863,12 @@ def test_hue_offsets(self): + def test_axes_data(self): + + ax = cat.boxplot(x="g", y="y", data=self.df) +- assert len(ax.artists) == 3 ++ assert len(self.get_box_artists(ax)) == 3 + + plt.close("all") + + ax = cat.boxplot(x="g", y="y", hue="h", data=self.df) +- assert len(ax.artists) == 6 ++ assert len(self.get_box_artists(ax)) == 6 + + plt.close("all") + +@@ -868,14 +876,14 @@ def test_box_colors(self): + + ax = cat.boxplot(x="g", y="y", data=self.df, saturation=1) + pal = palettes.color_palette(n_colors=3) +- for patch, color in zip(ax.artists, pal): ++ for patch, color in zip(self.get_box_artists(ax), pal): + assert patch.get_facecolor()[:3] == color + + plt.close("all") + + ax = cat.boxplot(x="g", y="y", hue="h", data=self.df, saturation=1) + pal = palettes.color_palette(n_colors=2) +- for patch, color in zip(ax.artists, pal * 2): ++ for patch, color in zip(self.get_box_artists(ax), pal * 2): + assert patch.get_facecolor()[:3] == color + + plt.close("all") +@@ -884,7 +892,7 @@ def test_draw_missing_boxes(self): + + ax = cat.boxplot(x="g", y="y", data=self.df, + order=["a", "b", "c", "d"]) +- assert len(ax.artists) == 3 ++ assert len(self.get_box_artists(ax)) == 3 + + def test_missing_data(self): + +@@ -894,13 +902,13 @@ def test_missing_data(self): + y[-2:] = np.nan + + ax = cat.boxplot(x=x, y=y) +- assert len(ax.artists) == 3 ++ assert len(self.get_box_artists(ax)) == 3 + + plt.close("all") + + y[-1] = 0 + ax = cat.boxplot(x=x, y=y, hue=h) +- assert len(ax.artists) == 7 ++ assert len(self.get_box_artists(ax)) == 7 + + plt.close("all") + +@@ -2766,11 +2774,11 @@ def test_plot_elements(self): + + g = cat.catplot(x="g", y="y", data=self.df, kind="box") + want_artists = self.g.unique().size +- assert len(g.ax.artists) == want_artists ++ assert len(self.get_box_artists(g.ax)) == want_artists + + g = cat.catplot(x="g", y="y", hue="h", data=self.df, kind="box") + want_artists = self.g.unique().size * self.h.unique().size +- assert len(g.ax.artists) == want_artists ++ assert len(self.get_box_artists(g.ax)) == want_artists + + g = cat.catplot(x="g", y="y", data=self.df, + kind="violin", inner=None) +@@ -3137,14 +3145,14 @@ def test_box_colors(self): + + ax = cat.boxenplot(x="g", y="y", data=self.df, saturation=1) + pal = palettes.color_palette(n_colors=3) +- for patch, color in zip(ax.artists, pal): ++ for patch, color in zip(self.get_box_artists(ax), pal): + assert patch.get_facecolor()[:3] == color + + plt.close("all") + + ax = cat.boxenplot(x="g", y="y", hue="h", data=self.df, saturation=1) + pal = palettes.color_palette(n_colors=2) +- for patch, color in zip(ax.artists, pal * 2): ++ for patch, color in zip(self.get_box_artists(ax), pal * 2): + assert patch.get_facecolor()[:3] == color + + plt.close("all") + +From ff78ed38817a346e760194ab3b03b28d7ea3ba1b Mon Sep 17 00:00:00 2001 +From: Michael Waskom <mwaskom@gmail.com> +Date: Sun, 31 Oct 2021 15:50:54 -0400 +Subject: [PATCH 2/4] Update kdeplot tests for mpl3.5 compatability + +--- + seaborn/tests/test_distributions.py | 53 ++++++++++++++++++++--------- + 1 file changed, 37 insertions(+), 16 deletions(-) + +diff --git a/seaborn/tests/test_distributions.py b/seaborn/tests/test_distributions.py +index d241fd978..466efb69e 100644 +--- a/seaborn/tests/test_distributions.py ++++ b/seaborn/tests/test_distributions.py +@@ -39,6 +39,27 @@ + ) + + ++def get_contour_coords(c): ++ """Provide compatability for change in contour artist type in mpl3.5.""" ++ # See https://github.com/matplotlib/matplotlib/issues/20906 ++ if isinstance(c, mpl.collections.LineCollection): ++ return c.get_segments() ++ elif isinstance(c, mpl.collections.PathCollection): ++ return [p.vertices[:np.argmax(p.codes) + 1] for p in c.get_paths()] ++ ++ ++def get_contour_color(c): ++ """Provide compatability for change in contour artist type in mpl3.5.""" ++ # See https://github.com/matplotlib/matplotlib/issues/20906 ++ if isinstance(c, mpl.collections.LineCollection): ++ return c.get_color() ++ elif isinstance(c, mpl.collections.PathCollection): ++ if c.get_facecolor().size: ++ return c.get_facecolor() ++ else: ++ return c.get_edgecolor() ++ ++ + class TestDistPlot(object): + + rs = np.random.RandomState(0) +@@ -902,7 +923,7 @@ def test_fill_artists(self, long_df): + f, ax = plt.subplots() + kdeplot(data=long_df, x="x", y="y", hue="c", fill=fill) + for c in ax.collections: +- if fill: ++ if fill or Version(mpl.__version__) >= Version("3.5.0b0"): + assert isinstance(c, mpl.collections.PathCollection) + else: + assert isinstance(c, mpl.collections.LineCollection) +@@ -918,8 +939,8 @@ def test_common_norm(self, rng): + kdeplot(x=x, y=y, hue=hue, common_norm=True, ax=ax1) + kdeplot(x=x, y=y, hue=hue, common_norm=False, ax=ax2) + +- n_seg_1 = sum([len(c.get_segments()) > 0 for c in ax1.collections]) +- n_seg_2 = sum([len(c.get_segments()) > 0 for c in ax2.collections]) ++ n_seg_1 = sum([len(get_contour_coords(c)) > 0 for c in ax1.collections]) ++ n_seg_2 = sum([len(get_contour_coords(c)) > 0 for c in ax2.collections]) + assert n_seg_2 > n_seg_1 + + def test_log_scale(self, rng): +@@ -946,7 +967,7 @@ def test_log_scale(self, rng): + ax2.contour(10 ** xx, yy, density, levels=levels) + + for c1, c2 in zip(ax1.collections, ax2.collections): +- assert_array_equal(c1.get_segments(), c2.get_segments()) ++ assert_array_equal(get_contour_coords(c1), get_contour_coords(c2)) + + def test_bandwidth(self, rng): + +@@ -959,7 +980,7 @@ def test_bandwidth(self, rng): + kdeplot(x=x, y=y, bw_adjust=2, ax=ax2) + + for c1, c2 in zip(ax1.collections, ax2.collections): +- seg1, seg2 = c1.get_segments(), c2.get_segments() ++ seg1, seg2 = get_contour_coords(c1), get_contour_coords(c2) + if seg1 + seg2: + x1 = seg1[0][:, 0] + x2 = seg2[0][:, 0] +@@ -980,9 +1001,9 @@ def test_weights(self, rng): + kdeplot(x=x, y=y, hue=hue, weights=weights, ax=ax2) + + for c1, c2 in zip(ax1.collections, ax2.collections): +- if c1.get_segments() and c2.get_segments(): +- seg1 = np.concatenate(c1.get_segments(), axis=0) +- seg2 = np.concatenate(c2.get_segments(), axis=0) ++ if get_contour_coords(c1) and get_contour_coords(c2): ++ seg1 = np.concatenate(get_contour_coords(c1), axis=0) ++ seg2 = np.concatenate(get_contour_coords(c2), axis=0) + assert not np.array_equal(seg1, seg2) + + def test_hue_ignores_cmap(self, long_df): +@@ -1030,7 +1051,7 @@ def test_levels_and_thresh(self, long_df): + kdeplot(**plot_kws, levels=np.linspace(thresh, 1, n), ax=ax2) + + for c1, c2 in zip(ax1.collections, ax2.collections): +- assert_array_equal(c1.get_segments(), c2.get_segments()) ++ assert_array_equal(get_contour_coords(c1), get_contour_coords(c2)) + + with pytest.raises(ValueError): + kdeplot(**plot_kws, levels=[0, 1, 2]) +@@ -1042,7 +1063,7 @@ def test_levels_and_thresh(self, long_df): + kdeplot(**plot_kws, levels=n, thresh=0, ax=ax2) + + for c1, c2 in zip(ax1.collections, ax2.collections): +- assert_array_equal(c1.get_segments(), c2.get_segments()) ++ assert_array_equal(get_contour_coords(c1), get_contour_coords(c2)) + for c1, c2 in zip(ax1.collections, ax2.collections): + assert_array_equal(c1.get_facecolors(), c2.get_facecolors()) + +@@ -2322,13 +2343,13 @@ def test_bivariate_kde_norm(self, rng): + z = [0] * 80 + [1] * 20 + + g = displot(x=x, y=y, col=z, kind="kde", levels=10) +- l1 = sum(bool(c.get_segments()) for c in g.axes.flat[0].collections) +- l2 = sum(bool(c.get_segments()) for c in g.axes.flat[1].collections) ++ l1 = sum(bool(get_contour_coords(c)) for c in g.axes.flat[0].collections) ++ l2 = sum(bool(get_contour_coords(c)) for c in g.axes.flat[1].collections) + assert l1 > l2 + + g = displot(x=x, y=y, col=z, kind="kde", levels=10, common_norm=False) +- l1 = sum(bool(c.get_segments()) for c in g.axes.flat[0].collections) +- l2 = sum(bool(c.get_segments()) for c in g.axes.flat[1].collections) ++ l1 = sum(bool(get_contour_coords(c)) for c in g.axes.flat[0].collections) ++ l2 = sum(bool(get_contour_coords(c)) for c in g.axes.flat[1].collections) + assert l1 == l2 + + def test_bivariate_hist_norm(self, rng): + +From a20ce3fabeb23c97b5827d9fb0c6a96ac109ea64 Mon Sep 17 00:00:00 2001 +From: Michael Waskom <mwaskom@gmail.com> +Date: Sun, 31 Oct 2021 16:10:47 -0400 +Subject: [PATCH 3/4] Update legend tests for mpl3.5 compatability + +--- + seaborn/tests/test_distributions.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/seaborn/tests/test_distributions.py b/seaborn/tests/test_distributions.py +index 466efb69e..024fe7541 100644 +--- a/seaborn/tests/test_distributions.py ++++ b/seaborn/tests/test_distributions.py +@@ -872,7 +872,7 @@ def test_legend(self, long_df): + for label, level in zip(legend_labels, order): + assert label.get_text() == level + +- legend_artists = ax.legend_.findobj(mpl.lines.Line2D)[::2] ++ legend_artists = ax.legend_.findobj(mpl.lines.Line2D) + palette = color_palette() + for artist, color in zip(legend_artists, palette): + assert_colors_equal(artist.get_color(), color) + diff --git a/gnu/packages/patches/rcs-5.10.0-no-stdin.patch b/gnu/packages/patches/rcs-5.10.0-no-stdin.patch deleted file mode 100644 index 56edfe7b65..0000000000 --- a/gnu/packages/patches/rcs-5.10.0-no-stdin.patch +++ /dev/null @@ -1,57 +0,0 @@ -http://git.savannah.gnu.org/cgit/rcs.git/patch/?id=8883c4f5a29be18e9ea09bd27a7b660830de45bb - - -From 8883c4f5a29be18e9ea09bd27a7b660830de45bb Mon Sep 17 00:00:00 2001 -From: Thien-Thi Nguyen <ttn@gnu.org> -Date: Fri, 23 Oct 2020 09:23:49 -0400 -Subject: [v] Don't test signal handling if stdin not ok. - -<https://mail.gnu.org/archive/html/bug-rcs/2020-10/msg00014.html> - -* tests/t632: If stdin is not open and connected to -a tty, skip the signal handling portion of the test. ---- - tests/ChangeLog | 9 +++++++++ - tests/t632 | 9 +++++++++ - 2 files changed, 18 insertions(+) - -diff --git a/tests/ChangeLog b/tests/ChangeLog -index c3715c0..0565058 100644 ---- a/tests/ChangeLog -+++ b/tests/ChangeLog -@@ -1,3 +1,12 @@ -+2020-10-23 Thien-Thi Nguyen <ttn@gnu.org> -+ -+ [v] Don't test signal handling if stdin not ok. -+ -+ <https://mail.gnu.org/archive/html/bug-rcs/2020-10/msg00014.html> -+ -+ * t632: If stdin is not open and connected to -+ a tty, skip the signal handling portion of the test. -+ - 2020-10-20 Thien-Thi Nguyen <ttn@gnu.org> - - Release: 5.10.0 -diff --git a/tests/t632 b/tests/t632 -index df6acc9..677ec8c 100644 ---- a/tests/t632 -+++ b/tests/t632 -@@ -40,6 +40,15 @@ echo | co -l -I $w \ - # (This is skipped if GNU coreutils timeout(1) is not available.) - ## - -+# <https://mail.gnu.org/archive/html/bug-rcs/2020-10/msg00014.html> -+# The timeout test needs co(1) to block on input. -+# If stdin is not open and connected to a tty, skip out. -+if test -t 0 ; then -+ echo STDIN OK -+else -+ exit 0 -+fi -+ - # TODO: Don't be lame! Pick one: - # (a) Mimic timeout(1) w/ sh commands. - # (b) Incorporate heart of timeout(1) into ./btdt and use that. --- -cgit v1.2.1 - diff --git a/gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch b/gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch new file mode 100644 index 0000000000..5d5bbaa4d0 --- /dev/null +++ b/gnu/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch @@ -0,0 +1,38 @@ +From 407c6a5db6c1f1cfb40bd6113f07f067d07885a4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> +Origin: https://github.com/mustache/mustache/pull/258 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954503 +Date: Mon, 27 Apr 2020 11:16:17 +0200 +Subject: [PATCH] Fix test race condition. + +The test suite randomly fails with errors such as: + +~~~ + 1) Failure: +AutoloadingTest#test_autoload_lowercase [/builddir/build/BUILD/mustache-1.1.1/usr/share/gems/gems/mustache-1.1.1/test/autoloading_test.rb:17]: +Expected: Comments + Actual: nil +~~~ + +This happens when `test_namespaced*` test cases are executed earlier +than the remaining test cases, because they are defining +`view_namespace` but not cleaning up afterwards. +--- + test/autoloading_test.rb | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/test/autoloading_test.rb b/test/autoloading_test.rb +index 0a7ad762..77eb3557 100644 +--- a/test/autoloading_test.rb ++++ b/test/autoloading_test.rb +@@ -7,6 +7,10 @@ def setup + Mustache.view_path = File.dirname(__FILE__) + '/fixtures' + end + ++ def teardown ++ Mustache.remove_instance_variable(:@view_namespace) if Mustache.instance_variable_defined?(:@view_namespace) ++ end ++ + def test_autoload + klass = Mustache.view_class(:Comments) + assert_equal Comments, klass diff --git a/gnu/packages/patches/tbb-fix-test-on-aarch64.patch b/gnu/packages/patches/tbb-fix-test-on-aarch64.patch new file mode 100644 index 0000000000..3a6003591e --- /dev/null +++ b/gnu/packages/patches/tbb-fix-test-on-aarch64.patch @@ -0,0 +1,35 @@ +From 013035b4e9af39f506e87ae6b755c3363e768d4d Mon Sep 17 00:00:00 2001 +From: Vladislav Shchapov <phprus@gmail.com> +Date: Thu, 23 Dec 2021 19:17:24 +0500 +Subject: [PATCH] Fix issue #687 (test_eh_thread) (#697) + +Signed-off-by: Vladislav Shchapov <phprus@gmail.com> +--- + test/tbb/test_eh_thread.cpp | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/test/tbb/test_eh_thread.cpp b/test/tbb/test_eh_thread.cpp +index aa6d764d..af291f48 100644 +--- a/test/tbb/test_eh_thread.cpp ++++ b/test/tbb/test_eh_thread.cpp +@@ -36,6 +36,7 @@ + // TODO: enable limitThreads with sanitizer under docker + #if TBB_USE_EXCEPTIONS && !_WIN32 && !__ANDROID__ + ++#include <limits.h> + #include <sys/types.h> + #include <sys/time.h> + #include <sys/resource.h> +@@ -73,7 +74,8 @@ public: + mValid = false; + pthread_attr_t attr; + // Limit the stack size not to consume all virtual memory on 32 bit platforms. +- if (pthread_attr_init(&attr) == 0 && pthread_attr_setstacksize(&attr, 100*1024) == 0) { ++ std::size_t stacksize = utils::max(128*1024, PTHREAD_STACK_MIN); ++ if (pthread_attr_init(&attr) == 0 && pthread_attr_setstacksize(&attr, stacksize) == 0) { + mValid = pthread_create(&mHandle, &attr, thread_routine, /* arg = */ nullptr) == 0; + } + } +-- +2.34.0 + diff --git a/gnu/packages/patches/ungoogled-chromium-accelerated-video-decode.patch b/gnu/packages/patches/ungoogled-chromium-accelerated-video-decode.patch deleted file mode 100644 index cbab626e59..0000000000 --- a/gnu/packages/patches/ungoogled-chromium-accelerated-video-decode.patch +++ /dev/null @@ -1,18 +0,0 @@ -Upstream Chromium no longer supports hardware accelerated video decoding -on GNU/Linux, yet it still works fine on many systems. This patch "unexpires" -the support. - -Taken from Arch Linux: -https://github.com/archlinux/svntogit-packages/blob/packages/chromium/trunk/unexpire-accelerated-video-decode-flag.patch - ---- a/chrome/browser/flag-metadata.json -+++ b/chrome/browser/flag-metadata.json -@@ -1285,7 +1285,7 @@ - { - "name": "enable-accelerated-video-decode", - "owners": [ "media-dev@chromium.org" ], -- "expiry_milestone": 93 -+ "expiry_milestone": 99 - }, - { - "name": "enable-accessibility-live-caption", diff --git a/gnu/packages/patches/util-linux-CVE-2021-3995.patch b/gnu/packages/patches/util-linux-CVE-2021-3995.patch new file mode 100644 index 0000000000..7faea83801 --- /dev/null +++ b/gnu/packages/patches/util-linux-CVE-2021-3995.patch @@ -0,0 +1,146 @@ +Fix CVE-2021-3995: + +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3995 +https://seclists.org/oss-sec/2022/q1/66 + +Patch copied from upstream source repository: + +https://github.com/util-linux/util-linux/commit/f3db9bd609494099f0c1b95231c5dfe383346929 + +From f3db9bd609494099f0c1b95231c5dfe383346929 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Wed, 24 Nov 2021 13:53:25 +0100 +Subject: [PATCH] libmount: fix UID check for FUSE umount [CVE-2021-3995] + +Improper UID check allows an unprivileged user to unmount FUSE +filesystems of users with similar UID. + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + include/strutils.h | 2 +- + libmount/src/context_umount.c | 14 +++--------- + libmount/src/mountP.h | 1 + + libmount/src/optstr.c | 42 +++++++++++++++++++++++++++++++++++ + 4 files changed, 47 insertions(+), 12 deletions(-) + +diff --git a/include/strutils.h b/include/strutils.h +index 6e95707ea..a84d29594 100644 +--- a/include/strutils.h ++++ b/include/strutils.h +@@ -106,8 +106,8 @@ static inline char *mem2strcpy(char *dest, const void *src, size_t n, size_t nma + if (n + 1 > nmax) + n = nmax - 1; + ++ memset(dest, '\0', nmax); + memcpy(dest, src, n); +- dest[nmax-1] = '\0'; + return dest; + } + +diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c +index 173637a15..8773c65ff 100644 +--- a/libmount/src/context_umount.c ++++ b/libmount/src/context_umount.c +@@ -453,10 +453,7 @@ static int is_fuse_usermount(struct libmnt_context *cxt, int *errsv) + struct libmnt_ns *ns_old; + const char *type = mnt_fs_get_fstype(cxt->fs); + const char *optstr; +- char *user_id = NULL; +- size_t sz; +- uid_t uid; +- char uidstr[sizeof(stringify_value(ULONG_MAX))]; ++ uid_t uid, entry_uid; + + *errsv = 0; + +@@ -473,11 +470,7 @@ static int is_fuse_usermount(struct libmnt_context *cxt, int *errsv) + optstr = mnt_fs_get_fs_options(cxt->fs); + if (!optstr) + return 0; +- +- if (mnt_optstr_get_option(optstr, "user_id", &user_id, &sz) != 0) +- return 0; +- +- if (sz == 0 || user_id == NULL) ++ if (mnt_optstr_get_uid(optstr, "user_id", &entry_uid) != 0) + return 0; + + /* get current user */ +@@ -494,8 +487,7 @@ static int is_fuse_usermount(struct libmnt_context *cxt, int *errsv) + return 0; + } + +- snprintf(uidstr, sizeof(uidstr), "%lu", (unsigned long) uid); +- return strncmp(user_id, uidstr, sz) == 0; ++ return uid == entry_uid; + } + + /* +diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h +index d43a83541..22442ec55 100644 +--- a/libmount/src/mountP.h ++++ b/libmount/src/mountP.h +@@ -399,6 +399,7 @@ extern const struct libmnt_optmap *mnt_optmap_get_entry( + const struct libmnt_optmap **mapent); + + /* optstr.c */ ++extern int mnt_optstr_get_uid(const char *optstr, const char *name, uid_t *uid); + extern int mnt_optstr_remove_option_at(char **optstr, char *begin, char *end); + extern int mnt_optstr_fix_gid(char **optstr, char *value, size_t valsz, char **next); + extern int mnt_optstr_fix_uid(char **optstr, char *value, size_t valsz, char **next); +diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c +index 921b9318e..16800f571 100644 +--- a/libmount/src/optstr.c ++++ b/libmount/src/optstr.c +@@ -1076,6 +1076,48 @@ int mnt_optstr_fix_user(char **optstr) + return rc; + } + ++/* ++ * Converts value from @optstr addressed by @name to uid. ++ * ++ * Returns: 0 on success, 1 if not found, <0 on error ++ */ ++int mnt_optstr_get_uid(const char *optstr, const char *name, uid_t *uid) ++{ ++ char *value = NULL; ++ size_t valsz = 0; ++ char buf[sizeof(stringify_value(UINT64_MAX))]; ++ int rc; ++ uint64_t num; ++ ++ assert(optstr); ++ assert(name); ++ assert(uid); ++ ++ rc = mnt_optstr_get_option(optstr, name, &value, &valsz); ++ if (rc != 0) ++ goto fail; ++ ++ if (valsz > sizeof(buf) - 1) { ++ rc = -ERANGE; ++ goto fail; ++ } ++ mem2strcpy(buf, value, valsz, sizeof(buf)); ++ ++ rc = ul_strtou64(buf, &num, 10); ++ if (rc != 0) ++ goto fail; ++ if (num > ULONG_MAX || (uid_t) num != num) { ++ rc = -ERANGE; ++ goto fail; ++ } ++ *uid = (uid_t) num; ++ ++ return 0; ++fail: ++ DBG(UTILS, ul_debug("failed to convert '%s'= to number [rc=%d]", name, rc)); ++ return rc; ++} ++ + /** + * mnt_match_options: + * @optstr: options string +-- +2.34.0 + diff --git a/gnu/packages/patches/util-linux-CVE-2021-3996.patch b/gnu/packages/patches/util-linux-CVE-2021-3996.patch new file mode 100644 index 0000000000..59edf5c7cf --- /dev/null +++ b/gnu/packages/patches/util-linux-CVE-2021-3996.patch @@ -0,0 +1,233 @@ +Fix CVE-2021-3996: + +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3996 +https://seclists.org/oss-sec/2022/q1/66 + +Patch copied from upstream source repository: + +https://github.com/util-linux/util-linux/commit/018a10907fa9885093f6d87401556932c2d8bd2b + +From 018a10907fa9885093f6d87401556932c2d8bd2b Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Tue, 4 Jan 2022 10:54:20 +0100 +Subject: [PATCH] libmount: fix (deleted) suffix issue [CVE-2021-3996] + +This issue is related to parsing the /proc/self/mountinfo file allows an +unprivileged user to unmount other user's filesystems that are either +world-writable themselves or mounted in a world-writable directory. + +The support for "(deleted)" is no more necessary as the Linux kernel does +not use it in /proc/self/mountinfo and /proc/self/mount files anymore. + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + libmount/src/tab_parse.c | 5 ----- + tests/expected/findmnt/filter-options | 1 - + tests/expected/findmnt/filter-options-nameval-neg | 3 +-- + tests/expected/findmnt/filter-types-neg | 1 - + tests/expected/findmnt/outputs-default | 3 +-- + tests/expected/findmnt/outputs-force-tree | 3 +-- + tests/expected/findmnt/outputs-kernel | 3 +-- + tests/expected/libmount/tabdiff-mount | 1 - + tests/expected/libmount/tabdiff-move | 1 - + tests/expected/libmount/tabdiff-remount | 1 - + tests/expected/libmount/tabdiff-umount | 1 - + tests/expected/libmount/tabfiles-parse-mountinfo | 11 ----------- + tests/expected/libmount/tabfiles-py-parse-mountinfo | 11 ----------- + tests/ts/findmnt/files/mountinfo | 1 - + tests/ts/findmnt/files/mountinfo-nonroot | 1 - + tests/ts/libmount/files/mountinfo | 1 - + 16 files changed, 4 insertions(+), 44 deletions(-) + +diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c +index 917779ab6..4407f9c9c 100644 +--- a/libmount/src/tab_parse.c ++++ b/libmount/src/tab_parse.c +@@ -227,11 +227,6 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, const char *s) + goto fail; + } + +- /* remove "\040(deleted)" suffix */ +- p = (char *) endswith(fs->target, PATH_DELETED_SUFFIX); +- if (p && *p) +- *p = '\0'; +- + s = skip_separator(s); + + /* (6) vfs options (fs-independent) */ +diff --git a/tests/expected/findmnt/filter-options b/tests/expected/findmnt/filter-options +index 2606bce76..97b0ead0a 100644 +--- a/tests/expected/findmnt/filter-options ++++ b/tests/expected/findmnt/filter-options +@@ -28,5 +28,4 @@ TARGET SOURCE FSTYPE OPTIONS + /home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 + /var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime + /mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-/mnt/foo /fooooo bar rw,relatime + rc=0 +diff --git a/tests/expected/findmnt/filter-options-nameval-neg b/tests/expected/findmnt/filter-options-nameval-neg +index 5471d65af..f0467ef75 100644 +--- a/tests/expected/findmnt/filter-options-nameval-neg ++++ b/tests/expected/findmnt/filter-options-nameval-neg +@@ -29,6 +29,5 @@ TARGET SOURCE FSTYPE OPTIO + |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered + | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 + |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime +-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-`-/mnt/foo /fooooo bar rw,relatime ++`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 + rc=0 +diff --git a/tests/expected/findmnt/filter-types-neg b/tests/expected/findmnt/filter-types-neg +index 2606bce76..97b0ead0a 100644 +--- a/tests/expected/findmnt/filter-types-neg ++++ b/tests/expected/findmnt/filter-types-neg +@@ -28,5 +28,4 @@ TARGET SOURCE FSTYPE OPTIONS + /home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 + /var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime + /mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-/mnt/foo /fooooo bar rw,relatime + rc=0 +diff --git a/tests/expected/findmnt/outputs-default b/tests/expected/findmnt/outputs-default +index 59495797b..01599355e 100644 +--- a/tests/expected/findmnt/outputs-default ++++ b/tests/expected/findmnt/outputs-default +@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO + |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered + | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 + |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime +-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-`-/mnt/foo /fooooo bar rw,relatime ++`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 + rc=0 +diff --git a/tests/expected/findmnt/outputs-force-tree b/tests/expected/findmnt/outputs-force-tree +index 59495797b..01599355e 100644 +--- a/tests/expected/findmnt/outputs-force-tree ++++ b/tests/expected/findmnt/outputs-force-tree +@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO + |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered + | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 + |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime +-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-`-/mnt/foo /fooooo bar rw,relatime ++`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 + rc=0 +diff --git a/tests/expected/findmnt/outputs-kernel b/tests/expected/findmnt/outputs-kernel +index 59495797b..01599355e 100644 +--- a/tests/expected/findmnt/outputs-kernel ++++ b/tests/expected/findmnt/outputs-kernel +@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO + |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered + | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500 + |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime +-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-`-/mnt/foo /fooooo bar rw,relatime ++`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 + rc=0 +diff --git a/tests/expected/libmount/tabdiff-mount b/tests/expected/libmount/tabdiff-mount +index 420aeacd5..3c18f8dc4 100644 +--- a/tests/expected/libmount/tabdiff-mount ++++ b/tests/expected/libmount/tabdiff-mount +@@ -1,3 +1,2 @@ + /dev/mapper/kzak-home on /home/kzak: MOUNTED +-/fooooo on /mnt/foo: MOUNTED + tmpfs on /mnt/test/foo
bar: MOUNTED +diff --git a/tests/expected/libmount/tabdiff-move b/tests/expected/libmount/tabdiff-move +index 24f9bc791..95820d93e 100644 +--- a/tests/expected/libmount/tabdiff-move ++++ b/tests/expected/libmount/tabdiff-move +@@ -1,3 +1,2 @@ + //foo.home/bar/ on /mnt/music: MOVED to /mnt/music +-/fooooo on /mnt/foo: UMOUNTED + tmpfs on /mnt/test/foo
bar: UMOUNTED +diff --git a/tests/expected/libmount/tabdiff-remount b/tests/expected/libmount/tabdiff-remount +index 82ebeab39..876bfd953 100644 +--- a/tests/expected/libmount/tabdiff-remount ++++ b/tests/expected/libmount/tabdiff-remount +@@ -1,4 +1,3 @@ + /dev/mapper/kzak-home on /home/kzak: REMOUNTED from 'rw,noatime,barrier=1,data=ordered' to 'ro,noatime,barrier=1,data=ordered' + //foo.home/bar/ on /mnt/sounds: REMOUNTED from 'rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344' to 'ro,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344' +-/fooooo on /mnt/foo: UMOUNTED + tmpfs on /mnt/test/foo
bar: UMOUNTED +diff --git a/tests/expected/libmount/tabdiff-umount b/tests/expected/libmount/tabdiff-umount +index a3e0fe48a..c7be725b9 100644 +--- a/tests/expected/libmount/tabdiff-umount ++++ b/tests/expected/libmount/tabdiff-umount +@@ -1,3 +1,2 @@ + /dev/mapper/kzak-home on /home/kzak: UMOUNTED +-/fooooo on /mnt/foo: UMOUNTED + tmpfs on /mnt/test/foo
bar: UMOUNTED +diff --git a/tests/expected/libmount/tabfiles-parse-mountinfo b/tests/expected/libmount/tabfiles-parse-mountinfo +index 47eb77006..d5ba5248e 100644 +--- a/tests/expected/libmount/tabfiles-parse-mountinfo ++++ b/tests/expected/libmount/tabfiles-parse-mountinfo +@@ -351,17 +351,6 @@ id: 47 + parent: 20 + devno: 0:38 + ------ fs: +-source: /fooooo +-target: /mnt/foo +-fstype: bar +-optstr: rw,relatime +-VFS-optstr: rw,relatime +-FS-opstr: rw +-root: / +-id: 48 +-parent: 20 +-devno: 0:39 +------- fs: + source: tmpfs + target: /mnt/test/foo
bar + fstype: tmpfs +diff --git a/tests/expected/libmount/tabfiles-py-parse-mountinfo b/tests/expected/libmount/tabfiles-py-parse-mountinfo +index 47eb77006..d5ba5248e 100644 +--- a/tests/expected/libmount/tabfiles-py-parse-mountinfo ++++ b/tests/expected/libmount/tabfiles-py-parse-mountinfo +@@ -351,17 +351,6 @@ id: 47 + parent: 20 + devno: 0:38 + ------ fs: +-source: /fooooo +-target: /mnt/foo +-fstype: bar +-optstr: rw,relatime +-VFS-optstr: rw,relatime +-FS-opstr: rw +-root: / +-id: 48 +-parent: 20 +-devno: 0:39 +------- fs: + source: tmpfs + target: /mnt/test/foo
bar + fstype: tmpfs +diff --git a/tests/ts/findmnt/files/mountinfo b/tests/ts/findmnt/files/mountinfo +index 475ea1a33..ff1e664a8 100644 +--- a/tests/ts/findmnt/files/mountinfo ++++ b/tests/ts/findmnt/files/mountinfo +@@ -30,4 +30,3 @@ + 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500 + 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw + 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw +diff --git a/tests/ts/findmnt/files/mountinfo-nonroot b/tests/ts/findmnt/files/mountinfo-nonroot +index e15b46701..87b421d2e 100644 +--- a/tests/ts/findmnt/files/mountinfo-nonroot ++++ b/tests/ts/findmnt/files/mountinfo-nonroot +@@ -29,4 +29,3 @@ + 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500 + 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw + 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw +diff --git a/tests/ts/libmount/files/mountinfo b/tests/ts/libmount/files/mountinfo +index c06307183..2b0174048 100644 +--- a/tests/ts/libmount/files/mountinfo ++++ b/tests/ts/libmount/files/mountinfo +@@ -30,5 +30,4 @@ + 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500 + 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw + 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +-48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw + 49 20 0:56 / /mnt/test/foo
bar rw,relatime shared:323 - tmpfs tmpfs rw +-- +2.34.0 + diff --git a/gnu/packages/patches/webrtc-audio-processing-big-endian.patch b/gnu/packages/patches/webrtc-audio-processing-big-endian.patch new file mode 100644 index 0000000000..78333fe7b7 --- /dev/null +++ b/gnu/packages/patches/webrtc-audio-processing-big-endian.patch @@ -0,0 +1,93 @@ +https://bugs.freedesktop.org/show_bug.cgi?id=95738 +https://bugs.freedesktop.org/attachment.cgi?id=124025 + +diff -up webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc.than webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc +--- webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc.than 2016-05-24 08:28:45.749940095 -0400 ++++ webrtc-audio-processing-0.2/webrtc/common_audio/wav_file.cc 2016-05-24 08:50:30.361020010 -0400 +@@ -64,9 +64,6 @@ WavReader::~WavReader() { + } + + size_t WavReader::ReadSamples(size_t num_samples, int16_t* samples) { +-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN +-#error "Need to convert samples to big-endian when reading from WAV file" +-#endif + // There could be metadata after the audio; ensure we don't read it. + num_samples = std::min(rtc::checked_cast<uint32_t>(num_samples), + num_samples_remaining_); +@@ -76,6 +73,12 @@ size_t WavReader::ReadSamples(size_t num + RTC_CHECK(read == num_samples || feof(file_handle_)); + RTC_CHECK_LE(read, num_samples_remaining_); + num_samples_remaining_ -= rtc::checked_cast<uint32_t>(read); ++#ifndef WEBRTC_ARCH_LITTLE_ENDIAN ++ //convert to big-endian ++ for(size_t idx = 0; idx < num_samples; idx++) { ++ samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); ++ } ++#endif + return read; + } + +@@ -120,10 +123,17 @@ WavWriter::~WavWriter() { + + void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) { + #ifndef WEBRTC_ARCH_LITTLE_ENDIAN +-#error "Need to convert samples to little-endian when writing to WAV file" +-#endif ++ int16_t * le_samples = new int16_t[num_samples]; ++ for(size_t idx = 0; idx < num_samples; idx++) { ++ le_samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); ++ } ++ const size_t written = ++ fwrite(le_samples, sizeof(*le_samples), num_samples, file_handle_); ++ delete []le_samples; ++#else + const size_t written = + fwrite(samples, sizeof(*samples), num_samples, file_handle_); ++#endif + RTC_CHECK_EQ(num_samples, written); + num_samples_ += static_cast<uint32_t>(written); + RTC_CHECK(written <= std::numeric_limits<uint32_t>::max() || +diff -up webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc.than webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc +--- webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc.than 2016-05-24 08:50:52.591379263 -0400 ++++ webrtc-audio-processing-0.2/webrtc/common_audio/wav_header.cc 2016-05-24 08:52:08.552606848 -0400 +@@ -129,7 +129,39 @@ static inline std::string ReadFourCC(uin + return std::string(reinterpret_cast<char*>(&x), 4); + } + #else +-#error "Write be-to-le conversion functions" ++static inline void WriteLE16(uint16_t* f, uint16_t x) { ++ *f = ((x << 8) & 0xff00) | ( ( x >> 8) & 0x00ff); ++} ++ ++static inline void WriteLE32(uint32_t* f, uint32_t x) { ++ *f = ( (x & 0x000000ff) << 24 ) ++ | ((x & 0x0000ff00) << 8) ++ | ((x & 0x00ff0000) >> 8) ++ | ((x & 0xff000000) >> 24 ); ++} ++ ++static inline void WriteFourCC(uint32_t* f, char a, char b, char c, char d) { ++ *f = (static_cast<uint32_t>(a) << 24 ) ++ | (static_cast<uint32_t>(b) << 16) ++ | (static_cast<uint32_t>(c) << 8) ++ | (static_cast<uint32_t>(d) ); ++} ++ ++static inline uint16_t ReadLE16(uint16_t x) { ++ return (( x & 0x00ff) << 8 )| ((x & 0xff00)>>8); ++} ++ ++static inline uint32_t ReadLE32(uint32_t x) { ++ return ( (x & 0x000000ff) << 24 ) ++ | ( (x & 0x0000ff00) << 8 ) ++ | ( (x & 0x00ff0000) >> 8) ++ | ( (x & 0xff000000) >> 24 ); ++} ++ ++static inline std::string ReadFourCC(uint32_t x) { ++ x = ReadLE32(x); ++ return std::string(reinterpret_cast<char*>(&x), 4); ++} + #endif + + static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) { |