develooper Front page | perl.perl5.porters | Postings from March 2001

File::Find, shortcircuiting && and undefined values

From:
Hans Ecke
Date:
March 10, 2001 08:03
Subject:
File::Find, shortcircuiting && and undefined values
Message ID:
Pine.A41.4.33.0103100133330.90688-100000@slate.Mines.EDU
Dear Mr. Sarathy,

in File::Find.pm, which you authored, I get the following error:

warning: Use of uninitialized value in join at
/usr/lib/perl5/5.6.0/File/Find.pm line 261.

Line 261 of File::Find reads:
if ($full_check && $SLnkSeen{$DEV, $INO}++) {

It seems the join in this line comes from the {$DEV,$INO} which is
internally interpreted as a
join $separator, ($DEV,$INO)

Debugging the offending script showed the following:
   * $full_check is 1 (true)
   * both $DEV and $INO are undefined

Obviously this was not supposed to happen. I looked around at which file
this condition occured. It is
/home/commonground/apps/gtksql-0.3/COPYING. The permissions are as
follows:

/home/commonground/apps> ls -l
drwxrw----    4 root     commongr     4096 Jan 12 12:20 gtksql-0.3/

/home/commonground/apps/gtksql-0.3> ls -l
-rw-rw----    1 root     commongr    18007 Dec  4  1999 COPYING

I, the caller of the script, am a member of the group commongr, but am
not user root. I don't understand why an lstat(file) needs "x"
permission for the directory the files lives in,  but it seems the case.
After a "chmod g+x /home/commonground/apps/gtksql-0.3" everything works
just fine.

A fix is the following line at the top of FollowSymlinks() after the
lstat:
    return $AbsName if (!defined $DEV) || (!defined $INO);

or just test for -x in _find_dir_symlnk().

I hope I made the problem clear. If not, please write.

I also hope this is not a known problem. I browsed through the mailing
lists but didn't see a reference. If I missed it, please accept my
apologies.

I'm running perl 5.6 on i686 Redhat Linux 7.0.

Sincerely

Hans Ecke

-- 
"But I don't want to go among mad people," Alice remarked.
"Oh, you can't help that," said the cat. "We're all mad here."

Hans Ecke                      hans@ecke.ws
Department of Geophysics       http://hans.ecke.ws
Colorado School of Mines       Tel: (USA) 303-273-3733
Golden, Colorado               Fax: (USA) 303-384-2125



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About