[14948] in Athena Bugs
sun4 8.0J: perl (/usr/athena/lib/perl/sys/socket.ph)
daemon@ATHENA.MIT.EDU (Albert Dvornik)
Mon Feb 10 15:00:20 1997
To: bugs@MIT.EDU
Date: Mon, 10 Feb 1997 15:00:07 EST
From: "Albert Dvornik" <bert@MIT.EDU>
System name: infocalypse
Type and version: SPARC/Classic 8.0J (1 update(s) to same version)
Display type: cgthree
What were you trying to do?
require "sys/socket.ph";
What's wrong:
Undefined subroutine "main'INTEL" called at
/usr/athena/lib/perl/sys/socket.ph line 102.
What should have happened:
People should not have assumed that h2ph is a stand-alone tool
and that it necessarily outputs correct Perl code.
Barring that, the problem should have been fixed after I
reported it the last time, in bugs[13117].
Please describe what is causing the problem:
The cause of the error is a combination of an ugly construct
in the Solaris /usr/include/sys/socket.h, and the fact that
h2ph is not as clever as some people may think. Namely, a
construct that cpp's empirically deal with even if INTEL and
ATT aren't defined:
#if (INTEL == 31) || (ATT == 31)
gets translated to code that Perl will barf on if &INTEL and
&ATT are undefined, which is (on Athena) always:
if (( &INTEL == 31) || ( &ATT == 31)) {
This is annoying, because it means that scripts that do
networking can't rely on the Perl in the Athena release.
Please give us a patch, since we want to fix the problem:
If, for some reason, we *have* to generate .ph files without
human intervention, we're asking for trouble; but I'd be
willing to try fixing h2ph to DTRT in this particular case.
If we can just patch the file and be done with it, here's a patch:
*** socket.ph Wed May 8 15:02:30 1996
--- socket.ph Mon Feb 10 14:45:10 1997
***************
*** 99,105 ****
local($opt) = @_;
eval "(($opt + 1))";
}';
! if (( &INTEL == 31) || ( &ATT == 31)) {
eval 'sub SOCKETSYS {88;}';
}
else {
--- 99,105 ----
local($opt) = @_;
eval "(($opt + 1))";
}';
! if (( eval('&INTEL') == 31) || ( eval('&ATT') == 31)) {
eval 'sub SOCKETSYS {88;}';
}
else {