From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: init_buffer PWD fix Date: Mon, 22 Apr 2002 16:21:30 -0700 (PDT) Sender: emacs-devel-admin@gnu.org Message-ID: <200204222321.g3MNLUx07415@shade.twinsun.com> References: NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1019517875 922 127.0.0.1 (22 Apr 2002 23:24:35 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 22 Apr 2002 23:24:35 +0000 (UTC) Cc: knagano@sodan.org, emacs-devel@gnu.org, andrewi@gnu.org, jasonr@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16znAh-0000El-00 for ; Tue, 23 Apr 2002 01:24:35 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16znBb-00028G-00 for ; Tue, 23 Apr 2002 01:25:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16znAQ-0002E8-00; Mon, 22 Apr 2002 19:24:18 -0400 Original-Received: from alcor.twinsun.com ([198.147.65.9]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16zn7p-0001ts-00; Mon, 22 Apr 2002 19:21:37 -0400 Original-Received: from shade.twinsun.com ([192.54.239.27]) by alcor.twinsun.com (8.12.1/8.12.1) with ESMTP id g3MNLUPd006014; Mon, 22 Apr 2002 16:21:35 -0700 (PDT) Original-Received: (eggert@localhost) by shade.twinsun.com (8.11.6+Sun/8.11.6) id g3MNLUx07415; Mon, 22 Apr 2002 16:21:30 -0700 (PDT) Original-To: eliz@is.elta.co.il In-Reply-To: (eliz@is.elta.co.il) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3061 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3061 > From: Eli Zaretskii > Date: Mon, 22 Apr 2002 14:14:48 +0300 (IDT) > > > && dotstat.st_mtime == pwdstat.st_mtime > > > > This won't hurt much on non-broken systems, and it should fix the vast > > majority of the problem on systems where st_ino is broken. > > That would be unreliable, I think: on some Windows filesystems, the time > stamp of a directory is determined when the directory is created, and > then never changes I don't see why this would cause a problem. That code-change would make st_mtime be a double-check on st_ino. I think you're suggesting that st_mtime might be a somewhat random number that never changes, but that's great: that's just what we want here. > Perhaps it's high time we added a file-name comparison primitive to > Emacs. There are few other places where it could be useful. On Posix > platforms it could compare inodes, while other platforms will do their > own magic. I suggest looking at the following macros from GNU diffutils/src/system.h: same_file same_file_attributes especially the commentary. Unfortunately, st_ino is not reliable even on many platforms that nearly conform to POSIX, and this includes GNU/Linux. The best workaround for this problem depends on the application. For some applications, this is better: if (0 < same_file (&stat_buf[0], &stat_buf[1]) && same_file_attributes (&stat_buf[0], &stat_buf[1])) assume_files_are_same (); else assume_files_are_different (); and for other applications, this is better: if (0 < same_file (&stat_buf[0], &stat_buf[1])) assume_files_are_same (); else assume_files_are_different (); and there are other possibilities, too, alas. > > Hmm, I guess nobody told the author of Fcopy_file.... Perhaps there's > > an opportunity for code consolidation/cleanup there. > > Not sure what you mean here: the inode comparison is ifdef'ed away for > the Windows port, The inode comparison is done if (! defined WINDOWSNT && (!defined (DOS_NT) || __DJGPP__ > 1)). Sorry, I don't know the ins and outs of the Windows ports, but I assumed that there could be a non-WINDOWSNT port out there. Maybe I'm confusing Windows and DOS, though.