From EDeloye at rfmd.com Thu Mar 6 07:37:25 2008 From: EDeloye at rfmd.com (Ed Deloye) Date: Thu, 6 Mar 2008 10:37:25 -0500 Subject: [Raleigh-talk] lstat/stat problem Message-ID: <3EA9CDD20D8E694F92C01B7BA7FC5AC80C9070B2@mail.internal.rfmd.com> 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", 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/95c1af79/attachment.html From EDeloye at rfmd.com Thu Mar 6 07:56:07 2008 From: EDeloye at rfmd.com (Ed Deloye) Date: Thu, 6 Mar 2008 10:56:07 -0500 Subject: [Raleigh-talk] lstat/stat problem In-Reply-To: <3EA9CDD20D8E694F92C01B7BA7FC5AC80C9070B2@mail.internal.rfmd.com> References: <3EA9CDD20D8E694F92C01B7BA7FC5AC80C9070B2@mail.internal.rfmd.com> Message-ID: <3EA9CDD20D8E694F92C01B7BA7FC5AC80C9070EE@mail.internal.rfmd.com> 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", 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