Bug 14694 - problem with perl on RH6.2
Summary: problem with perl on RH6.2
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: perl
Version: 6.2
Hardware: i686
OS: Linux
low
medium
Target Milestone: ---
Assignee: Crutcher Dunnavant
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-07-27 01:10 UTC by John Wagner
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-07-27 20:35:12 UTC
Embargoed:


Attachments (Terms of Use)

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.


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