bugGNU roff - Bugs: bug #54486, Makefile.am: correctly calculate...

 
 

bug #54486: Makefile.am: correctly calculate MAJOR_VERSION, MINOR_VERSION, REVISION

Submitter:  Ingo Schwarze <schwarze>
Submitted:  Fri 10 Aug 2018 03:47:47 AM UTC
   
 
Category:  Core Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  schwarze
Open/Closed:  Closed Planned Release:  1.22.4
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 10 Aug 2018 10:24:24 PM UTC, comment #2: 

Fixed in commit f1af4b0b Aug 10 05:40:57 2018 +0200.

Ingo Schwarze <schwarze>
Group Member
Fri 10 Aug 2018 03:51:51 AM UTC, comment #1: 

LGTM, thanks.

Werner LEMBERG <wl>
Group administrator
Fri 10 Aug 2018 03:47:47 AM UTC, original submission:  

The current Basic Regular Expressions in the top level Makefile.am for calculating these three variables are incorrect and do not work.  According to POSIX, the character '+' is not special in a BRE and matches itself; prepending a backslash changes nothing:

 $ echo aa+c | sed 's/a\+/b/'
 abc

So "[0-9]\+" does not work as intended, and the regular expressions never match, leaving all three variables as "1.22.4", causing further havoc down the road because \n(.x and \n(.y also become "1.22.4":

troff: doc.tmac:53: warning: missing ')' (got '.')
troff: doc.tmac:53: warning: macro '41.22.4' not defined

Of course, there are many ways to fix these regular expressions, but it is actually simpler, easier to read, and more robust to just use cut(1), which is also standardized by POSIX and fully portable:

 MAJOR_VERSION = `echo $(VERSION) | cut -d . -f 1`
 MINOR_VERSION = `echo $(VERSION) | cut -d . -f 2`
 REVISION      = `echo $(VERSION) | cut -d . -f 3`
 
Patch tested on OpenBSD and Linux.
OK to commit?

Ingo Schwarze <schwarze>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44758:  version.patch added by schwarze (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by schwarze (Submitted the item)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-10 schwarze Assigned toNone schwarze
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.22.4
    2018-08-10 schwarze StatusNone Fixed
    2018-08-10 schwarze Attached File- Added version.patch, #44758

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code