On Mon, 26 Jan 2015 18:34:44 +0000, Martín Ferrari writes:
>Following with strace, I see that foomatic-rip is incorrectly executing
>commands in the shell:
>
>[pid 13859] execve("/bin/bash", ["/bin/bash", "-c", "mpage -o -1 -b Letter -H
>-h Documentation for the Lexmark X792 Foomatic/Postscript -m36l36b36t36r -f -P-
>-"], [/* 38 vars */]) = 0

this can be fixed by changing just one line in fileconverters.c;
if the @@JOBTITLE@@ placeholder is prefixed by '\"' (and only prefixed),
then the argument prep logic wraps it suitably. (it's still a
pretty ugly mess, what with unnecessary detours via a shell but
that's a separate story.)

the attached patch makes that change, and a quick check with strace confirms
that a2ps is now called correctly:

25389 execve("/bin/bash", ["/bin/bash", "-c", "a2ps -1 --medium=A4dj 
--center-title=\"Documentation for the Ricoh SP C250DN PS\" -o -"], 
0x7fffc24477b8 /* 38 vars */ <unfinished ...>
...
25389 execve("/usr/bin/a2ps", ["a2ps", "-1", "--medium=A4dj", 
"--center-title=Documentation for the Ricoh SP C250DN PS", "-o", "-"], 
0x55f407b0f1b0 /* 37 vars */) = 0

>At the same time, I don't see any code generating the docs I am looking for, it
>seems commented out. So maybe that is also broken?

yes, it's nonexistent: they never migrated the documentation extraction code
from version 3.x's perl (where it was very simple to do) to version 4.x's c
codebase (where it's a bit more work) - but the did leave the
broken/incomplete '-o docs' in the code and the documentation :-(

i recreated something not entirely unlike that doc extractor earlier today
and will submit it in a separate bug regarding the misleading docs and
code leftovers.

--- a/fileconverter.c
+++ b/fileconverter.c
@@ -37,9 +37,9 @@
  * is not set. (Except if the spooler is CUPS, then 'texttops' is used
  */
 const char *fileconverters[][2] = {
-    { "a2ps", "a2ps -1 @@--medium=@@PAGESIZE@@ @@--center-title=@@JOBTITLE@@ -o -" },
+    { "a2ps", "a2ps -1 @@--medium=@@PAGESIZE@@ @@--center-title=\"@@JOBTITLE@@ -o -" },
     { "enscript", "enscript -G @@-M @@PAGESIZE@@ @@-b \"Page $%|@@JOBTITLE@@ --margins=36:36:36:36 --mark-wrapped-lines=arrow --word-wrap -p-" },
-    { "mpage", "mpage -o -1 @@-b @@PAGESIZE@@ @@-H -h @@JOBTITLE@@ -m36l36b36t36r -f -P- -" },
+    { "mpage", "mpage -o -1 @@-b @@PAGESIZE@@ @@-H -h \"@@JOBTITLE@@ -m36l36b36t36r -f -P- -" },
     { "paps", "paps @@--paper @@PAGESIZE@@ --header --font=11.5" },
     { NULL, NULL }
 };
-- 
Alexander Zangerl + GPG Key 2FCCF66BB963BD5F + http://snafu.priv.at/
Fachbegriffe der Informatik, GNU: GNU is Not Useful, ohne Windows 
oder Linux darunter. -- Uwe Ohse

Attachment: signature.asc
Description: Digital Signature

Reply via email to