On 02/02/2015 09:23 AM, Bernhard Voelker wrote: > OTOH, it seems that the sort order of env/printenv is quite stable > on all known platforms, so I think it might be sufficient for now to > use the same number of execv()s to work around the problem for the > failing case as shown in my initial diff. > >> Also note that the grep regexp is slightly too loose: it excludes >> any name that begins with "_", rather than just the one that is mentioned >> in that comment. > > Good catch. > I'll take care of this in the upcoming patch, too.
Patch attached. Thanks & have a nice day, Berny
>From 1d672ffdc321b458f7901556c13be5d717e04db6 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker <[email protected]> Date: Tue, 3 Feb 2015 01:52:04 +0100 Subject: [PATCH] tests: avoid a FP on aarch64 when comparing env/printenv output The following test fails on aarch64 on openSUSE's OpenBuildService due to glibc's execvp reversing the pointers of 'environ', i.e., the output of "env|tac" equals "env env" on that platform. * tests/misc/printenv.sh: Use 'env env' to work around the behavior on that platform. While at it, fix the grep pattern which suppressed all environment variables starting with an underscore "_" instead of "$_" (and "$LD_PRELOAD") only. --- tests/misc/printenv.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/misc/printenv.sh b/tests/misc/printenv.sh index 5c2f7c0..862b48b 100755 --- a/tests/misc/printenv.sh +++ b/tests/misc/printenv.sh @@ -23,8 +23,12 @@ print_ver_ printenv # printenv as a builtin, so we must invoke it via "env". # But beware of $_, set by many shells to the last command run. # Also, filter out LD_PRELOAD, which is set when running under valgrind. -env | grep -Ev '^(_|LD_PRELOAD=)' > exp || framework_failure_ -env -- printenv | grep -Ev '^(_|LD_PRELOAD=)' > out || fail=1 +# Note the apparently redundant "env env": this is to ensure to get +# env's output the same way as that of printenv and works around a bug +# on aarch64 at least where libc's execvp reverses the order of the +# output. +env -- env | grep -Ev '^(_|LD_PRELOAD)=' > exp || framework_failure_ +env -- printenv | grep -Ev '^(_|LD_PRELOAD)=' > out || fail=1 compare exp out || fail=1 # POSIX is clear that environ may, but need not be, sorted. -- 2.1.4
