Fix stdlib/tst-setcontext3 with dash [BZ#18418]

Message ID 55564F42.2070803@linaro.org
State Committed
Headers

Commit Message

Adhemerval Zanella Netto May 15, 2015, 7:55 p.m. UTC
  This patch remove the non-portable array usage on tst-setcontext3.sh
script.  It fixes the testcase when using dash as default shell.

Tested on x86_64. OK to apply?

--

2015-05-14  Adhemerval Zanella  <adhemerval.zanella@linaro.org>

	[BZ #18418]
	* stdlib/tst-setcontext3.sh: Remove non-portable array use.

--
  

Comments

Carlos O'Donell May 16, 2015, 4:06 a.m. UTC | #1
On 05/15/2015 03:55 PM, Adhemerval Zanella wrote:
> This patch remove the non-portable array usage on tst-setcontext3.sh
> script.  It fixes the testcase when using dash as default shell.
> 
> Tested on x86_64. OK to apply?

Why should this matter when the test is explicitly designed to use bash?

e.g. # !/bin/bash

You can't pretend to be bash, and not provide bash features.

However, the point is moot since I agree that making all of glibc work
with a variety of shells is useful.

OK to apply if you also change the interpreter also be /bin/sh.

> --
> 
> 2015-05-14  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> 
> 	[BZ #18418]
> 	* stdlib/tst-setcontext3.sh: Remove non-portable array use.
> 
> --
> 
> diff --git a/NEWS b/NEWS
> index 44803fa..a9ba85a 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -17,7 +17,8 @@ Version 2.22
>    17999, 18007, 18019, 18020, 18029, 18030, 18032, 18036, 18038, 18039,
>    18042, 18043, 18046, 18047, 18068, 18080, 18093, 18100, 18104, 18110,
>    18111, 18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210, 18211,
> -  18217, 18220, 18221, 18247, 18287, 18319, 18333, 18346, 18397, 18409.
> +  18217, 18220, 18221, 18247, 18287, 18319, 18333, 18346, 18397, 18409,
> +  18418.
>  
>  * Cache information can be queried via sysconf() function on s390 e.g. with
>    _SC_LEVEL1_ICACHE_SIZE as argument.
> diff --git a/stdlib/tst-setcontext3.sh b/stdlib/tst-setcontext3.sh
> index 6ad67a8..b48e6bb 100644
> --- a/stdlib/tst-setcontext3.sh
> +++ b/stdlib/tst-setcontext3.sh
> @@ -29,14 +29,12 @@ test_pre="${test_program_prefix_before_env} ${run_program_env}"
>  test="${test_program_prefix_after_env} ${objpfx}tst-setcontext3"
>  out=${objpfx}tst-setcontext3.out
>  
> -tempfiles=()
>  cleanup() {
> -  rm -f "${tempfiles[@]}"
> +  rm -f $tempfile
>  }
>  trap cleanup 0
>  
>  tempfile=$(mktemp "tst-setcontext3.XXXXXXXXXX")
> -tempfiles+=("$tempfile")
>  
>  # We want to run the test program and see if secontext called
>  # exit() and wrote out the test file we specified.  If the
>
  
Florian Weimer May 18, 2015, 7:59 a.m. UTC | #2
On 05/16/2015 06:06 AM, Carlos O'Donell wrote:
> On 05/15/2015 03:55 PM, Adhemerval Zanella wrote:
>> This patch remove the non-portable array usage on tst-setcontext3.sh
>> script.  It fixes the testcase when using dash as default shell.
>>
>> Tested on x86_64. OK to apply?
> 
> Why should this matter when the test is explicitly designed to use bash?
> 
> e.g. # !/bin/bash
> 
> You can't pretend to be bash, and not provide bash features.

The shell script is invoked with $(SHELL) from Makefile, so the #! line
is ignored.
  

Patch

diff --git a/NEWS b/NEWS
index 44803fa..a9ba85a 100644
--- a/NEWS
+++ b/NEWS
@@ -17,7 +17,8 @@  Version 2.22
   17999, 18007, 18019, 18020, 18029, 18030, 18032, 18036, 18038, 18039,
   18042, 18043, 18046, 18047, 18068, 18080, 18093, 18100, 18104, 18110,
   18111, 18125, 18128, 18138, 18185, 18196, 18197, 18206, 18210, 18211,
-  18217, 18220, 18221, 18247, 18287, 18319, 18333, 18346, 18397, 18409.
+  18217, 18220, 18221, 18247, 18287, 18319, 18333, 18346, 18397, 18409,
+  18418.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
diff --git a/stdlib/tst-setcontext3.sh b/stdlib/tst-setcontext3.sh
index 6ad67a8..b48e6bb 100644
--- a/stdlib/tst-setcontext3.sh
+++ b/stdlib/tst-setcontext3.sh
@@ -29,14 +29,12 @@  test_pre="${test_program_prefix_before_env} ${run_program_env}"
 test="${test_program_prefix_after_env} ${objpfx}tst-setcontext3"
 out=${objpfx}tst-setcontext3.out
 
-tempfiles=()
 cleanup() {
-  rm -f "${tempfiles[@]}"
+  rm -f $tempfile
 }
 trap cleanup 0
 
 tempfile=$(mktemp "tst-setcontext3.XXXXXXXXXX")
-tempfiles+=("$tempfile")
 
 # We want to run the test program and see if secontext called
 # exit() and wrote out the test file we specified.  If the