Change 27515 by [EMAIL PROTECTED] on 2006/03/16 12:01:10

        require should ignore directories found when searching @INC not just
        die as soon as it finds one.  It should for instance be possible to
        for require "File" to read the file "./File" even if there happens to
        be a "File" directory in perl's standard library.
        
        This fixes the RT #24404 fix in change 26373.

Affected files ...

... //depot/perl/pp_ctl.c#532 edit
... //depot/perl/t/comp/require.t#40 edit

Differences ...

==== //depot/perl/pp_ctl.c#532 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#531~27483~    2006-03-12 07:12:29.000000000 -0800
+++ perl/pp_ctl.c       2006-03-16 04:01:10.000000000 -0800
@@ -3011,14 +3011,10 @@
 {
     Stat_t st;
     const int st_rc = PerlLIO_stat(name, &st);
-    if (st_rc < 0) {
+    if (st_rc < 0 || S_ISDIR(st.st_mode) || S_ISBLK(st.st_mode)) {
        return NULL;
     }
 
-    if(S_ISDIR(st.st_mode) || S_ISBLK(st.st_mode)) {
-       Perl_die(aTHX_ "%s %s not allowed in require",
-           S_ISDIR(st.st_mode) ? "Directory" : "Block device", name);
-    }
     return PerlIO_open(name, mode);
 }
 

==== //depot/perl/t/comp/require.t#40 (xtext) ====
Index: perl/t/comp/require.t
--- perl/t/comp/require.t#39~26892~     2006-01-18 02:06:24.000000000 -0800
+++ perl/t/comp/require.t       2006-03-16 04:01:10.000000000 -0800
@@ -183,7 +183,7 @@
 my $r = "threads";
 eval { require $r };
 $i++;
-if($@ =~ /Directory .*threads not allowed in require/) {
+if($@ =~ /Can't locate threads in [EMAIL PROTECTED]/) {
     print "ok $i\n";
 } else {
     print "not ok $i\n";
End of Patch.

Reply via email to