Bug 14694 - problem with perl on RH6.2
problem with perl on RH6.2
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: perl (Show other bugs)
6.2
i686 Linux
low Severity medium
: ---
: ---
Assigned To: Crutcher Dunnavant
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-07-26 21:10 EDT by John Wagner
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-07-27 16:35:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Wagner 2000-07-26 21:10:10 EDT
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 16:35:10 EDT
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-01 20:13:42 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.