Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 8 Feb 2005 18:42:11 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com, newlib AT sources DOT redhat DOT com Subject: Re: several more bugs found by coreutils Message-ID: <20050208174211.GA3178@cygbert.vinschen.de> Reply-To: newlib AT sources DOT redhat DOT com, cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com, newlib AT sources DOT redhat DOT com References: <020120052058 DOT 2301 DOT 41FFED5A000D5EEC000008FD22007614380A050E040D0C079D0A AT comcast DOT net> <20050202100718 DOT GA7767 AT cygbert DOT vinschen DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050202100718.GA7767@cygbert.vinschen.de> User-Agent: Mutt/1.4.2i X-IsSubscribed: yes On Feb 2 11:07, Corinna Vinschen wrote: > On Feb 1 20:58, Erik Blake wrote: > > Further coreutils-5.3.0 debugging turned up more POSIX bugs in cygwin: > > > > defines struct passwd with the pw_uid and pw_gid members as ints, although POSIX requires uid_t and gid_t. > > http://www.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html > > include/pwd.h is a newlib file. However, I was pretty happy that pw_uid > and pw_gid were defined as int, when we changed uids and gids from 16 to > 32 bits. It was the one file which wasn't necessary to change. > > We could just redefine struct passwd to use uid_t and gid_t, but this > would break (very very very very unlikely) builds of Cygwin using > sources of versions before 1.5.0. In other words, old Cygwin sources > using 16 bit uids/gids would go down hell. > > Personally, I think I can live with that, but I would like to hear if > there's any good reason to build historic versions (say, b20) with a > recent newlib. > > > defines utimes with non-const second parameter, although POSIX requires it to be const; likewise for utime in (deferred to ). Additionally, both utimes() and utime() are required to touch file ctime on success. > > http://www.opengroup.org/onlinepubs/009695399/functions/utimes.html > > [snip] > > That should be easy to change in sys/time.h. > As far as the implementation of utime/utimes is affected, I already > changed it to set st_ctime. I have attached a patch to newlib this time. Thinking about that for a while, I'm pretty sure that it doesn't make sense to build old 32 bit versions of Cygwin with recent newlib versions. So I'm opting for having a clean pwd.h. The below patch changes the definitions of struct passwd and utimes(2) according to SUSv3. Corinna * libc/include/pwd.h (struct passwd): Change pw_uid and pw_gid members to uid_t and gid_t according to SUSv3. * libc/include/sys/time.h (utimes): Change second parameter to const according to SUSv3. Index: libc/include/pwd.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/pwd.h,v retrieving revision 1.2 diff -p -u -r1.2 pwd.h --- libc/include/pwd.h 9 Mar 2003 21:08:51 -0000 1.2 +++ libc/include/pwd.h 8 Feb 2005 17:37:22 -0000 @@ -50,8 +50,8 @@ extern "C" { struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* encrypted password */ - int pw_uid; /* user uid */ - int pw_gid; /* user gid */ + uid_t pw_uid; /* user uid */ + gid_t pw_gid; /* user gid */ char *pw_comment; /* comment */ char *pw_gecos; /* Honeywell login info */ char *pw_dir; /* home directory */ Index: libc/include/sys/time.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/sys/time.h,v retrieving revision 1.4 diff -p -u -r1.4 time.h --- libc/include/sys/time.h 21 Apr 2001 03:22:47 -0000 1.4 +++ libc/include/sys/time.h 8 Feb 2005 17:37:22 -0000 @@ -72,7 +72,7 @@ struct itimerval { int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); -int _EXFUN(utimes, (const char *__path, struct timeval *__tvp)); +int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp)); int _EXFUN(getitimer, (int __which, struct itimerval *__value)); int _EXFUN(setitimer, (int __which, const struct itimerval *__value, struct itimerval *__ovalue)); -- Corinna Vinschen Cygwin Project Co-Leader Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/