Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 gettext, 7 coreutils, 8 updateAutotoolsGnuConfigScriptsHook, 9}: 10 11stdenv.mkDerivation rec { 12 pname = "sharutils"; 13 version = "4.15.2"; 14 15 src = fetchurl { 16 url = "mirror://gnu/sharutils/sharutils-${version}.tar.xz"; 17 sha256 = "16isapn8f39lnffc3dp4dan05b7x6mnc76v6q5nn8ysxvvvwy19b"; 18 }; 19 20 hardeningDisable = [ "format" ]; 21 22 # GNU Gettext is needed on non-GNU platforms. 23 buildInputs = [ 24 coreutils 25 gettext 26 ]; 27 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; 28 29 # These tests try to hit /etc/passwd to find out your username if pass in a submitter 30 # name on the command line. Since we block access to /etc/passwd on the Darwin sandbox 31 # that cause shar to just segfault. It isn't a problem on Linux because their sandbox 32 # remaps /etc/passwd to a trivial file, but we can't do that on Darwin so I do this 33 # instead. In this case, I pass in the very imaginative "submitter" as the submitter name 34 35 patches = [ 36 # CVE-2018-1000097 37 (fetchurl { 38 url = "https://sources.debian.org/data/main/s/sharutils/1:4.15.2-2+deb9u1/debian/patches/01-fix-heap-buffer-overflow-cve-2018-1000097.patch"; 39 sha256 = "19g0sxc8g79aj5gd5idz5409311253jf2q8wqkasf0handdvsbxx"; 40 }) 41 (fetchurl { 42 url = "https://sources.debian.org/data/main/s/sharutils/1:4.15.2-4/debian/patches/02-fix-ftbfs-with-glibc-2.28.patch"; 43 sha256 = "15kpjqnfs98n6irmkh8pw7masr08xala7gx024agv7zv14722vkc"; 44 }) 45 46 # pending upstream build fix against -fno-common compilers like >=gcc-10 47 # Taken from https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/msg00002.html 48 (fetchpatch { 49 name = "sharutils-4.15.2-Fix-building-with-GCC-10.patch"; 50 url = "https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/txtDL8i6V6mUU.txt"; 51 sha256 = "0kfch1vm45lg237hr6fdv4b2lh5b1933k0fn8yj91gqm58svskvl"; 52 }) 53 (fetchpatch { 54 name = "sharutils-4.15.2-Do-not-include-lib-md5.c-into-src-shar.c.patch"; 55 url = "https://lists.gnu.org/archive/html/bug-gnu-utils/2020-01/txt5Z_KZup0yN.txt"; 56 sha256 = "0an8vfy3qj6sss9w0i4j8ilf7g5mbc7y13l644jy5bcm9przcjbd"; 57 }) 58 ]; 59 60 postPatch = 61 let 62 # This evaluates to a string containing: 63 # 64 # substituteInPlace tests/shar-2 --replace '${SHAR}' '${SHAR} -s submitter' 65 # substituteInPlace tests/shar-2 --replace '${SHAR}' '${SHAR} -s submitter' 66 shar_sub = "\${SHAR}"; 67 in 68 '' 69 substituteInPlace tests/shar-1 --replace '${shar_sub}' '${shar_sub} -s submitter' 70 substituteInPlace tests/shar-2 --replace '${shar_sub}' '${shar_sub} -s submitter' 71 72 substituteInPlace intl/Makefile.in --replace "AR = ar" "" 73 ''; 74 75 # Workaround to fix the static build on macOS. 76 env.NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration"; 77 78 doCheck = true; 79 80 meta = with lib; { 81 description = "Tools for remote synchronization and `shell archives'"; 82 longDescription = '' 83 GNU shar makes so-called shell archives out of many files, preparing 84 them for transmission by electronic mail services. A shell archive 85 is a collection of files that can be unpacked by /bin/sh. A wide 86 range of features provide extensive flexibility in manufacturing 87 shars and in specifying shar smartness. For example, shar may 88 compress files, uuencode binary files, split long files and 89 construct multi-part mailings, ensure correct unsharing order, and 90 provide simplistic checksums. 91 92 GNU unshar scans a set of mail messages looking for the start of 93 shell archives. It will automatically strip off the mail headers 94 and other introductory text. The archive bodies are then unpacked 95 by a copy of the shell. unshar may also process files containing 96 concatenated shell archives. 97 ''; 98 homepage = "https://www.gnu.org/software/sharutils/"; 99 license = licenses.gpl3Plus; 100 maintainers = [ ]; 101 platforms = platforms.all; 102 }; 103}