Bug 14694

Summary: problem with perl on RH6.2
Product: [Retired] Red Hat Linux Reporter: John Wagner <jwagner>
Component: perlAssignee: Crutcher Dunnavant <crutcher>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 6.2Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-07-27 20:35:12 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:

Description John Wagner 2000-07-27 01:10:10 UTC
I am trying to run following perl script on Red Hat 6.2 (as shipped) and
with perl perl-5.00503-10.  The script name is showdisk.pl which is being
executed as ./showdisk.pl.
The perl binary is in the standard place /usr/bin/perl.

#! /usr/bin/perl

foreach $_ ( `df -k | grep -v "Filesystem"` )
{
  local($device, $size, $used, $free, $percent, $mount);

  ($device, $size, $used, $free, $percent, $mount) = split(/\s+/);
  chop($percent);
  print "$percent\n";
}

This script won't run and exits with an error "bash: ./showdisk.pl: No such
file or directory"
When run with "strace ./showdisk.pl" I am getting error message:
execve("./showdisk.pl", ["./showdisk.pl"], [/* 19 vars */]) = 0
strace: exec: No such file or directory

However the script runs well after I add an option to perl, that is "#!
/usr/bin/perl -w"

The script after the modification:
#! /usr/bin/perl -w

foreach $_ ( `df -k | grep -v "Filesystem"` )
{
  local($device, $size, $used, $free, $percent, $mount);

  ($device, $size, $used, $free, $percent, $mount) = split(/\s+/);
  chop($percent);
  print "$percent\n";
}

I think that it is a bug since this script use to work previously in
addition I had some people to look at the script too.  Also if you look at
the strace output it seems that "exec" can not find a script or the perl
command.  Yes, the script does have rwx permission.

Comment 1 Nalin Dahyabhai 2000-07-27 20:35:10 UTC
Cutting and pasting this to a file doesn't let me reproduce this.  You might
try removing the space between the "#!" and the "/usr/bin/perl", as that
is not recommended practice.

Comment 2 John Wagner 2000-08-02 00:13:42 UTC
Removing the space between #! and /usr/bin/perl -w does not work -- I got the
same result.  However, after your comment about cutting and pasting I found out
that the return characters are causing the problem with the script.  After
cleaning the scripts from return characters the script is working without the
help of '-w' option to perl.  I have cleaned up the script with following
command "tr '\r' ' ' < showdisk.pl > after.pl". showdisk.pl is the original
script (the problem script).  It's a programmer error not a bug.
Thank you.