Bug #6209 Bourne shell and sed incompatible with Berkeley DB
Submitted: 22 Oct 2004 5:58 Modified: 2 May 2005 13:42
Reporter: Kent Boortz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.1 OS:Solaris (Solaris 9)
Assigned to: Kent Boortz CPU Architecture:Any

[22 Oct 2004 5:58] Kent Boortz
Description:
Some build problems using Solaris 9 standard tools.

Solaris 'sed' require, as many sed implementations, that there is a space
after the 'r' modifier and the file name. Exactly one space.

Solaris Bourne shell use the PATH to search for files sourced with dot.
Some scripts "bdb/dist/s_*" source the plain file name RELEASE.
This will fail if dot isn't in the PATH.

Solaris make gets confused by the line "%::SCCS/s.%" that ends most 
make files. This is not handled in this patch, I suggest that GNU make
is used instead (the idea with automake is that you shouldn't have to).

How to repeat:
Build with "--with-berkeley-db" from the bk tree on Solaris 9 with
a PATH similar to

  PATH=/opt/sfw/bin:/usr/local/bin:/usr/xpg4/bin:/usr/bin:\
/usr/sbin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin:/usr/ucb:/opt/SUNWspro/bin
  export PATH

The auto tools require GNU m4 that on my system is installed as 'gm4'.
To get around this I set

  M4=gm4
  export M4

Suggested fix:
--- 1.3/bdb/dist/s_win32_dsp    Wed Oct 30 12:48:57 2002
+++ edited/bdb/dist/s_win32_dsp Fri Oct 22 01:27:53 2004
@@ -3,7 +3,7 @@
 #
 # Build Windows/32 .dsp files.

-. RELEASE
+. ./RELEASE

 BUILDDIR=../build_win32
 SRCFILES=srcfiles.in
@@ -35,7 +35,9 @@
             -e "s/@srcfile@/$srcfile/g" \
             < $srctemplate >> $dspoutput.insert
     done
-    sed -e "/@SOURCE_FILES@/r$dspoutput.insert" \
+    # We need exactly one space after the 'r' modifier
+    # See 5.9 in http://www.student.northpark.edu/pemente/sed/sedfaq.txt
+    sed -e "/@SOURCE_FILES@/r $dspoutput.insert" \
         -e "/@SOURCE_FILES@/d" \
         -e "s/@project_name@/$projname/g" \
         -e "s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/g" \
--- 1.4/bdb/dist/s_java Mon Nov 11 17:17:26 2002
+++ edited/bdb/dist/s_java      Fri Oct 22 01:26:32 2004
@@ -5,7 +5,7 @@

 msgjava="/* DO NOT EDIT: automatically built by dist/s_java. */"

-. RELEASE
+. ./RELEASE

 t=/tmp/__java
 c=/tmp/__javajnic
--- 1.1/bdb/dist/s_javah        Wed Oct 30 12:51:50 2002
+++ edited/bdb/dist/s_javah     Fri Oct 22 01:26:44 2004
@@ -8,7 +8,7 @@
 # Using Sun's JDK rather than some other installation ensures
 # that the header files will not be constantly changed.

-. RELEASE
+. ./RELEASE

 JAVAC=javac
 JAVAH=javah
--- 1.3/bdb/dist/s_readme       Wed Oct 30 12:48:55 2002
+++ edited/bdb/dist/s_readme    Fri Oct 22 01:26:53 2004
@@ -8,7 +8,7 @@
 t=/tmp/__t
 trap 'rm -f $t; exit 0' 0 1 2 3 13 15

-. RELEASE
+. ./RELEASE

 cat << END_OF_README>$t
 $DB_VERSION_STRING
--- 1.1/bdb/dist/s_test Wed Oct 30 12:51:51 2002
+++ edited/bdb/dist/s_test      Fri Oct 22 01:27:06 2004
@@ -9,7 +9,7 @@
 t=/tmp/__t
 trap 'rm -f $t; exit 0' 0 1 2 3 13 15

-. RELEASE
+. ./RELEASE

 (echo "$msg1"                                  && \
  echo ""                                       && \
--- 1.3/bdb/dist/s_vxworks      Wed Oct 30 12:48:57 2002
+++ edited/bdb/dist/s_vxworks   Fri Oct 22 01:27:17 2004
@@ -5,7 +5,7 @@

 msgc="/* DO NOT EDIT: automatically built by dist/s_vxworks. */"

-. RELEASE
+. ./RELEASE

 s=/tmp/__db_a
 t=/tmp/__db_b
--- 1.3/bdb/dist/s_win32        Wed Oct 30 12:48:57 2002
+++ edited/bdb/dist/s_win32     Fri Oct 22 01:27:31 2004
@@ -6,7 +6,7 @@
 msgc="/* DO NOT EDIT: automatically built by dist/s_win32. */"
 msgw="; DO NOT EDIT: automatically built by dist/s_win32."

-. RELEASE
+. ./RELEASE

 s=/tmp/__db_a$$
 t=/tmp/__db_b$$
[9 Mar 2005 0:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/22810