bug-texinfo
[Top][All Lists]
Advanced

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

Re: [PATCH] install-info: fix delete dir file section code


From: John Wheeler
Subject: Re: [PATCH] install-info: fix delete dir file section code
Date: Sun, 26 Mar 2023 13:28:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

On 3/24/23 15:19, John Wheeler wrote:
On 3/24/23 14:41, Gavin Smith wrote:
Thanks for the detailed instructions on how to replicate this
problem.  I agree that the extra blank line being inserted is
not a good thing.

Could it be fixed by avoiding adding an extra blank line if
not needed, rather than by deleting an extra line?

With your proposed fix, it is possible for a non-blank line
to be removed.  So if 'dir' contains

* Menu:

Animals
* Gnu: (gnu).                    Wildebeest native to Africa.
Livestock
* Cow: (cow).                    A farm animal.

then running

../ginstall-info --remove --info-dir=. --info-file=./cow; \
../ginstall-info --info-dir=. --info-file=./cow \
cat dir

deletes the "* Gnu (gnu). ..." line.

I think that install-info should handle this case as well, which
would be possible if, for example, somebody hand-edited dir.
Unconditionally removing the line before the section doesn't seem
right.
Very good point, I had rashly assumed the sections would
never occur without an intervening blank line.  Also, I will
consider your suggestion to avoid adding the extra blank
line.  Will submit a revised patch when I get that done.

Can you think of a legitimate reason for there to be
multiple blank lines (a sequence of more that two
consecutive newline characters) in a valid dir file?

Thank you,
John

Attached is a revised patch that addresses your concern.  With
this patch deleting a section will remove all preceding blank
lines.  This change required changing file ii-0047-expected-dir-file
to remove the extra blank line at the end of the file.

I added test cases to check for correct behavior in the case you
pointed out and when deleting the last section: of the dir file and
of a non-terminal node in the dir file.

The one feature of this change that may raise an issue is in
case someone has used blank entry comment lines to create
a large vertical space between one dir section and the next. This
change will remove the extra blank lines if the following section
is removed.  Examples of this behavior can be seen in tests
ii-0060-test and ii-0061-test.

Your thoughts?

Thank you,
John

Attachment: jww-2303261300.patch
Description: Text Data


reply via email to

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