Bug 172256

Summary: bits/resource.ph has syntax errors
Product: Red Hat Enterprise Linux 3 Reporter: Jason Vas Dias <jvdias>
Component: perlAssignee: Jason Vas Dias <jvdias>
Status: CLOSED ERRATA QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: poelstra, prockai
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHSA-2005-881 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-12-20 14:59:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 170088    
Bug Blocks: 168424    

Description Jason Vas Dias 2005-11-02 00:41:54 UTC
+++ This bug was initially created as a clone of Bug #170088 +++

Description of problem:
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/bits/resource.ph file, as
shipped with the package has syntax errors in lines 15, 17, 19 - 23.

Version-Release number of selected component (if applicable):
perl-5.8.5-16.RHEL4

How reproducible:
Always.


Steps to Reproduce:
1. Include the file in some other Perl (i.e. require 'resource.ph';)
2. Try to run.
3. Get: Compilation failed in require at XXXX.perl line YYY.
  
Actual results:
Compilation fails due to syntax errors.

Expected results:
The file should be shipped without syntax errors.

Additional info:
N/A

-- Additional comment from jvdias on 2005-11-01 13:37 EST --
This problem is not specific to RHEL-4, but occurs with all linux perl versions.

There is no 'resource.ph' - you mean 'sys/resource.ph', which includes 
'bits/resource.ph' .

The include dependencies are:

'sys/resource.ph' -> 'bits/resource.ph' -> 'bits/types.h' -> 'stddef.ph' .

Unfortunately, there is no 'stddef.ph' - there is only 'linux/stddef.ph' .

You can workaround this problem by adding this directory to @INC:
'push @INC, "/usr/lib/perl-${PERL_VERSION}/${ARCH}-linux-thread-multi/linux";
 require "sys/resource.ph";
'

It appears that the 'linux/' include directory is in the gcc standard 
include path, but not in the perl standard @INC path.

I'll consider adding this directory to the standard @INC path in the next
PERL version.

-- Additional comment from bojan on 2005-11-01 14:10 EST --
I have no idea what all this really means as I'm not really a Perl guy, but
maybe there is a way to fix syntax errors by including different files. Anyway,
the compiler doesn't like lines like this (I picked these from one of my FC4
boxes, but RHEL4 has similar lines):

-------------------------
eval("sub  () { 6; }") unless defined(&);
eval("sub  () { 1; }") unless defined(&);
eval("sub  () { 7; }") unless defined(&);
eval("sub  () { 8; }") unless defined(&);
eval("sub  () { 9; }") unless defined(&);
eval("sub  () { 10; }") unless defined(&);
eval("sub  () { 11; }") unless defined(&);
-------------------------

Basically, it appears that there must be something _after_ sub and _before_ ()
in order for the line to be valid Perl. Like this:

-------------------------
eval("sub RLIMIT_CPU () { 0; }") unless defined(&RLIMIT_CPU);
-------------------------

When I hose the lines with nothing after sub, everything works.

Current Rawhide ( perl-5.8.7-0.5.fc5) doesn't have any of these syntax errors.
The files looks different.

-- Additional comment from jvdias on 2005-11-01 14:24 EST --
OK, sorry, it appears there are 2 problems here :

1. perl-5.8.5's h2ph generates incorrect headers with missing names for
   subroutines, as in :
   ---
   eval("sub  () { x; }") unless defined(&);
   ---
   should be:
   ---
   eval("sub CONST_NAME () { x; }") unless defined(&CONST_NAME);
   ---
  
   This problem is specific to the perl-5.8.5 version in RHEL-4 . 

2. The C-standard headers (eg. stddef.h, stdarg.h, syslimits.h)
   are not being picked  up from the right location on 
   Linux / glibc / gcc systems :

     /usr/lib/gcc-${arch}-${os}/${gcc-version}/include/

   but instead are being looked for in incorrect locations, eg.
     /usr/include/linux/stddef.h  : stddef.h used by the kernel
  
     syslimits.h : not found

   resulting in missing include dependencies for all PERL versions on Linux.


-- Additional comment from jvdias on 2005-11-01 16:06 EST --
This bug, which describes problem 1 in comment #3:
> 1. perl-5.8.5's h2ph generates incorrect headers with missing names for
>    subroutines
is a duplicate of upstream an perl bug:
 # 34498 -  h2ph unable to parse definitions inside enumerations
   ( http://rt.perl.org/rt3/Ticket/Display.html?id=34498 )
that is fixed with the h2ph from perl-5.8.7 .
I've generated a patch from perl-5.8.7 to the RHEL-4 5.8.5 h2ph which fixes
this problem, in versions >= perl-5.8.5-17.RHEL4 .
This should be in a RHEL-4 update release shortly.

Problem 2 of comment #3:
> 2. The C-standard headers (eg. stddef.h, stdarg.h, syslimits.h)
>    are not being picked  up

is covered by bug 172236, also to be fixed in perl-5.8.5-17.RHEL4.



-- Additional comment from bojan on 2005-11-01 16:54 EST --
Brilliant. Thanks!

Comment 1 Jason Vas Dias 2005-11-02 00:43:14 UTC
This bug was also a problem with all RHEL-3 perl versions prior to 
perl-5.8.0-90.2 - now fixed in that release.

Comment 4 Red Hat Bugzilla 2005-12-20 14:59:46 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-881.html