From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ericblake@comcast.net (Eric Blake) Newsgroups: gmane.os.cygwin,gmane.emacs.devel Subject: Re: New platform independent problem Date: Fri, 20 Jan 2006 17:01:37 +0000 Message-ID: <012020061701.4999.43D11771000C3BE00000138722058861720A050E040D0C079D0A@comcast.net> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1137776594 15012 80.91.229.2 (20 Jan 2006 17:03:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2006 17:03:14 +0000 (UTC) Cc: cygwin@cygwin.com, henman@it.to-be.co.jp, emacs-devel@gnu.org Original-X-From: cygwin-return-117775-goc-cygwin=m.gmane.org@cygwin.com Fri Jan 20 18:03:12 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 1Ezze8-0006OZ-QH for goc-cygwin@gmane.org; Fri, 20 Jan 2006 18:01:58 +0100 Original-Received: (qmail 687 invoked by alias); 20 Jan 2006 17:01:46 -0000 Original-Received: (qmail 670 invoked by uid 22791); 20 Jan 2006 17:01:44 -0000 X-Spam-Check-By: sourceware.org Original-Received: from rwcrmhc14.comcast.net (HELO rwcrmhc12.comcast.net) (216.148.227.89) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 20 Jan 2006 17:01:40 +0000 Original-Received: from rmailcenter15.comcast.net ([204.127.197.125]) by comcast.net (rwcrmhc14) with SMTP id <200601201701380140021g8oe>; Fri, 20 Jan 2006 17:01:38 +0000 Original-Received: from [128.170.36.44] by rmailcenter15.comcast.net; Fri, 20 Jan 2006 17:01:37 +0000 Original-To: Eli Zaretskii 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:73995 gmane.emacs.devel:49322 Archived-At: > You could have a flag that, if set, will instruct readdir to do the > expensive processing. Applications that need the real inode will set > that flag. And then we would have to change applications to call this nonstandard entry point at the beginning of their program to set the flag. As long as we are editing programs, we might as well teach them to respect a sentinel of -1 without having to resort to adding a nonstandard entry point. > > POSIX permits implementations to not have d_ino. In other words, when it > > comes to dirent.h, cygwin is fully POSIX-compliant to not have a d_ino > > member, and applications had better not assume that d_ino exists. > > That may be so, but I don't think I've seen packages that check > whether d_ino exist in their configury. They assume it does, AFAICS. Most GNU packages DO check - coreutils, findutils, bash, tar, etc. And since POSIX makes it optional, ALL portable programs SHOULD check for the existance of d_ino. I was actually surprised that emacs does not. > > > > It's bad mantra for an application to use a symbol that starts with > > > "__", since those symbols are reserved for the library implementation. > > > > My understanding is that leading __ is reserved for the IMPLEMENTATION in > > general, not just the library implementation; cygwin is part of the > > implementation. > > I was responding to a suggestion to use __deprecated_d_ino in the > Emacs code. Emacs is certainly _not_ a part of implementation. Correct. But that wouldn't help you anyways - if you are using the version of cygwin's dirent.h that spells it __deprecated_d_ino, then you are also using the version of cygwin's version.h that informs the cygwin1.dll to fill that entry with 0 rather than the hash. In other words, cygwin is smart enough to know whether your application was compiled with d_ino existance, and does not even bother creating a non-zero __deprecated_d_ino. > > > What platforms use d_ino==0 to mean an empty entry, rather than an entry > > where st_ino must be checked? > > I see it in Emacs, Corinna shows another example from rcp and scp. And after further research, I have found that coreutils is inconsistent; backupfile.c does it one way (0 means skip the entry, but don't care if d_ino matches st_ino) while pwd.c does it another way (0 means fall back to stat, so that result always matches st_ino, and skip entry if stat also failed). So now is the time to pick the behavior that is easiest to turn into a reasonable coding standard across all GNU platforms (and probably to add a gnulib module that does the d_ino magic for you). -- Eric Blake