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: Gavin Smith
Subject: Re: [PATCH] install-info: fix delete dir file section code
Date: Fri, 24 Mar 2023 19:41:48 +0000

On Fri, Mar 24, 2023 at 12:32:45PM -0500, John Wheeler wrote:
> Bug report: Off-by-one flaw in deleting empty dir section
> 
> Current troublesome behavior: install-info adds a blank line
> before the final dir file section each time that section is
> removed and re-installed.  This is troublesome when a build
> test process repeatedly removes and re-inserts a dir section.
> 
> Discussion: It is easy to assume that installing and deleting a
> section in a dir file should be inverse operations.  That is to
> say: deleting a section should exactly undo the effects of
> installing that section. It is also easy to assume that the effect
> of the delete operation should be consistent independent of the
> location of the section being deleted.  For install-info both of
> these assumptions are false.

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.



reply via email to

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