apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.95k stars 464 forks source link

hpgltops consumes all cpu cycles #2423

Closed michaelrsweet closed 17 years ago

michaelrsweet commented 17 years ago

Version: 1.2.11 CUPS.org User: imcguire

I am running CUPS on a Debian GNU/Linux 3.1 server (x86). Sometimes sending a job causes the hpgltops process to spin and consume cpu. If strace is used to attatch to the process it shows 'read(4, "", 4096) = 0' looping. I have seen this problem in version 1.2.6 - 1.2.11 and am not sure if the problem is specific to Linux. The problem can be reproduced at will and I have attached an example file that causes it.

michaelrsweet commented 17 years ago

CUPS.org User: mike

OK, this PCL text file was mis-identified as HP-GL/2... Fix attached.

michaelrsweet commented 17 years ago

CUPS.org User: mike

And another patch for hpgltops so it won't hang regardless...

michaelrsweet commented 17 years ago

"str2423.patch":

Index: mime.types

--- mime.types (revision 6617) +++ mime.types (working copy) @@ -84,7 +84,7 @@ contains(0,4096,"LANGUAGE = POSTSCRIPT") \ (contains(0,4096,<0a>%!) + \ !contains(0,4096,"ENTER LANGUAGE"))) -application/vnd.hp-HPGL hpgl string(0,<1B>&)\ +application/vnd.hp-HPGL hpgl \ string(0,<1B>E<1B>%0B) \ string(0,<1B>%-1B) string(0,<201B>)\ string(0,BP;) string(0,IN;) string(0,DF;) \

michaelrsweet commented 17 years ago

"str2423p2.patch":

Index: hpgl-input.c

--- hpgl-input.c (revision 6617) +++ hpgl-input.c (working copy) @@ -183,7 +183,9 @@ { bufptr = buf; while ((ch = getc(fp)) != ';')

@@ -195,6 +197,10 @@ while (!done) switch (ch = getc(fp)) {