pkgsrc-Changes archive

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

CVS commit: pkgsrc/textproc/mandoc



Module Name:    pkgsrc
Committed By:   wiz
Date:           Fri May  9 06:27:32 UTC 2025

Modified Files:
        pkgsrc/textproc/mandoc: Makefile distinfo
Added Files:
        pkgsrc/textproc/mandoc/patches: patch-out.c

Log Message:
mandoc: add upstream patch fixing an infinite loop

All self tests still pass.

With help from schwarze@OpenBSD, thanks!

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 pkgsrc/textproc/mandoc/Makefile
cvs rdiff -u -r1.8 -r1.9 pkgsrc/textproc/mandoc/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/textproc/mandoc/patches/patch-out.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/textproc/mandoc/Makefile
diff -u pkgsrc/textproc/mandoc/Makefile:1.17 pkgsrc/textproc/mandoc/Makefile:1.18
--- pkgsrc/textproc/mandoc/Makefile:1.17        Tue Jun 28 11:36:12 2022
+++ pkgsrc/textproc/mandoc/Makefile     Fri May  9 06:27:32 2025
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.17 2022/06/28 11:36:12 wiz Exp $
+# $NetBSD: Makefile,v 1.18 2025/05/09 06:27:32 wiz Exp $
 
 DISTNAME=      mandoc-1.14.6
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    textproc devel
 MASTER_SITES=  http://mandoc.bsd.lv/snapshots/
 

Index: pkgsrc/textproc/mandoc/distinfo
diff -u pkgsrc/textproc/mandoc/distinfo:1.8 pkgsrc/textproc/mandoc/distinfo:1.9
--- pkgsrc/textproc/mandoc/distinfo:1.8 Tue Oct 26 11:22:21 2021
+++ pkgsrc/textproc/mandoc/distinfo     Fri May  9 06:27:32 2025
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.8 2021/10/26 11:22:21 nia Exp $
+$NetBSD: distinfo,v 1.9 2025/05/09 06:27:32 wiz Exp $
 
 BLAKE2s (mandoc-1.14.6.tar.gz) = ec1c9fced52eb7638ccf3d39c6cbeafb9bab371cf28070738d4f30f28a69d75b
 SHA512 (mandoc-1.14.6.tar.gz) = 54286070812a47b629f68757046d3c9a1bdd2b5d1c3b84a5c8e4cb92f1331afa745443f7238175835d8cfbe5b8dd442e00c75c3a5b5b8f8efd8d2ec8f636dad4
 Size (mandoc-1.14.6.tar.gz) = 697150 bytes
+SHA1 (patch-out.c) = 10cad373e3b9af79c460637f1e0ae72a1faeb670
 SHA1 (patch-roff.7) = ac872e85109bb69911a55f82730452a6dfb34159

Added files:

Index: pkgsrc/textproc/mandoc/patches/patch-out.c
diff -u /dev/null pkgsrc/textproc/mandoc/patches/patch-out.c:1.1
--- /dev/null   Fri May  9 06:27:32 2025
+++ pkgsrc/textproc/mandoc/patches/patch-out.c  Fri May  9 06:27:32 2025
@@ -0,0 +1,78 @@
+$NetBSD: patch-out.c,v 1.1 2025/05/09 06:27:32 wiz Exp $
+
+1.83 from upstream, without the RCS Id change:
+
+Revert part of the previous diff to fix a regression (another endless loop)
+reported by Michael <Stapelberg at Debian> in the Linux md(4) manual.
+
+The reason the colwidth[] array is needed is not that it stores widths
+different from those in tbl->cols[].width, but that only part of the
+columns participate in the comparisons, i.e. only those intersecting 
+at least one span the still requires width distribution.
+
+--- out.c.orig 2021-09-23 18:03:23.000000000 +0000
++++ out.c
+@@ -123,6 +123,7 @@ tblcalc(struct rofftbl *tbl, const struc
+       const struct tbl_dat    *dp;
+       struct roffcol          *col;
+       struct tbl_colgroup     *first_group, **gp, *g;
++      size_t                  *colwidth;
+       size_t                   ewidth, min1, min2, wanted, width, xwidth;
+       int                      done, icol, maxcol, necol, nxcol, quirkcol;
+ 
+@@ -256,16 +257,28 @@ tblcalc(struct rofftbl *tbl, const struc
+                       gp = &(*gp)->next;
+       }
+ 
++      colwidth = mandoc_reallocarray(NULL, maxcol + 1, sizeof(*colwidth));
+       while (first_group != NULL) {
+ 
+               /*
++               * Rebuild the array of the widths of all columns
++               * participating in spans that require expansion.
++               */
++
++              for (icol = 0; icol <= maxcol; icol++)
++                      colwidth[icol] = SIZE_MAX;
++              for (g = first_group; g != NULL; g = g->next)
++                      for (icol = g->startcol; icol <= g->endcol; icol++)
++                              colwidth[icol] = tbl->cols[icol].width;
++
++              /*
+                * Find the smallest and second smallest column width
+                * among the columns which may need expamsion.
+                */
+ 
+               min1 = min2 = SIZE_MAX;
+               for (icol = 0; icol <= maxcol; icol++) {
+-                      width = tbl->cols[icol].width;
++                      width = colwidth[icol];
+                       if (min1 > width) {
+                               min2 = min1;
+                               min1 = width;
+@@ -283,7 +296,7 @@ tblcalc(struct rofftbl *tbl, const struc
+               for (g = first_group; g != NULL; g = g->next) {
+                       necol = 0;
+                       for (icol = g->startcol; icol <= g->endcol; icol++)
+-                              if (tbl->cols[icol].width == min1)
++                              if (colwidth[icol] == min1)
+                                       necol++;
+                       if (necol == 0)
+                               continue;
+@@ -300,7 +313,7 @@ tblcalc(struct rofftbl *tbl, const struc
+               while ((g = *gp) != NULL) {
+                       done = 0;
+                       for (icol = g->startcol; icol <= g->endcol; icol++) {
+-                              if (tbl->cols[icol].width != min1)
++                              if (colwidth[icol] != min1)
+                                       continue;
+                               if (g->wanted <= wanted - min1) {
+                                       tbl->cols[icol].width += g->wanted;
+@@ -317,6 +330,7 @@ tblcalc(struct rofftbl *tbl, const struc
+                               gp = &(*gp)->next;
+               }
+       }
++      free(colwidth);
+ 
+       /*
+        * Align numbers with text.



Home | Main Index | Thread Index | Old Index