develooper Front page | perl.beginners | Postings from April 2002

GoryDetails on: error log message

Thread Previous | Thread Next
From:
drieux
Date:
April 25, 2002 17:06
Subject:
GoryDetails on: error log message
Message ID:
6E0232D4-58A9-11D6-AF89-0030654D3CAE@wetware.com

On Thursday, April 25, 2002, at 04:16 , drieux wrote:

>> [Thu Apr 25 23:48:59 2002] [error] (2)No such file or directory: exec of
>> /web/cgi-bin/genestate/check_login.cgi failed
>> [Thu Apr 25 23:48:59 2002] [error] [client 192.168.0.1] Premature end of
>> script headers: /web/cgi-bin/genestate/check_login.cgi
>>
>> </log snippet>

wow - just used unix2dos and I can generate the
similar error case on our linux box.


[Thu Apr 25 16:58:46 2002] [error] (2)No such file or directory: exec of 
/drieux/CS/cgi/dumbDos.cgi failed
[Thu Apr 25 16:58:46 2002] [error] [client <IPADDR>] Premature end of 
script headers: /drieux/CS/cgi/dumbDos.cgi

this occurs because of the 'dos' two byte ending:

0000000   #   !   /   u   s   r   /   b   i   n   /   p   e   r   l  \r
0000020  \n  \r  \n   u   s   e       C   G   I       q   w   /   :   s
0000040   t   a   n   d   a   r   d   /   ;  \r  \n  \r  \n   $   u   r
0000060   l       =       "   h   t   t   p   :   /   /   w   w   w   .
0000100   p   e   r   l   .   c   o   m   /   C   P   A   N   /   "   ;
0000120  \r  \n   p   r   i   n   t       "   L   o   c   a   t   i   o
0000140   n   :       $   u   r   l   \   n   \   n   "   ;  \r  \n   e
0000160   x   i   t   ;  \r  \n

the comedy here is that the killer is that your linux machine
is reading the 'shebang' there not as

	#!/usr/bin/perl

but as

	#!/usr/bin/perl^M

and there is no such file of that type.

fix that one line and your code will work....

now of course had you put that line as

	#!/usr/bin/perl -w

then the 'shebang' would have worked because
the formating would have been

	od -c dumbDos.cgi
0000000   #   !   /   u   s   r   /   b   i   n   /   p   e   r   l
0000020   -   w  \r  \n  \r  \n

that would have moved the "^M" like gunge off of

	#!/usr/bin/perl

and perl has no problem with sucking in

	-w\r\n

as a command line argument

since in the dark it will 'chomp' that stuff anyway .....

have we mentioned 'use -w' before????

Did we ever mention 'use strict;' before!!!

There are Majikal and Mystical Reasons.....

ciao
drieux

---


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About