makehistory can generate duplicate lines
Kamil Jońca
kjonca at op.pl
Tue Nov 22 20:12:36 UTC 2022
Julien ÉLIE <julien at trigofacile.com> writes:
[...]
>
> I believe the following patch would fix the issue. (I don't know if you can try patches - it seems like you're running the package Debian distribution.)
>
> --- a/storage/cnfs/cnfs.c
> +++ b/storage/cnfs/cnfs.c
> @@ -1804,6 +1804,14 @@ cnfs_next(ARTHANDLE *article, const RETRTYPE amount)
> if (middle >= cycbuff->len - cycbuff->blksz - 1) {
> priv.rollover = true;
> middle = cycbuff->minartoffset;
> + /* If the beginning of cycbuff is the next place where to write
> + * an article, then the cycbuff has fully wrapped, and the
> + * first article has already been walked through. */
> + if (middle == cycbuff->free) {
> + if (!SMpreopen)
> + CNFSshutdowncycbuff(cycbuff);
> + continue;
> + }
> }
> break;
> } else {
>
[...]
Here is a patch that works:
>
> --- a/storage/cnfs/cnfs.c
> +++ b/storage/cnfs/cnfs.c
> @@ -1138,7 +1138,7 @@ CNFSArtMayBeHere(CYCBUFF *cycbuff, off_t offset, uint32_t cycnum)
> ** avoid a false negative response, *not* a false positive response.
> */
> if (!(cycnum == cycbuff->cyclenum
> - || (cycnum == cycbuff->cyclenum - 1 && offset > cycbuff->free)
> + || (cycnum == cycbuff->cyclenum - 1 && offset >= cycbuff->free)
> || (cycnum + 1 == 0 && cycbuff->cyclenum == 2
> && offset > cycbuff->free))) {
> /* We've been overwritten */
>
>
I applied both patches to debian sources, and I am runnning this
server.
Nothing exploded, seems to work.
--8<---------------cut here---------------start------------->8---
sudo -u news env PATH=$PATH:/usr/lib/news/bin makehistory -O -x -S
--8<---------------cut here---------------end--------------->8---
creates no duplicates.
Effect of
--8<---------------cut here---------------start------------->8---
sudo -u news env PATH=$PATH:/usr/lib/news/bin makehistory -f history.n
--8<---------------cut here---------------end--------------->8---
also looks better than before.
KJ
--
http://wolnelektury.pl/wesprzyj/teraz/
More information about the inn-workers
mailing list