[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Bug in subversion sed usage inside configure (Solaris)

From: Rainer Jung <rainer.jung_at_kippdata.de>
Date: Thu, 6 Aug 2015 12:13:07 +0200

This has been observed for Subversion 1.9.0, but visual inspection shows
the same in the head revisions of at least 1.9, 1.8 and 1.7. Trunk
already has a fix, but a bigger and different one than the one proposed
here. Moving to the trunk fix would be fine (it is not in 1.9 STATUS
currently), but if you think that would be a change too big, the
following is simpler:

Subversion 1.9.0 uses the following sed command in configure:

   $SED -e 's@^.*/\([0-9.]*\)\(.*$\)@\1@ ; 1q'

On Solaris there are two sed incarnations installed by default,
/usr/bin/sed and /usr/xpg4/bin/sed. Both of them do not accept this use
and return with:

   sed: command garbled: s@^.*/\([0-9.]*\)\(.*$\)@\1@ ; 1q

The reasons is the space before "; 1q". Removing it fixes the "garbled".
But still the command does not do what was intended. It will return
(example)

   Server version: Apache/2.4.4 (Unix)

instead of the expected

   2.4.4

The reason for this failure is the "$" character in the sed command
which is not known to the Solaris implementation.

I suggest to use the following easier pattern instead, which would also
work for GNU sed and should also work on all other platforms:

   $SED -e 's@.*/\([0-9.]*\).*@\1@; 1q'

Motivation:

- Space character before ";" is not needed and harmful at least on Solaris

- Caret "^" and Dollar sign "$" before resp. after ".*" is implicit and
at least the Dollar sign harms on Solaris

- The second capture "\(...\)" is not used so can be removed

This is the suggested patch for 1.9 head:

--- build/ac-macros/apache.m4 2015-07-27 02:23:40.000000000 +0200
+++ build/ac-macros/apache.m4 2015-08-06 12:04:47.114473000 +0200
@@ -166,7 +166,7 @@
      if ! test -e $HTTPD ; then
        HTTPD="`$APXS -q bindir`/`$APXS -q PROGNAME`"
      fi
- HTTPD_VERSION=["`$HTTPD -v | $SED -e 's@^.*/\([0-9.]*\)\(.*$\)@\1@
; 1q'`"]
+ HTTPD_VERSION=["`$HTTPD -v | $SED -e 's@.*/\([0-9.]*\).*@\1@; 1q'`"]
      AC_ARG_ENABLE(broken-httpd-auth,
        AS_HELP_STRING([--enable-broken-httpd-auth],
                       [Allow building against httpd 2.4 with broken auth]),

Regards,

Rainer
Received on 2015-08-06 12:13:36 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.