bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] bootstrap: avoid broken Solaris sed


From: Paul Eggert
Subject: Re: [PATCH] bootstrap: avoid broken Solaris sed
Date: Sat, 13 Nov 2010 18:16:34 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

On 11/13/2010 03:18 PM, Eric Blake wrote:
> +    if test -x /usr/xpg4/bin/sed; then

I'm leery about using XPG4 sed on Solaris.
That has its own set of bugs, which in practice can
bite just as often as the standard 'sed', maybe more
often.  One classic example: it can't handle scripts
containing more than 100 lines.  I'm sure there are
others.

Instead, I suggest rewriting 'bootstrap' so that it
works even with standard 'sed' on Solaris.  In this
case it's pretty easy: the rewrite is shorter and
arguably clearer than the original.

>From 2e828daf92c8b2ba102787adf686ba5582844c3d Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Sat, 13 Nov 2010 18:12:48 -0800
Subject: [PATCH] bootstrap: port to Solaris sed

* build-aux/bootstrap (get_version): Port to Solaris sed.
See Ralf Wildenhues's note in
<http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00156.html>.
---
 ChangeLog           |    8 ++++++++
 build-aux/bootstrap |   17 +++++++++--------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index aaa02ef..f44597e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-13  Paul Eggert  <address@hidden>
+
+       bootstrap: port to Solaris sed
+
+       * build-aux/bootstrap (get_version): Port to Solaris sed.
+       See Ralf Wildenhues's note in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00156.html>.
+
 2010-11-13  Bruno Haible  <address@hidden>
 
        rename, renameat: Avoid test failures at NFS mounted locations.
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 6c311c3..12fec20 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -344,17 +344,18 @@ get_version() {
   $app --version >/dev/null 2>&1 || return 1
 
   $app --version 2>&1 |
-  sed -n '# extract version within line
-          s/.*[v ]\{1,\}\([0-9]\{1,\}\(\.[.a-z0-9-]*\)*\).*/\1/
-          t done
+  sed -n '# Move version to start of line.
+          s/.*[v ]\([0-9]\)/\1/
 
-          # extract version at start of line
-          s/^\([0-9]\{1,\}\(\.[.a-z0-9-]*\)*\).*/\1/
-          t done
+          # Skip lines that do not start with version.
+          /^[0-9]/!d
 
-          d
+          # Remove characters after the version.
+          s/[^.a-z0-9-].*//
+
+          # The first component must be digits only.
+          s/^\([0-9]*\)[a-z-].*/\1/
 
-          :done
           #the following essentially does s/5.005/5.5/
           s/\.0*\([1-9]\)/.\1/g
           p
-- 
1.7.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]