Update of bug #68571 (group groff):

                 Summary: [troff] `shift` request should not perform operation
if argument invalid => [PATCH] [troff] `shift` request should not perform
operation if argument invalid

    _______________________________________________________

Follow-up Comment #2:


commit 137d884a9c2204c611b17d26c79aa768298fdf08
Author: G. Branden Robinson <[email protected]>
Date:   Mon Jul 27 22:38:39 2026 -0500

    XXX [troff]: Revise `shift` request behavior.  Fix Savannah #68571.

diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index ca4530e9a..0493efe46 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -1011,10 +1011,15 @@ static void next_file_request() // .nx
 
 static void shift_request() // .shift
 {
-  int n;
-  if (!has_arg() || !read_integer(&n))
+  int n = 0;
+  if (!has_arg())
     n = 1;
-  input_stack::shift(n);
+  else
+    (void) read_integer(&n);
+  if (n < 0)
+    warning(WARN_RANGE, "ignoring negative macro argument shift %1", n);
+  else if (n > 0)
+    input_stack::shift(n);
   skip_line();
 }
 




    _______________________________________________________

Reply to this item at:

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

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

Attachment: signature.asc
Description: PGP signature

Reply via email to