diff -u foomatic-filters-4.0.0/debian/changelog foomatic-filters-4.0.0/debian/changelog --- foomatic-filters-4.0.0/debian/changelog +++ foomatic-filters-4.0.0/debian/changelog @@ -1,3 +1,15 @@ +foomatic-filters (4.0.0-0ubuntu0.3) intrepid-proposed; urgency=low + + * debian/patches/02-foomatic-rip-binary-data-after-pjl-options-corrupted.patch: + Binary job data got corrupted after reading PJL options from the driver + output. This should finally fix LP: #318614. + + * debian/patches/foomatic-rip-segfault-on-jcl-merging.patch, + debian/patches/01-foomatic-rip-segfault-on-jcl-merging.patch: Renamed patch + to make the patches getting applied in the correct order. + + -- Till Kamppeter Mon, 2 Feb 2009 19:18:49 +0100 + foomatic-filters (4.0.0-0ubuntu0.2) intrepid-proposed; urgency=low * debian/patches/foomatic-rip-segfault-on-jcl-merging.patch: Fixed reverted: --- foomatic-filters-4.0.0/debian/patches/foomatic-rip-segfault-on-jcl-merging.patch +++ foomatic-filters-4.0.0.orig/debian/patches/foomatic-rip-segfault-on-jcl-merging.patch @@ -1,20 +0,0 @@ -diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.0/renderer.c foomatic-filters-4.0.0.new/renderer.c ---- foomatic-filters-4.0.0/renderer.c 2009-01-14 20:23:15.000000000 +0100 -+++ foomatic-filters-4.0.0.new/renderer.c 2009-01-29 20:00:23.000000000 +0100 -@@ -134,7 +134,7 @@ - if (cnt >= alloc -1) - { - alloc *= 2; -- result = realloc(result, alloc); -+ result = realloc(result, alloc * sizeof(char *)); - } - result[cnt] = line; - cnt++; -@@ -163,6 +163,7 @@ - while (isspace(*p2)) - p2--; - -+ if (p1 - j1 != p2 - j2) return 0; - return strncmp(j1, j2, p1 - j1 + 1) == 0; - } - only in patch2: unchanged: --- foomatic-filters-4.0.0.orig/debian/patches/02-foomatic-rip-binary-data-after-pjl-options-corrupted.patch +++ foomatic-filters-4.0.0/debian/patches/02-foomatic-rip-binary-data-after-pjl-options-corrupted.patch @@ -0,0 +1,137 @@ +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.0/renderer.c foomatic-filters-4.0.0.new/renderer.c +--- foomatic-filters-4.0.0/renderer.c 2009-02-02 19:13:40.000000000 +0100 ++++ foomatic-filters-4.0.0.new/renderer.c 2009-02-02 19:13:49.000000000 +0100 +@@ -93,7 +93,7 @@ + dstrreplace(cmd, "echo", ECHO, 0); /* TODO search for \wecho\w */ + } + +-char * read_line(FILE *stream) ++char * read_line(FILE *stream, size_t *readbytes) + { + char *line; + size_t alloc = 64, len = 0; +@@ -106,21 +106,32 @@ + alloc *= 2; + line = realloc(line, alloc); + } +- if (c == '\n') +- break; + line[len] = (char)c; + len++; ++ if (c == '\n') ++ break; + } + + line[len] = '\0'; ++ *readbytes = len; + return line; + } + ++write_binary_data(FILE *stream, const char *data, size_t bytes) ++{ ++ int i; ++ for (i=0; i < bytes; i++) ++ { ++ fputc(data[i], stream); ++ } ++} ++ + /* + * Read all lines containing 'jclstr' from 'stream' (actually, one more) and + * return them in a zero terminated array. + */ +-static char ** read_jcl_lines(FILE *stream, const char *jclstr) ++static char ** read_jcl_lines(FILE *stream, const char *jclstr, ++ size_t *readbinarybytes) + { + char *line; + char **result; +@@ -129,7 +140,7 @@ + result = malloc(alloc * sizeof(char *)); + + /* read from the renderer output until the first non-JCL line appears */ +- while ((line = read_line(stream))) ++ while ((line = read_line(stream, readbinarybytes))) + { + if (cnt >= alloc -1) + { +@@ -137,11 +148,14 @@ + result = realloc(result, alloc * sizeof(char *)); + } + result[cnt] = line; +- cnt++; + if (!strstr(line, jclstr)) + break; ++ /* Remove newline from the end of a line containing JCL */ ++ result[cnt][*readbinarybytes - 1] = '\0'; ++ cnt++; + } + ++ cnt++; + result[cnt] = NULL; + return result; + } +@@ -203,6 +217,7 @@ + static int write_merged_jcl_options(FILE *stream, + char **original_opts, + char **opts, ++ size_t readbinarybytes, + const char *jclstr) + { + char *p = strstr(original_opts[0], jclstr); +@@ -214,7 +229,7 @@ + { + fprintf(stream, "%s", jclbegin); + argv_write(stream, opts, "\n"); +- fprintf(stream, "%s\n", original_opts[0]); ++ write_binary_data(stream, original_opts[0], readbinarybytes); + return 0; + } + +@@ -234,7 +249,7 @@ + if (p) + fprintf(stream, "%s\n", p); + +- fprintf(stream, "%s\n", original_opts[1]); ++ write_binary_data(stream, original_opts[1], readbinarybytes); + return 1; + } + +@@ -247,13 +262,14 @@ + if (!jcl_options_find_keyword(original_opts, *optsp, jclstr)) + fprintf(stream, "%s\n", *optsp); + +- for (optsp = original_opts; *optsp; optsp++) { ++ for (optsp = original_opts; *(optsp + 1); optsp++) { + if (optsp != original_opts) p = *optsp; + if (jcl_options_find_keyword(opts, p, jclstr)) + fprintf(stream, "%s\n", jcl_options_find_keyword(opts, p, jclstr)); + else + fprintf(stream, "%s\n", p); + } ++ write_binary_data(stream, *optsp, readbinarybytes); + + return 1; + } +@@ -274,6 +290,7 @@ + { + FILE *fileh = open_postpipe(); + int driverjcl; ++ size_t readbinarybytes; + + log_jcl(); + +@@ -286,11 +303,12 @@ + { + char *jclstr = strndup(jclprepend[0], + strcspn(jclprepend[0], " \t\n\r")); +- char **jclheader = read_jcl_lines(in, jclstr); ++ char **jclheader = read_jcl_lines(in, jclstr, &readbinarybytes); + + driverjcl = write_merged_jcl_options(fileh, + jclheader, + jclprepend, ++ readbinarybytes, + jclstr); + + free(jclstr); only in patch2: unchanged: --- foomatic-filters-4.0.0.orig/debian/patches/01-foomatic-rip-segfault-on-jcl-merging.patch +++ foomatic-filters-4.0.0/debian/patches/01-foomatic-rip-segfault-on-jcl-merging.patch @@ -0,0 +1,20 @@ +diff -Nur -x '*.orig' -x '*~' foomatic-filters-4.0.0/renderer.c foomatic-filters-4.0.0.new/renderer.c +--- foomatic-filters-4.0.0/renderer.c 2009-01-14 20:23:15.000000000 +0100 ++++ foomatic-filters-4.0.0.new/renderer.c 2009-01-29 20:00:23.000000000 +0100 +@@ -134,7 +134,7 @@ + if (cnt >= alloc -1) + { + alloc *= 2; +- result = realloc(result, alloc); ++ result = realloc(result, alloc * sizeof(char *)); + } + result[cnt] = line; + cnt++; +@@ -163,6 +163,7 @@ + while (isspace(*p2)) + p2--; + ++ if (p1 - j1 != p2 - j2) return 0; + return strncmp(j1, j2, p1 - j1 + 1) == 0; + } +