From a2e8a69d33abb5be5738b14e7c7b31eb0c397457 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Fri, 23 Jul 2010 22:13:48 +0200 Subject: Added missing changes (patch) from 4.0.4-0ubuntu2. --- debian/changelog | 12 + ...ror-out-on-problems-longer-string-buffers.patch | 241 +++++++++++++++++++++ debian/rules | 5 +- 3 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 debian/patches/01_foomatic-rip-error-out-on-problems-longer-string-buffers.patch diff --git a/debian/changelog b/debian/changelog index b9ccc0a..73183ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ foomatic-filters (4.0.4-1) UNRELEASED; urgency=low * Merge from Ubuntu: - Install the apport hook on Ubuntu - Merge the changelog entries. + - Merge the patch. - Merge most package relationships. - Merge package descriptions (Closes: #467380) - Turn on the insertion of PostScript code for CUPS' page accounting by @@ -28,6 +29,17 @@ foomatic-filters (4.0.4-1) UNRELEASED; urgency=low -- Didier Raboud Mon, 19 Jul 2010 19:23:14 +0200 +foomatic-filters (4.0.4-0ubuntu2) maverick; urgency=low + + * debian/patches/01_foomatic-rip-error-out-on-problems-longer-string-buffers.patch: + Let foomatic-rip actually error out if something goes wrong. It simply + continued or closed silently (exit status 0) on several issues (LP: + 570522). Also make string buffers bigger as many of them were too small. + This patch contains the changes which are planned to be introduced in + Foomatic 4.0.5, so this can be considered a test release for 4.0.5. + + -- Till Kampeter Tue, 8 Jun 2010 17:47:03 +0200 + foomatic-filters (4.0.4-0ubuntu1) lucid; urgency=low * New upstream release diff --git a/debian/patches/01_foomatic-rip-error-out-on-problems-longer-string-buffers.patch b/debian/patches/01_foomatic-rip-error-out-on-problems-longer-string-buffers.patch new file mode 100644 index 0000000..720cf50 --- /dev/null +++ b/debian/patches/01_foomatic-rip-error-out-on-problems-longer-string-buffers.patch @@ -0,0 +1,241 @@ +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.4//ChangeLog foomatic-filters-4.0.4.new//ChangeLog +--- foomatic-filters-4.0.4//ChangeLog 2010-02-15 13:57:40.000000000 +0100 ++++ foomatic-filters-4.0.4.new//ChangeLog 2010-06-08 17:19:38.201710562 +0200 +@@ -1,3 +1,32 @@ ++2010-06-08 Till Kamppeter ++ ++ * USAGE: Documentation correction. ++ ++2010-06-07 Till Kamppeter ++ ++ * USAGE: Finally completed the documentation update to reflect that ++ the Ghostscript library is not needed any more. ++ ++ * foomaticrip.c, foomaticrip.h, pdf.c: Let foomatic-rip actually ++ error out if something goes wrong. It simply continued or closed ++ silently (exit status 0) on the following events: Failure of ++ print_file() function call, failure of Ghostscript to determine ++ the number of pages of a PDF input file (causes Ubuntu bug ++ #570522), failure to start Ghostscript to render a PDF file, ++ failure to create a temporary file for extracting selected pages ++ from a PDF file, failure to run Ghostscript to extract pages from ++ a PDF file, page count result being a negative number. ++ ++ * foomaticrip.c: Use EXIT_PRINTED constant and not hard-coded "0" ++ as exit value when terminating successfully. ++ ++ * foomaticrip.h: Correct definition of EXIT_STARVED constant. ++ ++2010-03-26 Till Kamppeter ++ ++ * options.c, options.h: Made some strings longer, to avoid space ++ problems. ++ + 2010-02-15 Till Kamppeter + + * Tagged branch for release 4.0.4. +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.4//foomaticrip.c foomatic-filters-4.0.4.new//foomaticrip.c +--- foomatic-filters-4.0.4//foomaticrip.c 2010-02-15 13:57:40.000000000 +0100 ++++ foomatic-filters-4.0.4.new//foomaticrip.c 2010-06-08 17:19:38.201710562 +0200 +@@ -1602,7 +1602,8 @@ + PostScript file (all before the first page begins). */ + optionset_copy_values(optionset("userval"), optionset("header")); + +- print_file(filename, 1); ++ if (!print_file(filename, 1)) ++ rip_die(EXIT_PRNERR_NORETRY, "Could not print file %s\n", filename); + filename = strtok_r(NULL, " ", &p); + } + +@@ -1639,6 +1640,6 @@ + + list_free(arglist); + +- return 0; ++ return EXIT_PRINTED; + } + +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.4//foomaticrip.h foomatic-filters-4.0.4.new//foomaticrip.h +--- foomatic-filters-4.0.4//foomaticrip.h 2010-02-15 13:57:40.000000000 +0100 ++++ foomatic-filters-4.0.4.new//foomaticrip.h 2010-06-08 17:19:38.201710562 +0200 +@@ -56,7 +56,7 @@ + #define EXIT_JOBERR 3 /* job is defective */ + #define EXIT_SIGNAL 4 /* terminated after catching signal */ + #define EXIT_ENGAGED 5 /* printer is otherwise engaged (connection refused) */ +-#define EXIT_STARVED = 6; /* starved for system resources */ ++#define EXIT_STARVED 6 /* starved for system resources */ + #define EXIT_PRNERR_NORETRY_ACCESS_DENIED 7 /* bad password? bad port permissions? */ + #define EXIT_PRNERR_NOT_RESPONDING 8 /* just doesn't answer at all (turned off?) */ + #define EXIT_PRNERR_NORETRY_BAD_SETTINGS 9 /* interface settings are invalid */ +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.4//options.c foomatic-filters-4.0.4.new//options.c +--- foomatic-filters-4.0.4//options.c 2010-02-15 13:57:40.000000000 +0100 ++++ foomatic-filters-4.0.4.new//options.c 2010-06-08 17:19:38.211630380 +0200 +@@ -34,10 +34,10 @@ + + /* Values from foomatic keywords in the ppd file */ + char printer_model [256]; +-char printer_id [128]; ++char printer_id [256]; + char driver [128]; +-char cmd [1024]; +-char cmd_pdf [1024]; ++char cmd [4096]; ++char cmd_pdf [4096]; + dstr_t *postpipe = NULL; /* command into which the output of this + filter should be piped */ + int ps_accounting = 1; +@@ -751,7 +751,7 @@ + { + choice_t *choice = option_find_choice(opt, "Custom"); + char ** paramvalues = paramvalues_from_string(opt, values); +- char width[30], height[20]; ++ char width[30], height[30]; + int pos; + + assert(choice); +@@ -1215,7 +1215,7 @@ + } + + if (!startswith(code, "%% FoomaticRIPOptionSetting")) +- unhtmlify(choice->command, 1024, code); ++ unhtmlify(choice->command, 65536, code); + } + + /* +@@ -1529,10 +1529,10 @@ + unhtmlify(postpipe->data, postpipe->alloc, value->data); + } + else if (strcmp(key, "FoomaticRIPCommandLine") == 0) { +- unhtmlify(cmd, 1024, value->data); ++ unhtmlify(cmd, 4096, value->data); + } + else if (strcmp(key, "FoomaticRIPCommandLinePDF") == 0) { +- unhtmlify(cmd_pdf, 1024, value->data); ++ unhtmlify(cmd_pdf, 4096, value->data); + } + else if (strcmp(key, "FoomaticRIPNoPageAccounting") == 0) { + /* Boolean value */ +@@ -1742,7 +1742,7 @@ + * line */ + if (startswith(cmd, "gs")) + { +- strncpy(cmd_pdf, cmd, 1024); ++ strncpy(cmd_pdf, cmd, 4096); + return 1; + } + +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.4//options.h foomatic-filters-4.0.4.new//options.h +--- foomatic-filters-4.0.4//options.h 2010-02-15 13:57:40.000000000 +0100 ++++ foomatic-filters-4.0.4.new//options.h 2010-06-08 17:19:38.211630380 +0200 +@@ -55,7 +55,7 @@ + typedef struct choice_s { + char value [128]; + char text [128]; +- char command[1024]; ++ char command[65536]; + struct choice_s *next; + } choice_t; + +@@ -125,8 +125,8 @@ + extern char jclend[256]; + extern char jclprefix[256]; + +-extern char cmd[1024]; +-extern char cmd_pdf[1024]; ++extern char cmd[4096]; ++extern char cmd_pdf[4096]; + + extern int ps_accounting; + +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.4//pdf.c foomatic-filters-4.0.4.new//pdf.c +--- foomatic-filters-4.0.4//pdf.c 2010-02-15 13:57:40.000000000 +0100 ++++ foomatic-filters-4.0.4.new//pdf.c 2010-06-08 17:19:38.211630380 +0200 +@@ -52,10 +52,8 @@ + gspath, filename); + + FILE *pd = popen(gscommand, "r"); +- if (!pd) { +- _log("Failed to execute ghostscript to determine number of input pages!\n"); +- return 0; +- } ++ if (!pd) ++ rip_die(EXIT_STARVED, "Failed to execute ghostscript to determine number of input pages!\n"); + + fread(output, 1, 31, pd); + pclose(pd); +@@ -77,7 +75,7 @@ + _log("Starting renderer with command: %s\n", cmd); + kid3 = start_process("kid3", exec_kid3, (void *)cmd, NULL, NULL); + if (kid3 < 0) +- return 0; ++ rip_die(EXIT_STARVED, "Could not start renderer\n"); + + return 1; + } +@@ -118,7 +116,7 @@ + snprintf(filename, PATH_MAX, "%s/foomatic-XXXXXX", temp_dir()); + mktemp(filename); + if (!filename[0]) +- return 0; ++ rip_die(EXIT_STARVED, "Unable to create temporary file!\n"); + + snprintf(filename_arg, PATH_MAX, "-sOutputFile=%s", filename); + snprintf(first_arg, 50, "-dFirstPage=%d", first); +@@ -132,10 +130,8 @@ + gspath, filename_arg, first_arg, last_arg, pdffilename); + + FILE *pd = popen(gscommand, "r"); +- if (!pd) { +- _log("Could not run ghostscript to extract the pages!\n"); +- return 0; +- } ++ if (!pd) ++ rip_die(EXIT_STARVED, "Could not run ghostscript to extract the pages!\n"); + pclose(pd); + + return 1; +@@ -158,7 +154,7 @@ + else + { + if (!pdf_extract_pages(tmpfile, filename, firstpage, lastpage)) +- return 0; ++ rip_die(EXIT_STARVED, "Could not run ghostscript to extract the pages!\n"); + dstrcatf(cmd, " < %s", tmpfile); + } + +@@ -237,7 +233,7 @@ + page_count = pdf_count_pages(filename); + + if (page_count <= 0) +- return 0; ++ rip_die(EXIT_JOBERR, "Unable to determine number of pages, page count: %d\n", page_count); + _log("File contains %d pages\n", page_count); + + optionset_copy_values(optionset("header"), optionset("currentpage")); +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.4//USAGE foomatic-filters-4.0.4.new//USAGE +--- foomatic-filters-4.0.4//USAGE 2010-02-15 13:57:40.000000000 +0100 ++++ foomatic-filters-4.0.4.new//USAGE 2010-06-08 17:19:38.201710562 +0200 +@@ -74,9 +74,8 @@ + Foomatic runs on all systems where one can run the Perl + interpreter and Ghostscript. + +-foomatic-filters needs the Ghostscript library for foomatic-rip and +-the Perl interpreter for beh (Backend Error Handler) and the test +-suite. ++foomatic-filters needs the Perl interpreter for beh (Backend Error ++Handler) and the test suite. + + To build foomatic-rip you need a C compiler and its standard libraries. + +@@ -138,9 +137,8 @@ + a normal user. + + The "configure" script will auto-detect where the programs have to be +-installed and where the Perl interpreter and the Ghostscript library +-are located. If "configure" fails because of something not being +-installed, do ++installed and where the Perl interpreter is located. If "configure" ++fails because of something not being installed, do + + rm -rf config.cache autom*.cache + diff --git a/debian/rules b/debian/rules index 06d71d5..44621a8 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,11 @@ #!/usr/bin/make -f +include /usr/share/cdbs/1/rules/simple-patchsys.mk + derives_from_ubuntu := $(shell (dpkg-vendor --derives-from Ubuntu && echo "yes") || echo "no") %: dh $@ - override_dh_auto_configure: dh_auto_configure -- --disable-file-converter-check @@ -15,7 +16,7 @@ override_dh_auto_build: override_dh_install: dh_install - + rm -f $(CURDIR)/debian/foomatic-filters/etc/foomatic/filter.conf* cp -p debian/parseconfig.pl $(CURDIR)/debian/foomatic-filters/usr/share/foomatic chmod +x $(CURDIR)/debian/foomatic-filters/usr/share/foomatic/parseconfig.pl -- cgit v1.2.3