URL:
  <https://savannah.gnu.org/bugs/?68875>

                 Summary: [soelim] off-by-one error in warning diagnostic
about escaped space
                   Group: GNU roff
               Submitter: gbranden
               Submitted: Tue 03 Nov 2026 03:48:03 AM UTC
                Category: Preprocessor soelim
                Severity: 3 - Normal
              Item Group: Warning/Suspicious behaviour
                  Status: In Progress
                 Privacy: Public
             Assigned to: gbranden
             Open/Closed: Open
         Discussion Lock: Unlocked
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Tue 03 Nov 2026 03:48:03 AM UTC By: G. Branden Robinson <gbranden>
Exhibit:


$ cat /tmp/branden/sorcerer 
.so "included\ file
This is line \n[ln].
$ od -c /tmp/branden/included\ file 
0000000   i   n   c   l   u   d   e   d
0000010
$ ~/groff-1.24.2/bin/soelim -I /tmp/branden/ /tmp/branden/sorcerer 
.lf 1 "/tmp/branden/sorcerer
/home/branden/groff-1.24.2/bin/soelim:/tmp/branden/sorcerer:2: warning:
escaping a space is unnecessary and not compatible with troff syntax
.lf 1 "/tmp/branden/included file
included
.lf 2 "/tmp/branden/sorcerer
This is line \n[ln].


But there is no "line 2" in "included file".

_soelim_ kind of tries to have it both ways; the main file processor
_do_file_() assumes all is well and increments the line counter once it has a
seen a `so` line that it has decided is well formed, then calls _do_so_() to
interpret the file name argument.

But the file name argument can have problems, as seen above.  Clark was
already doing a temporary decrementation dance in the case that the `so`
argument could not be opened.

We must dance similarly to emit our warning.

Once we do:


$ ./build/soelim -I /tmp/branden/ /tmp/branden/sorcerer 
.lf 1 "/tmp/branden/sorcerer
./build/soelim:/tmp/branden/sorcerer:1: warning: escaping a space is
unnecessary and not compatible with troff syntax
.lf 1 "/tmp/branden/included file
./build/soelim:/tmp/branden/included file:1: warning: no newline at end of
file
included
.lf 2 "/tmp/branden/sorcerer
This is line \n[ln].


Target at _groff_ 1.26.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68875>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to