several more bugs found by coreutils
Tue Feb 1 20:58:00 GMT 2005

Further coreutils-5.3.0 debugging turned up more POSIX bugs in cygwin:

<pwd.h> defines struct passwd with the pw_uid and pw_gid members as ints, although POSIX requires uid_t and gid_t.

<sys/time.h> defines utimes with non-const second parameter, although POSIX requires it to be const; likewise for utime in <utime.h> (deferred to <sys/utime.h>).  Additionally, both utimes() and utime() are required to touch file ctime on success.

readdir() populates the dirent.d_ino member with a hashed filename, regardless of whether the file is located on NTFS and actually has an inode.  This means that readdir() and stat()'s idea of inode are different, and this breaks the pwd program (it tries to find a directory member in ".." using readdir that has the same node as "." according to stat).

#include <unistd.h>
#include <stdio.h>
#include <sys/resource.h>
#include <errno.h>
#include <dirent.h>
#include <sys/stat.h>
int main(int argc, char**argv)
   int i;
   DIR* dir;
   struct dirent* ent;
   struct stat st;
   dir = opendir("d");
   while ((ent = readdir(dir)))
      printf("Found `%s', inode %llu\n", ent->d_name, ent->d_ino);
   stat("d", &st);
   printf("`.' inode should have been %llu\n", st.st_ino);
   stat(".", &st);
   printf("`..' inode should have been %llu\n", st.st_ino);
   return 0;

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list