[Foomatic] foomatic-rip bug report

Till Kamppeter till.kamppeter at gmx.net
Mon Dec 20 15:09:33 PST 2004


Jociel Cavalcante Andrade wrote:
> In article <mailman.202.1103505644.215.foomatic-devel at linuxprinting.org>, Till
> Kamppeter <till.kamppeter at gmx.net> writes:
> 
>>Tim Waugh wrote:
>>
>>>On Thu, Dec 16, 2004 at 01:17:42PM +0000, Jociel Cavalcante Andrade wrote:
>>>
>>>
>>>
>>>>Ol�,
>>>>
>>>>I found a bug into foomatic-rip filter.
>>>>When I try to use PJL with two intructions that starts with the same
> 
> string,
> 
>>>>the foomatic-rip replaces the first by the other. Thus, the first PJL
>>>>instruction not appear in output code.
>>>>For example, when I use "PJL HOLDKEY=1234" and "PJL HOLD=STORE", in this
> 
> order,
> 
>>>>the foomatic-rip think that "PJL HOLD" already exists, because the script
> 
> found
> 
>>>>the string "PJL HOLD...." included before.
>>>>Thus, the perl script replaces "PJL HOLDKEY=1234" by "PJL HOLD=STORE".
>>>>
>>>>I solved this, momentarily, using "PJL HoldKey" instead of "PJL HOLDKEY".
>>>>
>>>>To fix it, is enough to change the following code at foomatic-rip:
>>>>
>>>>for (@jclheader) {
>>>>    # If the command is there, replace it
>>>>    $_ =~ s/$cmd.*(\r\n|\n|\r)/$line/ and
>>>>    $cmdfound = 1;
>>>>}
>>>>
>>>>by:
>>>>
>>>>for (@jclheader) {
>>>>    # If the command is there, replace it
>>>>    $_ =~ s/$cmd*(\r\n|\n|\r)/$line/ and
>>>>    $cmdfound = 1;
>>>>}
>>>
>>>
>>>This is certainly wrong.  The '*' applies to the last character of
>>>$cmd in that case!
>>>
>>>Tim.
>>>*/
>>
>>Can you try
>>
>>--------------------------------------------------------------------------
>>for (@jclheader) {
>>      # If the command is there, replace it
>>      $_ =~ s/\b$cmd\b.*(\r\n|\n|\r)/$line/ and
>>      $cmdfound = 1;
>>}
>>--------------------------------------------------------------------------
>>
>>The '\b' means 'word Boundary'. This way the command must mach a word, 
>>so the command "foo" does match "foo=xxx", but not "foobar=yyy".
>>
>>Can you try this? Does it work? Please report here on the list.
> 
> 
> I tried this and worked perfectly.... This resolve the problem!
> 
> 

I have fixed it now on the CVS of the stable branch, using the following 
code:

--------------------------------------------------------------------------
for (@jclheader) {
       # If the command is there, replace it
       $_ =~ s/$cmd\b.*(\r\n|\n|\r)/$line/ and
       $cmdfound = 1;
}
--------------------------------------------------------------------------

I have left out the "\b" before the "$cmd", as there is not really a 
word boundary, as for PJL "$cmd" always begins with "@PJL ...".

Jociel, obrigado pelo relotório do bug e pelos testes (Jociel thanks for 
the bug report and testing).

Patrick, can you add the fix to your version for the unstable branch? 
Thanks.

    Till



More information about the Printing-foomatic mailing list