[Foomatic] foomatic-rip bug report

Till Kamppeter till.kamppeter at gmx.net
Sun Dec 19 18:47:45 PST 2004


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.

    Till




More information about the Printing-foomatic mailing list