Opened 6 years ago

Closed 6 years ago

#917 closed defect (fixed)

configure sed version_release stripper broken under NetBSD

Reported by: robe Owned by: robe
Priority: major Milestone: 3.7.0
Component: Build/Install Version: main
Severity: Unassigned Keywords:
Cc:

Description

From Greg Troxel https://lists.osgeo.org/pipermail/geos-devel/2018-August/008451.html

But, I figured out what was wrong.  This is the version from configure
(so no extra [ - don't paste it in...).    The key thing is to add ()
around .* before the ?, because

  .*?

is malformed.   It's the .* production that the ? applies to (present or
not).

  VERSION_RELEASE=`echo "$VERSION" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+)(.*)?$/\1/'`

GNU sed may be allowing this as an extension, because "*?" doesn't make sense, since * is repetition.

Actually, the whole ? is redundant and can be just dropped, because

  (.*)?

matches zero or more occurrences fo any character, and also the empty string.  But .* matches the empty string anyway.  So while I can see the point that it leads the reader to think "either some arbitrary string or the empty string", it's just more complicated for no good reason.

So just drop the ? after the .*

Change History (3)

comment:1 by Bas Couwenberg, 6 years ago

Patching configure.ac as suggested by Greg should be fine, i.e.:

--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ VERSION_MAJOR=3
 VERSION_MINOR=7
 VERSION_PATCH=0rc1
 VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
-VERSION_RELEASE=`echo "$VERSION" | sed -E 's/^([[0-9]+\.[0-9]+\.[0-9]+]).*?$/\1/'`
+VERSION_RELEASE=`echo "$VERSION" | sed -E 's/^([[0-9]+\.[0-9]+\.[0-9]+]).*$/\1/'`
 
 dnl CAPI_VERSION_MAJOR=$(($CAPI_INTERFACE_CURRENT-$CAPI_INTERFACE_AGE))
 dnl the following should be more portable

It handles cases like 3.7.0rc1dev just fine on Linux too.

Last edited 6 years ago by Bas Couwenberg (previous) (diff)

comment:2 by Regina Obe <lr@…>, 6 years ago

In bf8567c/git:

revise sed check for parsing version so works on all GNU compliant sed. References #917 for 3.8.0

comment:3 by Regina Obe <lr@…>, 6 years ago

Resolution: fixed
Status: assignedclosed

In 4f66f8f/git:

revise sed check for parsing version so works on all sed per Greg Troxel and Bas Cowenberg.

Closes #917 for 3.7.0
Update NEWS credits

Note: See TracTickets for help on using tickets.