delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/30/16:35:17

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3CCEFEFB.7F44402A@email.byu.edu>
Date: Tue, 30 Apr 2002 14:30:51 -0600
From: Eric Blake <ebb9 AT email DOT byu DOT edu>
Organization: BYU Student
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: 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 AT email DOT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019