You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Albert Chin <ht...@mlists.thewrittenword.com> on 2003/08/23 07:29:04 UTC

sed magic in apr_common.m4 to source config.layout breaks on IRIX

There is some sed magic in apr_common.m4 to source config.layout. The
first sed line is:
  "1s/[ ^I]*<[lL]ayout[ ^I]*$2[ ^I]*>[ ^I]*//;t"

What does this do? It breaks the sed statement on IRIX 6.5.19m.
Removing the sed statement above causes everything to work fine. I've
tested the sed statement without the first line on the following
platforms with success:
  AIX 4.3.2, 5.1
  HP-UX 10.20-11i
  IRIX 6.5
  Redhat Linux 7.1, 9.0
  Solaris 2.5.1-9/SPARC
  Tru64 UNIX 4.0D, 5.1

-- 
albert chin (china@thewrittenword.com)

Re: sed magic in apr_common.m4 to source config.layout breaks on IRIX

Posted by Albert Chin <ht...@mlists.thewrittenword.com>.
On Sat, Aug 23, 2003 at 09:30:35AM +0200, Sascha Schumann wrote:
> On Sat, 23 Aug 2003, Albert Chin wrote:
> 
>     Can you give the patch a try?  It is _way_ easier to maintain
>     than the sed version.

Won't work. -v isn't supported by all awk's. It is by "nawk" and
"gawk". I've attached an updated patch to fix this and remove the
changequote's.

--- build/apr_common.m4.orig	Fri Aug 22 09:46:48 2003
+++ build/apr_common.m4	Sun Aug 24 10:22:06 2003
@@ -756,14 +756,12 @@
     exit 1
   fi
   pldconf=./config.pld
-  changequote({,})
-  sed -e "1s/[ 	]*<[lL]ayout[ 	]*$2[ 	]*>[ 	]*//;t" \
-      -e "1,/[ 	]*<[lL]ayout[ 	]*$2[ 	]*>[ 	]*/d" \
-      -e '/[ 	]*<\/Layout>[ 	]*/,$d' \
-      -e "s/^[ 	]*//g" \
-      -e "s/:[ 	]*/=\'/g" \
-      -e "s/[ 	]*$/'/g" \
-      $1 > $pldconf
+  awk '                                                         \
+        /<[[Ll]]ayout/ { if ([$]2 == "'$2'" ">") ok=1; next; }               \
+        ok == 1 && /<\/Layout>/ { exit; }                                    \
+        ok == 1 { print [substr]([$]1,1,length([$]1)-1) "=\"" [$]2 "\"" } '  \
+        < $1 > $pldconf
+
   layout_name=$2
   if test ! -s $pldconf; then
     echo "** Error: unable to find layout $layout_name"
@@ -786,7 +784,7 @@
         ;;
     esac
     val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
-    val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
+    val=`echo $val | sed -e 's:[[\$]]\([[a-z_]]*\):$[\1]:g'`
     if test "$autosuffix" = "yes"; then
       if echo $val | grep apache >/dev/null; then
         addtarget=no
@@ -799,7 +797,6 @@
     fi
     eval "$var='$val'"
   done
-  changequote([,])
 ])dnl
 
 dnl

-- 
albert chin (china@thewrittenword.com)

Re: sed magic in apr_common.m4 to source config.layout breaks on IRIX

Posted by Sascha Schumann <sa...@schumann.cx>.
On Sat, 23 Aug 2003, Albert Chin wrote:

> There is some sed magic in apr_common.m4 to source config.layout. The
> first sed line is:

    I've fixed this in May but have not come around to commit it
    yet.  See the attached patch.  And no, I have no idea what
    the first sed expression is trying to achieve.

> What does this do? It breaks the sed statement on IRIX 6.5.19m.
> Removing the sed statement above causes everything to work fine. I've
> tested the sed statement without the first line on the following
> platforms with success:

    Can you give the patch a try?  It is _way_ easier to maintain
    than the sed version.

    - Sascha