bugGNU roff - Bugs: bug #63960, [man,mdoc] continuous rendering...

 
 

bug #63960: [man,mdoc] continuous rendering can cause tbl to misdraw vertical rules

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Sat 25 Mar 2023 08:18:58 PM UTC
   
 
Category:  Macro package - others/general Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Duplicate
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 18 May 2025 05:22:53 PM UTC, comment #6: 

This is resolved in the groff trunk.

Using the "ascii.7" document from the trunk of Alex Colomar's Linux man-pages repository, I observe the following.


$ nroff -t -man -T ascii -P-cbou ./ascii.7 > /tmp/63960-groff-1.23.0.txt
$ nroff -t -rBP=7n -rLL=78n -man -T ascii -P-cbou ./ascii.7 >| /tmp/63960-groff-1.24.0pre.txt
$ diff -u /tmp/63960-groff-1.23.0.txt /tmp/63960-groff-1.24.0pre.txt
--- /tmp/63960-groff-1.23.0.txt 2025-05-18 12:13:23.417434556 -0500
+++ /tmp/63960-groff-1.24.0pre.txt      2025-05-18 12:15:05.737161737 -0500
@@ -13,74 +13,75 @@

        C program '\X' escapes are noted.

-       Oct   Dec   Hex   Char                        Oct   Dec   Hex   Char
-       ------------------------------------------------------------------------
-       000   0     00    NUL '\0' (null character)   100   64    40    @
-       001   1     01    SOH (start of heading)      101   65    41    A
-       002   2     02    STX (start of text)         102   66    42    B
-       003   3     03    ETX (end of text)           103   67    43    C
-       004   4     04    EOT (end of transmission)   104   68    44    D
-       005   5     05    ENQ (enquiry)               105   69    45    E
-       006   6     06    ACK (acknowledge)           106   70    46    F
-       007   7     07    BEL '\a' (bell)             107   71    47    G
-       010   8     08    BS  '\b' (backspace)        110   72    48    H
-       011   9     09    HT  '\t' (horizontal tab)   111   73    49    I
-       012   10    0A    LF  '\n' (new line)         112   74    4A    J
-       013   11    0B    VT  '\v' (vertical tab)     113   75    4B    K
-       014   12    0C    FF  '\f' (form feed)        114   76    4C    L
-       015   13    0D    CR  '\r' (carriage ret)     115   77    4D    M
-       016   14    0E    SO  (shift out)             116   78    4E    N
-       017   15    0F    SI  (shift in)              117   79    4F    O
-       020   16    10    DLE (data link escape)      120   80    50    P
-       021   17    11    DC1 (device control 1)      121   81    51    Q
-       022   18    12    DC2 (device control 2)      122   82    52    R
-       023   19    13    DC3 (device control 3)      123   83    53    S
-       024   20    14    DC4 (device control 4)      124   84    54    T
-       025   21    15    NAK (negative ack.)         125   85    55    U
-       026   22    16    SYN (synchronous idle)      126   86    56    V
-       027   23    17    ETB (end of trans. blk)     127   87    57    W
-       030   24    18    CAN (cancel)                130   88    58    X
-       031   25    19    EM  (end of medium)         131   89    59    Y
-       032   26    1A    SUB (substitute)            132   90    5A    Z
-       033   27    1B    ESC (escape)                133   91    5B    [
-       034   28    1C    FS  (file separator)        134   92    5C    \  '\\'
-       035   29    1D    GS  (group separator)       135   93    5D    ]
-       036   30    1E    RS  (record separator)      136   94    5E    ^
-       037   31    1F    US  (unit separator)        137   95    5F    _
-       040   32    20    SPACE                       140   96    60    `
-       041   33    21    !                           141   97    61    a
-       042   34    22    "                           142   98    62    b
-       043   35    23    #                           143   99    63    c
-       044   36    24    $                           144   100   64    d
-       045   37    25    %                           145   101   65    e
-       046   38    26    &                           146   102   66    f
-       047   39    27    '                           147   103   67    g
-       050   40    28    (                           150   104   68    h
-       051   41    29    )                           151   105   69    i
-       052   42    2A    *                           152   106   6A    j
-       053   43    2B    +                           153   107   6B    k
-       054   44    2C    ,                           154   108   6C    l
-       055   45    2D    -                           155   109   6D    m
-       056   46    2E    .                           156   110   6E    n
-       057   47    2F    /                           157   111   6F    o
-       060   48    30    0                           160   112   70    p
-       061   49    31    1                           161   113   71    q
-       062   50    32    2                           162   114   72    r
-       063   51    33    3                           163   115   73    s
-       064   52    34    4                           164   116   74    t
-       065   53    35    5                           165   117   75    u
-       066   54    36    6                           166   118   76    v
-       067   55    37    7                           167   119   77    w
-       070   56    38    8                           170   120   78    x
-       071   57    39    9                           171   121   79    y
-       072   58    3A    :                           172   122   7A    z
-       073   59    3B    ;                           173   123   7B    {
-       074   60    3C    <                           174   124   7C    |
-       075   61    3D    =                           175   125   7D    }
-       076   62    3E    >                           176   126   7E    ~
-       077   63    3F    ?                         | 177   127   7F    DEL
                                                    |
-   Tables                                          |
+       Oct   Dec   Hex   Char                      | Oct   Dec   Hex   Char
+       --------------------------------------------+---------------------------
+       000   0     00    NUL '\0' (null character) | 100   64    40    @
+       001   1     01    SOH (start of heading)    | 101   65    41    A
+       002   2     02    STX (start of text)       | 102   66    42    B
+       003   3     03    ETX (end of text)         | 103   67    43    C
+       004   4     04    EOT (end of transmission) | 104   68    44    D
+       005   5     05    ENQ (enquiry)             | 105   69    45    E
+       006   6     06    ACK (acknowledge)         | 106   70    46    F
+       007   7     07    BEL '\a' (bell)           | 107   71    47    G
+       010   8     08    BS  '\b' (backspace)      | 110   72    48    H
+       011   9     09    HT  '\t' (horizontal tab) | 111   73    49    I
+       012   10    0A    LF  '\n' (new line)       | 112   74    4A    J
+       013   11    0B    VT  '\v' (vertical tab)   | 113   75    4B    K
+       014   12    0C    FF  '\f' (form feed)      | 114   76    4C    L
+       015   13    0D    CR  '\r' (carriage ret)   | 115   77    4D    M
+       016   14    0E    SO  (shift out)           | 116   78    4E    N
+       017   15    0F    SI  (shift in)            | 117   79    4F    O
+       020   16    10    DLE (data link escape)    | 120   80    50    P
+       021   17    11    DC1 (device control 1)    | 121   81    51    Q
+       022   18    12    DC2 (device control 2)    | 122   82    52    R
+       023   19    13    DC3 (device control 3)    | 123   83    53    S
+       024   20    14    DC4 (device control 4)    | 124   84    54    T
+       025   21    15    NAK (negative ack.)       | 125   85    55    U
+       026   22    16    SYN (synchronous idle)    | 126   86    56    V
+       027   23    17    ETB (end of trans. blk)   | 127   87    57    W
+       030   24    18    CAN (cancel)              | 130   88    58    X
+       031   25    19    EM  (end of medium)       | 131   89    59    Y
+       032   26    1A    SUB (substitute)          | 132   90    5A    Z
+       033   27    1B    ESC (escape)              | 133   91    5B    [
+       034   28    1C    FS  (file separator)      | 134   92    5C    \  '\\'
+       035   29    1D    GS  (group separator)     | 135   93    5D    ]
+       036   30    1E    RS  (record separator)    | 136   94    5E    ^
+       037   31    1F    US  (unit separator)      | 137   95    5F    _
+       040   32    20    SPACE                     | 140   96    60    `
+       041   33    21    !                         | 141   97    61    a
+       042   34    22    "                         | 142   98    62    b
+       043   35    23    #                         | 143   99    63    c
+       044   36    24    $                         | 144   100   64    d
+       045   37    25    %                         | 145   101   65    e
+       046   38    26    &                         | 146   102   66    f
+       047   39    27    '                         | 147   103   67    g
+       050   40    28    (                         | 150   104   68    h
+       051   41    29    )                         | 151   105   69    i
+       052   42    2A    *                         | 152   106   6A    j
+       053   43    2B    +                         | 153   107   6B    k
+       054   44    2C    ,                         | 154   108   6C    l
+       055   45    2D    -                         | 155   109   6D    m
+       056   46    2E    .                         | 156   110   6E    n
+       057   47    2F    /                         | 157   111   6F    o
+       060   48    30    0                         | 160   112   70    p
+       061   49    31    1                         | 161   113   71    q
+       062   50    32    2                         | 162   114   72    r
+       063   51    33    3                         | 163   115   73    s
+       064   52    34    4                         | 164   116   74    t
+       065   53    35    5                         | 165   117   75    u
+       066   54    36    6                         | 166   118   76    v
+       067   55    37    7                         | 167   119   77    w
+       070   56    38    8                         | 170   120   78    x
+       071   57    39    9                         | 171   121   79    y
+       072   58    3A    :                         | 172   122   7A    z
+       073   59    3B    ;                         | 173   123   7B    {
+       074   60    3C    <                         | 174   124   7C    |
+       075   61    3D    =                         | 175   125   7D    }
+       076   62    3E    >                         | 176   126   7E    ~
+       077   63    3F    ?                         | 177   127   7F    DEL
+
+   Tables
        For convenience, below are more compact tables in hex and decimal.

           2 3 4 5 6 7       30 40 50 60 70 80 90 100 110 120


G. Branden Robinson <gbranden>
Group administrator
Sun 18 May 2025 05:21:06 PM UTC, comment #5: 

This is ultimately the same issue as bug #65190.

G. Branden Robinson <gbranden>
Group administrator
Wed 29 Mar 2023 07:34:19 AM UTC, comment #4: 

Do this for both man(7) and mdoc(7).

G. Branden Robinson <gbranden>
Group administrator
Mon 27 Mar 2023 08:56:06 AM UTC, comment #3: 

comment #1:

> the "3usekeeps" hack


implemented as a repsonse to bug #57665

Dave <barx>
Group Member
Sun 26 Mar 2023 04:19:27 PM UTC, comment #2: 

Also, this is new misbehavior in groff 1.23.0; 1.22.4 draws the vertical rule "correctly", but all tables are interrupted by 1v of blank space where the page breaks mentioned in comment #1 would be (the rule also does not span the blank space, because the formatter thinks there's a page boundary there).  I find this near-cosmetic problem a lesser evil, but readers' mileage may vary, and in any case, I mean to fix it one way or the other.

G. Branden Robinson <gbranden>
Group administrator
Sun 26 Mar 2023 04:15:55 PM UTC, comment #1: 

Confirmed; thanks for the report.

The version of the ascii(7) man page in Linux man-pages 5.10 on my Debian system did not reproduce this behavior, but the one from my Git checkout of its project did.

I'm attaching a bespoke reproducer.

The problem appears to be that even with continuous rendering on, a notional page length of 11 inches remains in place, extended in places by certain macros a line at a time.  However, when we start a table with `TS`, that macro can't have any idea how long the table will ultimately be.

Thus, if the table should happen to be long enough to cross a "page" boundary, the vertical line (which is always drawn from the bottom up in GNU tbl) is of the wrong length (and starts from the wrong place, too).

Here's a patch that appears to solve the problem.  It's a bit of a hack (but so is what we do for line length in HTML output.)

Before committing, which might wait until after 1.23.0 final anyway, I'd like to see if this hack obviates the need for the "3usekeeps" hack which I also put in place for managing tbl tables in man pages when continuous rendering.

And ultimately, both of those hacks as well as a lot of tedium in man(7) and mdoc(7) might be obviated if we proceed with my plans in bug #63587.


$ git di
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 0d540fbcb..df92dfa27 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -1203,6 +1203,10 @@ contains unsupported escape sequence
 .  \" If continuous rendering, tell tbl not to use keeps.
 .  ie \\n[cR] .nr 3usekeeps 0
 .  el         .nr 3usekeeps 1
+.  if \\n[cR] \{\
+.    nr an*saved-trap-distance \\n[.t]
+.    pl +1000i
+.  \}
 .  if \\n[an*is-output-html] \{\
 .    nr an-TS-ll \\n[.l]
 .    ll 1000n
@@ -1218,6 +1222,10 @@ contains unsupported escape sequence
 .de1 TE
 .  HTML-IMAGE-END
 .  if \\n[an*is-output-html] .ll \\n[an-TS-ll]u
+.  if \\n[cR] \{\
+.    pl (u;\\n[nl] + \\n[an*saved-trap-distance])
+.    rr an*saved-trap-distance
+.  \}
 .  if !r TW .if !\\n[an-was-tbl-failure-reported] \{\
 .    ds an-msg tbl preprocessor failed, or it or soelim was not run;\"
 .    as an-msg " table(s) likely not rendered\"


Feel free to apply this to your local derivative of groff; please report any collateral problems arising from it.

(file #54526)

G. Branden Robinson <gbranden>
Group administrator
Sat 25 Mar 2023 08:18:58 PM UTC, original submission:  

Subject: nroff...rc3: missing vertical line in long tables with cR=1
(default value)

GNU nroff (groff) version 1.23.0.rc3
GNU groff version 1.23.0.rc3

  Seen with "man 7 ascii":

[...]

       074   60    3C    <                           174   124   7C    |
       075   61    3D    =                           175   125   7D    }
       076   62    3E    >                           176   126   7E    ~
       077   63    3F    ?                         | 177   127   7F   DEL
                                                   |
   Tables                                          |

[...]
#End of example

  "nroff -t -man -rcR=0 ascii.7" shows the vertical line.

Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #54526:  brascii.7 added by gbranden (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Linux man-pages maintainer)
  • -email is unavailable- added by barx (Posted a comment)
  • -email is unavailable- added by gbranden (Updated the item)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2025-05-18 gbranden Open/ClosedOpen Closed
    2025-05-18 gbranden StatusConfirmed Duplicate
        Assigned toNone gbranden
        Carbon-Copy- Added -email is unavailable-
    2023-03-29 gbranden CategoryMacro package man Macro package - others/general
        Summary[man] continuous rendering can cause tbl to misdraw vertical rules [man,mdoc] continuous rendering can cause tbl to misdraw vertical rules
    2023-03-26 gbranden CategoryPreprocessor tbl Macro package man
    2023-03-26 gbranden Summary[tbl] roff...rc3: missing vertical line in long tables with cR=1 (default value) [man] continuous rendering can cause tbl to misdraw vertical rules
    2023-03-26 gbranden Attached File- Added brascii.7, #54526
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.15-ef91.
    Corresponding source code