bugGNU roff - Bugs: bug #57873, grog mangles explicitly given...

 
 

bug #57873: grog mangles explicitly given groff options

Submitter:  None
Submitted:  Fri 21 Feb 2020 03:08:54 PM UTC
   
 
Category:  Utilities 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
   

Tue 29 Jun 2021 04:27:39 AM UTC, comment #4: 


commit 6145868098b56a77b5e585f0ee3ec04ab73c5e66
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Tue Jun 29 14:11:14 2021 +1000

    [grog]: Refactor command-line argument handling.

    * src/utils/grog/grog.pl:
      - Drop scalars `groff_opts`, `device`, and `with_warnings`.
      - Move scalar `pdf_with_ligatures`...

      (process_arguments): ...here.  Recognize all groff options that take
      an optionally whitespace-separated option argument and apply the
      existing "delayed option" handling to them.  Push any groff option
      except `-m` as-is onto the constructed groff command's argument list
      (`-m` handling is unchanged).  Match long option names exactly, not
      sloppily.  Stop recognizing `--with-warnings` option.  Emit error
      diagnostic if unrecognized long option encountered.

      (infer_device): Delete subroutine and its top-level call site.

      (help): Undocument `--warnings`.

    * src/utils/grog/grog.1.man:
      (Synopsis): Use font style macros instead of .OP.  Undocument
      `--warnings`.

      (Options): Note that the groff arguments produced by the grog
      `--ligatures` option are supported only by the `pdf` device.
      Undocument `--warnings`.  Undocument groff-incompatible restriction on
      whitespace before option arguments; grog is compatible now.  Simplify
      discussion in light of simplified grog logic.

      (Details): Undocument scenario where grog infers multiple
      main/major/full-service macro packages; this no longer happens.

      (Examples): Update to no longer illustrate includion of `-T ps`
      option; this no longer happens by default.

    * NEWS: Document removal of grog's `--warnings` option.

    Fixes <https://savannah.gnu.org/bugs/?57873>; groff options are
    no longer "mangled".

commit ee76f84c0ebb855b6a0bb8f6d6ed49520619b32d
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Tue Jun 29 13:44:44 2021 +1000

    Add regression test for Savannah #57873.

    * src/utils/grog/tests/preserve-groff-options.sh: Test it.
    * src/utils/grog/grog.am (grog_TESTS): Run test.


G. Branden Robinson <gbranden>
Group administrator
Tue 29 Jun 2021 03:05:18 AM UTC, comment #3: 

Removing patch annotation.  I'm resolving this a different way with another refactor that kills off a lot of code.

G. Branden Robinson <gbranden>
Group administrator
Mon 07 Jun 2021 09:49:31 PM UTC, comment #2: 

Categorizing grog bugs as Utilities, per discussion.

Dave <barx>
Group Member
Sun 06 Dec 2020 12:33:22 AM UTC, comment #1: 

Subject: [PATCH] grog/subs.pl: Fix wrong regexp for groff options

groff/src/roff/grog/subs.pl: Fix wrong regular expressions for groff
options

  The arguments to an option can contain other characters than
alphanumeric and '_', like '=' and '.'.

  The options' arguments in the output shall not start with a
HYPHEN-MINUS (-).

  Original output:

groff -w -w -f -N -T ps -t -man man/groff.7

  After the patch:

groff -w w -f N -P -pa5 -r a5=0 -T ps -t -man man/groff.7

(Actually to be right, "-dpaper=a5" is missing in the command line.)

Fixes bug #57873.


Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 src/roff/grog/subs.pl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/roff/grog/subs.pl b/src/roff/grog/subs.pl
index 65e55e78..1c40dd95 100644
--- a/src/roff/grog/subs.pl
+++ b/src/roff/grog/subs.pl
@@ -272,14 +272,15 @@ sub handle_args {
       next;
     }

-    if ($arg =~ /^-(\w)(\w*)$/) {        # maybe a groff option
+    if ($arg =~ /^-(\w)([^ ]*)$/) {        # maybe a groff option
       my $opt_char = $1;
       my $opt_char_with_arg = $opt_char . ':';
       my $others = $2;
       if ( $groff_opts =~ /$opt_char_with_arg/ ) {        # groff optarg
         if ( $others ) {        # optarg is here
           push @Command, '-' . $opt_char;
-          push @Command, '-' . $others;
+#          push @Command, '-' . $others;
+          push @Command, '' . $others;
           next;
         }
         # next arg is optarg
--
2.29.2


Bjarni Ingi Gislason <bjarniig>
Fri 21 Feb 2020 03:08:54 PM UTC, original submission:  

GROFF VERSION:
1.22.4

MACHINE:
Dell inspiron desktop

OS:
Ubuntu 18.04

COMPILER:
c++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

INPUT FILES:

COMMAND LINE:
grog -ww -fN -P-pa5 -ra5=0 man/groff.7

DESCRIPTION OF INCORRECT BEHAVIOUR:
Output is
groff -w -w -f -N -t -man man/groff.7
which mangles the options (this is documented)

This is a changed from previous versions of grog, and means
that multi-char options cannot be used.

SUGGESTED FIX [optional]:

Anonymous

 

(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 (Updated the item)
  • -email is unavailable- added by bjarniig (Posted a comment)
  •  

    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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-29 gbranden StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2021-06-29 gbranden Summary[PATCH] grog mangles output grog mangles explicitly given groff options
    2021-06-29 gbranden StatusNone In Progress
        Assigned toNone gbranden
    2021-06-07 barx Carbon-CopyRemoved 93119 -
    2021-06-07 barx CategoryCore Utilities
    2021-05-23 barx Carbon-CopyRemoved 93119 -
    2021-05-23 barx Summarygrog mangles output [PATCH] grog mangles output

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code