This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in stat()?


I am running into weird behavior with stat().  I am getting the same
st_ino number for two distinct directories.  When using the jikes
compiler on the GNU Classpath project (the upstream source of libjava in
gcc), jikes is keying off of the inode number to determine where to
write .class files.  Because the inode number is a duplicate, jikes is
making the wrong choice, and then failing to compile.

I've simplified the demonstration of the problem as follows:
$ cd /tmp
$ cat blah.cpp
#include <sys/stat.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    struct stat status;
    int result;
    result = stat("./java/net", &status);
    printf("net (%d): %d, %d\n", result, status.st_dev, status.st_ino);
    result = stat("./java/nio", &status);
    printf("nio (%d): %d, %d\n", result, status.st_dev, status.st_ino);
    return 0;
}
$ g++ blah.cpp -o blah
$ cd ~/cp/lib
$ rm -Rf java
$ mkdir java java/net
$ /tmp/blah
net (0): 4096, 547532427
nio (-1): 0, 0
$ mkdir java/nio
$ /tmp/blah
net (0): 4096, 547532427
nio (0): 4096, 547532427
$ cd /tmp
$ rm -Rf java
$ mkdir java java/net java/nio
$ /tmp/blah
net (0): 4096, 314387057
nio (0): 4096, 311437853

Notice that in the /tmp directory, stat() correctly gave different
st_ino values for the two newly created directories.  However, in
~/cp/lib, BOTH directories are given the inode of 547532427, even though
they are distinct objects.

Is there a bug in the implementation of <sys/stat.h>?  I am running the
latest version of cygwin (1.3.10-1) and gcc (2.95.3-5) unmodified, with
the root directory located at d:\cygwin on a Win98 box.

-- 
This signature intentionally left boring.

Eric Blake             ebb9@email.byu.edu
  BYU student, free software programmer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]