From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Corinna Vinschen Newsgroups: gmane.os.cygwin,gmane.emacs.devel Subject: Re: New platform independent problem Date: Fri, 20 Jan 2006 15:14:12 +0100 Message-ID: <20060120141412.GA11284@calimero.vinschen.de> References: <43D0797C.1030604@it.to-be.co.jp> <20060120122559.GZ8318@calimero.vinschen.de> <43D0ECA5.3030506@byu.net> Reply-To: cygwin@cygwin.com, emacs-devel@gnu.org, Eli Zaretskii NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137766502 7690 80.91.229.2 (20 Jan 2006 14:15:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2006 14:15:02 +0000 (UTC) Original-X-From: cygwin-return-117761-goc-cygwin=m.gmane.org@cygwin.com Fri Jan 20 15:15:00 2006 Return-path: Envelope-to: goc-cygwin@gmane.org Original-Received: from sourceware.org ([209.132.176.174]) by ciao.gmane.org with smtp (Exim 4.43) id 1Ezx1z-00052f-Dh for goc-cygwin@gmane.org; Fri, 20 Jan 2006 15:14:23 +0100 Original-Received: (qmail 16489 invoked by alias); 20 Jan 2006 14:14:17 -0000 Original-Received: (qmail 16477 invoked by uid 22791); 20 Jan 2006 14:14:16 -0000 X-Spam-Check-By: sourceware.org Original-Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Fri, 20 Jan 2006 14:14:15 +0000 Original-Received: by calimero.vinschen.de (Postfix, from userid 500) id 9DC18544001; Fri, 20 Jan 2006 15:14:12 +0100 (CET) Original-To: cygwin@cygwin.com, emacs-devel@gnu.org, Eli Zaretskii Mail-Followup-To: cygwin@cygwin.com, emacs-devel@gnu.org, Eli Zaretskii Content-Disposition: inline In-Reply-To: <43D0ECA5.3030506@byu.net> User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Xref: news.gmane.org gmane.os.cygwin:73981 gmane.emacs.devel:49318 Archived-At: [Resent to add emacs-devel and Eli on the "To:" list] On Jan 20 06:59, Eric Blake wrote: > According to Corinna Vinschen on 1/20/2006 5:25 AM: > > I'm also having a problem right now building rcp and scp due to the > > missing d_ino. OTOH, the d_ino member is not required by POSIX, but > > only in X/Open compliant OSes, see > > > > http://www.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html > > http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap02.html#tag_02_01_04 > > > > So, portable applications shouldn't rely on d_ino. > > Is there a compromise here? Many applications that look at d_ino also > check whether the d_ino member is 0, in which case they fall back on > st_ino. For example, coreutils's pwd.c contains: > > #define NOT_AN_INODE_NUMBER 0 > #ifdef D_INO_IN_DIRENT > # define D_INO(dp)((dp)->d_ino) > #else > /* Some systems don't have inodes, so fake them to avoid lots of ifdefs. */ > # define D_INO(dp) NOT_AN_INODE_NUMBER > #endif > > Then later on, it can blindly do: > > ino_t ino = D_INO(dp); > if (ino == NOT_AN_INODE_NUMBER) > { > if (lstat (dp->d_name, &ent_sb) < 0) > continue; /* Skip any entry we can't stat. */ > ino = ent_sb.st_ino; > } Well, other applications like rcp and scp just use d_ino to check for 0 and to ignore it entirely then, like this: while (readdir) { if (d_ino == 0) continue; [...action...] } This means, if d_ino is 0, it breaks scp and rcp and some other applications. If it's always some arbitrary non-zero value, it breaks pwd from coreutils and some other applications. If it's available and doesn't match st_ino, it breaks another set of applications. If it's not available at all, it breaks all applications asking for d_ino in any way. > Cygwin would then set it to 0 on WinNT and 2k (where it is > prohibitively expensive to determine a real value), set it to the hash on > Win9x and ME (since st_ino is also the hash on those platforms), and set > it to the actual st_ino value on WinXP and beyond (since the API exists). That would be a better solution, though it would still not be ok to set it to 0 on NT4 and 2K. Maybe we should think about another way to generate a hash value and use it on all platforms. I'm just at a loss right now, to come up with another hash generation method, which would allow to get the same inode number for hardlinks :-( Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat