Re: patch preventing creation of empty top file (was Re: doc patch

Derek Robert Price <[email protected]> Wed, 19 Sep 2001 08:44:38 -0400
Newsgroups gmane.comp.tex.texi2html.devel
Message-ID <[email protected]>
Peter Moulder wrote:

> On Tue, Sep 18, 2001 at 02:24:48PM -0400, Derek Robert Price wrote:
> > > Attached is a short context diff as per subject line.  (See also
> > > <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=101265&repeatmerged=yes>.)
> >
> > At face value, this looks good to me, but what cases created an empty top file
> > previously?
>
> In the old code shown in the patch, the file is opened unconditionally
> but only written to if either !$T2H_SPLIT or $has_top; it's created as a
> zero-length file if $T2H_SPLIT && !$has_top.
>
> > Even with your patch, running texi2html on an empty file (touch
> > test.texinfo; ./texi2html test.texinfo) creates a top file (test.html) containing
> > the HTML header, footer, and the "This document was generated by ... on ... using
> > texi2html" text.
>
> The patch ensured that no zero-length file would be created, though I
> didn't consider the "zero-content" case.
>
> I've now looked at it some more, but I think it is doing the right thing
> (except that perhaps it ought to warn) for contentless input.
>
> The attached patch is [believed to be] logically identical to the
> previous patch, but is arranged to be easier to understand: the
> monolithic case is now in a separate block of code.  (Also used
> $docu_doc_file instead of $docu_top_file, though these currently have
> the same value in the monolithic case.)

Yeah, I should have looked up why $has_top could be set, but this new version _is_
easier to read.

Anyway, logically, this looks good to me, though I still haven't tested it.  My quick
reading of that section of the code still leaves me without a clue as to how to
produce a document without a top node.  I thought it was just a matter of not
including the "@top" or "@node top" macros, but I tried that and it doesn't seem to
work.

Anyway, commit this if you like, though I'd prefer a chance to reproduce the bug
before you do.

Derek