about summary refs log tree commit diff
path: root/pkgs/misc/drivers/hplip
diff options
context:
space:
mode:
authorYarny0 <41838844+Yarny0@users.noreply.github.com>2019-06-30 15:15:28 +0200
committerYarny0 <41838844+Yarny0@users.noreply.github.com>2019-07-14 10:15:06 +0200
commit60311e09576528982582bf9cf1eb86c109a72387 (patch)
treeaca76a3bc00d8fcfd1d1d6085e8ac76ba6eeac17 /pkgs/misc/drivers/hplip
parent15aacfb45077d572fd3999ab00a6fe630af2cae7 (diff)
downloadnixlib-60311e09576528982582bf9cf1eb86c109a72387.tar
nixlib-60311e09576528982582bf9cf1eb86c109a72387.tar.gz
nixlib-60311e09576528982582bf9cf1eb86c109a72387.tar.bz2
nixlib-60311e09576528982582bf9cf1eb86c109a72387.tar.lz
nixlib-60311e09576528982582bf9cf1eb86c109a72387.tar.xz
nixlib-60311e09576528982582bf9cf1eb86c109a72387.tar.zst
nixlib-60311e09576528982582bf9cf1eb86c109a72387.zip
hplip: patch imageProcessor segfault in `hpcups` (#58949)
Beginning with version 3.18.7, `hpcups` fails with
> DEBUG: imageProcessorStartPage failed
and segfaults (tested with HP LaserJet 1000 printer).

Upstream bug reports:
* https://bugs.launchpad.net/hplip/+bug/1788706
* https://bugs.launchpad.net/hplip/+bug/1787289

There is a patch available in one of the reports:
https://bugs.launchpad.net/hplip/+bug/1787289/+attachment/5176026/+files/hplip.patch
It applies to 3.18.7, but not to later versions.

This commit adds a slight adaption of
the patch that applies to versions 3.18.9 -- 3.19.6.
The patch fixes https://github.com/NixOS/nixpkgs/issues/58949 .

Note that the patch is merely a workaround:
It simply removes all calls into the
ImageProcessor library from `HPCupsFilter.cpp`.
Diffstat (limited to 'pkgs/misc/drivers/hplip')
-rw-r--r--pkgs/misc/drivers/hplip/default.nix7
-rw-r--r--pkgs/misc/drivers/hplip/image-processor.patch62
2 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix
index 1726e8ea421d..eced20902c61 100644
--- a/pkgs/misc/drivers/hplip/default.nix
+++ b/pkgs/misc/drivers/hplip/default.nix
@@ -82,6 +82,13 @@ pythonPackages.buildPythonApplication {
 
   makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
 
+  patches = [
+    # remove ImageProcessor usage, it causes segfaults, see
+    # https://bugs.launchpad.net/hplip/+bug/1788706
+    # https://bugs.launchpad.net/hplip/+bug/1787289
+    ./image-processor.patch
+  ];
+
   prePatch = ''
     # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
     find . -type f -exec sed -i \
diff --git a/pkgs/misc/drivers/hplip/image-processor.patch b/pkgs/misc/drivers/hplip/image-processor.patch
new file mode 100644
index 000000000000..ef1040ba08bb
--- /dev/null
+++ b/pkgs/misc/drivers/hplip/image-processor.patch
@@ -0,0 +1,62 @@
+diff --git i/prnt/hpcups/HPCupsFilter.cpp w/prnt/hpcups/HPCupsFilter.cpp
+index 5b282d8..153ee3a 100644
+--- i/prnt/hpcups/HPCupsFilter.cpp
++++ w/prnt/hpcups/HPCupsFilter.cpp
+@@ -31,7 +31,6 @@
+ \*****************************************************************************/
+ 
+ #include "HPCupsFilter.h"
+-#include "ImageProcessor.h"
+ 
+ #include <signal.h>
+ #include <sys/wait.h>
+@@ -637,16 +636,10 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ 
+ 
+     sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name);
+-    image_processor_t* imageProcessor = imageProcessorCreate();
+ 
+     while (cupsRasterReadHeader2(cups_raster, &cups_header))
+     {
+ 
+-        IMAGE_PROCESSOR_ERROR result = imageProcessorStartPage(imageProcessor, &cups_header);
+-        if (result != IPE_SUCCESS){
+-            dbglog("DEBUG: imageProcessorStartPage failed result = %d\n", result);
+-        }
+-
+         current_page_number++;
+ 
+         if (current_page_number == 1) {
+@@ -745,11 +738,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+             color_raster = rgbRaster;
+             black_raster = kRaster;
+ 
+-            result = imageProcessorProcessLine(imageProcessor, m_pPrinterBuffer, cups_header.cupsBytesPerLine);
+-            if (result != IPE_SUCCESS){
+-                dbglog("DEBUG: imageProcessorProcessLine failed result = %d\n", result);
+-            }
+-
+ 
+             if ((y == 0) && !is_ljmono) {
+                 //For ljmono, make sure that first line is not a blankRaster line.Otherwise printer
+@@ -780,11 +768,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+             }
+         }  // for() loop end
+ 
+-        result = imageProcessorEndPage(imageProcessor);
+-        if (result != IPE_SUCCESS){
+-                dbglog("DEBUG: imageProcessorEndPage failed result = %d\n", result);
+-        }
+-
+ 
+         m_Job.NewPage();
+         if (err != NO_ERROR) {
+@@ -800,8 +783,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+         rgbRaster = NULL;
+     }
+ 
+-    imageProcessorDestroy(imageProcessor);
+-
+     unlink(hpPreProcessedRasterFile);
+     return ret_status;
+ }