unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@twinsun.com>
Cc: knagano@sodan.org, emacs-devel@gnu.org, andrewi@gnu.org, jasonr@gnu.org
Subject: Re: init_buffer PWD fix
Date: Mon, 22 Apr 2002 16:21:30 -0700 (PDT)	[thread overview]
Message-ID: <200204222321.g3MNLUx07415@shade.twinsun.com> (raw)
In-Reply-To: <Pine.SUN.3.91.1020422140200.14580A-100000@is> (eliz@is.elta.co.il)

> From: Eli Zaretskii <eliz@is.elta.co.il>
> 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.

  reply	other threads:[~2002-04-22 23:21 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-21 20:15 init_buffer PWD fix Keiichiro Nagano
2002-04-21 23:00 ` Keiichiro Nagano
2002-04-22  6:18 ` Paul Eggert
2002-04-22  7:20   ` Keiichiro Nagano
2002-04-22 11:15     ` Eli Zaretskii
2002-04-22 21:16     ` Jason Rumney
2002-04-22  7:53   ` Eli Zaretskii
2002-04-22  7:01     ` Paul Eggert
2002-04-22  8:10       ` Eli Zaretskii
2002-04-22  7:22         ` Paul Eggert
2002-04-22 11:14           ` Eli Zaretskii
2002-04-22 23:21             ` Paul Eggert [this message]
2002-04-23  6:05               ` Eli Zaretskii
2002-04-22 21:21         ` Jason Rumney
2002-04-23  5:56           ` Eli Zaretskii
2002-04-23  6:14   ` MIYASHITA Hisashi
2002-04-23 11:00     ` Eli Zaretskii
2002-04-24 17:55       ` Richard Stallman
2002-04-24 18:14         ` MIYASHITA Hisashi
2002-04-23 17:45     ` Paul Eggert
2002-04-24  6:52       ` MIYASHITA Hisashi
2002-04-24  7:13         ` Paul Eggert
2002-04-24  7:45           ` MIYASHITA Hisashi
2002-04-24 11:12             ` Eli Zaretskii
2002-04-24 10:30               ` MIYASHITA Hisashi
2002-04-24 16:03                 ` Eli Zaretskii
2002-04-24 17:13                   ` MIYASHITA Hisashi
2002-04-24 18:10                     ` Eli Zaretskii
2002-04-24 18:25                       ` MIYASHITA Hisashi
2002-04-24 19:19                     ` Paul Eggert
2002-04-24 19:41                       ` MIYASHITA Hisashi
2002-04-24 19:59                         ` MIYASHITA Hisashi
2002-04-24 20:21                         ` Paul Eggert
2002-04-24 20:41                           ` MIYASHITA Hisashi
2002-04-24 21:01                             ` Paul Eggert
2002-04-24 21:23                               ` MIYASHITA Hisashi
2002-04-24 21:35                                 ` MIYASHITA Hisashi
2002-04-25 22:52                                 ` Stefan Monnier
2002-04-25  3:42                             ` Eli Zaretskii
2002-04-24 16:47                 ` Paul Eggert
2002-04-24 17:55                   ` MIYASHITA Hisashi
2002-04-24 10:38               ` MIYASHITA Hisashi
2002-04-24 16:08                 ` Eli Zaretskii
2002-04-24 16:10                 ` Eli Zaretskii
2002-04-24  7:55           ` MIYASHITA Hisashi
2002-04-24 11:07           ` Eli Zaretskii
2002-04-24 11:05         ` Eli Zaretskii
2002-04-24 10:31           ` MIYASHITA Hisashi
2002-04-24 16:05             ` Eli Zaretskii
2002-04-22  7:03 ` Eli Zaretskii
2002-04-22  6:49   ` Keiichiro Nagano
2002-04-22  8:01     ` Eli Zaretskii
2002-04-22  8:26       ` Keiichiro Nagano
2002-04-22 11:19         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200204222321.g3MNLUx07415@shade.twinsun.com \
    --to=eggert@twinsun.com \
    --cc=andrewi@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    --cc=knagano@sodan.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).