bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Warn user when 2 files conflict on a case insensitive fs


From: Patrice Dumas
Subject: Re: [PATCH] Warn user when 2 files conflict on a case insensitive fs
Date: Mon, 9 Jan 2023 09:57:45 +0100

On Mon, Jan 09, 2023 at 08:03:52AM +0100, Torbjorn SVENSSON wrote:
> 
> 
> On 2023-01-07 16:05, Patrice Dumas wrote:
> > That'd be nice, indeed.  Beware that the issue can happen between
> > redirection pages, and also between regular elements and redirection
> > pages (but not between regular elements).
> 
> AFAICT, the colliding redirection pages should be fairly simple to detect,
> but how to detect and handle a collision between a redirection page and
> regular element?
> Would it be okay to check if there is a file on the file system, with the
> same name in lower case, before generating the redirection page?
> The assumption here is that everything else is already generated when the
> redirection pages are to be generated.

The file names can be known well before they are written, they are set
at the beginning because that is necessary for references.  In a first
step file names are associated to nodes/anchors/float labels  and
sections, in _set_root_commands_targets_node_files.  Such names are not
necessarily used for output HTML pages file names, it depends on how the
document is split, and the nature of the command (anchors only have
redirection pages, for instance).

The file names are then set for each element (to simplify, a
node/section) in _html_set_pages_files with the help of functions in
Texinfo/Convert/Converter.pm such as set_tree_unit_file or
set_file_path.

Redirection pages are output after the other elements, but it could very
well be the other way around, as after calling
_set_root_commands_targets_node_files and _html_set_pages_files all the
information for redirection pages (and normal elements) file names is
available.

I think that is would be better to check redirection pages at about that
point in the code after _html_set_pages_files, before going through
elements.  It could be relevant to add some function in
Texinfo/Convert/Converter.pm to check if a file with same casing is
already set in case CASE_INSENSITIVE_FILENAMES is set.

Actually, it could be that redirection pages clash with element file
names because of transliteration, for example the following names would
clash:
@node Près
@anchor{Prés}

I will change the code in Texinfo/Convert/Converter.pm to set
$self->{'filenames'} independently of CASE_INSENSITIVE_FILENAMES.

> > > In the newlib case, there were a chapter (Iconv.html) and a node
> > > (iconv.html) and the solution that "fixed" the problem was to rename the
> > > chapter. I suppose this is also a problem in the current implementation of
> > > text2any as it's simply pushed to the user to resolve rather than having 
> > > the
> > > tool generate unique filenames/aborting in the case of conflicting
> > > filenames.
> > 
> > I do not think that the tool is to blame (after the bug is fixed, of
> > course ;-), the decision is to blame.  But there is no decision that
> > is not pushed to the user as there are conflicting choices without a
> > an option that is better in all cases.  If the default was
> > CASE_INSENSITIVE_FILENAMES=1, all the users who want the best manuals,
> > on case-sensitive filesystems would have to override the default.
> > 
> 
> You said above that it can't happen between regular elements. Isn't that
> contradicted by the newlib issue? It was a chapter and an element describing
> the function iconv...

It can't happen between regular elements with
CASE_INSENSITIVE_FILENAMES=1.

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]