From owner-freebsd-ports-bugs@freebsd.org Sun Mar 6 12:33:45 2016 Return-Path: Delivered-To: freebsd-ports-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 896229DAD88 for ; Sun, 6 Mar 2016 12:33:45 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EB72659 for ; Sun, 6 Mar 2016 12:33:45 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u26CXjBr070779 for ; Sun, 6 Mar 2016 12:33:45 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 207738] print/hplip: hpcups send 10000 bytes of garbage (0x00) to the printer Date: Sun, 06 Mar 2016 12:33:45 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: guru@unixarea.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: makc@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2016 12:33:45 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207738 Bug ID: 207738 Summary: print/hplip: hpcups send 10000 bytes of garbage (0x00) to the printer Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: Individual Port(s) Assignee: makc@FreeBSD.org Reporter: guru@unixarea.de Flags: maintainer-feedback?(makc@FreeBSD.org) Assignee: makc@FreeBSD.org While hunting some other problem with a HP Deskjet 2510 printer, I discover= ed that due to a bug in print/hplip source prnt/hpcups/Encapsulator.cpp 10000 bytes of 0x00 are send to the printer before the real PCL commands: prnt/hpcups/CommonDefinitions.h: #define PCL_BUFFER_SIZE 10000 prnt/hpcups/Encapsulator.cpp: cur_pcl_buffer_size =3D PCL_BUFFER_SIZE; pcl_buffer =3D new BYTE[cur_pcl_buffer_size + 2]; if (pcl_buffer =3D=3D NULL) { return ALLOCMEM_ERROR; } memset(pcl_buffer, 0, cur_pcl_buffer_size); cur_pcl_buffer_ptr =3D pcl_buffer; err =3D flushPrinterBuffer(); prnt/hpcups/Encapsulator.h: virtual DRIVER_ERROR flushPrinterBuffer() { return m_pSystemServices->Send((const BYTE *) pcl_buffer, 10000); } $ od -c printer24674.prn | head -5 0000000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 0023420 033 E 033 % - 1 2 3 4 5 X @ P J L=20=20= =20=20 0023440 S E T S T R I N G C O D E S E 0023460 T =3D U T F 8 \n @ P J L C O M M ... Perhaps this should be fixed upstream in the original sources, but I do not know to whom direkt this. For our port a patch is simple and tested here: --- prnt/hpcups/Encapsulator.cpp.orig 2014-10-07 10:55:45.000000000 +0200 +++ prnt/hpcups/Encapsulator.cpp 2016-03-06 12:32:07.780767000 +0100 @@ -65,7 +65,9 @@ memset(pcl_buffer, 0, cur_pcl_buffer_size); cur_pcl_buffer_ptr =3D pcl_buffer; - err =3D flushPrinterBuffer(); +// We should not send 10000 NULL bytes to the printer +// err =3D flushPrinterBuffer(); + err =3D NO_ERROR; struct tm *t; time_t long_time; --=20 You are receiving this mail because: You are the assignee for the bug.=