bugGNU roff - Bugs: bug #62257, [man] don't slice the center...

 
 

bug #62257: [man] don't slice the center footer in the middle of an escape sequence

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Wed 06 Apr 2022 12:07:05 AM UTC
   
 
Category:  Macro man Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 07 Apr 2022 11:05:08 PM UTC, comment #2: 


commit 223814d9c217a8ac137e9e521297377572e31526
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Fri Apr 8 07:48:45 2022 +1000

    [man]: Abbreviate TH arguments more carefully.

    * tmac/an.tmac: Do it.

      (an*scan-string-for-backslash): Add new helper macro.

      (an*abbreviate-inner-footer): Rewrite.  Use the foregoing and a
      different technique to compute available space and shorten the string.
      So that we don't break the inner footer in the middle of an escape
      sequence, just trim characters from the end.

    Fixes <https://savannah.gnu.org/bugs/?62257>.


G. Branden Robinson <gbranden>
Group administrator
Wed 06 Apr 2022 12:22:43 AM UTC, comment #1: 

Note the lack of file name and line number for the diagnostic message.  Looks like that would be pretty hard to fix since the error is only recognized very late in processing.  I took the document and manually preconv-ed it, then this.


##(gdb) set args -F font -F build/font -M tmac -M build/tmac -z -Ww -Tutf8 -man man.5
##(gdb) break copy_mode_error
Breakpoint 1 at 0x61e53: file ../src/roff/troff/input.cpp, line 8731.
##(gdb) run
Starting program: /home/branden/src/GIT/groff/build/troff -F font -F build/font -M tmac -M build/tmac -z -Ww -Tutf8 -man man.5

Breakpoint 1, copy_mode_error (format=0x5555555e2bd0 "%1 not allowed in escape sequence parameter", arg1=..., arg2=..., arg3=...)
    at ../src/roff/troff/input.cpp:8731
8731      if (ignoring) {
##(gdb) bt
#0  copy_mode_error (format=0x5555555e2bd0 "%1 not allowed in escape sequence parameter", arg1=..., arg2=..., arg3=...)
    at ../src/roff/troff/input.cpp:8731
#1  0x000055555559f403 in get_char_for_escape_parameter (allow_space=true) at ../src/roff/troff/input.cpp:840
#2  0x000055555559f4bf in read_long_escape_parameters (mode=WITH_ARGS) at ../src/roff/troff/input.cpp:871
#3  0x00005555555a3073 in token::next (this=0x55555561ccc0 <tok>) at ../src/roff/troff/input.cpp:2259
#4  0x00005555555abb4c in do_width () at ../src/roff/troff/input.cpp:5253
#5  0x00005555555a2da8 in token::next (this=0x55555561ccc0 <tok>) at ../src/roff/troff/input.cpp:2199
#6  0x00005555555d1345 in start_number () at ../src/roff/troff/number.cpp:218
#7  0x00005555555d1286 in get_incr_number (res=0x7fffffffd94c, si=117 'u') at ../src/roff/troff/number.cpp:198
#8  0x00005555555d115e in get_number (res=0x7fffffffd96c, si=117 'u', prev_value=0) at ../src/roff/troff/number.cpp:156
#9  0x00005555555d33ed in define_number_reg () at ../src/roff/troff/reg.cpp:313
#10 0x00005555555a4d61 in request::invoke (this=0x5555556a1520) at ../src/roff/troff/input.cpp:3081
#11 0x00005555555a6f02 in interpolate_macro (nm=..., no_next=0) at ../src/roff/troff/input.cpp:3807
#12 0x00005555555a473d in process_input_stack () at ../src/roff/troff/input.cpp:2849
#13 0x00005555555a3eb9 in exit_troff () at ../src/roff/troff/input.cpp:2575
#14 0x00005555555b3943 in main (argc=14, argv=0x7fffffffdd18) at ../src/roff/troff/input.cpp:8230
##(gdb) quit


I suspect to fix this we'd need special nodes that embedded file name and line number information.  And I don't see any point adding node types before we make ourselves friendly to UTF-8 input.  So...that bit goes into the future.

A refactor of "an-prepare-inner-footer" can happen now, though.

G. Branden Robinson <gbranden>
Group administrator
Wed 06 Apr 2022 12:07:05 AM UTC, original submission:  

The fix for bug #61386 did not anticipate the presence of escape sequences in the center footer.

That won't do.  A real man page can trip it up.


$ zcat /usr/share/man/ja/man5/apt_preferences.5.gz | ./build/test-groff -kz -Ww -Tutf8 -man
troff: error: newline character not allowed in escape sequence parameter


Fix this.

G. Branden Robinson <gbranden>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-07 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code