[Exim] exim-3.12: Building: quoting problem with sed

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Jim Knoble
Dátum:  
Címzett: Exim Users
Tárgy: [Exim] exim-3.12: Building: quoting problem with sed
Phillip--

I seem to have stumbled onto a shortcoming in the way the exim utility
scripts are built by setting ZCAT_COMMAND to `/bin/gzip -dc' (on a
Linux [Red Hat] system). The result was that sed decided it had an
incomplete substitution command when building the exigrep utility from
exigrep.src, due to the embedded whitespace in the substitution string.

The attached patch appears to fix this problem, although i'm a bit
anxious about EXIWHAT_EGREP_ARG, which obviously needs to remain quoted
due to embedded whitespace. I'm not completely satisfied with the
solution i chose, but i'm unable to think of one that is both `better'
and no more complex than this one.

--
jim knoble
jmknoble@???
--- ./OS/Makefile-Base.orig-quotes    Wed Dec 8 04:57:01 1999
+++ ./OS/Makefile-Base    Sun Jan  9 04:12:20 2000
@@ -95,15 +95,15 @@
 # Target for the exicyclog utility script
 exicyclog: Makefile config.h ../src/exicyclog.src
     @rm -f exicyclog
-    sed -e s?CONFIGURE_FILE?$(CONFIGURE_FILE)? \
-      -e s?BIN_DIRECTORY?$(BIN_DIRECTORY)? \
-      -e s?EXICYCLOG_MAX?$(EXICYCLOG_MAX)? \
-      -e s?COMPRESS_COMMAND?$(COMPRESS_COMMAND)? \
-      -e s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)? \
-      -e s?CHOWN_COMMAND?$(CHOWN_COMMAND)? \
-      -e s?CHGRP_COMMAND?$(CHGRP_COMMAND)? \
-      -e s?MV_COMMAND?$(MV_COMMAND)? \
-      -e s?RM_COMMAND?$(RM_COMMAND)? \
+    sed -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+      -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+      -e "s?EXICYCLOG_MAX?$(EXICYCLOG_MAX)?" \
+      -e "s?COMPRESS_COMMAND?$(COMPRESS_COMMAND)?" \
+      -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
+      -e "s?CHOWN_COMMAND?$(CHOWN_COMMAND)?" \
+      -e "s?CHGRP_COMMAND?$(CHGRP_COMMAND)?" \
+      -e "s?MV_COMMAND?$(MV_COMMAND)?" \
+      -e "s?RM_COMMAND?$(RM_COMMAND)?" \
       ../src/exicyclog.src > exicyclog-t
     @mv exicyclog-t exicyclog
     @chmod a+x exicyclog
@@ -113,7 +113,7 @@
 # Target for the exinext utility script
 exinext: Makefile config.h ../src/exinext.src
     @rm -f exinext
-    sed -e s?CONFIGURE_FILE?$(CONFIGURE_FILE)? -e s?BIN_DIRECTORY?$(BIN_DIRECTORY)? ../src/exinext.src > exinext-t
+    sed -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" ../src/exinext.src > exinext-t
     @mv exinext-t exinext
     @chmod a+x exinext
     @echo ">>> exinext script built"; echo ""
@@ -121,12 +121,12 @@
 # Target for the exiwhat utility script
 exiwhat: Makefile config.h ../src/exiwhat.src
     @rm -f exiwhat
-    sed -e s?CONFIGURE_FILE?$(CONFIGURE_FILE)? \
-      -e s?BIN_DIRECTORY?$(BIN_DIRECTORY)? \
-      -e s?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)? \
-      -e s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)? \
-      -e s?EXIWHAT_KILL_ARG?$(EXIWHAT_KILL_ARG)? \
-      -e s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)? \
+    sed -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+      -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+      -e "s?EXIWHAT_PS_CMD?$(EXIWHAT_PS_CMD)?" \
+      -e "s?EXIWHAT_PS_ARG?$(EXIWHAT_PS_ARG)?" \
+      -e "s?EXIWHAT_KILL_ARG?$(EXIWHAT_KILL_ARG)?" \
+      -e "s?EXIWHAT_EGREP_ARG?$(EXIWHAT_EGREP_ARG)?" \
       ../src/exiwhat.src > exiwhat-t
     @mv exiwhat-t exiwhat
     @chmod a+x exiwhat
@@ -137,11 +137,11 @@
           ../Local/eximon.conf
     @rm -f eximon
     $(SHELL) $(SCRIPTS)/Configure-eximon
-    sed -e s?CONFIGURE_FILE?$(CONFIGURE_FILE)? \
-      -e s?BIN_DIRECTORY?$(BIN_DIRECTORY)? \
-      -e s?BASENAME_COMMAND?$(BASENAME_COMMAND)? \
-      -e s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)? \
-      -e s?X11_LD_LIBRARY?$(X11_LD_LIB)? \
+    sed -e "s?CONFIGURE_FILE?$(CONFIGURE_FILE)?" \
+      -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
+      -e "s?BASENAME_COMMAND?$(BASENAME_COMMAND)?" \
+      -e "s?HOSTNAME_COMMAND?$(HOSTNAME_COMMAND)?" \
+      -e "s?X11_LD_LIBRARY?$(X11_LD_LIB)?" \
       ../src/eximon.src >> eximon
     @echo ">>> eximon script built"; echo ""


@@ -150,9 +150,9 @@

 ../util/exigrep: Makefile ../src/exigrep.src
     @rm -f ../util/exigrep
-    sed -e s?PERL_COMMAND?$(PERL_COMMAND)? \
-      -e s?ZCAT_COMMAND?$(ZCAT_COMMAND)? \
-          -e s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)? \
+    sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
+      -e "s?ZCAT_COMMAND?$(ZCAT_COMMAND)?" \
+          -e "s?COMPRESS_SUFFIX?$(COMPRESS_SUFFIX)?" \
       ../src/exigrep.src > ../util/exigrep-t
     @mv ../util/exigrep-t ../util/exigrep
     @chmod a+x ../util/exigrep
@@ -160,7 +160,7 @@


 ../util/eximstats: Makefile ../src/eximstats.src
     @rm -f ../util/eximstats
-    sed -e s?PERL_COMMAND?$(PERL_COMMAND)? \
+    sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
       ../src/eximstats.src > ../util/eximstats-t
     @mv ../util/eximstats-t ../util/eximstats
     @chmod a+x ../util/eximstats
@@ -168,7 +168,7 @@


 ../util/exiqsumm: Makefile ../src/exiqsumm.src
     @rm -f ../util/exiqsumm
-    sed -e s?PERL_COMMAND?$(PERL_COMMAND)? \
+    sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
       ../src/exiqsumm.src > ../util/exiqsumm-t
     @mv ../util/exiqsumm-t ../util/exiqsumm
     @chmod a+x ../util/exiqsumm
@@ -176,7 +176,7 @@


 ../util/transport-filter.pl: Makefile ../src/transport-filter.src
     @rm -f ../util/transport-filter.pl
-    sed -e s?PERL_COMMAND?$(PERL_COMMAND)? \
+    sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
       ../src/transport-filter.src > ../util/transport-filter.pl-t
     @mv ../util/transport-filter.pl-t ../util/transport-filter.pl
     @chmod a+x ../util/transport-filter.pl
@@ -184,7 +184,7 @@


 ../util/convert4r3: Makefile ../src/convert4r3.src
     @rm -f ../util/convert4r3
-    sed -e s?PERL_COMMAND?$(PERL_COMMAND)? \
+    sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
       ../src/convert4r3.src > ../util/convert4r3-t
     @mv ../util/convert4r3-t ../util/convert4r3
     @chmod a+x ../util/convert4r3
--- ./src/exiwhat.src.orig-quotes    Wed Dec  8 04:57:05 1999
+++ ./src/exiwhat.src    Sun Jan  9 04:20:39 2000
@@ -22,7 +22,7 @@
 ps_cmd=EXIWHAT_PS_CMD
 ps_arg=EXIWHAT_PS_ARG
 kill_arg=EXIWHAT_KILL_ARG
-egrep_arg='EXIWHAT_EGREP_ARG'
+egrep_arg=EXIWHAT_EGREP_ARG


# Determine where the spool directory is. The strings CONFIGURE_FILE and
# BIN_DIRECTORY below are replaced by their compile-time settings when