1 { lib, stdenv, buildPackages, fetchurl, fetchpatch, pkg-config, libuuid, gettext, texinfo
3 , shared ? !stdenv.hostPlatform.isStatic
4 , e2fsprogs, runCommand
7 stdenv.mkDerivation rec {
12 url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
13 sha256 = "1fgvwbj9ihz5svzrd2l0s18k16r4qg3wimrniv71fn3vdcg0shxp";
16 # fuse2fs adds 14mb of dependencies
17 outputs = [ "bin" "dev" "out" "man" "info" ]
18 ++ lib.optionals stdenv.isLinux [ "fuse2fs" ];
20 depsBuildBuild = [ buildPackages.stdenv.cc ];
21 nativeBuildInputs = [ pkg-config texinfo ];
22 buildInputs = [ libuuid gettext ]
23 ++ lib.optionals stdenv.isLinux [ fuse ];
27 name = "CVE-2022-1304.patch";
28 url = "https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/patch/?id=ab51d587bb9b229b1fade1afd02e1574c1ba5c76";
29 sha256 = "sha256-YEEow34/81NBOc6F6FS6i505FCQ7GHeIz0a0qWNs7Fg=";
31 (fetchpatch { # avoid using missing __GNUC_PREREQ(X,Y)
32 url = "https://raw.githubusercontent.com/void-linux/void-packages/9583597eb3e6e6b33f61dbc615d511ce030bc443/srcpkgs/e2fsprogs/patches/fix-glibcism.patch";
33 sha256 = "1gfcsr0i3q8q2f0lqza8na0iy4l4p3cbii51ds6zmj0y4hz2dwhb";
34 excludes = [ "lib/ext2fs/hashmap.h" ];
40 # Remove six failing tests
41 # https://github.com/NixOS/nixpkgs/issues/65471
42 for test in m_image_mmp m_mmp m_mmp_bad_csum m_mmp_bad_magic t_mmp_1on t_mmp_2off; do
48 if stdenv.isLinux then [
49 # It seems that the e2fsprogs is one of the few packages that cannot be
50 # build with shared and static libs.
51 (if shared then "--enable-elf-shlibs" else "--disable-elf-shlibs")
52 "--enable-symlink-install"
53 "--enable-relative-symlinks"
55 # fsck, libblkid, libuuid and uuidd are in util-linux-ng (the "libuuid" dependency)
61 "--enable-libuuid --disable-e2initrd-helper"
64 checkInputs = [ buildPackages.perl ];
68 # avoid cycle between outputs
69 if [ -f $out/lib/${pname}/e2scrub_all_cron ]; then
70 mv $out/lib/${pname}/e2scrub_all_cron $bin/bin/
72 '' + lib.optionalString stdenv.isLinux ''
74 mv $bin/bin/fuse2fs $fuse2fs/bin/fuse2fs
77 enableParallelBuilding = true;
80 simple-filesystem = runCommand "e2fsprogs-create-fs" {} ''
82 truncate -s10M $out/disc
83 ${e2fsprogs}/bin/mkfs.ext4 $out/disc | tee $out/success
84 ${e2fsprogs}/bin/e2fsck -n $out/disc | tee $out/success
89 homepage = "http://e2fsprogs.sourceforge.net/";
90 changelog = "http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#${version}";
91 description = "Tools for creating and checking ext2/ext3/ext4 filesystems";
92 license = with licenses; [
94 lgpl2Plus # lib/ext2fs, lib/e2p
98 platforms = platforms.unix;
99 maintainers = [ maintainers.eelco ];