develooper Front page | perl.perl5.porters | Postings from May 2004

[PATCH] Re: [perl #29581] glob() misses a lot of matches

Thread Next
LAUN Wolfgang
May 17, 2004 01:53
[PATCH] Re: [perl #29581] glob() misses a lot of matches
Message ID:
Marek Rouchal wrote on 14 May 2004 12:42:22:

> In a somewhat complex file structure, Perl's glob() fails to find a lot
> of matches, which are easily listed with e.g. tcsh's internal glob,
> as the following example shows (note: my UNIX account is neither 
> lmadmin nor in the lmadmin group, see ls -l output below):

Marek: The "note:..." has been a good hint. If you check the permissions of
subdirectories in and below /opt/lic/share/license/site/cadadm, you'll 
find at least one where you don't have access. In your mail I've seen
this one:

> $ ls -la /opt/lic/share/license/site/cadadm/vnavigator_eval/
> drwxr-s---   2 lmadmin  lmadmin     4096 Nov 12  2003 SAVE-TMP/

If some directory cannot be opened due to permission denied, 
File::Glob::bsd_glob exits immediately, returning the unsorted
results found up to this point; you might compare this with an
unsorted ls of the directory. Also, $! is set accordingly.

To get a behaviour that is identical to the shell, EACCES must be
ignored, too, in the bsd_glob error function.

Kind regards

--- ext/File/Glob/Glob.xs~	Fri Aug 23 00:59:49 2002
+++ ext/File/Glob/Glob.xs	Sun May 16 08:47:01 2004
@@ -21,7 +21,7 @@
 errfunc(const char *foo, int bar) {
-  return !(bar == ENOENT || bar == ENOTDIR);
+  return !(bar == EACCES || bar == ENOENT || bar == ENOTDIR);

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About