unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Gregory Heytings <gregory@heytings.org>
Cc: 51523@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca
Subject: bug#51523: 29.0.50; gnus-mime-view-part-externally very slow
Date: Mon, 01 Nov 2021 18:46:14 +0200	[thread overview]
Message-ID: <83zgqnlt7t.fsf@gnu.org> (raw)
In-Reply-To: <6abcac838b521de77925@heytings.org> (message from Gregory Heytings on Mon, 01 Nov 2021 15:20:38 +0000)

> Date: Mon, 01 Nov 2021 15:20:38 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: 51523@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca
> 
> > . it uses the literal file name without even expanding it to an absolute file name, so the same FILE might mean different files if default-directory changes
> > . file names are generally not reliable enough for unique identifiers of files (think symlinks on all systems, letter-case and numerical tails on Windows, etc.), so we should at least use file-truename
> > . interning the file names could produce many unnecessary symbols in the global obarray
> >
> > Can we make the implementation more robust by fixing these?
> >
> 
> Sure, I'll do that.  Am I right that the first two points are fixed by 
> using file-truename, and that the third one would be fixed by using 
> (intern ... nil)?

Yes for the first two, but I don't understand the last one: using nil
as the 2nd argument is the same as omitting it, and they both stand
for the global obarray.  You need to specify a different obarray to
avoid "polluting" the global one.

> > The name of the function also doesn't reflect what it does: it only 
> > looks at the file's last modification time, so maybe at least "time" 
> > should be in the name?
> 
> Perhaps we could also check the file size?

If what we really want is to detect changes in contents, yes, I think
we should also check the size.

> > I also question the decision of testing modification time for equality: 
> > why not check if the time stamp is newer, and disregard the changes to 
> > an older time stamp?
> 
> This wouldn't be right I think, because the user might replace a file with 
> another one with an older modification time.

What would be the purpose of replacing with an older file, but keeping
the old time stamp?  And why is Gnus obligated to support such strange
use cases?  We can always tell the users to bump the file's time stamp
by 'touch'ing it, no?

> > When looking this way at this function, I ask myself whether extending 
> > file-newer-than-file-p to do this job would be a better idea?
> 
> You mean, using file-newer-than-file-p with two identical arguments? 

No, that'd be silly.  I mean something like

   (file-newer-than-file-p FILE t)

should have the special meaning of doing what file-has-changed-p does
now.

> > Or maybe I don't understand the general use case for this function.
> 
> The use case is the one of this bug: check whether a file has changed 
> since the last invocation of file-has-changed-p.

But then the time stamp and the size might not be enough.  What if the
inode changed, for example?

> It's used to solve this bug: mailcap-parse-mailcaps parses the
> mailcap files again only when at least one of them has changed.

Yes, but the function is supposed to be more general than just this
one case, and I'm asking about the more general use of it.





  parent reply	other threads:[~2021-11-01 16:46 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31  4:11 bug#51523: 29.0.50; gnus-mime-view-part-externally very slow Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-31 15:27 ` Lars Ingebrigtsen
2021-10-31 21:47   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-31 23:41     ` Gregory Heytings
2021-11-01  0:01       ` Lars Ingebrigtsen
2021-11-01  0:11         ` Gregory Heytings
2021-11-01  0:15           ` Lars Ingebrigtsen
2021-11-01  2:26             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-01 13:38               ` Lars Ingebrigtsen
2021-11-01  0:17         ` Gregory Heytings
2021-11-01  0:21           ` Lars Ingebrigtsen
2021-11-01  0:55             ` Gregory Heytings
2021-11-01  1:24               ` Gregory Heytings
2021-11-01  1:26                 ` Gregory Heytings
     [not found]               ` <6abcac838bb94542451d@heytings.org>
2021-11-01  9:28                 ` Gregory Heytings
     [not found]               ` <6abcac838bb83b0904d7@heytings.org>
     [not found]                 ` <6abcac838bad7cded4c5@heytings.org>
2021-11-01 12:26                   ` Gregory Heytings
2021-11-01 13:52                     ` Lars Ingebrigtsen
2021-11-01 15:00                     ` Eli Zaretskii
2021-11-01 15:20                       ` Gregory Heytings
2021-11-01 15:23                         ` Lars Ingebrigtsen
2021-11-01 16:46                         ` Eli Zaretskii [this message]
2021-11-01 16:59                           ` Lars Ingebrigtsen
2021-11-01 17:03                             ` Eli Zaretskii
2021-11-01 17:15                             ` Eli Zaretskii
2021-11-01 17:19                               ` Lars Ingebrigtsen
2021-11-01 17:21                                 ` Eli Zaretskii
2021-11-01 17:23                                   ` Lars Ingebrigtsen
2021-11-01 17:28                                     ` Eli Zaretskii
2021-11-01 17:34                                       ` Lars Ingebrigtsen
2021-11-01 18:17                                         ` Eli Zaretskii
2021-11-01 21:14                                         ` Gregory Heytings
2021-11-02 14:50                                           ` Lars Ingebrigtsen
2021-11-02 15:12                                           ` Eli Zaretskii
2021-11-03 10:45                                             ` Gregory Heytings
2021-11-03 12:02                                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-03 12:57                                                 ` Gregory Heytings
2021-11-03 13:17                                                   ` Eli Zaretskii
2021-11-03 13:27                                                     ` Gregory Heytings
2021-11-03 13:53                                                       ` Eli Zaretskii
2021-11-03 14:25                                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-03 14:26                                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-03 15:20                                                         ` Gregory Heytings
2021-11-03 18:56                                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-03 13:06                                               ` Eli Zaretskii
2021-11-01  0:04     ` Lars Ingebrigtsen

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=83zgqnlt7t.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=51523@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /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).