Hi Branden,

I'd like to understand why groff(1) formats differently a paragraph
depending on the previous ones.  I sometimes experience different
placement of spaces for an unchanged paragraph.  I use a script to diff
manual pages at different commits, which is useful to quickly see the
effects of a commit in a formatted page.  That script sometimes shows
suprious space changes (produced by groff(1)) for parts of the page that
haven't been changed, and which one would expect should not be formatted
differently.

Below is an example in what is now the latest commit in the Linux
man-pages repository.  The commit I'll be using for this example is
man-pages.git 5889aa978ddc (2025-05-02; "man/man2const/TIOCLINUX.2const:
Document CAP_SYS_ADMIN requirement for TIOCL_SETSEL modes").

        $ git log -1 -p --oneline 5889aa978ddc
        5889aa978 (HEAD -> master, korg/master, korg/HEAD, alx/main, 
alx/contrib, alx/HEAD, main, contrib) man/man2const/TIOCLINUX.2const: Document 
CAP_SYS_ADMIN requirement for TIOCL_SET>
        diff --git a/man/man2const/TIOCLINUX.2const 
b/man/man2const/TIOCLINUX.2const
        index 61f1c596d..b98a0202b 100644
        --- a/man/man2const/TIOCLINUX.2const
        +++ b/man/man2const/TIOCLINUX.2const
        @@ -72,18 +72,30 @@ .SH DESCRIPTION
         Select character-by-character.
         The indicated screen characters are highlighted
         and saved in a kernel buffer.
        +.IP
        +Since Linux 6.7, using this selection mode requires the
        +.B CAP_SYS_ADMIN
        +capability.
         .TP
         .B TIOCL_SELWORD
         Select word-by-word,
         expanding the selection outwards to align with word boundaries.
         The indicated screen characters are highlighted
         and saved in a kernel buffer.
        +.IP
        +Since Linux 6.7, using this selection mode requires the
        +.B CAP_SYS_ADMIN
        +capability.
         .TP
         .B TIOCL_SELLINE
         Select line-by-line,
         expanding the selection outwards to select full lines.
         The indicated screen characters are highlighted
         and saved in a kernel buffer.
        +.IP
        +Since Linux 6.7, using this selection mode requires the
        +.B CAP_SYS_ADMIN
        +capability.
         .TP
         .B TIOCL_SELPOINTER
         Show the pointer at position
        @@ -118,11 +130,11 @@ .SH DESCRIPTION
         this operation yields an
         .B EINVAL
         error.
        -.RE
         .IP
        -Since Linux 6.7, using this subcode requires the
        +Since Linux 6.7, using this selection mode requires the
         .B CAP_SYS_ADMIN
         capability.
        +.RE
         .TP
         .BR subcode = TIOCL_PASTESEL
         Paste selection.

Now, let's use the diffman-git(1) script.  You can get it by installing
it from source from the man-pages repo: `make && sudo make install`.
You can also run it directly from the repo: `./src/bin/diffman-git`.
Documentation is in the repo as a manual page in man1, of course.

$ diffman-git 5889aa978ddc
--- 5889aa978ddc^:man/man2const/TIOCLINUX.2const
+++ 5889aa978ddc:man/man2const/TIOCLINUX.2const
@@ -38,36 +38,46 @@
                    Select character‐by‐character.  The indicated screen 
characters  are
                    highlighted and saved in a kernel buffer.
 
+                   Since  Linux 6.7, using this selection mode requires the 
CAP_SYS_AD‐
+                   MIN capability.
+
             TIOCL_SELWORD
-                   Select  word‐by‐word, expanding the selection outwards to 
align with
-                   word boundaries.  The indicated screen  characters  are  
highlighted
+                   Select word‐by‐word, expanding the selection outwards to 
align  with
+                   word  boundaries.   The  indicated screen characters are 
highlighted
                    and saved in a kernel buffer.
 
+                   Since Linux 6.7, using this selection mode requires the  
CAP_SYS_AD‐
+                   MIN capability.
+
             TIOCL_SELLINE
                    Select line‐by‐line, expanding the selection outwards to 
select full
                    lines.  The indicated screen characters are highlighted and 
saved in
                    a kernel buffer.
 
+                   Since  Linux 6.7, using this selection mode requires the 
CAP_SYS_AD‐
+                   MIN capability.
+
             TIOCL_SELPOINTER
-                   Show  the  pointer  at  position  (xs, ys) or (xe, ye), 
whichever is
+                   Show the pointer at position (xs, ys)  or  (xe,  ye),  
whichever  is
                    later in text flow order.
 
             TIOCL_SELCLEAR
-                   Remove the current selection highlight, if  any,  from  the 
 console
+                   Remove  the  current  selection  highlight, if any, from 
the console
                    holding the selection.
 
                    This does not affect the stored selected text.
 
             TIOCL_SELMOUSEREPORT
-                   Make  the terminal report (xs, ys) as the current mouse 
location us‐
-                   ing the xterm(1) mouse  tracking  protocol  (see  
console_codes(4)).
-                   The  lower 4 bits of sel_mode (TIOCL_SELBUTTONMASK) 
indicate the de‐
+                   Make the terminal report (xs, ys) as the current mouse 
location  us‐
+                   ing  the  xterm(1)  mouse  tracking protocol (see 
console_codes(4)).
+                   The lower 4 bits of sel_mode (TIOCL_SELBUTTONMASK) indicate 
the  de‐
                    sired button press and modifier key information for the 
mouse event.
 
-                   If mouse reporting is not enabled for the terminal,  this  
operation
+                   If  mouse  reporting is not enabled for the terminal, this 
operation
                    yields an EINVAL error.
 
-            Since Linux 6.7, using this subcode requires the CAP_SYS_ADMIN 
capability.
+                   Since Linux 6.7, using this selection mode requires the  
CAP_SYS_AD‐
+                   MIN capability.
 
      subcode=TIOCL_PASTESEL
             Paste selection.  The characters in the selection buffer are 
written to fd.


There are several paragraphs which shouldn't report changes: every
paragraph that doesn't start with "Since Linux 6.7," should be
unchanged.

Is this a bug?  Is it a feature?


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to