unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64741: CUPS: fix the PATH settings for filters
@ 2023-07-20  8:32 Emmanuel Beffara
  2023-07-20 21:28 ` Maxim Cournoyer
  0 siblings, 1 reply; 2+ messages in thread
From: Emmanuel Beffara @ 2023-07-20  8:32 UTC (permalink / raw)
  To: 64741

[-- Attachment #1: Type: text/plain, Size: 4493 bytes --]

Hello,

I would like to propose the attached patch for the `cups-filters` package. The
point is to add the paths for `coreutils` and `sed` to the PATH setting in the
wrapper scripts so that the filters can find them. Maybe other packages should
be added, at least this patch fixes the issue I was facing.

About my specific case: I want to use the printing service of my university,
an instance of PaperCut. This is as simple as setting an LPD queue at the
right address with the PPD printer driver provided by the university (a Ricoh
IM C5500 PS in my case, if that makes any difference). After switching to Guix
system a few months ago, this stopped working: print jobs were sent with no
error message but they all appeared as 1 page in PaperCut and nothing actually
came out of the printers. I finally took the time to explore the logs and it
appears that CUPS at some point calls `foomatic-rip` and that this filter
fails, as shown in these extracts from `/var/log/cups/error_log`:

```
I [18/Jul/2023:16:34:10 +0200] [Job 12] Started filter /gnu/store/nhjpc32034v6186v37l51j0z2jq8xlkm-cups-server-bin/lib/cups/filter/foomatic-rip (PID 27451)
[...]
D [18/Jul/2023:16:34:21 +0200] [Job 12] Starting process \"renderer\" (generation 2)                                                                                                                                                    
D [18/Jul/2023:16:34:21 +0200] [Job 12] JCL: \033%-12345X@PJL                                                                                                                                                                           
D [18/Jul/2023:16:34:21 +0200] [Job 12] <job data>                                                                                                                                                                                      
D [18/Jul/2023:16:34:21 +0200] [Job 12] /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: line 5: date: command not found                                                                                       
D [18/Jul/2023:16:34:21 +0200] [Job 12] /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: line 5: sed: command not found                                                                                        
D [18/Jul/2023:16:34:21 +0200] [Job 12] /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: line 5: date: command not found                                                                                       
D [18/Jul/2023:16:34:21 +0200] [Job 12] /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: line 5: sed: command not found                                                                                        
D [18/Jul/2023:16:34:21 +0200] [Job 12] /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash: line 5: cat: command not found                                                                                        
D [18/Jul/2023:16:34:21 +0200] [Job 12] renderer exited with status 127                                                                                                                                                                 
D [18/Jul/2023:16:34:21 +0200] [Job 12] Process is dying with \"Encountered error Broken pipe during fwrite\", exit stat 1                                                                                                              
[...]
D [18/Jul/2023:16:34:21 +0200] [Job 12] PID 27451 (/gnu/store/nhjpc32034v6186v37l51j0z2jq8xlkm-cups-server-bin/lib/cups/filter/foomatic-rip) stopped with status 1.                                                                     
```

So `foomatic-rip` actually needs `date`, `sed` and `cat` but does not find
them. The issue with required tools is known in Guix because the package
definition for `cups-filters` already adds paths for `ghostscript-with-cups`
and `grep`. The patch just adds necessary inputs for those, and it makes
printing work for me. I don't know what other tools the filters might require
in other situations.

On a different level, I am surprised that the failure above does not lead to
an actual user-visible error by CUPS. A corrupted job is actually sent
silently (probably with some error messages mixed with the printing job or
with malformed printing commands) although the filter does return an error
code. Maybe this should be sent upstream as a CUPS bug?

-- 
Emmanuel

[-- Attachment #2: cups-filters.patch --]
[-- Type: text/plain, Size: 1401 bytes --]

diff --git a/gnu/packages/cups.scm b/gnu/packages/cups.scm
index 9d81a0aa07..301fdcdb35 100644
--- a/gnu/packages/cups.scm
+++ b/gnu/packages/cups.scm
@@ -198,9 +198,11 @@ (define-public cups-filters
                       (wrap-program file
                         `("PATH" ":" prefix
                           (,(string-append
+                             #$(this-package-input "coreutils") "/bin:"
                              #$(this-package-input "ghostscript-with-cups")
                              "/bin:"
-                             #$(this-package-input "grep") "/bin")))))
+                             #$(this-package-input "grep") "/bin:"
+                             #$(this-package-input "sed") "/bin")))))
                     (find-files (string-append #$output
                                                "/lib/cups/filter"))))))))
     (native-inputs
@@ -208,6 +210,7 @@ (define-public cups-filters
            pkg-config))
     (inputs
      (list avahi
+           coreutils
            fontconfig
            freetype
            font-dejavu                  ; also needed by test suite
@@ -222,6 +225,7 @@ (define-public cups-filters
            glib
            qpdf
            poppler
+           sed
            cups-minimal))
     (home-page "https://wiki.linuxfoundation.org/openprinting/cups-filters")
     (synopsis "OpenPrinting CUPS filters and backends")

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-20 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20  8:32 bug#64741: CUPS: fix the PATH settings for filters Emmanuel Beffara
2023-07-20 21:28 ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).