LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
LARONDE Thierry <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Sat, 29 Jul 2023 08:36:11 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (50 lines)
On Fri, Jul 28, 2023 at 07:53:19PM +0100, David Carlisle wrote:
> On 28/07/2023 18:57, LARONDE Thierry wrote:
> 
> but if \filesize{README} and \mdfivesum{README} refer to a different
> file than \input{README} then they are not reliably useful for their
> main use cases.

It shall be noted that as long as a filename is subject to different
behavior (adding an extension or not; I'm unclear now about the fact
that \input could try to input README without the ".tex" extension if
not found, deviating from m.537---and even \openin is adding
inconditionnally a ".tex" if no extension: see m.1275).

But at the LaTeX (macro) level (but even at the binary level: no
atomicity; but the time gap is increased at macro level), if the
behavior is not definite, you have a race condition. The first
\filesize{README} could first fail to read a README.tex then succeed
to read a README (without extension) but the \input following,
because something in the system has created a README.tex in the
meantime, would be opening _not the same file_.

So the behavior has to be definite and the filename fixed or there
should be the mean to store the absolute pathname of the file found
first and to use only this pathname without beating around the bush
anymore for any other use or, as is done in code, to open it (without
filling the buffer at first and not close it) and to refer to this
handle further in the code.

Or there is a consistency/security problem.

The first and not totally satisfactory solution is to impose an
extension (".tex" being added if no extension to the name) without
alternatives. But this ensures only the filename, not that another
request will not find another file with the same filename earlier in the
path when searching...

So:

1) Is LaTeX expecting to be able to "\input" a file without extension?
For me, "\input" could only be a tex file; so the extension was
mandatory...

2) What is done to ensure that the same file, at least by its absolute
pathname, is opened when opening it several times?
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C

ATOM RSS1 RSS2