[Raleigh-talk] lstat/stat problem
Ed Deloye
EDeloye at rfmd.com
Thu Mar 6 07:56:07 PST 2008
And a big Never Mind...
I was looking at the explicit lstat call and ignoring the implicit stat
call in the line
return unless ( -f $_ or -l $_ );
Removing the unless statement eliminated the problem.
As Pogo said, for those of you old enough to remember, "We have met the
enemy... and he is us"
Regards,
Ed
From: raleigh-talk-bounces+edeloye=rfmd.com at pm.org
[mailto:raleigh-talk-bounces+edeloye=rfmd.com at pm.org] On Behalf Of Ed
Deloye
Sent: Thursday, March 06, 2008 10:37 AM
To: raleigh-talk at pm.org
Subject: [Raleigh-talk] lstat/stat problem
I am having a problem with lstat not working the way I think it should.
Here is the test script that I created to verify what is happening.
#!/usr/local/bin/perl
use File::Find;
find( \&wanted,
"/projects/lcasas/tsmc/tsmc90lp/cds/xor/ScottsValley_s_8906" ) ;
sub wanted {
no warnings;
my ( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev,
$size, $atime, $mtime, $ctime );
my ( $sec, $min, $hour, $mday, $mon, $timeyear );
return unless ( -f $_ or -l $_ );
( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
$atime, $mtime, $ctime ) = lstat($_);
( $sec, $min, $hour, $mday, $mon, $timeyear ) =
localtime($mtime);
$timeyear += 1900;
printf
"%s;%s;%s;%s-%02d-%02d;%02d:%02d:%02d;%d\n",
$File::Find::name, $uid, $gid,
$timeyear, ++$mon, $mday, $hour, $min, $sec, $size;
}
I ran strace and got this output (truncated):
lstat("/projects/lcasas/tsmc/tsmc90lp/cds/xor/ScottsValley_s_8906",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chdir("/projects/lcasas/tsmc/tsmc90lp/cds/xor/ScottsValley_s_8906") = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
getdents64(3, /* 7 entries */, 32768) = 248
getdents64(3, /* 0 entries */, 32768) = 0
close(3) = 0
stat("ScottsValley_s_8906.gds", <unfinished ...>
The lstat function is called but a stat is invoked. Can anyone shed any
light on what is happening?
Thanks for your help,
Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/raleigh-talk/attachments/20080306/a253c042/attachment-0001.html
More information about the Raleigh-talk
mailing list