mvertes / txt2man

txt2man converts text to man page
GNU General Public License v2.0
57 stars 9 forks source link

Whitespace within "()" in SYNOPSIS Causes Regexp Error #38

Open ediw8311xht opened 1 year ago

ediw8311xht commented 1 year ago

Example of text causing error:

SYNOPSIS

    Lorem ipsum
    (BYE GUYS) Lorem ipsum

The error returned is:

gawk: cmd. line:145: (FILENAME=- FNR=4) fatal: 
invalid regexp: Unmatched ( or \(: /\<(BYE\>/

Conditions

  1. Occurs inside SYNOPSIS section.
  2. When there is a space anywhere within a set of colons ().
  3. When there is not a set of colons () within the first line of SYNOPSIS with a space or not with a space.

Examples:

1. (SUCCESS)

SYNOPSIS

    Lorem ipsum (HELLOGUYS)
    (BYE GUYS) Lorem ipsum

2. (SUCCESS)

SYNOPSIS

    Lorem ipsum
    (BYE_GUYS) Lorem ipsum

3. (ERROR)

SYNOPSIS

    Lorem ipsum
    (BYE GUYS) Lorem ipsum

4. (ERROR)

SYNOPSIS

    Lorem ipsum
    ffff (hello) Lorem ipsum
    fasdfasf ( fasdfadsf)

5. (ERROR)

SYNOPSIS

    Lorem ipsum
    ffff Lorem ipsum
    fasdfasf ( fasdfadsf)
    lorem (hello yo)

Example of real world man page that throws error:

https://www.gsp.com/cgi-bin/man.cgi?section=1&topic=man

System

  1. Gawk 5.2.1
  2. Bash 5.1.16
  3. Txt2man 1.7.1-2
ediw8311xht commented 1 year ago

https://github.com/mvertes/txt2man/blob/be89fb412fd443813db6b4d2fcd4223546138757/txt2man#L289-L301

Error goes away when removing this section, so its something in this section causing the issue.