Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [ Patch 0/4] Fix for POSIX compliance
@ 2010-09-20 21:26 Yann E. MORIN
  2010-09-20 21:26 ` [Buildroot] [PATCH 1/4] toolchain: fix helpers " Yann E. MORIN
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Yann E. MORIN @ 2010-09-20 21:26 UTC (permalink / raw)
  To: buildroot

Hello All!

This series adds fixes for POSIX 1003.1-2008 compliance in some shell
scripts, with respect to string comparison. POSIX says that string
comparison in test(1) is done using a sing '='; using two is a bashism.
See:
  http://www.opengroup.org/onlinepubs/9699919799/utilities/test.html
  man 1 test
  man 1 bash

  [PATCH 1/4] toolchain: fix helpers for POSIX compliance
  [PATCH 2/4] skeleton: fix atstk1005, ststk100x and atngw100 for POSIX [...]
  [PATCH 3/4] scripts: fix for POSIX compliance
  [PATCH 4/4] package/tcl: fix for POSIX compliance

Totally untested (I lack the proper Atmel hardware, at least), but should be
harmless.

Note: I have done no other compliance checking at all, only string comparison.

Regards,
Yann E. MORIN.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/4] toolchain: fix helpers for POSIX compliance
  2010-09-20 21:26 [Buildroot] [ Patch 0/4] Fix for POSIX compliance Yann E. MORIN
@ 2010-09-20 21:26 ` Yann E. MORIN
  2010-09-20 21:26 ` [Buildroot] [PATCH 2/4] skeleton: fix atstk1005, ststk100x and atngw100 " Yann E. MORIN
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2010-09-20 21:26 UTC (permalink / raw)
  To: buildroot

Using two '=' for string comparison is a bashism.
Revert to using one, as stated in POSIX 1003.1-2008.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
---
 toolchain/helpers.mk |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 5c87d2b..05d43e7 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -170,11 +170,11 @@ check_glibc = \
 #
 check_uclibc_feature = \
 	IS_IN_LIBC=`grep -q "\#define $(1) 1" $(3) && echo y` ; \
-	if [ x$($(2)) != x"y" -a x$${IS_IN_LIBC} == x"y" ] ; then \
+	if [ x$($(2)) != x"y" -a x$${IS_IN_LIBC} = x"y" ] ; then \
 		echo "$(4) available in C library, please enable $(2)" ; \
 		exit 1 ; \
 	fi ; \
-	if [ x$($(2)) == x"y" -a x$${IS_IN_LIBC} != x"y" ] ; then \
+	if [ x$($(2)) = x"y" -a x$${IS_IN_LIBC} != x"y" ] ; then \
 		echo "$(4) not available in C library, please disable $(2)" ; \
 		exit 1 ; \
 	fi
@@ -214,11 +214,11 @@ check_arm_abi = \
 	else \
 		EXT_TOOLCHAIN_ABI="oabi" ; \
 	fi ; \
-	if [ x$(BR2_ARM_OABI) == x"y" -a $${EXT_TOOLCHAIN_ABI} == "eabi" ] ; then \
+	if [ x$(BR2_ARM_OABI) = x"y" -a $${EXT_TOOLCHAIN_ABI} = "eabi" ] ; then \
 		echo "Incorrect ABI setting" ; \
 		exit 1 ; \
 	fi ; \
-	if [ x$(BR2_ARM_EABI) == x"y" -a $${EXT_TOOLCHAIN_ABI} == "oabi" ] ; then \
+	if [ x$(BR2_ARM_EABI) = x"y" -a $${EXT_TOOLCHAIN_ABI} = "oabi" ] ; then \
 		echo "Incorrect ABI setting" ; \
 		exit 1 ; \
 	fi ; \
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/4] skeleton: fix atstk1005, ststk100x and atngw100 for POSIX compliance
  2010-09-20 21:26 [Buildroot] [ Patch 0/4] Fix for POSIX compliance Yann E. MORIN
  2010-09-20 21:26 ` [Buildroot] [PATCH 1/4] toolchain: fix helpers " Yann E. MORIN
@ 2010-09-20 21:26 ` Yann E. MORIN
  2010-09-20 21:26 ` [Buildroot] [PATCH 3/4] scripts: fix " Yann E. MORIN
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2010-09-20 21:26 UTC (permalink / raw)
  To: buildroot

Using two '=' for string comparison is a bashism.
Revert to using one, as stated in POSIX 1003.1-2008.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
---
 .../atngw100/target_skeleton/etc/init.d/S99gpio    |    6 +++---
 .../atstk1005/target_skeleton/etc/init.d/S99gpio   |    6 +++---
 .../atstk100x/target_skeleton/etc/init.d/S99gpio   |    6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio
index ea07784..3a17740 100755
--- a/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio
+++ b/target/device/Atmel/atngw100/target_skeleton/etc/init.d/S99gpio
@@ -8,9 +8,9 @@ fi
 
 BOARD=`cat /etc/release | cut -d ' ' -f1`
 
-if [ "${BOARD}" == "" ]; then
+if [ "${BOARD}" = "" ]; then
 	echo "none";
-elif [ "${BOARD}" == "NGW100" ]; then
+elif [ "${BOARD}" = "NGW100" ]; then
 	echo "'${BOARD}'"
 
 	echo -n "  boot LED: "
@@ -111,7 +111,7 @@ elif [ "${BOARD}" == "NGW100" ]; then
 		echo "failed"
 		exit 1
 	fi
-elif [ "${BOARD}" == "STK1000" ]; then # end NGW100
+elif [ "${BOARD}" = "STK1000" ]; then # end NGW100
 	echo "'${BOARD}'"
 
 	echo -n "  switches: "
diff --git a/target/device/Atmel/atstk1005/target_skeleton/etc/init.d/S99gpio b/target/device/Atmel/atstk1005/target_skeleton/etc/init.d/S99gpio
index 967761a..7c07f28 100644
--- a/target/device/Atmel/atstk1005/target_skeleton/etc/init.d/S99gpio
+++ b/target/device/Atmel/atstk1005/target_skeleton/etc/init.d/S99gpio
@@ -8,9 +8,9 @@ fi
 
 BOARD=`cat /etc/release | cut -d ' ' -f1`
 
-if [ "${BOARD}" == "" ]; then
+if [ "${BOARD}" = "" ]; then
 	echo "none";
-elif [ "${BOARD}" == "NGW" ]; then
+elif [ "${BOARD}" = "NGW" ]; then
 	echo "'${BOARD}'"
 
 	echo -n "  boot LED: "
@@ -111,7 +111,7 @@ elif [ "${BOARD}" == "NGW" ]; then
 		echo "failed"
 		exit 1
 	fi
-elif [ "${BOARD}" == "STK1000" ]; then # end NGW
+elif [ "${BOARD}" = "STK1000" ]; then # end NGW
 	echo "'${BOARD}'"
 
 	echo -n "  switches: "
diff --git a/target/device/Atmel/atstk100x/target_skeleton/etc/init.d/S99gpio b/target/device/Atmel/atstk100x/target_skeleton/etc/init.d/S99gpio
index 967761a..7c07f28 100644
--- a/target/device/Atmel/atstk100x/target_skeleton/etc/init.d/S99gpio
+++ b/target/device/Atmel/atstk100x/target_skeleton/etc/init.d/S99gpio
@@ -8,9 +8,9 @@ fi
 
 BOARD=`cat /etc/release | cut -d ' ' -f1`
 
-if [ "${BOARD}" == "" ]; then
+if [ "${BOARD}" = "" ]; then
 	echo "none";
-elif [ "${BOARD}" == "NGW" ]; then
+elif [ "${BOARD}" = "NGW" ]; then
 	echo "'${BOARD}'"
 
 	echo -n "  boot LED: "
@@ -111,7 +111,7 @@ elif [ "${BOARD}" == "NGW" ]; then
 		echo "failed"
 		exit 1
 	fi
-elif [ "${BOARD}" == "STK1000" ]; then # end NGW
+elif [ "${BOARD}" = "STK1000" ]; then # end NGW
 	echo "'${BOARD}'"
 
 	echo -n "  switches: "
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 3/4] scripts: fix for POSIX compliance
  2010-09-20 21:26 [Buildroot] [ Patch 0/4] Fix for POSIX compliance Yann E. MORIN
  2010-09-20 21:26 ` [Buildroot] [PATCH 1/4] toolchain: fix helpers " Yann E. MORIN
  2010-09-20 21:26 ` [Buildroot] [PATCH 2/4] skeleton: fix atstk1005, ststk100x and atngw100 " Yann E. MORIN
@ 2010-09-20 21:26 ` Yann E. MORIN
  2010-09-20 21:26 ` [Buildroot] [PATCH 4/4] package/tcl: " Yann E. MORIN
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2010-09-20 21:26 UTC (permalink / raw)
  To: buildroot

Using two '=' for string comparison is a bashism.
Revert to using one, as stated in POSIX 1003.1-2008.

Of the three affected scripts, two are explicitly called vi #!/bin/bash.
Those two do not _need_ the fix, but gets it nonetheless, in case we
later switch to a POSIX-compliant shell for those scripts.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
---
 scripts/get_linux_config.sh |    6 +++---
 scripts/mkpkg               |   14 +++++++-------
 scripts/testheader.inc      |   16 ++++++++--------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/scripts/get_linux_config.sh b/scripts/get_linux_config.sh
index 5cd0e37..6c00036 100755
--- a/scripts/get_linux_config.sh
+++ b/scripts/get_linux_config.sh
@@ -23,7 +23,7 @@ LINUX_MINOR_VERSION=${LINUX26_DIR:13}
 
 function DBG_PRINT
 {
-	if [ ${DEBUG} == 1 ] ; then
+	if [ ${DEBUG} = 1 ] ; then
 		echo $1
 	fi
 }
@@ -50,8 +50,8 @@ for i in ${CONFIGS} ; do
 	    echo Copying `basename $i`.config ...
 	    cp $i.config ${LINUX26_CONFIG}
     elif [ ${THIS_MAJOR} -eq ${LINUX_MAJOR_VERSION} ] ; then
-	if [ "${LINUX_MINOR_VERSION}X" == "X" ] ; then
-		if [ "${THIS_MINOR}X" == "X" ] ; then
+	if [ "${LINUX_MINOR_VERSION}X" = "X" ] ; then
+		if [ "${THIS_MINOR}X" = "X" ] ; then
 		    echo Copying `basename $i`.config ...
 		    cp $i.config ${LINUX26_CONFIG}
 		else		
diff --git a/scripts/mkpkg b/scripts/mkpkg
index af47f42..4db0fef 100755
--- a/scripts/mkpkg
+++ b/scripts/mkpkg
@@ -36,7 +36,7 @@ function	process ()
 {
 	make $1 >> ${LOG} 2>&1 || test=${FAIL}
 	grep "\.tar\." ${LOG} > ${DEPENDENCY}
-	if [ ${test} == ${OK} ] ; then
+	if [ ${test} = ${OK} ] ; then
 		mv ${LOG} ${LOG_OK_FILE}
 		printf "%-16s" "OK"
 		if [ "${2}X" != "X" ] ; then
@@ -65,29 +65,29 @@ function build_package ()
 {
 	# echo "BUILD PACKAGE:1=$1 2=$2 3=$3 4=$4 5=$5 6=$6 7=$7"
 	printf "mk	%-32s" "$1"
-	if [ "$2X" == "X" ] ; then		# no parameters
+	if [ "$2X" = "X" ] ; then		# no parameters
 		clean_files	$1
 		dirclean	$1
 		process		$1 "$3"
-	elif [ "$2X" == "?X" ] ; then		# no parameters
+	elif [ "$2X" = "?X" ] ; then		# no parameters
 		clean_files	$1
 		dirclean	$1
 		process		$1 "$3"
-	elif [ "$2X" == "OKX" ] ; then	# Previous build was OK
+	elif [ "$2X" = "OKX" ] ; then	# Previous build was OK
 		clean_files	$1
 		dirclean	$1
 		process		$1 "$3"
-	elif [ "$2X" == "FAILX" ] ; then
+	elif [ "$2X" = "FAILX" ] ; then
 		clean_files	$1
 		dirclean	$1
 		process		$1 "$3"
-	elif [ "$2X" == "BROKENX" ] ; then
+	elif [ "$2X" = "BROKENX" ] ; then
 		printf  "%-16s" "BROKEN"
 		if [ "${3}X" != "X" ] ; then
 			printf	"%s"	"\"$3\"";
 		fi
 		echo
-	elif [ "$2X" == "DISABLEDX" ] ; then
+	elif [ "$2X" = "DISABLEDX" ] ; then
 		printf  "%-16s" "DISABLED"
 		if [ "${3}X" != "X" ] ; then
 			printf	"%s"	"\"$3\"";
diff --git a/scripts/testheader.inc b/scripts/testheader.inc
index 232e1e0..44b5585 100644
--- a/scripts/testheader.inc
+++ b/scripts/testheader.inc
@@ -31,7 +31,7 @@ function	RESTART()
 function	EXE()
 {
 	printf 	"EXE	"				| tee -a ${LOGFILE}
-	if [ ${active} == 1 ] ; then
+	if [ ${active} = 1 ] ; then
 		$1 $2 $3 "$4"
 		return 0;
 	else
@@ -49,10 +49,10 @@ function	EXE()
 function	AVR()
 {
 	printf 	"AVR	"				| tee -a ${LOGFILE}
-	if [ "${ARCH}X" == "avr32X" ] ; then
+	if [ "${ARCH}X" = "avr32X" ] ; then
 		echo "mk $2 UNSUPPORTED \"$4\" $5 $6"	| tee -a ${LOGFILE}
 		return 1;
-	elif [ ${active} == 1 ] ; then
+	elif [ ${active} = 1 ] ; then
 		$1 $2 "$3" "$4"
 		return 0;
 	else
@@ -72,22 +72,22 @@ function skip()
 {
 	printf "skip	%-8s" "$1"			| tee -a ${LOGFILE}
 	printf "%-32s" "$2"				| tee -a ${LOGFILE}
-	if [   "$3X" == "OKX" ] ; then
+	if [   "$3X" = "OKX" ] ; then
 		printf "%-16s"	"DISABLED"		| tee -a ${LOGFILE}
 		if [ "${4}X" != "X" ] ; then
 			printf	"%-64s"	"\"$4\""	| tee -a ${LOGFILE}
 		fi
-	elif [ "$3X" == "FAILX" ] ; then
+	elif [ "$3X" = "FAILX" ] ; then
 		printf "%-16s"	"DISABLED"		| tee -a ${LOGFILE}
 		if [ "${4}X" != "X" ] ; then
 			printf	"%-64s"	"\"$4\""	| tee -a ${LOGFILE}
 		fi
-	elif [ "$3X" == "BROKENX" ] ; then
+	elif [ "$3X" = "BROKENX" ] ; then
 		printf "%-16s"	"DISABLED"		| tee -a ${LOGFILE}
 		if [ "${4}X" != "X" ] ; then
 			printf	"%-64s"	"\"$4\""	| tee -a ${LOGFILE}
 		fi
-	elif [ "$3X" == "DISABLEDX" ] ; then
+	elif [ "$3X" = "DISABLEDX" ] ; then
 		printf "%-16s"	"DISABLED"		| tee -a ${LOGFILE}
 		if [ "${4}X" != "X" ] ; then
 			printf	"%-64s"	"\"$4\""	| tee -a ${LOGFILE}
@@ -104,7 +104,7 @@ function skip()
 function bb()
 {
 	printf 	"%-8s"	"bb"				| tee -a ${LOGFILE}
-	if [ ${busybox} == 1 ] ; then
+	if [ ${busybox} = 1 ] ; then
 		printf "%-8s"	"$1"			| tee -a ${LOGFILE}
 		$1 $2 $3 $4 $5 $6
 		return 0;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 4/4] package/tcl: fix for POSIX compliance
  2010-09-20 21:26 [Buildroot] [ Patch 0/4] Fix for POSIX compliance Yann E. MORIN
                   ` (2 preceding siblings ...)
  2010-09-20 21:26 ` [Buildroot] [PATCH 3/4] scripts: fix " Yann E. MORIN
@ 2010-09-20 21:26 ` Yann E. MORIN
  2010-09-28 16:38 ` [Buildroot] [ Patch 0/4] Fix " Yann E. MORIN
  2010-09-30 20:09 ` Peter Korsgaard
  5 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2010-09-20 21:26 UTC (permalink / raw)
  To: buildroot

Using two '=' for string comparison is a bashism.
Revert to using one, as stated in POSIX 1003.1-2008.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
---
 package/tcl/tcl.mk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/tcl/tcl.mk b/package/tcl/tcl.mk
index edcc441..cf46811 100644
--- a/package/tcl/tcl.mk
+++ b/package/tcl/tcl.mk
@@ -15,10 +15,10 @@ TCL_CONF_OPT = \
 
 define TCL_POST_INSTALL_CLEANUP
 	-$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/usr/lib/libtcl8.4.so
-	-if [ "$(BR2_PACKAGE_TCL_DEL_ENCODINGS)" == "y" ]; then \
+	-if [ "$(BR2_PACKAGE_TCL_DEL_ENCODINGS)" = "y" ]; then \
 	rm -Rf $(TARGET_DIR)/usr/lib/tcl8.4/encoding/*; \
 	fi
-	-if [ "$(BR2_PACKAGE_TCL_SHLIB_ONLY)" == "y" ]; then \
+	-if [ "$(BR2_PACKAGE_TCL_SHLIB_ONLY)" = "y" ]; then \
 	rm -f $(TARGET_DIR)/usr/bin/tclsh8.4; \
 	fi
 endef
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [ Patch 0/4] Fix for POSIX compliance
  2010-09-20 21:26 [Buildroot] [ Patch 0/4] Fix for POSIX compliance Yann E. MORIN
                   ` (3 preceding siblings ...)
  2010-09-20 21:26 ` [Buildroot] [PATCH 4/4] package/tcl: " Yann E. MORIN
@ 2010-09-28 16:38 ` Yann E. MORIN
  2010-09-30 20:09 ` Peter Korsgaard
  5 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2010-09-28 16:38 UTC (permalink / raw)
  To: buildroot

All,

On Monday 20 September 2010 23:26:05 Yann E. MORIN wrote:
> This series adds fixes for POSIX 1003.1-2008 compliance in some shell
> scripts, with respect to string comparison. POSIX says that string
> comparison in test(1) is done using a sing '='; using two is a bashism.

Ping? ;-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [ Patch 0/4] Fix for POSIX compliance
  2010-09-20 21:26 [Buildroot] [ Patch 0/4] Fix for POSIX compliance Yann E. MORIN
                   ` (4 preceding siblings ...)
  2010-09-28 16:38 ` [Buildroot] [ Patch 0/4] Fix " Yann E. MORIN
@ 2010-09-30 20:09 ` Peter Korsgaard
  5 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2010-09-30 20:09 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@anciens.enib.fr> writes:

 Yann> Hello All!
 Yann> This series adds fixes for POSIX 1003.1-2008 compliance in some shell
 Yann> scripts, with respect to string comparison. POSIX says that string
 Yann> comparison in test(1) is done using a sing '='; using two is a bashism.
 Yann> See:
 Yann>   http://www.opengroup.org/onlinepubs/9699919799/utilities/test.html
 Yann>   man 1 test
 Yann>   man 1 bash

Committed all 4, thanks!

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-09-30 20:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-20 21:26 [Buildroot] [ Patch 0/4] Fix for POSIX compliance Yann E. MORIN
2010-09-20 21:26 ` [Buildroot] [PATCH 1/4] toolchain: fix helpers " Yann E. MORIN
2010-09-20 21:26 ` [Buildroot] [PATCH 2/4] skeleton: fix atstk1005, ststk100x and atngw100 " Yann E. MORIN
2010-09-20 21:26 ` [Buildroot] [PATCH 3/4] scripts: fix " Yann E. MORIN
2010-09-20 21:26 ` [Buildroot] [PATCH 4/4] package/tcl: " Yann E. MORIN
2010-09-28 16:38 ` [Buildroot] [ Patch 0/4] Fix " Yann E. MORIN
2010-09-30 20:09 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox