···58585959 ./sys-ustat.patch6060 ../../common/compiler-rt/libsanitizer-no-cyclades-9.patch6161+ ./compiler-rt-5-cstddef.patch6162 ] ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;62636364 # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
···11+https://gmplib.org/repo/gmp-6.2/raw-rev/561a9c25298e22+33+diff -r e1fd9db13b47 -r 561a9c25298e mpz/inp_raw.c44+--- a/mpz/inp_raw.c Tue Dec 22 23:49:51 2020 +010055++++ b/mpz/inp_raw.c Thu Oct 21 19:06:49 2021 +020066+@@ -88,8 +88,11 @@77+88+ abs_csize = ABS (csize);99+1010++ if (UNLIKELY (abs_csize > ~(mp_bitcnt_t) 0 / 8))1111++ return 0; /* Bit size overflows */1212++1313+ /* round up to a multiple of limbs */1414+- abs_xsize = BITS_TO_LIMBS (abs_csize*8);1515++ abs_xsize = BITS_TO_LIMBS ((mp_bitcnt_t) abs_csize * 8);1616+1717+ if (abs_xsize != 0)1818+ {1919+
+2
pkgs/development/libraries/gmp/6.x.nix
···2020 sha256 = "0z2ddfiwgi0xbf65z4fg4hqqzlhv0cc6hdcswf3c6n21xdmk5sga";2121 };22222323+ patches = [ ./6.2.1-CVE-2021-43618.patch ];2424+2325 #outputs TODO: split $cxx due to libstdc++ dependency2426 # maybe let ghc use a version with *.so shared with rest of nixpkgs and *.a added2527 # - see #5855 for related discussion
+2-2
pkgs/development/libraries/gsl/default.nix
···2233stdenv.mkDerivation rec {44 pname = "gsl";55- version = "2.7";55+ version = "2.7.1";6677 src = fetchurl {88 url = "mirror://gnu/gsl/${pname}-${version}.tar.gz";99- sha256 = "sha256-77vzeF2g5TA4vnkHUAYotGYVLbw8FzqH3hteui4jYCs=";99+ sha256 = "sha256-3LD71DBIgyt1f/mUJpGo3XACbV2g/4VgHlJof23us0s=";1010 };11111212 preConfigure = if (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11" && stdenv.isDarwin) then ''
···11-diff --git a/kde-modules/KDEInstallDirs.cmake b/kde-modules/KDEInstallDirs.cmake11+diff --git a/kde-modules/KDEInstallDirsCommon.cmake b/kde-modules/KDEInstallDirsCommon.cmake22index c1d056b..d9e19f0 10064433---- a/kde-modules/KDEInstallDirs.cmake44-+++ b/kde-modules/KDEInstallDirs.cmake55-@@ -242,35 +242,6 @@33+--- a/kde-modules/KDEInstallDirsCommon.cmake44++++ b/kde-modules/KDEInstallDirsCommon.cmake55+@@ -15,35 +15,6 @@66 # GNUInstallDirs code deals with re-configuring, but that is dealt with77 # by the _define_* macros in this module).88 set(_LIBDIR_DEFAULT "lib")
···11-WGET_ARGS=( https://download.kde.org/stable/frameworks/5.87/ -A '*.tar.xz' )11+WGET_ARGS=( https://download.kde.org/stable/frameworks/5.89/ -A '*.tar.xz' )
···2727 # It will rebuild itself using the version of this package (NSS) and if2828 # an update is required do the required changes to the expression.2929 # Example: nix-shell ./maintainers/scripts/update.nix --argstr package cacert3030- version = "3.73";3030+ version = "3.73.1";31313232in3333stdenv.mkDerivation rec {···36363737 src = fetchurl {3838 url = "mirror://mozilla/security/nss/releases/NSS_${lib.replaceStrings [ "." ] [ "_" ] version}_RTM/src/${pname}-${version}.tar.gz";3939- sha256 = "1rfqjq02rfv0ycdmvic51pi093rg33zb8kpqkvddf44vv9l3lvan";3939+ sha256 = "x2j5/jEp6LzC6WeUVtft2UU6IleEqPx9xFAYBvH+mr4=";4040 };41414242 depsBuildBuild = [ buildPackages.stdenv.cc ];
···13131414buildPythonPackage rec {1515 pname = "botocore";1616- version = "1.23.14"; # N.B: if you change this, change boto3 and awscli to a matching version1616+ version = "1.23.21"; # N.B: if you change this, change boto3 and awscli to a matching version17171818 src = fetchPypi {1919 inherit pname version;2020- sha256 = "sha256-6NUsvy5zxiaM8sIH9H48+z7eCYP5PotZZ0tUYo5+8fE=";2020+ sha256 = "d7f8e82cba38aa1e66015cab0a5ca3204503e90afc4695e97228e28329a14c04";2121 };22222323 propagatedBuildInputs = [
···1818 # If you need these, you can just add them to your environment.19192020 pname = "hypothesis";2121- version = "6.27.1";2121+ version = "6.30.1";22222323 # Use github tarballs that includes tests2424 src = fetchFromGitHub {2525 owner = "HypothesisWorks";2626 repo = "hypothesis-python";2727 rev = "hypothesis-python-${version}";2828- sha256 = "05kfz041vrd9fy8gl8ch05g806jj4j6l1cnwhqgygagn9z3aq1jx";2828+ sha256 = "0nk57v03q7ss7dbsfd9gi3lzl6ngplk7axbiksm26dgkhh4swk8y";2929 };30303131 postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";
···11{ lib22+, stdenv23, buildPythonPackage34, fetchPypi45, pytestCheckHook···1716 checkInputs = [1817 pytestCheckHook1918 ];1919+2020+ preCheck = lib.optionalString stdenv.isDarwin ''2121+ # Work around https://github.com/jupyter/testpath/issues/242222+ export TMPDIR="/tmp"2323+ '';20242125 meta = with lib; {2226 description = "Test utilities for code working with files and commands";
···11-From 76523ca5b2227085bb65253900e866b08a2b5efb Mon Sep 17 00:00:00 200122-From: Tobias Mayer <tobim@fastmail.fm>33-Date: Fri, 30 Jul 2021 10:50:16 +020044-Subject: [PATCH] Disable NAT64 address synthesis on darwin55-66-This intentionally breaks the feature by partially reverting77-https://github.com/curl/curl/commit/31f631a142d855f069242f3e0c643beec25d1b5188-99-This is a stop-gap to get CMake to build without the SystemConfiguration1010-framework.1111----1212- Utilities/cmcurl/CMakeLists.txt | 8 --------1313- Utilities/cmcurl/lib/curl_setup.h | 4 ----1414- Utilities/cmcurl/lib/hostip.c | 17 -----------------1515- 3 files changed, 29 deletions(-)1616-171diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt1818-index 16ef037ccc..17564bbb69 10064422+index 9eef01aaf0..d141d4086c 100644193--- a/Utilities/cmcurl/CMakeLists.txt204+++ b/Utilities/cmcurl/CMakeLists.txt2121-@@ -511,14 +511,6 @@ if(CMAKE_USE_SECTRANSP)2222- list(APPEND CURL_LIBS "${COREFOUNDATION_FRAMEWORK}" "${SECURITY_FRAMEWORK}")2323- endif()55+@@ -537,12 +537,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")66+ message(FATAL_ERROR "CoreFoundation framework not found")77+ endif()2482525--if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")269- find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration")2710- if(NOT SYSTEMCONFIGURATION_FRAMEWORK)2811- message(FATAL_ERROR "SystemConfiguration framework not found")2912- endif()3030-- list(APPEND CURL_LIBS "${SYSTEMCONFIGURATION_FRAMEWORK}")3131--endif()3213-3333- if(CMAKE_USE_OPENSSL)3434- find_package(OpenSSL)3535- if(NOT OpenSSL_FOUND)1414+- list(APPEND CURL_LIBS "-framework CoreFoundation" "-framework SystemConfiguration")1515++ list(APPEND CURL_LIBS "-framework CoreFoundation")1616+1717+ if(CMAKE_USE_SECTRANSP)1818+ find_library(SECURITY_FRAMEWORK "Security")3619diff --git a/Utilities/cmcurl/lib/curl_setup.h b/Utilities/cmcurl/lib/curl_setup.h3737-index 2d13a40a55..35160bc0f5 1006442020+index 554dcc1e67..059f14e632 1006443821--- a/Utilities/cmcurl/lib/curl_setup.h3922+++ b/Utilities/cmcurl/lib/curl_setup.h4040-@@ -251,11 +251,7 @@2323+@@ -257,11 +257,7 @@4124 * performing this task will result in a synthesized IPv6 address.4225 */4326 #if defined(__APPLE__) && !defined(USE_ARES)···33503451 #ifdef USE_LWIPSOCK3552diff --git a/Utilities/cmcurl/lib/hostip.c b/Utilities/cmcurl/lib/hostip.c3636-index e0e3cfc2cb..45190a100b 1006445353+index 117caa2957..9f7c709e44 1006443754--- a/Utilities/cmcurl/lib/hostip.c3855+++ b/Utilities/cmcurl/lib/hostip.c3956@@ -68,10 +68,6 @@···4764 #if defined(CURLRES_SYNCH) && \4865 defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP)4966 /* alarm-based timeouts can only be used with all the dependencies satisfied */5050-@@ -533,19 +529,6 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,6767+@@ -653,23 +649,6 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,5168 return CURLRESOLV_ERROR;5269 }53705471-#if defined(ENABLE_IPV6) && defined(CURL_OSX_CALL_COPYPROXIES)5555-- /*5656-- * The automagic conversion from IPv4 literals to IPv6 literals only works5757-- * if the SCDynamicStoreCopyProxies system function gets called first. As5858-- * Curl currently doesn't support system-wide HTTP proxies, we therefore5959-- * don't use any value this function might return.6060-- *6161-- * This function is only available on a macOS and is not needed for6262-- * IPv4-only builds, hence the conditions above.6363-- */6464-- SCDynamicStoreCopyProxies(NULL);7272+- {7373+- /*7474+- * The automagic conversion from IPv4 literals to IPv6 literals only7575+- * works if the SCDynamicStoreCopyProxies system function gets called7676+- * first. As Curl currently doesn't support system-wide HTTP proxies, we7777+- * therefore don't use any value this function might return.7878+- *7979+- * This function is only available on a macOS and is not needed for8080+- * IPv4-only builds, hence the conditions above.8181+- */8282+- CFDictionaryRef dict = SCDynamicStoreCopyProxies(NULL);8383+- if(dict)8484+- CFRelease(dict);8585+- }6586-#endif6687-6788 #ifndef USE_RESOLVE_ON_IPS6889 /* First check if this is an IPv4 address string */6990 if(Curl_inet_pton(AF_INET, hostname, &in) > 0)7070--- 7171-2.32.07272-
···11+based on upstream https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=161e87d12167b1e36193385485c1f6ce92f74f02;hp=d5c94731766bf4f276146fd29c1df8eebc2aaf6922+33+adapted by ris to apply to 2.35.2 (simply capitalizing booleans)44+55+diff --git a/binutils/stabs.c b/binutils/stabs.c66+index 274bfb0e7fa..83ee3ea5fa4 10064477+--- a/binutils/stabs.c88++++ b/binutils/stabs.c99+@@ -202,7 +202,7 @@ static debug_type stab_find_type (void *, struct stab_handle *, const int *);1010+ static bool stab_record_type1111+ (void *, struct stab_handle *, const int *, debug_type);1212+ static debug_type stab_xcoff_builtin_type1313+- (void *, struct stab_handle *, int);1414++ (void *, struct stab_handle *, unsigned int);1515+ static debug_type stab_find_tagged_type1616+ (void *, struct stab_handle *, const char *, int, enum debug_type_kind);1717+ static debug_type *stab_demangle_argtypes1818+@@ -3496,166 +3496,167 @@ stab_record_type (void *dhandle ATTRIBUTE_UNUSED, struct stab_handle *info,1919+2020+ static debug_type2121+ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,2222+- int typenum)2323++ unsigned int typenum)2424+ {2525+ debug_type rettype;2626+ const char *name;2727+2828+- if (typenum >= 0 || typenum < -XCOFF_TYPE_COUNT)2929++ typenum = -typenum - 1;3030++ if (typenum >= XCOFF_TYPE_COUNT)3131+ {3232+- fprintf (stderr, _("Unrecognized XCOFF type %d\n"), typenum);3333++ fprintf (stderr, _("Unrecognized XCOFF type %d\n"), -typenum - 1);3434+ return DEBUG_TYPE_NULL;3535+ }3636+- if (info->xcoff_types[-typenum] != NULL)3737+- return info->xcoff_types[-typenum];3838++ if (info->xcoff_types[typenum] != NULL)3939++ return info->xcoff_types[typenum];4040+4141+- switch (-typenum)4242++ switch (typenum)4343+ {4444+- case 1:4545++ case 0:4646+ /* The size of this and all the other types are fixed, defined4747+ by the debugging format. */4848+ name = "int";4949+ rettype = debug_make_int_type (dhandle, 4, FALSE);5050+ break;5151+- case 2:5252++ case 1:5353+ name = "char";5454+ rettype = debug_make_int_type (dhandle, 1, FALSE);5555+ break;5656+- case 3:5757++ case 2:5858+ name = "short";5959+ rettype = debug_make_int_type (dhandle, 2, FALSE);6060+ break;6161+- case 4:6262++ case 3:6363+ name = "long";6464+ rettype = debug_make_int_type (dhandle, 4, FALSE);6565+ break;6666+- case 5:6767++ case 4:6868+ name = "unsigned char";6969+ rettype = debug_make_int_type (dhandle, 1, TRUE);7070+ break;7171+- case 6:7272++ case 5:7373+ name = "signed char";7474+ rettype = debug_make_int_type (dhandle, 1, FALSE);7575+ break;7676+- case 7:7777++ case 6:7878+ name = "unsigned short";7979+ rettype = debug_make_int_type (dhandle, 2, TRUE);8080+ break;8181+- case 8:8282++ case 7:8383+ name = "unsigned int";8484+ rettype = debug_make_int_type (dhandle, 4, TRUE);8585+ break;8686+- case 9:8787++ case 8:8888+ name = "unsigned";8989+ rettype = debug_make_int_type (dhandle, 4, TRUE);9090+ break;9191+- case 10:9292++ case 9:9393+ name = "unsigned long";9494+ rettype = debug_make_int_type (dhandle, 4, TRUE);9595+ break;9696+- case 11:9797++ case 10:9898+ name = "void";9999+ rettype = debug_make_void_type (dhandle);100100+ break;101101+- case 12:102102++ case 11:103103+ /* IEEE single precision (32 bit). */104104+ name = "float";105105+ rettype = debug_make_float_type (dhandle, 4);106106+ break;107107+- case 13:108108++ case 12:109109+ /* IEEE double precision (64 bit). */110110+ name = "double";111111+ rettype = debug_make_float_type (dhandle, 8);112112+ break;113113+- case 14:114114++ case 13:115115+ /* This is an IEEE double on the RS/6000, and different machines116116+ with different sizes for "long double" should use different117117+ negative type numbers. See stabs.texinfo. */118118+ name = "long double";119119+ rettype = debug_make_float_type (dhandle, 8);120120+ break;121121+- case 15:122122++ case 14:123123+ name = "integer";124124+ rettype = debug_make_int_type (dhandle, 4, FALSE);125125+ break;126126+- case 16:127127++ case 15:128128+ name = "boolean";129129+ rettype = debug_make_bool_type (dhandle, 4);130130+ break;131131+- case 17:132132++ case 16:133133+ name = "short real";134134+ rettype = debug_make_float_type (dhandle, 4);135135+ break;136136+- case 18:137137++ case 17:138138+ name = "real";139139+ rettype = debug_make_float_type (dhandle, 8);140140+ break;141141+- case 19:142142++ case 18:143143+ /* FIXME */144144+ name = "stringptr";145145+ rettype = NULL;146146+ break;147147+- case 20:148148++ case 19:149149+ /* FIXME */150150+ name = "character";151151+ rettype = debug_make_int_type (dhandle, 1, TRUE);152152+ break;153153+- case 21:154154++ case 20:155155+ name = "logical*1";156156+ rettype = debug_make_bool_type (dhandle, 1);157157+ break;158158+- case 22:159159++ case 21:160160+ name = "logical*2";161161+ rettype = debug_make_bool_type (dhandle, 2);162162+ break;163163+- case 23:164164++ case 22:165165+ name = "logical*4";166166+ rettype = debug_make_bool_type (dhandle, 4);167167+ break;168168+- case 24:169169++ case 23:170170+ name = "logical";171171+ rettype = debug_make_bool_type (dhandle, 4);172172+ break;173173+- case 25:174174++ case 24:175175+ /* Complex type consisting of two IEEE single precision values. */176176+ name = "complex";177177+ rettype = debug_make_complex_type (dhandle, 8);178178+ break;179179+- case 26:180180++ case 25:181181+ /* Complex type consisting of two IEEE double precision values. */182182+ name = "double complex";183183+ rettype = debug_make_complex_type (dhandle, 16);184184+ break;185185+- case 27:186186++ case 26:187187+ name = "integer*1";188188+ rettype = debug_make_int_type (dhandle, 1, FALSE);189189+ break;190190+- case 28:191191++ case 27:192192+ name = "integer*2";193193+ rettype = debug_make_int_type (dhandle, 2, FALSE);194194+ break;195195+- case 29:196196++ case 28:197197+ name = "integer*4";198198+ rettype = debug_make_int_type (dhandle, 4, FALSE);199199+ break;200200+- case 30:201201++ case 29:202202+ /* FIXME */203203+ name = "wchar";204204+ rettype = debug_make_int_type (dhandle, 2, FALSE);205205+ break;206206+- case 31:207207++ case 30:208208+ name = "long long";209209+ rettype = debug_make_int_type (dhandle, 8, FALSE);210210+ break;211211+- case 32:212212++ case 31:213213+ name = "unsigned long long";214214+ rettype = debug_make_int_type (dhandle, 8, TRUE);215215+ break;216216+- case 33:217217++ case 32:218218+ name = "logical*8";219219+ rettype = debug_make_bool_type (dhandle, 8);220220+ break;221221+- case 34:222222++ case 33:223223+ name = "integer*8";224224+ rettype = debug_make_int_type (dhandle, 8, FALSE);225225+ break;226226+@@ -3664,9 +3665,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,227227+ }228228+229229+ rettype = debug_name_type (dhandle, name, rettype);230230+-231231+- info->xcoff_types[-typenum] = rettype;232232+-233233++ info->xcoff_types[typenum] = rettype;234234+ return rettype;235235+ }236236+237237+-- 238238+2.27.0239239+
+1
pkgs/development/tools/misc/binutils/default.nix
···85858686 ./CVE-2020-35448.patch8787 ./CVE-2021-3487.patch8888+ ./CVE-2021-45078.patch8889 ] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch8990 ++ # This patch was suggested by Nick Clifton to fix9091 # https://sourceware.org/bugzilla/show_bug.cgi?id=16177
···11{ lib, stdenv, buildPackages, fetchurl, bison, m422-, fetchpatch, autoreconfHook, help2man22+, autoreconfHook, help2man33}:44+55+# Avoid 'fetchpatch' to allow 'flex' to be used as a possible 'gcc'66+# dependency during bootstrap. Useful when gcc is built from snapshot77+# or from a git tree (flex lexers are not pre-generated there).4859stdenv.mkDerivation rec {610 pname = "flex";···17131814 # Also upstream, will be part of 2.6.51915 # https://github.com/westes/flex/commit/24fd0551333e2020- patches = [(fetchpatch {1616+ patches = [(fetchurl {2117 name = "glibc-2.26.patch";2222- url = "https://raw.githubusercontent.com/lede-project/source/0fb14a2b1ab2f82c"2323- + "/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch";2424- sha256 = "1aarhcmz7mfrgh15pkj6f7ikxa2m0mllw1i1vscsf1kw5d05lw6f";1818+ url = "https://raw.githubusercontent.com/lede-project/source/0fb14a2b1ab2f82ce63f4437b062229d73d90516/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch";1919+ sha256 = "0mpp41zdg17gx30kcpj83jl8hssks3adbks0qzbhcz882b9c083r";2520 })];26212722 postPatch = ''
···11-From d4ea219a35a09fe02bc9e47e8530644cb4fc4146 Mon Sep 17 00:00:00 200111+From 93b2d29de784c68d1b4d70d7f214b19432aec6a8 Mon Sep 17 00:00:00 200122From: Eelco Dolstra <eelco.dolstra@logicblox.com>33Date: Tue, 8 Jan 2013 15:46:30 +010044-Subject: [PATCH 01/21] Start device units for uninitialised encrypted devices44+Subject: [PATCH 01/19] Start device units for uninitialised encrypted devices5566This is necessary because the NixOS service that initialises the77filesystem depends on the appearance of the device unit. Also, this···2828 SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}!="crypto_LUKS", SYMLINK+="gpt-auto-root"2929 SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}=="crypto_LUKS", SYMLINK+="gpt-auto-root-luks"3030-- 3131-2.33.03131+2.33.13232
···11-From c06abdb631527f56a626b739340d1b275349612c Mon Sep 17 00:00:00 200111+From b39b8871bcaa07280d6b0cf2226b1a3be31232b8 Mon Sep 17 00:00:00 200122From: Eelco Dolstra <eelco.dolstra@logicblox.com>33Date: Mon, 11 May 2015 15:39:38 +020044-Subject: [PATCH 06/21] Get rid of a useless message in user sessions44+Subject: [PATCH 06/19] Get rid of a useless message in user sessions5566Namely lots of variants of77···2727 /* If stopping a unit fails continuously we might enter a stop loop here, hence stop acting on the2828 * service being unnecessary after a while. */2929-- 3030-2.33.03030+2.33.13131
···11-From 75d12cf65073458f091899d673c613dfc43f60c0 Mon Sep 17 00:00:00 200111+From f4e9304560ad42eeb8d42be583cc55eb2e5b4bb1 Mon Sep 17 00:00:00 200122From: Imuli <i@imu.li>33Date: Wed, 19 Oct 2016 08:46:47 -040044-Subject: [PATCH 10/21] localectl: use /etc/X11/xkb for list-x11-*44+Subject: [PATCH 10/19] localectl: use /etc/X11/xkb for list-x11-*5566NixOS has an option to link the xkb data files to /etc/X11, but not to77/usr/share/X11.···2323 return log_error_errno(errno, "Failed to open keyboard mapping list. %m");24242525-- 2626-2.33.02626+2.33.12727
···11-From 39969a1b01d6c223a21c770093209b7f4047aaa4 Mon Sep 17 00:00:00 200111+From eb93778af78a127e8e20d6ed7fd9f91fd22dc7c9 Mon Sep 17 00:00:00 200122From: Andreas Rammhold <andreas@rammhold.de>33Date: Thu, 9 May 2019 11:15:22 +020044-Subject: [PATCH 13/21] add rootprefix to lookup dir paths44+Subject: [PATCH 13/19] add rootprefix to lookup dir paths5566systemd does not longer use the UDEVLIBEXEC directory as root for77discovery default udev rules. By adding `$out/lib` to the lookup paths···3434 #define CONF_PATHS(n) \3535 CONF_PATHS_USR(n) \3636-- 3737-2.33.03737+2.33.13838
···11-From e7c960789b0ca97b24a66e9eeaa56ea645d9c66b Mon Sep 17 00:00:00 200111+From 1d623def80a3532ac1445499c9d4673e21ae8195 Mon Sep 17 00:00:00 200122From: Nikolay Amiantov <ab@fmap.me>33Date: Thu, 25 Jul 2019 20:45:55 +030044-Subject: [PATCH 14/21] systemd-shutdown: execute scripts in44+Subject: [PATCH 14/19] systemd-shutdown: execute scripts in55 /etc/systemd/system-shutdown6677This is needed for NixOS to use such scripts as systemd directory is immutable.···2323 /* The log target defaults to console, but the original systemd process will pass its log target in through a2424 * command line argument, which will override this default. Also, ensure we'll never log to the journal or2525-- 2626-2.33.02626+2.33.12727
···11-From 7654964344ba083529cb232ab229db7c0888f782 Mon Sep 17 00:00:00 200111+From 50f2ada6cbfafa75b628410e8834f29581854e6f Mon Sep 17 00:00:00 200122From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>33Date: Sun, 6 Dec 2020 08:34:19 +010044-Subject: [PATCH 18/21] pkg-config: derive prefix from --prefix44+Subject: [PATCH 18/19] pkg-config: derive prefix from --prefix5566Point prefix to the one configured, instead of `/usr` `systemd` has limited77support for making the pkgconfig prefix overridable, and interpolates those···2929 rootprefix=${root_prefix}3030 sysconf_dir={{SYSCONF_DIR}}3131-- 3232-2.33.03232+2.33.13333
···11-From 4e9b4aa87d299be08cffc77a86d6f473a7a4109a Mon Sep 17 00:00:00 200111+From 2ab388cf0be320879e668a6206cb15d002b55f98 Mon Sep 17 00:00:00 200122From: Andreas Rammhold <andreas@rammhold.de>33Date: Wed, 18 Aug 2021 19:10:08 +020044-Subject: [PATCH 19/21] core: handle lookup paths being symlinks44+Subject: [PATCH 19/19] core: handle lookup paths being symlinks5566With a recent change paths leaving the statically known lookup paths77would be treated differently then those that remained within those. That···7676 log_debug("%s: linked unit file: %s → %s",7777 __func__, filename, simplified);7878-- 7979-2.33.07979+2.33.18080
···11-From 2d9fcfcfa38667ada306e095599944f941576e53 Mon Sep 17 00:00:00 200122-From: Jan Janssen <medhefgo@web.de>33-Date: Wed, 11 Aug 2021 14:59:46 +020044-Subject: [PATCH 21/21] sd-boot: Rework console input handling55-66-Fixes: #1584777-Probably fixes: #1919188-99-(cherry picked from commit e98d271e57f3d0356e444b6ea2d48836ee2769b0)1010----1111- src/boot/efi/boot.c | 55 +++++++---------------1212- src/boot/efi/console.c | 102 +++++++++++++++++++++++++++++------------1313- src/boot/efi/console.h | 2 +-1414- 3 files changed, 91 insertions(+), 68 deletions(-)1515-1616-diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c1717-index 54d704f0d1..b4f3b9605a 1006441818---- a/src/boot/efi/boot.c1919-+++ b/src/boot/efi/boot.c2020-@@ -134,7 +134,7 @@ static BOOLEAN line_edit(2121- uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, print);2222- uefi_call_wrapper(ST->ConOut->SetCursorPosition, 3, ST->ConOut, cursor, y_pos);2323-2424-- err = console_key_read(&key, TRUE);2525-+ err = console_key_read(&key, 0);2626- if (EFI_ERROR(err))2727- continue;2828-2929-@@ -387,7 +387,7 @@ static VOID print_status(Config *config, CHAR16 *loaded_image_path) {3030- Print(L"OsIndicationsSupported: %d\n", indvar);3131-3232- Print(L"\n--- press key ---\n\n");3333-- console_key_read(&key, TRUE);3434-+ console_key_read(&key, 0);3535-3636- Print(L"timeout: %u\n", config->timeout_sec);3737- if (config->timeout_sec_efivar >= 0)3838-@@ -432,7 +432,7 @@ static VOID print_status(Config *config, CHAR16 *loaded_image_path) {3939- Print(L"LoaderEntryDefault: %s\n", defaultstr);4040-4141- Print(L"\n--- press key ---\n\n");4242-- console_key_read(&key, TRUE);4343-+ console_key_read(&key, 0);4444-4545- for (UINTN i = 0; i < config->entry_count; i++) {4646- ConfigEntry *entry;4747-@@ -482,7 +482,7 @@ static VOID print_status(Config *config, CHAR16 *loaded_image_path) {4848- entry->path, entry->next_name);4949-5050- Print(L"\n--- press key ---\n\n");5151-- console_key_read(&key, TRUE);5252-+ console_key_read(&key, 0);5353- }5454-5555- uefi_call_wrapper(ST->ConOut->ClearScreen, 1, ST->ConOut);5656-@@ -509,11 +509,10 @@ static BOOLEAN menu_run(5757- UINTN y_max;5858- CHAR16 *status;5959- CHAR16 *clearline;6060-- INTN timeout_remain;6161-+ UINTN timeout_remain = config->timeout_sec;6262- INT16 idx;6363- BOOLEAN exit = FALSE;6464- BOOLEAN run = TRUE;6565-- BOOLEAN wait = FALSE;6666-6767- graphics_mode(FALSE);6868- uefi_call_wrapper(ST->ConIn->Reset, 2, ST->ConIn, FALSE);6969-@@ -538,12 +537,6 @@ static BOOLEAN menu_run(7070- y_max = 25;7171- }7272-7373-- /* we check 10 times per second for a keystroke */7474-- if (config->timeout_sec > 0)7575-- timeout_remain = config->timeout_sec * 10;7676-- else7777-- timeout_remain = -1;7878--7979- idx_highlight = config->idx_default;8080- idx_highlight_prev = 0;8181-8282-@@ -643,7 +636,7 @@ static BOOLEAN menu_run(8383-8484- if (timeout_remain > 0) {8585- FreePool(status);8686-- status = PoolPrint(L"Boot in %d sec.", (timeout_remain + 5) / 10);8787-+ status = PoolPrint(L"Boot in %d s.", timeout_remain);8888- }8989-9090- /* print status at last line of screen */9191-@@ -664,27 +657,18 @@ static BOOLEAN menu_run(9292- uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, clearline+1 + x + len);9393- }9494-9595-- err = console_key_read(&key, wait);9696-- if (EFI_ERROR(err)) {9797-- /* timeout reached */9898-+ err = console_key_read(&key, timeout_remain > 0 ? 1000 * 1000 : 0);9999-+ if (err == EFI_TIMEOUT) {100100-+ timeout_remain--;101101- if (timeout_remain == 0) {102102- exit = TRUE;103103- break;104104- }105105-106106-- /* sleep and update status */107107-- if (timeout_remain > 0) {108108-- uefi_call_wrapper(BS->Stall, 1, 100 * 1000);109109-- timeout_remain--;110110-- continue;111111-- }112112--113113-- /* timeout disabled, wait for next key */114114-- wait = TRUE;115115-+ /* update status */116116- continue;117117-- }118118--119119-- timeout_remain = -1;120120-+ } else121121-+ timeout_remain = 0;122122-123123- /* clear status after keystroke */124124- if (status) {125125-@@ -787,7 +771,7 @@ static BOOLEAN menu_run(126126- config->timeout_sec_efivar,127127- EFI_VARIABLE_NON_VOLATILE);128128- if (config->timeout_sec_efivar > 0)129129-- status = PoolPrint(L"Menu timeout set to %d sec.", config->timeout_sec_efivar);130130-+ status = PoolPrint(L"Menu timeout set to %d s.", config->timeout_sec_efivar);131131- else132132- status = StrDuplicate(L"Menu disabled. Hold down key at bootup to show menu.");133133- } else if (config->timeout_sec_efivar <= 0){134134-@@ -795,7 +779,7 @@ static BOOLEAN menu_run(135135- efivar_set(136136- LOADER_GUID, L"LoaderConfigTimeout", NULL, EFI_VARIABLE_NON_VOLATILE);137137- if (config->timeout_sec_config > 0)138138-- status = PoolPrint(L"Menu timeout of %d sec is defined by configuration file.",139139-+ status = PoolPrint(L"Menu timeout of %d s is defined by configuration file.",140140- config->timeout_sec_config);141141- else142142- status = StrDuplicate(L"Menu disabled. Hold down key at bootup to show menu.");143143-@@ -813,7 +797,7 @@ static BOOLEAN menu_run(144144- config->timeout_sec_efivar,145145- EFI_VARIABLE_NON_VOLATILE);146146- if (config->timeout_sec_efivar > 0)147147-- status = PoolPrint(L"Menu timeout set to %d sec.",148148-+ status = PoolPrint(L"Menu timeout set to %d s.",149149- config->timeout_sec_efivar);150150- else151151- status = StrDuplicate(L"Menu disabled. Hold down key at bootup to show menu.");152152-@@ -2369,13 +2353,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {153153- else {154154- UINT64 key;155155-156156-- err = console_key_read(&key, FALSE);157157--158158-- if (err == EFI_NOT_READY) {159159-- uefi_call_wrapper(BS->Stall, 1, 100 * 1000);160160-- err = console_key_read(&key, FALSE);161161-- }162162--163163-+ /* Block up to 100ms to give firmware time to get input working. */164164-+ err = console_key_read(&key, 100 * 1000);165165- if (!EFI_ERROR(err)) {166166- INT16 idx;167167-168168-diff --git a/src/boot/efi/console.c b/src/boot/efi/console.c169169-index 83619d2147..369c549daf 100644170170---- a/src/boot/efi/console.c171171-+++ b/src/boot/efi/console.c172172-@@ -11,61 +11,105 @@173173-174174- #define EFI_SIMPLE_TEXT_INPUT_EX_GUID &(EFI_GUID) EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID175175-176176--EFI_STATUS console_key_read(UINT64 *key, BOOLEAN wait) {177177-+static inline void EventClosep(EFI_EVENT *event) {178178-+ if (!*event)179179-+ return;180180-+181181-+ uefi_call_wrapper(BS->CloseEvent, 1, *event);182182-+}183183-+184184-+/*185185-+ * Reading input from the console sounds like an easy task to do, but thanks to broken186186-+ * firmware it is actually a nightmare.187187-+ *188188-+ * There is a ConIn and TextInputEx API for this. Ideally we want to use TextInputEx,189189-+ * because that gives us Ctrl/Alt/Shift key state information. Unfortunately, it is not190190-+ * always available and sometimes just non-functional.191191-+ *192192-+ * On the other hand we have ConIn, where some firmware likes to just freeze on us193193-+ * if we call ReadKeyStroke on it.194194-+ *195195-+ * Therefore, we use WaitForEvent on both ConIn and TextInputEx (if available) along196196-+ * with a timer event. The timer ensures there is no need to call into functions197197-+ * that might freeze on us, while still allowing us to show a timeout counter.198198-+ */199199-+EFI_STATUS console_key_read(UINT64 *key, UINT64 timeout_usec) {200200- static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx;201201- static BOOLEAN checked;202202- UINTN index;203203- EFI_INPUT_KEY k;204204- EFI_STATUS err;205205-+ _cleanup_(EventClosep) EFI_EVENT timer = NULL;206206-+ EFI_EVENT events[3] = { ST->ConIn->WaitForKey };207207-+ UINTN n_events = 1;208208-209209- if (!checked) {210210- err = LibLocateProtocol(EFI_SIMPLE_TEXT_INPUT_EX_GUID, (VOID **)&TextInputEx);211211-- if (EFI_ERROR(err))212212-+ if (EFI_ERROR(err) ||213213-+ uefi_call_wrapper(BS->CheckEvent, 1, TextInputEx->WaitForKeyEx) == EFI_INVALID_PARAMETER)214214-+ /* If WaitForKeyEx fails here, the firmware pretends it talks this215215-+ * protocol, but it really doesn't. */216216- TextInputEx = NULL;217217-+ else218218-+ events[n_events++] = TextInputEx->WaitForKeyEx;219219-220220- checked = TRUE;221221- }222222-223223-- /* wait until key is pressed */224224-- if (wait)225225-- uefi_call_wrapper(BS->WaitForEvent, 3, 1, &ST->ConIn->WaitForKey, &index);226226-+ if (timeout_usec > 0) {227227-+ err = uefi_call_wrapper(BS->CreateEvent, 5, EVT_TIMER, 0, NULL, NULL, &timer);228228-+ if (EFI_ERROR(err))229229-+ return log_error_status_stall(err, L"Error creating timer event: %r", err);230230-+231231-+ /* SetTimer expects 100ns units for some reason. */232232-+ err = uefi_call_wrapper(BS->SetTimer, 3, timer, TimerRelative, timeout_usec * 10);233233-+ if (EFI_ERROR(err))234234-+ return log_error_status_stall(err, L"Error arming timer event: %r", err);235235-236236-- if (TextInputEx) {237237-+ events[n_events++] = timer;238238-+ }239239-+240240-+ err = uefi_call_wrapper(BS->WaitForEvent, 3, n_events, events, &index);241241-+ if (EFI_ERROR(err))242242-+ return log_error_status_stall(err, L"Error waiting for events: %r", err);243243-+244244-+ if (timeout_usec > 0 && timer == events[index])245245-+ return EFI_TIMEOUT;246246-+247247-+ /* TextInputEx might be ready too even if ConIn got to signal first. */248248-+ if (TextInputEx && !EFI_ERROR(uefi_call_wrapper(BS->CheckEvent, 1, TextInputEx->WaitForKeyEx))) {249249- EFI_KEY_DATA keydata;250250- UINT64 keypress;251251-+ UINT32 shift = 0;252252-253253- err = uefi_call_wrapper(TextInputEx->ReadKeyStrokeEx, 2, TextInputEx, &keydata);254254-- if (!EFI_ERROR(err)) {255255-- UINT32 shift = 0;256256--257257-- /* do not distinguish between left and right keys */258258-- if (keydata.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) {259259-- if (keydata.KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED|EFI_LEFT_CONTROL_PRESSED))260260-- shift |= EFI_CONTROL_PRESSED;261261-- if (keydata.KeyState.KeyShiftState & (EFI_RIGHT_ALT_PRESSED|EFI_LEFT_ALT_PRESSED))262262-- shift |= EFI_ALT_PRESSED;263263-- };264264--265265-- /* 32 bit modifier keys + 16 bit scan code + 16 bit unicode */266266-- keypress = KEYPRESS(shift, keydata.Key.ScanCode, keydata.Key.UnicodeChar);267267-- if (keypress > 0) {268268-- *key = keypress;269269-- return 0;270270-- }271271-+ if (EFI_ERROR(err))272272-+ return err;273273-+274274-+ /* do not distinguish between left and right keys */275275-+ if (keydata.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) {276276-+ if (keydata.KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED|EFI_LEFT_CONTROL_PRESSED))277277-+ shift |= EFI_CONTROL_PRESSED;278278-+ if (keydata.KeyState.KeyShiftState & (EFI_RIGHT_ALT_PRESSED|EFI_LEFT_ALT_PRESSED))279279-+ shift |= EFI_ALT_PRESSED;280280-+ };281281-+282282-+ /* 32 bit modifier keys + 16 bit scan code + 16 bit unicode */283283-+ keypress = KEYPRESS(shift, keydata.Key.ScanCode, keydata.Key.UnicodeChar);284284-+ if (keypress > 0) {285285-+ *key = keypress;286286-+ return EFI_SUCCESS;287287- }288288-+289289-+ return EFI_NOT_READY;290290- }291291-292292-- /* fallback for firmware which does not support SimpleTextInputExProtocol293293-- *294294-- * This is also called in case ReadKeyStrokeEx did not return a key, because295295-- * some broken firmwares offer SimpleTextInputExProtocol, but never actually296296-- * handle any key. */297297- err = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &k);298298- if (EFI_ERROR(err))299299- return err;300300-301301- *key = KEYPRESS(0, k.ScanCode, k.UnicodeChar);302302-- return 0;303303-+ return EFI_SUCCESS;304304- }305305-306306- static EFI_STATUS change_mode(UINTN mode) {307307-diff --git a/src/boot/efi/console.h b/src/boot/efi/console.h308308-index 2c69af552a..23848a9c58 100644309309---- a/src/boot/efi/console.h310310-+++ b/src/boot/efi/console.h311311-@@ -16,5 +16,5 @@ enum console_mode_change_type {312312- CONSOLE_MODE_MAX,313313- };314314-315315--EFI_STATUS console_key_read(UINT64 *key, BOOLEAN wait);316316-+EFI_STATUS console_key_read(UINT64 *key, UINT64 timeout_usec);317317- EFI_STATUS console_set_mode(UINTN *mode, enum console_mode_change_type how);318318--- 319319-2.33.0320320-
+3-16
pkgs/os-specific/linux/systemd/default.nix
···123123assert withCryptsetup -> (cryptsetup != null);124124let125125 wantCurl = withRemote || withImportd;126126- version = "249.5";126126+ version = "249.7";127127in128128stdenv.mkDerivation {129129 inherit pname version;···134134 owner = "systemd";135135 repo = "systemd-stable";136136 rev = "v${version}";137137- sha256 = "0bir2syy20rdi59sv8xp8nw1c92zl9z0wmv7ggsll8dca7niqwbp";137137+ sha256 = "sha256-y33/BvvI+JyhsvuT1Cbm6J2Z72j71oXgLw6X9NwCMPE=";138138 };139139140140 # If these need to be regenerated, `git am path/to/00*.patch` them into a···166166 # systemd. With the below patch we mitigate that effect by special casing167167 # all our root unit dirs if they are symlinks. This does exactly what we168168 # need (AFAICT).169169+ # See https://github.com/systemd/systemd/pull/20479 for upsteam discussion.169170 ./0019-core-handle-lookup-paths-being-symlinks.patch170170-171171- # In v248 compiler weirdness and refactoring lead to the bootloader172172- # erroring out handling keyboard input on some systems. See173173- # https://github.com/systemd/systemd/issues/19191174174- # This should be redundant in v249.6 when it offically gets tagged in175175- # systemd-stable176176- ./0020-sd-boot-Unify-error-handling.patch177177- ./0021-sd-boot-Rework-console-input-handling.patch178171 ] ++ lib.optional stdenv.hostPlatform.isMusl (let179172 oe-core = fetchzip {180173 url = "https://git.openembedded.org/openembedded-core/snapshot/openembedded-core-14c6e5a4b72d0e4665279158a0740dd1dc21f72f.tar.bz2";···577584 '';578585579586 postInstall = ''580580- # sysinit.target: Don't depend on581581- # systemd-tmpfiles-setup.service. This interferes with NixOps's582582- # send-keys feature (since sshd.service depends indirectly on583583- # sysinit.target).584584- mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/585585-586587 mkdir -p $out/example/systemd587588 mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example588589 mv $out/lib/systemd/{system,user} $out/example/systemd
+2-14
pkgs/os-specific/linux/util-linux/default.nix
···11{ lib, stdenv, fetchurl, pkg-config, zlib, shadow, libcap_ng22, ncurses ? null, pam, systemd ? null33, nlsSupport ? true44-, audit ? null54}:66-77-assert stdenv.hostPlatform.isStatic -> audit != null;8596stdenv.mkDerivation rec {107 pname = "util-linux";···1720 ];18211922 outputs = [ "bin" "dev" "out" "lib" "man" ];2323+ separateDebugInfo = true;20242125 postPatch = ''2226 patchShebangs tests/run.sh···5860 nativeBuildInputs = [ pkg-config ];5961 buildInputs =6062 [ zlib pam libcap_ng ]6161- ++ lib.filter (p: p != null) [ ncurses systemd ]6262- # not sure how util-linux is linking with linux-pam,6363- # probably just with a simplistic -lpam.6464- # linux-pam doesn't seem to have a .pc file so I can't6565- # add -laudit to the Requires.private.6666- # libaudit is also needed directly anyway cf login-utils/login.c6767- # and sys-utils/hwclock.c, not sure how we got it working6868- # without audit on dynamic builds.6969- ++ lib.optionals stdenv.hostPlatform.isStatic [ audit ];7070-7171- NIX_CFLAGS_LINK = lib.optionalString stdenv.hostPlatform.isStatic "-laudit";6363+ ++ lib.filter (p: p != null) [ ncurses systemd ];72647365 doCheck = false; # "For development purpose only. Don't execute on production system!"7466
···3333 ./fix-chmod-exit-code.patch3434 # Workaround for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=514333535 ./disable-seek-hole.patch3636+ # Workaround for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=523303737+ # This patch can be dropped, once we upgrade to the next coreutils version after 9.03838+ ./fix-arm64-macos.patch3639 ];37403841 postPatch = ''
+124
pkgs/tools/misc/coreutils/fix-arm64-macos.patch
···11+diff --git a/src/uname.c b/src/uname.c22+index ae9b8e29d..e84fc477a 10064433+--- a/src/uname.c44++++ b/src/uname.c55+@@ -27,7 +27,7 @@66+ # include <sys/systeminfo.h>77+ #endif88+99+-#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__1010++#if HAVE_SYS_SYSCTL_H && ! defined __GLIBC__ && ! defined __APPLE__1111+ # if HAVE_SYS_PARAM_H1212+ # include <sys/param.h> /* needed for OpenBSD 3.0 */1313+ # endif1414+@@ -44,11 +44,6 @@1515+ # endif1616+ #endif1717+1818+-#ifdef __APPLE__1919+-# include <mach/machine.h>2020+-# include <mach-o/arch.h>2121+-#endif2222+-2323+ #include "system.h"2424+ #include "die.h"2525+ #include "error.h"2626+@@ -167,6 +162,24 @@ print_element (char const *element)2727+ fputs (element, stdout);2828+ }2929+3030++/* Print ELEMENT, preceded by a space if something has already been3131++ printed. But if the environment variable ENVVAR is set, print its3232++ value instead of ELEMENT. */3333++3434++static void3535++print_element_env (char const *element, char const *envvar)3636++{3737++#ifdef __APPLE__3838++ if (envvar)3939++ {4040++ char const *val = getenv (envvar);4141++ if (val)4242++ element = val;4343++ }4444++#endif4545++ print_element (element);4646++}4747++4848+4949+ /* Set all the option flags according to the switches specified.5050+ Return the mask indicating which elements to print. */5151+@@ -287,26 +300,36 @@ main (int argc, char **argv)5252+ die (EXIT_FAILURE, errno, _("cannot get system name"));5353+5454+ if (toprint & PRINT_KERNEL_NAME)5555+- print_element (name.sysname);5656++ print_element_env (name.sysname, "UNAME_SYSNAME");5757+ if (toprint & PRINT_NODENAME)5858+- print_element (name.nodename);5959++ print_element_env (name.nodename, "UNAME_NODENAME");6060+ if (toprint & PRINT_KERNEL_RELEASE)6161+- print_element (name.release);6262++ print_element_env (name.release, "UNAME_RELEASE");6363+ if (toprint & PRINT_KERNEL_VERSION)6464+- print_element (name.version);6565++ print_element_env (name.version, "UNAME_VERSION");6666+ if (toprint & PRINT_MACHINE)6767+- print_element (name.machine);6868++ print_element_env (name.machine, "UNAME_MACHINE");6969+ }7070+7171+ if (toprint & PRINT_PROCESSOR)7272+ {7373+ char const *element = unknown;7474++#ifdef __APPLE__7575++# if defined __arm__ || defined __arm64__7676++ element = "arm";7777++# elif defined __i386__ || defined __x86_64__7878++ element = "i386";7979++# elif defined __ppc__ || defined __ppc64__8080++ element = "powerpc";8181++# endif8282++#endif8383+ #if HAVE_SYSINFO && defined SI_ARCHITECTURE8484+- {8585+- static char processor[257];8686+- if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))8787+- element = processor;8888+- }8989++ if (element == unknown)9090++ {9191++ static char processor[257];9292++ if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))9393++ element = processor;9494++ }9595+ #endif9696+ #ifdef UNAME_PROCESSOR9797+ if (element == unknown)9898+@@ -316,26 +339,6 @@ main (int argc, char **argv)9999+ static int mib[] = { CTL_HW, UNAME_PROCESSOR };100100+ if (sysctl (mib, 2, processor, &s, 0, 0) >= 0)101101+ element = processor;102102+-103103+-# ifdef __APPLE__104104+- /* This kludge works around a bug in Mac OS X. */105105+- if (element == unknown)106106+- {107107+- cpu_type_t cputype;108108+- size_t cs = sizeof cputype;109109+- NXArchInfo const *ai;110110+- if (sysctlbyname ("hw.cputype", &cputype, &cs, NULL, 0) == 0111111+- && (ai = NXGetArchInfoFromCpuType (cputype,112112+- CPU_SUBTYPE_MULTIPLE))113113+- != NULL)114114+- element = ai->name;115115+-116116+- /* Hack "safely" around the ppc vs. powerpc return value. */117117+- if (cputype == CPU_TYPE_POWERPC118118+- && STRNCMP_LIT (element, "ppc") == 0)119119+- element = "powerpc";120120+- }121121+-# endif122122+ }123123+ #endif124124+ if (! (toprint == UINT_MAX && element == unknown))