[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #54486] Makefile.am: correctly calculate MAJOR_VERSION, MINOR_VERSI
From: |
Ingo Schwarze |
Subject: |
[bug #54486] Makefile.am: correctly calculate MAJOR_VERSION, MINOR_VERSION, REVISION |
Date: |
Thu, 9 Aug 2018 23:47:49 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; OpenBSD amd64; rv:61.0) Gecko/20100101 Firefox/61.0 |
URL:
<http://savannah.gnu.org/bugs/?54486>
Summary: Makefile.am: correctly calculate MAJOR_VERSION,
MINOR_VERSION, REVISION
Project: GNU troff
Submitted by: schwarze
Submitted on: Fri 10 Aug 2018 03:47:47 AM UTC
Category: Core
Severity: 3 - Normal
Item Group: Incorrect behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release: None
_______________________________________________________
Details:
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?
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 10 Aug 2018 03:47:47 AM UTC Name: version.patch Size: 1KiB By:
schwarze
<http://savannah.gnu.org/bugs/download.php?file_id=44758>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54486>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #54486] Makefile.am: correctly calculate MAJOR_VERSION, MINOR_VERSION, REVISION,
Ingo Schwarze <=