[njs] Always use a sharp (#) symbol as the sed separator.

Dmitry Volyntsev xeioex at nginx.com
Wed May 17 04:01:45 UTC 2023


details:   https://hg.nginx.org/njs/rev/71fa2f4b6adb
branches:  
changeset: 2118:71fa2f4b6adb
user:      "Sergey A. Osokin" <osa at FreeBSD.org.ru>
date:      Fri May 12 19:38:29 2023 -0400
description:
Always use a sharp (#) symbol as the sed separator.

sed(1) command line utility may fail with the following error:
sed: 1: "s, at EXTRA_LIBS@,-lm   -L ...": bad in substitute command: '-'
when a replacement for @EXTRA_LIBS@ contains a comma symbol.

diffstat:

 auto/libxml2 |   2 +-
 auto/make    |  14 +++++++-------
 auto/options |   4 ++--
 auto/zlib    |   2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diffs (83 lines):

diff -r ce29debb0b3d -r 71fa2f4b6adb auto/libxml2
--- a/auto/libxml2	Tue May 16 20:58:23 2023 -0700
+++ b/auto/libxml2	Fri May 12 19:38:29 2023 -0400
@@ -26,7 +26,7 @@ if [ $NJS_LIBXML2 = YES ]; then
         # pkg-config
 
         njs_feature="libxml2 via pkg-config"
-        njs_feature_incs=`pkg-config libxml-2.0 --cflags | sed -n -e 's/.*-I *\([^ ][^ ]*\).*/\1/p'`
+        njs_feature_incs=`pkg-config libxml-2.0 --cflags | sed -n -e 's#.*-I *\([^ ][^ ]*\).*#\1#p'`
         njs_feature_libs=`pkg-config libxml-2.0 --libs`
 
         . auto/feature
diff -r ce29debb0b3d -r 71fa2f4b6adb auto/make
--- a/auto/make	Tue May 16 20:58:23 2023 -0700
+++ b/auto/make	Fri May 12 19:38:29 2023 -0400
@@ -54,7 +54,7 @@ NJS_STATIC_LINK = ${AR} -r -c
 NJS_LINK = ${CC} ${NJS_LD_OPT}
 NJS_CFLAGS = ${NJS_CFLAGS} ${NJS_CC_OPT} ${CFLAGS}
 
-NJS_VER = $(grep NJS_VERSION src/njs.h | sed -e 's/.*"\(.*\)".*/\1/')
+NJS_VER = $(grep NJS_VERSION src/njs.h | sed -e 's#.*"\(.*\)".*#\1#')
 NJS_TYPES_VER = \$(NJS_VER)
 
 NPM = npm
@@ -275,7 +275,7 @@ cat << END >> $NJS_MAKEFILE
 $NJS_BUILD_DIR/ts/package.json: $njs_ts_deps
 	cp -fr ts $NJS_BUILD_DIR/
 	cp LICENSE $NJS_BUILD_DIR/ts/
-	sed 's/__VERSION__/"\$(NJS_TYPES_VER)"/' \\
+	sed 's#__VERSION__#"\$(NJS_TYPES_VER)"#' \\
 		ts/package.json > $NJS_BUILD_DIR/ts/package.json
 
 $NJS_BUILD_DIR/ts/node_modules: $NJS_BUILD_DIR/ts/package.json
@@ -320,11 +320,11 @@ cat << END >> $NJS_MAKEFILE
 pc: $NJS_BUILD_DIR/njs.pc
 
 $NJS_BUILD_DIR/njs.pc: $NJS_BUILD_DIR/njs_auto_config.h
-	sed -e "s, at PREFIX@,$(pwd)/$NJS_BUILD_DIR," \\
-		-e "s, at LIBDIR@,$(pwd)/$NJS_BUILD_DIR," \\
-		-e "s, at CFLAGS@,-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src," \\
-		-e "s, at VERSION@,\$(NJS_VER)," \\
-		-e "s, at EXTRA_LIBS@,-lm $NJS_LIBS $NJS_LIB_AUX_LIBS," \\
+	sed -e "s#@PREFIX@#$(pwd)/$NJS_BUILD_DIR#" \\
+		-e "s#@LIBDIR@#$(pwd)/$NJS_BUILD_DIR#" \\
+		-e "s#@CFLAGS@#-I$(pwd)/$NJS_BUILD_DIR -I$(pwd)/src#" \\
+		-e "s#@VERSION@#\$(NJS_VER)#" \\
+		-e "s#@EXTRA_LIBS@#-lm $NJS_LIBS $NJS_LIB_AUX_LIBS#" \\
 		src/njs.pc.in > \$@
 END
 
diff -r ce29debb0b3d -r 71fa2f4b6adb auto/options
--- a/auto/options	Tue May 16 20:58:23 2023 -0700
+++ b/auto/options	Fri May 12 19:38:29 2023 -0400
@@ -28,7 +28,7 @@ NJS_CONFIGURE_OPTIONS=
 for njs_option
 do
     case "$njs_option" in
-        -*=*) value=`echo "$njs_option" | sed -e 's/[-_a-zA-Z0-9]*=//'`      ;;
+        -*=*) value=`echo "$njs_option" | sed -e 's#[-_a-zA-Z0-9]*=##'`      ;;
            *) value="" ;;
     esac
 
@@ -70,7 +70,7 @@ do
         ;;
     esac
 
-    njs_opt=`echo $njs_option | sed -e "s/\(--[^=]*=\)\(.* .*\)/\1'\2'/"`
+    njs_opt=`echo $njs_option | sed -e "s#\(--[^=]*=\)\(.* .*\)#\1'\2'#"`
 
     NJS_CONFIGURE_OPTIONS="$NJS_CONFIGURE_OPTIONS $njs_opt"
 
diff -r ce29debb0b3d -r 71fa2f4b6adb auto/zlib
--- a/auto/zlib	Tue May 16 20:58:23 2023 -0700
+++ b/auto/zlib	Fri May 12 19:38:29 2023 -0400
@@ -26,7 +26,7 @@ if [ $NJS_ZLIB = YES ]; then
         # pkg-config
 
         njs_feature="zlib via pkg-config"
-        njs_feature_incs=`pkg-config zlib --cflags | sed -n -e 's/.*-I *\([^ ][^ ]*\).*/\1/p'`
+        njs_feature_incs=`pkg-config zlib --cflags | sed -n -e 's#.*-I *\([^ ][^ ]*\).*#\1#p'`
         njs_feature_libs=`pkg-config zlib --libs`
 
         . auto/feature


More information about the nginx-devel mailing list