Bug 66640 - File::stat::stat("/does/not/exist") generates extraneous output with -w
Summary: File::stat::stat("/does/not/exist") generates extraneous output with -w
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: perl
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Chip Turner
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-06-12 20:22 UTC by Jay Berkenbilt
Modified: 2007-04-18 16:43 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2002-06-12 20:22:48 UTC
Embargoed:


Attachments (Terms of Use)
patch to fix problem (286 bytes, patch)
2002-06-12 20:22 UTC, Jay Berkenbilt
no flags Details | Diff

Description Jay Berkenbilt 2002-06-12 20:22:12 UTC
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 20:22:41 UTC
Created attachment 60727 [details]
patch to fix problem

Comment 2 Chip Turner 2002-06-13 15:35:43 UTC
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.