Hi,

ifhp has a bug while using filters calling filters with 
file_output_match

The default for file_util_path is:

  file_util_path= /opt/bin/file \%s{inputfile}
                                ^^^^^^^^^^^^^^
and \%s{inputfile} is set during runtime.

Here my ifhp.conf file for our HP DeskJet cp1700

----------------------------------------------------------------------
[ hpdjcp1700 ]

status@

debug=9

ppd_file=/etc/opt/LPRng/ppd/cp1700.ppd

forceconversion

file_output_match = [
  *pcl*                   raw
  *postscript*            raw     \%s{foomatic_rip}
  *text*                  filter  \%s{a2ps_converter}
  *pdf*                   filter  \%s{pdf2ps_converter}
  *tex_dvi*               filter  \%s{dvips}
  *gzip_compressed*       filter  \%s{gzip_decompress}
  *compress'd_data*       filter  \%s{gzip_decompress}
  ]
----------------------------------------------------------------------

We need several filters to get everything right.

And now what debug=9 tells us while doing 'lpr one.pdf':

----------------------------------------------------------------------
     1  ...
     2   [28] HASH key 'file_util_path'  - OBJ_T_STR '/usr/local/bin/file 
\%s{inputfile}' at 07:23:27.638
     3  ...
     4  Send_job: starting transfer at 07:23:27.860
     5  Make_stdin_file: input is_file 1, size 1087 at 07:23:27.860 
     6  Fix_option_str: orig '/usr/local/bin/file \%s{inputfile}', remove_ws 0, trim 
1, one_line 1 at 07:23:27.860
     7                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     8  ...
     9  Fix_option_str: returning '/usr/local/bin/file dfA798ADDR127.0.0.1' at 
07:23:27.862
    10                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    11  Send_job: foomatic 1 at 07:23:27.863
    12  Init_outbuf: Outbuf 0x54418, Outmax 10240, Outlen 0 at 07:23:27.863
    13  Send_job: want 64 at 07:23:27.863
    14  Send_job: read 64 from stdin '%PDF-1.2
    15  %<C7><EC><8F><A2>
    16  6 0 obj
    17  <</Length 7 0 R/Filter /FlateDecode>>
    18  str' at 07:23:27.863
    19  Send_job: file_util_path '/usr/local/bin/file dfA798ADDR127.0.0.1' at 
07:23:27.863
    20  Use_file_util: pgm '/usr/local/bin/file dfA798ADDR127.0.0.1', value_len 512 at 
07:23:27.863
    21  Use_file_util: file program = '/usr/local/bin/file dfA798ADDR127.0.0.1' at 
07:23:27.864
    22  Make_tempfile: tempfile 'ifhpXXXXXX' at 07:23:27.864
    23  Make_tempfile: new tempfile 'ifhp4zay6C', fd 4 at 07:23:27.864
    24  Filter_file: pgm '/usr/local/bin/file dfA798ADDR127.0.0.1', title 'FILE_UTIL', 
stdin 0, stdout 4 at 07:23:27.865
    25  Split_cmd_line_OBJ: line '/usr/local/bin/file dfA798ADDR127.0.0.1' at 
07:23:27.865
    26  Split_cmd_line: arg '/usr/local/bin/file', rest 'dfA798ADDR127.0.0.1' at 
07:23:27.865
    27  Split_cmd_line: arg 'dfA798ADDR127.0.0.1', rest '<NULL>' at 07:23:27.865
    28  Split_cmd_line_OBJ - OBJ_T_LIST len 2 at 07:23:27.866
    29   [0]  '/usr/local/bin/file'  at 07:23:27.866
    30   [1]  'dfA798ADDR127.0.0.1'  at 07:23:27.866
    31   [2]  0x0 at 07:23:27.866
    32  Filter_file: process args - OBJ_T_LIST len 2 at 07:23:27.866
    33   [0]  '/usr/local/bin/file'  at 07:23:27.867
    34   [1]  'dfA798ADDR127.0.0.1'  at 07:23:27.867
    35   [2]  0x0 at 07:23:27.867
    36  Filter_file: started FILE_UTIL- 'file' at 07:23:27.869
    37  Filter_file: converter pid 14804, exit 'exit status 0' at 07:23:27.939
    38  Use_file_util: read 47, 'dfA798ADDR127.0.0.1: PDF document, version 1.2
    39  ' at 07:23:27.939
    40  Use_file_util: file information = 'pdf_document,_version_1.2' at 07:23:27.939
    41                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
    42  Use_file_util: file util done, 'pdf_document,_version_1.2' at 07:23:27.940
    43  Init_outbuf: Outbuf 0x54418, Outmax 10240, Outlen 64 at 07:23:27.940
    44  Send_job: initial job type 'pdf_document,_version_1.2' at 07:23:27.940
    45  Send_job: file_output_match - OBJ_T_LIST len 9 at 07:23:27.940
    46   [0]  '['  at 07:23:27.941
    47   [1]  '*pcl*                   raw'  at 07:23:27.941
    48   [2]  '*postscript*            raw     \%s{foomatic_rip}'  at 07:23:27.941
    49   [3]  '*text*                  filter  \%s{a2ps_converter}'  at 07:23:27.941
    50   [4]  '*pdf*                   filter  \%s{pdf2ps_converter}'  at 07:23:27.941
    51   [5]  '*tex_dvi*               filter  \%s{dvips}'  at 07:23:27.941
    52   [6]  '*gzip_compressed*       filter  \%s{gzip_decompress}'  at 07:23:27.942
    53   [7]  '*compress'd_data*       filter  \%s{gzip_decompress}'  at 07:23:27.942
    54   [8]  ']'  at 07:23:27.942
    55   [9]  0x0 at 07:23:27.942
    56  ...
    57  Send_job: [4] '*pdf*                   filter  \%s{pdf2ps_converter}' at 
07:23:27.945
    58  Send_job: checking against - OBJ_T_LIST len 3 at 07:23:27.946
    59   [0]  '*pdf*'  at 07:23:27.946
    60   [1]  'filter'  at 07:23:27.946
    61   [2]  '\%s{pdf2ps_converter}'  at 07:23:27.946
    62   [3]  0x0 at 07:23:27.946
    63  Globmatch: '*pdf*' to 'pdf_document,_version_1.2' result 0 at 07:23:27.946
    64  Send_job: match language 'filter' at 07:23:27.946
    65  Fix_option_str: orig '\%s{pdf2ps_converter}', remove_ws 0, trim 1, one_line 1 
at 07:23:27.947
    66  Fix_option_str: escape at '\%s{pdf2ps_converter}', '%' at 07:23:27.947
    67  Fix_option_str: var sub into '%s{pdf2ps_converter}' at 07:23:27.947
    68  Fix_option_str: getting 'pdf2ps_converter' fmt '%s' at 07:23:27.947
    69  Find_sub_value: type '{', id 'pdf2ps_converter' at 07:23:27.947
    70  Find_sub_value: from Zopts '<NULL>' at 07:23:27.947
    71  Find_sub_value: from Model '/usr/local/Acrobat508/bin/acroread.exe 
-toPostScript -fast -level1 -size a4' at 07:23:27.947
    72  ...
    73  Filter_file: process args - OBJ_T_LIST len 6 at 07:23:27.953
    74   [0]  '/usr/local/Acrobat508/bin/acroread.exe'  at 07:23:27.953
    75   [1]  '-toPostScript'  at 07:23:27.953
    76   [2]  '-fast'  at 07:23:27.953
    77   [3]  '-level1'  at 07:23:27.954
    78   [4]  '-size'  at 07:23:27.954
    79   [5]  'a4'  at 07:23:27.954
    80   [6]  0x0 at 07:23:27.954
    81  Filter_file: started CONVERTER- 'acroread.exe' at 07:23:27.956
    82  Filter_file: converter pid 14805, exit 'exit status 0' at 07:23:34.770
    83  Send_job: converter done, output 48648 bytes at 07:23:34.771
    84                            ^^^^^^^^^^^^^^^^^^
    85  Send_job: foomatic 1 at 07:23:34.771
    86  Init_outbuf: Outbuf 0x54418, Outmax 10240, Outlen 0 at 07:23:34.771
    87  Send_job: want 64 at 07:23:34.771
    88  Send_job: read 64 from stdin '%!PS-Adobe-3.0
    89  %%Title: (AcroE8aO6C)
    90  %%Version: 1 2
    91  %%CreationDa' at 07:23:34.772
    92  Send_job: file_util_path '/usr/local/bin/file dfA798ADDR127.0.0.1' at 
07:23:34.772
    93                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    94  ...
    95  Filter_file: process args - OBJ_T_LIST len 4 at 07:23:34.775
    96   [0]  '/usr/local/bin/file'  at 07:23:34.775
    97   [1]  '-m'  at 07:23:34.775
    98   [2]  '/etc/opt/LPRng/magic:/usr/local/share/magic'  at 07:23:34.776
    99   [3]  'dfA798ADDR127.0.0.1'  at 07:23:34.776
   100   [4]  0x0 at 07:23:34.776
   101  Filter_file: started FILE_UTIL- 'file' at 07:23:34.777
   102  Filter_file: converter pid 14818, exit 'exit status 0' at 07:23:34.790
   103  Use_file_util: read 47, 'dfA798ADDR127.0.0.1: PDF document, version 1.2' at 
07:23:34.791
   104  Use_file_util: file information = 'pdf_document,_version_1.2' at 07:23:34.791
   105                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
   106  Send_job: [4] '*pdf*                   filter  \%s{pdf2ps_converter}' at 
07:23:34.797
   107  Send_job: checking against - OBJ_T_LIST len 3 at 07:23:34.797
   108   [0]  '*pdf*'  at 07:23:34.797
   109   [1]  'filter'  at 07:23:34.797
   110   [2]  '\%s{pdf2ps_converter}'  at 07:23:34.797
   111   [3]  0x0 at 07:23:34.797
   112  Globmatch: '*pdf*' to 'pdf_document,_version_1.2' result 0 at 07:23:34.797
   113  Send_job: match language 'filter' at 07:23:34.798
   114  Fix_option_str: orig '\%s{pdf2ps_converter}', remove_ws 0, trim 1, one_line 1 
at 07:23:34.798
   115  Fix_option_str: escape at '\%s{pdf2ps_converter}', '%' at 07:23:34.798
   116  Fix_option_str: var sub into '%s{pdf2ps_converter}' at 07:23:34.798
   117  Fix_option_str: getting 'pdf2ps_converter' fmt '%s' at 07:23:34.798
   118  Find_sub_value: type '{', id 'pdf2ps_converter' at 07:23:34.798
   119  Find_sub_value: from Zopts '<NULL>' at 07:23:34.799
   120  Find_sub_value: from Model '/usr/local/Acrobat508/bin/acroread.exe 
-toPostScript -fast -level1 -size a4' at 07:23:34.799
   121  ...
   122  Filter_file: process args - OBJ_T_LIST len 6 at 07:23:34.804
   123   [0]  '/usr/local/Acrobat508/bin/acroread.exe'  at 07:23:34.804
   124   [1]  '-toPostScript'  at 07:23:34.804
   125   [2]  '-fast'  at 07:23:34.805
   126   [3]  '-level1'  at 07:23:34.805
   127   [4]  '-size'  at 07:23:34.805
   128   [5]  'a4'  at 07:23:34.805
   129   [6]  0x0 at 07:23:34.805
   130  Filter_file: started CONVERTER- 'acroread.exe' at 07:23:34.806
   131  Filter_file: 'CONVERTER' msg '<stdin>: File does not begin with '%PDF-'.' at 
07:23:36.405
   132                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------------------------------------------------------------


line 2 shows the config line from ifhp.conf

line 9 shows the expansion 

line 40 shows the real file format

line 63-65 shows what to do with pdf

line 71 shows our call to acroread

line 83 shows that acroread has created output

line 85 shows the second loop

line 92 shows the wrong call of 'file'

line 104 again tells us we are using pdf

line 131 shows an error msg from acroread 

The loop works ok. Filters gets the right files as stdin,
but the 'file' command is called wrong.

The variable 'file_util' in ifhp.c is only initialized one time

----------------------------------------------------------------------
        file_util = GET_HASH_STR_OBJ( Model, "file_util_path", MEMINFO );
        file_util = Fix_option_str( file_util, 0, 1, 1 );
----------------------------------------------------------------------

I'm not sure if this is correct.

Changing the definition of file_util_path from

  file_util_path= /usr/local/bin/file \%s{inputfile}

to

  file_util_path= /usr/local/bin/file -

gives me a working environment, but I'm not sure about any other 
(negativ) effects.



Willi


-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to