Mailing List Archive

Error in $spitshell usage in perl5.001m on AIX 4.1
Here's an annoying one.

When building scripts such as c2ph, h2ph, etc on aix 4.1, $spitshell
is defined to be the local script "spitshell" in the source tree,
which is the following one-liner:

exec grep -v '^[ ]*#'

This is fed the following input in a here doc in h2ph.SH:

$spitshell >h2ph <<!GROK!THIS!
#!$binexp/perl
'di ';
'ds 00 \"';
'ig 00 ';

\$perlincl = '$archlibexp';
!GROK!THIS!

The #! line is being lost, so these scripts are then run with /bin/sh,
which doesn't handle the nroff code at the top.

I'm not sure what the fix is. The test for this in Configure is the
exit status from

sh -c '#'

which, sure enough on AIX 4.1, is non-zero. But /bin/sh scripts on
AIX appears to do the correct thing with such comments. In any event,
the subsequent usage of spitshell is going to strip the #! line in ANY
case, so NONE of the h2ph, c2ph, etc. scripts generated in this case
can possible work (unless perl is the default interpreter -- haven't
heard of any vendor doing this yet....).

W. Phillip Moore Phone: (212)-762-2433
Information Technology Department FAX: (212)-762-1009
Morgan Stanley and Co. E-mail: wpm@morgan.com
750 9th Ave. 9F, NY, NY 10019

"Grant me the serenity to accept the things I cannot change, the
courage to change the things I can, and the wisdom to hide the
bodies of the people that I had to kill because they pissed me
off."
-- Anonymous
Error in $spitshell usage in perl5.001m on AIX 4.1 [ In reply to ]
>>>>> "Phil" == Phillip Moore <wpm@morgan.com> writes:

Phil> The #! line is being lost, so these scripts are then run with /bin/sh,
Phil> which doesn't handle the nroff code at the top.

Phil> I'm not sure what the fix is. The test for this in Configure is the
Phil> exit status from

Phil> sh -c '#'

Phil> which, sure enough on AIX 4.1, is non-zero. But /bin/sh scripts
Phil> on AIX appears to do the correct thing with such comments. In
Phil> any event, the subsequent usage of spitshell is going to strip
Phil> the #! line in ANY case, so NONE of the h2ph, c2ph, etc. scripts
Phil> generated in this case can possible work (unless perl is the
Phil> default interpreter -- haven't heard of any vendor doing this
Phil> yet....).

Well, assuming that /bin/line is available on all the platforms with
ugly shells, then you could do this:

Instead of

exec grep -v '^[ ]*#'

if you use

line && grep -v '^[ ]*#'

then this works.

Still smells like a hack....

W. Phillip Moore Phone: (212)-762-2433
Information Technology Department FAX: (212)-762-1009
Morgan Stanley and Co. E-mail: wpm@morgan.com
750 9th Ave. 9F, NY, NY 10019

"Grant me the serenity to accept the things I cannot change, the
courage to change the things I can, and the wisdom to hide the
bodies of the people that I had to kill because they pissed me
off."
-- Anonymous