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

Re: [perl #84590] Inconsistent stat() implementation wrt inode numbers

Thread Previous
From:
David Leadbeater
Date:
March 8, 2011 10:58
Subject:
Re: [perl #84590] Inconsistent stat() implementation wrt inode numbers
Message ID:
8FB908A5-B6E8-4D06-A67B-023BF02A66A1@dgl.cx
On 22 Feb 2011, at 13:00, Dave Mitchell wrote:
[...]
>> It appears that perl treats ino_t as signed whereas it is overwhelmingly
>> defined as unsigned:
> 
> So, would this be as simple as changing mPUSHi(PL_statcache.st_ino)
> to mPUSHu() in pp_stat?

To fix this particular issue, yes, however on Linux (and probably similar on other systems) the size of ino_t depends on what _FILE_OFFSET_BITS is set to (i.e. if perl is configured with large file support), so it probably should take that into account too.

David

PS, on 32-bit x86 Linux:
$ echo -e '#include <stdio.h>\n#include <sys/types.h>\nmain(){printf("%lu\\n", sizeof(ino_t));}' > i.c && make i CFLAGS=-D_FILE_OFFSET_BITS=64 && ./i
8
$ echo -e '#include <stdio.h>\n#include <sys/types.h>\nmain(){printf("%lu\\n", sizeof(ino_t));}' > i.c && make i && ./i
4


Thread Previous


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