GNU bug report logs -
#57129
29.0.50; Improve behavior of conditionals in Eshell
Previous Next
Reported by: Jim Porter <jporterbugs <at> gmail.com>
Date: Thu, 11 Aug 2022 02:44:02 UTC
Severity: normal
Found in version 29.0.50
Done: Jim Porter <jporterbugs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #83 received at 57129 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 16 Aug 2022 09:54:25 -0700
> Cc: bug-gnulib <at> gnu.org, larsi <at> gnus.org, 57129 <at> debbugs.gnu.org,
> jporterbugs <at> gmail.com, Bruno Haible <bruno <at> clisp.org>
> From: Paul Eggert <eggert <at> cs.ucla.edu>
>
> On 8/16/22 09:25, Eli Zaretskii wrote:
> > The programmer didn't
> > expect that because it is natural to expect each call to a function
> > that creates a temporary file to create a file under a new name, not
> > reuse the same name.
>
> Regardless of whether the programmer expects a random name or a
> predictable-but-unique name, there are only a finite number of names to
> choose from so the programmer must take into account the possibility
> that the chosen name clashes with names that the programmer would prefer
> not to be chosen.
Then what is this comment and the following assertion in Bruno's code
about?
/* With 6 'X' and a good pseudo-random number generator behind the scenes,
the probability of getting the same file name twice in a row should be
1/62^6 < 1/10^10. */
ASSERT (strcmp (filename1, filename2) != 0);
That "finite number" of 62^6 sounds pretty close to infinity to me!
> This means an Emacs patch such as [1] is needed regardless of whether
> Gnulib's gen_tempname is changed to be more random than it is. Although
> it's true that the bug fixed by [1] is less likely if gen_tempname
> generates more-random names, the bug can occur no matter what we do
> about gen_tempname.
No, sorry. I object to this patch, because it hides the problem under
the carpet. That there's a file-visiting buffer that records the name
of a temporary file is just one case where this issue gets in the way.
The general problem is still there. And it isn't an Emacs problem, so
Emacs is not the place to solve it.
Therefore, if there's no intention to fix this in Gnulib, I'm going to
update the documentation of make-temp-file so that Emacs users and
programmers will be informed about that and will be careful enough to
side-step these issues in all the situations. (Not that I understand
why won't Gnulib provide consistent behavior on all platforms, but I
guess it's above my pay grade.)
This bug report was last modified 2 years and 129 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.