From 6a2195c3a5ff2cfb1e5ec0792976cdb609ddb022 Mon Sep 17 00:00:00 2001 From: Brandon Dimcheff Date: Sun, 21 Dec 2014 20:33:51 -0500 Subject: [PATCH 1/2] Fix compiled-in /bin/bash in foomatic filters Foomatic filters contained a 64-char c string hardcoded to /bin/bash. This caused some filters (at least pdftops) to fail. I also had to increase the size of the string because nix paths are too long. --- pkgs/misc/cups/filters.nix | 9 ++++++++- pkgs/misc/cups/longer-shell-path.patch | 13 +++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 pkgs/misc/cups/longer-shell-path.patch diff --git a/pkgs/misc/cups/filters.nix b/pkgs/misc/cups/filters.nix index 8a0406203aeb..18723779527f 100644 --- a/pkgs/misc/cups/filters.nix +++ b/pkgs/misc/cups/filters.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, pkgconfig, cups, poppler, fontconfig -, libjpeg, libpng, perl, ijs, qpdf, dbus }: +, libjpeg, libpng, perl, ijs, qpdf, dbus, bash }: stdenv.mkDerivation rec { name = "cups-filters-${version}"; @@ -34,6 +34,13 @@ stdenv.mkDerivation rec { substituteInPlace filter/gstoraster.c --replace execve execvpe ''; + patches = [ ./longer-shell-path.patch ]; + + postPatch = + '' + substituteInPlace filter/foomatic-rip/foomaticrip.c --replace "/bin/bash" "${bash}/bin/bash" + ''; + postInstall = '' for i in $out/lib/cups/filter/{pstopdf,texttops,imagetops}; do diff --git a/pkgs/misc/cups/longer-shell-path.patch b/pkgs/misc/cups/longer-shell-path.patch new file mode 100644 index 000000000000..351bcc0b4096 --- /dev/null +++ b/pkgs/misc/cups/longer-shell-path.patch @@ -0,0 +1,13 @@ +diff --git a/filter/foomatic-rip/foomaticrip.c b/filter/foomatic-rip/foomaticrip.c +index 1c019aa..431d2f9 100644 +--- a/filter/foomatic-rip/foomaticrip.c ++++ b/filter/foomatic-rip/foomaticrip.c +@@ -174,7 +174,7 @@ char cupsfilterpath[PATH_MAX] = "/usr/local/lib/cups/filter:" + "/opt/cups/filter:" + "/usr/lib/cups/filter"; + +-char modern_shell[64] = "/bin/bash"; ++char modern_shell[128] = "/bin/bash"; + + void config_set_option(const char *key, const char *value) + { From 139d7f6e1a3aafd79897e0c3997913d412b31308 Mon Sep 17 00:00:00 2001 From: Brandon Dimcheff Date: Tue, 23 Dec 2014 11:53:58 -0500 Subject: [PATCH 2/2] squish cups patches all into one statement --- pkgs/misc/cups/filters.nix | 14 +++++++------- pkgs/misc/cups/longer-shell-path.patch | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/misc/cups/filters.nix b/pkgs/misc/cups/filters.nix index 18723779527f..524662a0ee6c 100644 --- a/pkgs/misc/cups/filters.nix +++ b/pkgs/misc/cups/filters.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, pkgconfig, cups, poppler, fontconfig -, libjpeg, libpng, perl, ijs, qpdf, dbus, bash }: +, libjpeg, libpng, perl, ijs, qpdf, dbus, substituteAll, bash }: stdenv.mkDerivation rec { name = "cups-filters-${version}"; @@ -34,12 +34,12 @@ stdenv.mkDerivation rec { substituteInPlace filter/gstoraster.c --replace execve execvpe ''; - patches = [ ./longer-shell-path.patch ]; - - postPatch = - '' - substituteInPlace filter/foomatic-rip/foomaticrip.c --replace "/bin/bash" "${bash}/bin/bash" - ''; + patches = [ + (substituteAll { + src = ./longer-shell-path.patch; + bash = "${bash}/bin/bash"; + }) + ]; postInstall = '' diff --git a/pkgs/misc/cups/longer-shell-path.patch b/pkgs/misc/cups/longer-shell-path.patch index 351bcc0b4096..a15fd4832258 100644 --- a/pkgs/misc/cups/longer-shell-path.patch +++ b/pkgs/misc/cups/longer-shell-path.patch @@ -7,7 +7,7 @@ index 1c019aa..431d2f9 100644 "/usr/lib/cups/filter"; -char modern_shell[64] = "/bin/bash"; -+char modern_shell[128] = "/bin/bash"; ++char modern_shell[128] = "@bash@"; void config_set_option(const char *key, const char *value) {