bugGNU roff - Bugs: bug #61605, [man pages] obfuscate source files...

 
 

bug #61605: [man pages] obfuscate source files to accommodate now-withdrawn stripper

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Fri 03 Dec 2021 12:00:59 AM UTC
   
 
Category:  General Severity:  2 - Minor
Item Group:  Documentation Status:  Rejected
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 30 Mar 2023 05:35:51 PM UTC, comment #2: 

I comment to note that (1) groff no longer ships "strip.sed" as of  1.23.0.rc2, and (2) a sed script should be able to successively modify the pattern space to eliminate trailing spaces after having previously removed a comment.

(2) might require the use of sed features one doesn't learn in the first ten minutes of exposure to the language, like labels and the 't' command.  Such is life.  The consensus of the groff community was that such stripping has not yielded significant performance benefits for many years, and imposes other complications.

See one mailing list discussion of the subject, and the groff change history for an example of the problems the assumption of stripping can cause.

G. Branden Robinson <gbranden>
Group administrator
Fri 03 Dec 2021 07:12:58 PM UTC, comment #1: 

original submission:

> Subject: [man pages] Do not create trailing spaces
>
>   When there is a space in front of an inline comment,
> it remains there after the comment has been removed,
> so the line contains a trailing space when it is processed.


This doesn't accurately describe how GNU troff works.

As our Texinfo manual says, "Trailing spaces on text lines are ignored."

First, comments are discarded on input, when they are read.  Then, if there are (discardable) space nodes remaining on the output line when it is converted into device-independent format, those space nodes are discarded.

You raise the issue of comments directly abutting the ends of string definitions.  There is a principle of design that says "Different things should look different."  People should indeed notice this difference in white space usage before a comment escape sequence, because a string definition in *roff languages is not like text input (nor even like most other requests).

>   If the space is not a part of a string definition,
> remove the space
> so the software does not need to waste processing
> efforts to remove it.


groff does many things more computationally expensive than walking a linked list and removing items from it.  Trailing white space may be annoying to nit pickers but it has well-established semantics in *roff languages, and your micro-optimizing claim notwithstanding, it is common in programming languages to separate comments from semantically significant logic on the same input line.

I would challenge you measure the effect you claim.  Perhaps it would rise above the noise floor if there were thousands of trailing space characters on an input line, because that might cause the data to cross a page boundary, leading to a cache miss. (But perhaps not.)  In any case, the number of real-world *roff documents that will have this property of myriad blanks between the end of text on a line and a comment is vanishingly small.
 

>   The '\"' is just as any punctuation mark, showing the end of the text
> for the software to execute.


That's a strange way of looking at it, and not really what it means to the parser.  For one thing, there are two kinds of punctuation mark to a *roff--end-of-sentence punctuation and its complement.  A comment escape sequence is neither.

>   Examples of a trailing space:
>
> troff:./contrib/hdtbl/groff_hdtbl.7.man:1029: warning: trailing space in line
>
> or \f[BI]bold italic\f[], \" \f[BI] is not portable man(7)
>
> ##
> troff:./man/groff.7.man:501: warning: trailing space in line
>
> is \f[BI]bold-italic\f[]\/, \" indulging a bit of man(7) evil here
>
> ##
> troff:./man/roff.7.man:408: warning: trailing space in line
>
> Around this time, \" judging by "CSTR #17"
>
> ##
> troff:./man/roff.7.man:436: warning: trailing space in line
>
> does not feature a request list, \" nor does V6 Unix troff(1) (1975)
>
> ##
> troff:./src/preproc/eqn/eqn.1.man:177: warning: trailing space in line
>
> Three points are worth special note. \" good, bad, and different
>
> ##
> troff: backtrace: file './src/preproc/tbl/tbl.1.man':1395
>
> the escape character must be disabled. \" XXX: Why?
>
> ##
> troff:./src/roff/groff/groff.1.man:1148: warning: trailing space in line
>
> librarian program \" such as man-db, since 2001
>
> ##
> troff:./tmac/groff_mdoc.7.man:4635: warning: trailing space in line
>
> Old typesetters lacked directional double quotes, \" like the C/A/T
>
> ##
> troff:./tmac/groff_mdoc.7.man:4644: warning: trailing space in line
>
> strings this way. \" thanks to Ingo Schwarze for the research
>
> ##
> troff:./tmac/groff_ms.7.man:2296: warning: trailing space in line
>
> macro \" I wouldn't mention that, but Lesk 1978 encourages doing so. :-/


I wrote most of those comments and I'm not inclined to smash them up against the real text they annotate nor to delete them.

I believe I am writing idiomatic *roff.

G. Branden Robinson <gbranden>
Group administrator
Fri 03 Dec 2021 12:00:59 AM UTC, original submission:  

Subject: [man pages] Do not create trailing spaces

  When there is a space in front of an inline comment,
it remains there after the comment has been removed,
so the line contains a trailing space when it is processed.

  If the space is not a part of a string definition,
remove the space
so the software does not need to waste processing
efforts to remove it..

  The '\"' is just as any punctuation mark, showing the end of the text
for the software to execute.

  Examples of a trailing space:

troff:./contrib/hdtbl/groff_hdtbl.7.man:1029: warning: trailing space in line

or \f[BI]bold italic\f[], \" \f[BI] is not portable man(7)

##
troff:./man/groff.7.man:501: warning: trailing space in line

is \f[BI]bold-italic\f[]\/, \" indulging a bit of man(7) evil here

##
troff:./man/roff.7.man:408: warning: trailing space in line

Around this time, \" judging by "CSTR #17"

##
troff:./man/roff.7.man:436: warning: trailing space in line

does not feature a request list, \" nor does V6 Unix troff(1) (1975)

##
troff:./src/preproc/eqn/eqn.1.man:177: warning: trailing space in line

Three points are worth special note. \" good, bad, and different

##
troff: backtrace: file './src/preproc/tbl/tbl.1.man':1395

the escape character must be disabled. \" XXX: Why?

##
troff:./src/roff/groff/groff.1.man:1148: warning: trailing space in line

librarian program \" such as man-db, since 2001

##
troff:./tmac/groff_mdoc.7.man:4635: warning: trailing space in line

Old typesetters lacked directional double quotes, \" like the C/A/T

##
troff:./tmac/groff_mdoc.7.man:4644: warning: trailing space in line

strings this way. \" thanks to Ingo Schwarze for the research

##
troff:./tmac/groff_ms.7.man:2296: warning: trailing space in line

macro \" I wouldn't mention that, but Lesk 1978 encourages doing so. :-/

Bjarni Ingi Gislason <bjarniig>

 

(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 (Posted a comment)
  • -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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-03-30 gbranden Summary[man pages] Do not create trailing spaces [man pages] obfuscate source files to accommodate now-withdrawn stripper
    2022-03-05 gbranden CategoryNone General
    2021-12-03 gbranden Severity3 - Normal 2 - Minor
        StatusNone Rejected
        Assigned toNone gbranden
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code