diff --git a/pkgs/tools/misc/parallel/default.nix b/pkgs/tools/misc/parallel/default.nix index e99f2aa12d5f..2f3ca5afd5a4 100644 --- a/pkgs/tools/misc/parallel/default.nix +++ b/pkgs/tools/misc/parallel/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv, perl, makeWrapper, procps }: +{ fetchurl, stdenv, perl, makeWrapper, procps, coreutils }: stdenv.mkDerivation rec { name = "parallel-20200822"; @@ -8,6 +8,14 @@ stdenv.mkDerivation rec { sha256 = "02dy46g6f05p7s2qs8h6yg20p1zl3flxxf77n5jw74l3h1m24m4n"; }; + patches = [ + ./fix-max-line-length-allowed.diff + ]; + + postPatch = '' + substituteInPlace src/parallel --subst-var-by coreutils ${coreutils} + ''; + outputs = [ "out" "man" ]; nativeBuildInputs = [ makeWrapper ]; diff --git a/pkgs/tools/misc/parallel/fix-max-line-length-allowed.diff b/pkgs/tools/misc/parallel/fix-max-line-length-allowed.diff new file mode 100644 index 000000000000..c6d501ecb22a --- /dev/null +++ b/pkgs/tools/misc/parallel/fix-max-line-length-allowed.diff @@ -0,0 +1,17 @@ +Correct path to coreutils echo to fix parallel --max-line-length-allowed. + +Author: Bjørn Forsman + +diff --git a/src/parallel b/src/parallel +index a047fd94..9fc5f671 100755 +--- a/src/parallel ++++ b/src/parallel +@@ -11580,7 +11580,7 @@ sub is_acceptable_command_line_length($$) { + $len += length $Global::parallel_env; + } + # Force using non-built-in command +- ::qqx("/bin/echo ".${string}x(($len-length "/bin/echo ")/length $string)); ++ ::qqx("@coreutils@/bin/echo ".${string}x(($len-length "@coreutils@/bin/echo ")/length $string)); + ::debug("init", "$len=$? "); + return not $?; + }