Bug 66640 - File::stat::stat("/does/not/exist") generates extraneous output with -w
File::stat::stat("/does/not/exist") generates extraneous output with -w
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: perl (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Chip Turner
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-06-12 16:22 EDT by Jay Berkenbilt
Modified: 2007-04-18 12:43 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-06-12 16:22:48 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)
patch to fix problem (286 bytes, patch)
2002-06-12 16:22 EDT, Jay Berkenbilt
no flags Details | Diff

  None (edit)
Description Jay Berkenbilt 2002-06-12 16:22:12 EDT
Description of Problem:

File::stat::stat(), when called on a file that does not exist, causes a message
to get printed to stderr if -w was passed to perl.  It should just return undef.
 This problem did not exist in RedHat 7.2.
 
Version-Release number of selected component (if applicable):

perl-5.6.1-34.99.6


How Reproducible:

always

Steps to Reproduce:
1. perl -w -e 'use File::stat; stat("/does/not/exist");'

Actual Results:

stat() on unopened filehandle /does/not/exist at
/usr/lib/perl5/5.6.1/File/stat.pm line 49.

Expected Results:

No output should have been generated.

Additional Information:
	
No doubt perl 5.6.1 is checking for something that 5.6.0 didn't check.  The
stat.pm code is unchanged.  This patch to /usr/lib/perl/5.6.1/File/stat.pm fixes
the problem.  Locally disabling $^W is no worse that locally disabling strict
'refs', which the code already does.

I'm including it inline since it's so small, but I'll also attach it as an
attached file.

--- stat.pm~    Mon Apr  1 12:28:01 2002
+++ stat.pm     Wed Jun 12 16:16:21 2002
@@ -45,6 +45,7 @@
     my $st = populate(CORE::stat $arg);
     return $st if $st;
     no strict 'refs';
+    local($^W) = 0;
     require Symbol;
     return populate(CORE::stat \*{Symbol::qualify($arg)});
 }
Comment 1 Jay Berkenbilt 2002-06-12 16:22:41 EDT
Created attachment 60727 [details]
patch to fix problem
Comment 2 Chip Turner 2002-06-13 11:35:43 EDT
this is fixed in perl 5.8.0 in Rawhide.  unlikely to fix in 7.2 or 7.3, however,
unless an errata becomes necessary.

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