Skip to content

Commit

Permalink
mpack: fix gcc-14 and add Debian patches (#369796)
Browse files Browse the repository at this point in the history
  • Loading branch information
zowoq authored Jan 12, 2025
2 parents aa24b58 + 78cc36a commit b621926
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 65 deletions.
23 changes: 0 additions & 23 deletions pkgs/by-name/mp/mpack/CVE-2011-4919.patch

This file was deleted.

29 changes: 0 additions & 29 deletions pkgs/by-name/mp/mpack/build-fix.patch

This file was deleted.

69 changes: 56 additions & 13 deletions pkgs/by-name/mp/mpack/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
lib,
stdenv,
fetchurl,
fetchpatch,
autoreconfHook,
testers,
mpack,
}:
Expand All @@ -15,23 +17,64 @@ stdenv.mkDerivation rec {
hash = "sha256-J0EIuzo5mCpO/BT7OmUpjmbI5xNnw9q/STOBYtIHqUw=";
};

patches = [
./build-fix.patch
./sendmail-via-execvp.diff
./CVE-2011-4919.patch
];
patches =
let
# https://salsa.debian.org/debian/mpack/-/tree/7d6514b314a7341614ec8275b03acfcb6a854a6f/debian/patches
fetchDebPatch =
{ name, hash }:
fetchpatch {
inherit name hash;
url = "https://salsa.debian.org/debian/mpack/-/raw/7d6514b314a7341614ec8275b03acfcb6a854a6f/debian/patches/${name}";
};
in
[
./sendmail-via-execvp.diff
]
++ (map fetchDebPatch [
{
name = "01_legacy.patch";
hash = "sha256-v2pZUXecgxJqoHadBhpAAoferQNSeYE+m7qzEiggeO4=";
}
{
name = "02_fix-permissions.patch";
hash = "sha256-sltnIqgv7+pwwSFQRCDeCwnjoo2OrvmGFm+SM9U/HB4=";
}
{
name = "03_specify-filename-replacement-character.patch";
hash = "sha256-vmLIGFSqKK/qSsltzhdLQGoekew3r25EwAu56umeXlU=";
}
{
name = "04_fix-return-error-code.patch";
hash = "sha256-l23D6xhkgtkEsErzUy/q6U3aPf5N7YUw2PEToU1YXKI=";
}
{
name = "06_fix-makefile.patch";
hash = "sha256-69plDqy2sLzO1O4mqjJIlTRCw5ZeVySiqwo93ZkX3Ho=";
}
{
name = "07_fix-decode-base64-attachment.patch";
hash = "sha256-hzSCrEg0j6dJNLbfwRNn+rWGRnyUBLjJUlORJS9aDD4=";
}
{
name = "08_fix-mime-version.patch";
hash = "sha256-l2rBqbyKmnz5tEPeuX6HCqw7rSV8pDb7ijpCHsdh57g=";
}
{
name = "09_remove-debugging-message.patch";
hash = "sha256-dtq6BHgH4ciho0+TNW/rU3KWoeKs/1jwJafnHTr9ebI=";
}
]);

postPatch = ''
for f in *.{c,man,pl,unix} ; do
substituteInPlace $f --replace /usr/tmp /tmp
done
# this just shuts up some warnings
for f in {decode,encode,part,unixos,unixpk,unixunpk,xmalloc}.c ; do
sed -i 'i#include <stdlib.h>' $f
done
substituteInPlace *.{c,man,pl,unix} --replace-quiet /usr/tmp /tmp
# silence a buffer overflow warning
substituteInPlace uudecode.c \
--replace-fail "char buf[1024], buf2[1024];" "char buf[1024], buf2[1066];"
'';

nativeBuildInputs = [ autoreconfHook ];

postInstall = ''
install -Dm644 -t $out/share/doc/mpack INSTALL README.*
'';
Expand Down

0 comments on commit b621926

Please sign in to comment.