Bug 520441

Summary: ExtUtils::MakeMaker adds extra sanity check to executable perl scripts
Product: [Community] Spacewalk Reporter: Milan Zázrivec <mzazrivec>
Component: ServerAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: low    
Version: 0.7   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-12-07 12:02:56 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:    
Bug Blocks: 507670    

Description Milan Zázrivec 2009-08-31 14:10:06 UTC
Description of problem:
All Spacewalk executable perl scripts (i.e. those located under bin/ sbin/
directoris) built by ExtUtils::MakeMaker have these two lines added to
the beginning of the file during package build:

eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell

These two lines are being added by ExtUtils::MakeMaker and take care of
situations when the operating system is not able to deal with the information
following the #! declaration at the beginning and tries to run the script
under arbitrary shell (i.e. not perl as it should). 

Though these two lines are quite harmless (Linux is able to deal with #!
without any problems), having these two lines in the running code might
be a problem when the perl stack reports an error at some particular line,
but the line number information will be skewed (i.e. the line numbers
in spacewalk source code would not match).

Version-Release number of selected component (if applicable):
Spacewalk 0.6

How reproducible:
Always

Steps to Reproduce:
1. Look at the begining of the perl executables in your Spacewalk
installation
  
Actual results:
Some of the start with:
#!/usr/bin/perl

eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
    if 0; # not running under some shell


Expected results:
Should be just:
#!/usr/bin/perl

Additional info:
Adelton suggests adding these lines to every affected Makefile.PL:

package MY;
sub tools_other {
        my $self = shift;
        my $ret = $self->SUPER::tools_other(@_);
        $ret =~ s/^(FIXIN\b.+)$/## $1\nFIXIN = \$(PERLRUN) -e 1/m;
        return $ret;
}

Comment 1 Milan Zázrivec 2009-09-01 13:41:35 UTC
Packages affected:

spacewalk-web (dobby module)
perl-Satcon
spacewalk-setup

Comment 2 Milan Zázrivec 2009-09-01 13:52:41 UTC
spacewalk.git master: a9ee83d25fb5135caada005c68b66787308b4692

Comment 3 Miroslav Suchý 2009-12-07 12:02:56 UTC
Spacewalk 0.7 released.