Skip to contentSkip to conversation

devtools: avoid config backup during test build setup

PATCH Superseded Thomas Monjalon 2 participants 7 messages Dec 16, 2019 – May 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: avoid config backup during test build setup

The config options are updated with sed and the short inline option. In FreeBSD, the suffix argument of the inline option is mandatory. In order to avoid creating a backup file when using sed inline, the argument is set as an empty suffix.

The short option '-i' does not expect '=' before the suffix argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created in the build directory.

Removing the '=' sign while keeping an empty suffix avoids creating a backup file.

Fixes 4a4a20c4775b ("devtools: support FreeBSD")

---

This patch does not work on FreeBSD.
Does it mean the equal sign is required on FreeBSD? This is not what I see on the documentation:
https://www.freebsd.org/cgi/man.cgi?query=sed&sektion=&n=1

---
 devtools/test-build.sh | 76 +++++++++++++++++++++---------------------
 1 file changed, 38 insertions(+), 38 deletions(-)
devtools/test-build.sh +38 -38
index 52305fbb8c..8b6e484a8e 100755
@@ -141,82 +141,82 @@ config () # <directory> <target> <options>
 		echo 'Customize configuration'
 		# Built-in options (lowercase)
 		! echo $3 | grep -q '+default' || \
-		sed -ri="" 's,(RTE_MACHINE=")native,\1default,' $1/.config
+		sed -ri'' 's,(RTE_MACHINE=")native,\1default,' $1/.config
 		echo $3 | grep -q '+next' || \
-		sed -ri=""           's,(NEXT_ABI=)y,\1n,' $1/.config
+		sed -ri''           's,(NEXT_ABI=)y,\1n,' $1/.config
 		! echo $3 | grep -q '+shared' || \
-		sed -ri=""         's,(SHARED_LIB=)n,\1y,' $1/.config
+		sed -ri''         's,(SHARED_LIB=)n,\1y,' $1/.config
 		! echo $3 | grep -q '+debug' || ( \
-		sed -ri=""  's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
-		sed -ri=""           's,(_DEBUG.*=)n,\1y,' $1/.config
-		sed -ri=""  's,(_STAT)([S_].*=|=)n,\1\2y,' $1/.config
-		sed -ri="" 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
+		sed -ri'' 's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
+		sed -ri''           's,(_DEBUG.*=)n,\1y,' $1/.config
+		sed -ri''  's,(_STAT)([S_].*=|=)n,\1\2y,' $1/.config
+		sed -ri'' 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
 
 		# Automatic configuration
 		test "$DPDK_DEP_NUMA" != n || \
-		sed -ri=""             's,(NUMA.*=)y,\1n,' $1/.config
-		sed -ri=""    's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
-		sed -ri=""             's,(BYPASS=)n,\1y,' $1/.config
+		sed -ri''             's,(NUMA.*=)y,\1n,' $1/.config
+		sed -ri''    's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
+		sed -ri''             's,(BYPASS=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ARCHIVE" != y || \
-		sed -ri=""       's,(RESOURCE_TAR=)n,\1y,' $1/.config
+		sed -ri''       's,(RESOURCE_TAR=)n,\1y,' $1/.config
 		test "$DPDK_DEP_BPF" != y || \
-		sed -ri=""         's,(PMD_AF_XDP=)n,\1y,' $1/.config
+		sed -ri''         's,(PMD_AF_XDP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ISAL" != y || \
-		sed -ri=""           's,(PMD_ISAL=)n,\1y,' $1/.config
+		sed -ri''           's,(PMD_ISAL=)n,\1y,' $1/.config
 		test "$DPDK_DEP_MLX" != y || \
-		sed -ri=""           's,(MLX._PMD=)n,\1y,' $1/.config
+		sed -ri''           's,(MLX._PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_NFB" != y || \
-		sed -ri=""            's,(NFB_PMD=)n,\1y,' $1/.config
+		sed -ri''            's,(NFB_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SZE" != y || \
-		sed -ri=""       's,(PMD_SZEDATA2=)n,\1y,' $1/.config
+		sed -ri''       's,(PMD_SZEDATA2=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""          's,(BNX2X_PMD=)n,\1y,' $1/.config
+		sed -ri''          's,(BNX2X_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""           's,(PMD_ZLIB=)n,\1y,' $1/.config
+		sed -ri''           's,(PMD_ZLIB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""   's,(COMPRESSDEV_TEST=)n,\1y,' $1/.config
+		sed -ri''   's,(COMPRESSDEV_TEST=)n,\1y,' $1/.config
 		test "$DPDK_DEP_PCAP" != y || \
-		sed -ri=""               's,(PCAP=)n,\1y,' $1/.config
+		sed -ri''               's,(PCAP=)n,\1y,' $1/.config
 		test -z "$ARMV8_CRYPTO_LIB_PATH" || \
-		sed -ri=""   's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
+		sed -ri''   's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
-		sed -ri=""       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
+		sed -ri''       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
-		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
+		sed -ri''      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
-		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
+		sed -ri''         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test -z "$LIBSSO_KASUMI_PATH" || \
-		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
+		sed -ri''         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test -z "$LIBSSO_ZUC_PATH" || \
-		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
+		sed -ri''            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
+		sed -ri''            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""        's,(PMD_OPENSSL=)n,\1y,' $1/.config
+		sed -ri''        's,(PMD_OPENSSL=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""            's,(QAT_SYM=)n,\1y,' $1/.config
+		sed -ri''            's,(QAT_SYM=)n,\1y,' $1/.config
 		test -z "$FLEXRAN_SDK" || \
-		sed -ri=""     's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
-		sed -ri=""           's,(SCHED_.*=)n,\1y,' $1/.config
+		sed -ri''     's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
+		sed -ri''           's,(SCHED_.*=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""   's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
+		sed -ri''   's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""          's,(MVPP2_PMD=)n,\1y,' $1/.config
+		sed -ri''          's,(MVPP2_PMD=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""         's,(MVNETA_PMD=)n,\1y,' $1/.config
+		sed -ri''         's,(MVNETA_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ELF" != y || \
-		sed -ri=""            's,(BPF_ELF=)n,\1y,' $1/.config
+		sed -ri''            's,(BPF_ELF=)n,\1y,' $1/.config
 		test "$DPDK_DEP_JSON" != y || \
-		sed -ri=""          's,(TELEMETRY=)n,\1y,' $1/.config
+		sed -ri''          's,(TELEMETRY=)n,\1y,' $1/.config
 		build_config_hook $1 $2 $3
 
 		# Explicit enabler/disabler (uppercase)
 		for option in $(echo $3 | sed 's,[~+], &,g') ; do
 			pattern=$(echo $option | cut -c2-)
 			if echo $option | grep -q '^~' ; then
-				sed -ri="" "s,($pattern=)y,\1n," $1/.config
+				sed -ri'' "s,($pattern=)y,\1n," $1/.config
 			elif echo $option | grep -q '^+' ; then
-				sed -ri="" "s,($pattern=)n,\1y," $1/.config
+				sed -ri'' "s,($pattern=)n,\1y," $1/.config
 			fi
 		done
 	fi
Signature · 1 line
2.24.0
#1 lore raw
Quoted 19 lines · Thomas Monjalon

The config options are updated with sed and the short inline option. In FreeBSD, the suffix argument of the inline option is mandatory. In order to avoid creating a backup file when using sed inline, the argument is set as an empty suffix.

The short option '-i' does not expect '=' before the suffix argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created in the build directory.

Removing the '=' sign while keeping an empty suffix avoids creating a backup file.

Fixes 4a4a20c4775b ("devtools: support FreeBSD")
Quoted 8 lines

---

This patch does not work on FreeBSD.
Does it mean the equal sign is required on FreeBSD? This is not what I see on the documentation:
https://www.freebsd.org/cgi/man.cgi?query=sed&sektion=&n=1

---

It appears it is needed, which is why the "=" was added in the first place. See commit: 4a4a20c4775b ("devtools: support FreeBSD"), by Olivier

Is having the backup file a big issue?

Regards,
/Bruce

#2 lore raw

16/12/2019 17:40, Bruce Richardson:

Quoted 27 lines · Thomas Monjalon
Quoted 26 lines

The config options are updated with sed and the short inline option. In FreeBSD, the suffix argument of the inline option is mandatory. In order to avoid creating a backup file when using sed inline, the argument is set as an empty suffix.

The short option '-i' does not expect '=' before the suffix argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created in the build directory.

Removing the '=' sign while keeping an empty suffix avoids creating a backup file.

Fixes 4a4a20c4775b ("devtools: support FreeBSD")

---

This patch does not work on FreeBSD.
Does it mean the equal sign is required on FreeBSD? This is not what I see on the documentation:
https://www.freebsd.org/cgi/man.cgi?query=sed&sektion=&n=1

Quoted 6 lines
Quoted 1 line

---

It appears it is needed, which is why the "=" was added in the first place. See commit: 4a4a20c4775b ("devtools: support FreeBSD"), by Olivier

Is having the backup file a big issue?

No it's not a big issue.
But I really would like to know how to have a common behaviour on BSD an Linux for a thing as simple as "sed -i" !
And why the mandatory "=" is not documented on FreeBSD?

It cannot be so much broken. We probably miss something...

#3 lore raw
Quoted 33 lines · Thomas Monjalon

16/12/2019 17:40, Bruce Richardson:

Quoted 32 lines · Thomas Monjalon
Quoted 19 lines

The config options are updated with sed and the short inline option. In FreeBSD, the suffix argument of the inline option is mandatory. In order to avoid creating a backup file when using sed inline, the argument is set as an empty suffix.

The short option '-i' does not expect '=' before the suffix argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created in the build directory.

Removing the '=' sign while keeping an empty suffix avoids creating a backup file.

Fixes 4a4a20c4775b ("devtools: support FreeBSD")
Quoted 8 lines

---

This patch does not work on FreeBSD.
Does it mean the equal sign is required on FreeBSD? This is not what I see on the documentation:
https://www.freebsd.org/cgi/man.cgi?query=sed&sektion=&n=1

---

It appears it is needed, which is why the "=" was added in the first place. See commit: 4a4a20c4775b ("devtools: support FreeBSD"), by Olivier

Quoted 9 lines
Quoted 1 line

Is having the backup file a big issue?

No it's not a big issue.
But I really would like to know how to have a common behaviour on BSD an Linux for a thing as simple as "sed -i" !
And why the mandatory "=" is not documented on FreeBSD?

It cannot be so much broken. We probably miss something...

I think FreeBSD just requires a space between the -i and the ''. Testing that seems to work for me on BSD. I assume it also should work on Linux.

/Bruce

#4 lore raw

16/12/2019 17:59, Bruce Richardson:

Quoted 41 lines · Thomas Monjalon
Quoted 40 lines

16/12/2019 17:40, Bruce Richardson:

Quoted 27 lines · Thomas Monjalon
Quoted 26 lines

The config options are updated with sed and the short inline option. In FreeBSD, the suffix argument of the inline option is mandatory. In order to avoid creating a backup file when using sed inline, the argument is set as an empty suffix.

The short option '-i' does not expect '=' before the suffix argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created in the build directory.

Removing the '=' sign while keeping an empty suffix avoids creating a backup file.

Fixes 4a4a20c4775b ("devtools: support FreeBSD")

---

This patch does not work on FreeBSD.
Does it mean the equal sign is required on FreeBSD? This is not what I see on the documentation:
https://www.freebsd.org/cgi/man.cgi?query=sed&sektion=&n=1

Quoted 6 lines
Quoted 1 line

---

It appears it is needed, which is why the "=" was added in the first place. See commit: 4a4a20c4775b ("devtools: support FreeBSD"), by Olivier

Is having the backup file a big issue?

No it's not a big issue.
But I really would like to know how to have a common behaviour on BSD an Linux for a thing as simple as "sed -i" !
And why the mandatory "=" is not documented on FreeBSD?

Quoted 4 lines
Quoted 2 lines

It cannot be so much broken. We probably miss something...

I think FreeBSD just requires a space between the -i and the ''. Testing that seems to work for me on BSD. I assume it also should work on Linux.

Thanks Bruce, I will send a v2.

#5 lore raw

PATCH v2 1/1 devtools: remove config backup after test build setup

In reply to Thomas Monjalon

The config options are updated with sed and the short in-place option. In order to avoid creating a backup file when using sed in-place, the argument was tentatively set as an empty suffix.
On Linux, the suffix argument is optional, without space or equal before. On FreeBSD, the suffix argument of the in-place option is mandatory. This argument cannot be an empty string if no space before.

In GNU sed, the short option '-i' does not expect '=' before the suffix argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created on Linux in the build directory.

There is no common solution (without creating a function) to skip the backup file with GNU sed and BSD sed. It is solved by always creating a .config.tmp backup file which is removed at the end of the configuration.

Fixes 4a4a20c4775b ("devtools: support FreeBSD")

---

v1: try removing = sign
v2: do not skip backup file

---
 devtools/test-build.sh | 78 ++++++++++++++++++++++--------------------
 1 file changed, 40 insertions(+), 38 deletions(-)
devtools/test-build.sh +40 -38
index 52305fbb8c..f451d91ad3 100755
@@ -141,84 +141,86 @@ config () # <directory> <target> <options>
 		echo 'Customize configuration'
 		# Built-in options (lowercase)
 		! echo $3 | grep -q '+default' || \
-		sed -ri="" 's,(RTE_MACHINE=")native,\1default,' $1/.config
+		sed -ri.tmp 's,(RTE_MACHINE=")native,\1default,' $1/.config
 		echo $3 | grep -q '+next' || \
-		sed -ri=""           's,(NEXT_ABI=)y,\1n,' $1/.config
+		sed -ri.tmp           's,(NEXT_ABI=)y,\1n,' $1/.config
 		! echo $3 | grep -q '+shared' || \
-		sed -ri=""         's,(SHARED_LIB=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(SHARED_LIB=)n,\1y,' $1/.config
 		! echo $3 | grep -q '+debug' || ( \
-		sed -ri=""  's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
-		sed -ri=""           's,(_DEBUG.*=)n,\1y,' $1/.config
-		sed -ri=""  's,(_STAT)([S_].*=|=)n,\1\2y,' $1/.config
-		sed -ri="" 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
+		sed -ri.tmp 's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
+		sed -ri.tmp           's,(_DEBUG.*=)n,\1y,' $1/.config
+		sed -ri.tmp  's,(_STAT)([S_].*=|=)n,\1\2y,' $1/.config
+		sed -ri.tmp 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
 
 		# Automatic configuration
 		test "$DPDK_DEP_NUMA" != n || \
-		sed -ri=""             's,(NUMA.*=)y,\1n,' $1/.config
-		sed -ri=""    's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
-		sed -ri=""             's,(BYPASS=)n,\1y,' $1/.config
+		sed -ri.tmp             's,(NUMA.*=)y,\1n,' $1/.config
+		sed -ri.tmp    's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
+		sed -ri.tmp             's,(BYPASS=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ARCHIVE" != y || \
-		sed -ri=""       's,(RESOURCE_TAR=)n,\1y,' $1/.config
+		sed -ri.tmp       's,(RESOURCE_TAR=)n,\1y,' $1/.config
 		test "$DPDK_DEP_BPF" != y || \
-		sed -ri=""         's,(PMD_AF_XDP=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(PMD_AF_XDP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ISAL" != y || \
-		sed -ri=""           's,(PMD_ISAL=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(PMD_ISAL=)n,\1y,' $1/.config
 		test "$DPDK_DEP_MLX" != y || \
-		sed -ri=""           's,(MLX._PMD=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(MLX._PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_NFB" != y || \
-		sed -ri=""            's,(NFB_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(NFB_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SZE" != y || \
-		sed -ri=""       's,(PMD_SZEDATA2=)n,\1y,' $1/.config
+		sed -ri.tmp       's,(PMD_SZEDATA2=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""          's,(BNX2X_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp          's,(BNX2X_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""           's,(PMD_ZLIB=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(PMD_ZLIB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""   's,(COMPRESSDEV_TEST=)n,\1y,' $1/.config
+		sed -ri.tmp   's,(COMPRESSDEV_TEST=)n,\1y,' $1/.config
 		test "$DPDK_DEP_PCAP" != y || \
-		sed -ri=""               's,(PCAP=)n,\1y,' $1/.config
+		sed -ri.tmp               's,(PCAP=)n,\1y,' $1/.config
 		test -z "$ARMV8_CRYPTO_LIB_PATH" || \
-		sed -ri=""   's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
+		sed -ri.tmp   's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
-		sed -ri=""       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
+		sed -ri.tmp       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
-		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
+		sed -ri.tmp      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
-		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test -z "$LIBSSO_KASUMI_PATH" || \
-		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test -z "$LIBSSO_ZUC_PATH" || \
-		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""        's,(PMD_OPENSSL=)n,\1y,' $1/.config
+		sed -ri.tmp        's,(PMD_OPENSSL=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""            's,(QAT_SYM=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(QAT_SYM=)n,\1y,' $1/.config
 		test -z "$FLEXRAN_SDK" || \
-		sed -ri=""     's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
-		sed -ri=""           's,(SCHED_.*=)n,\1y,' $1/.config
+		sed -ri.tmp     's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(SCHED_.*=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""   's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
+		sed -ri.tmp   's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""          's,(MVPP2_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp          's,(MVPP2_PMD=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""         's,(MVNETA_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(MVNETA_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ELF" != y || \
-		sed -ri=""            's,(BPF_ELF=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(BPF_ELF=)n,\1y,' $1/.config
 		test "$DPDK_DEP_JSON" != y || \
-		sed -ri=""          's,(TELEMETRY=)n,\1y,' $1/.config
+		sed -ri.tmp          's,(TELEMETRY=)n,\1y,' $1/.config
 		build_config_hook $1 $2 $3
 
 		# Explicit enabler/disabler (uppercase)
 		for option in $(echo $3 | sed 's,[~+], &,g') ; do
 			pattern=$(echo $option | cut -c2-)
 			if echo $option | grep -q '^~' ; then
-				sed -ri="" "s,($pattern=)y,\1n," $1/.config
+				sed -ri.tmp "s,($pattern=)y,\1n," $1/.config
 			elif echo $option | grep -q '^+' ; then
-				sed -ri="" "s,($pattern=)n,\1y," $1/.config
+				sed -ri.tmp "s,($pattern=)n,\1y," $1/.config
 			fi
 		done
+
+		rm -f $1/.config.tmp
 	fi
 }
 
Signature · 1 line
2.24.0
#6 lore raw

Re: [dpdk-dev] [PATCH v2] devtools: remove config backup after test build setup

16/12/2019 20:15, Thomas Monjalon:

Quoted 24 lines

The config options are updated with sed and the short in-place option. In order to avoid creating a backup file when using sed in-place, the argument was tentatively set as an empty suffix.
On Linux, the suffix argument is optional, without space or equal before. On FreeBSD, the suffix argument of the in-place option is mandatory. This argument cannot be an empty string if no space before.

In GNU sed, the short option '-i' does not expect '=' before the suffix argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created on Linux in the build directory.

There is no common solution (without creating a function) to skip the backup file with GNU sed and BSD sed. It is solved by always creating a .config.tmp backup file which is removed at the end of the configuration.

Fixes 4a4a20c4775b ("devtools: support FreeBSD")
Quoted 8 lines

---

v1: try removing = sign
v2: do not skip backup file

---
 devtools/test-build.sh | 78 ++++++++++++++++++++++--------------------
 1 file changed, 40 insertions(+), 38 deletions(-)

This file should be removed in 20.11 when dropping make support. No need for this short-live half-fix.
Marked as rejected.