Subject: Re: [PATCH v2] Test t5560: Fix test when run with dash

From: Johannes Sixt <[email-masked]>
Date: Fri, 15 Jan 2010 09:30:48 +0100

Tarmigan Casebolt schrieb:
>         REQUEST_METHOD="GET" some_shell_function

> I can't tell from my reading of the POSIX spec whether my usage was
> wrong or if dash is wrong,

According to POSIX, variables set as shown above for shell functions are
not exported and retain their value after the function returns. I would
not be surprised if dash got this right, and the tests fail because they
were written for bash, which gets it wrong.

In particular,

f() { sh -c 'echo +$v+'; }
v=x f
echo +$v+
sh -c 'echo +$v+'"

Should print

++
+x+
++

I can test only ash, bash, zsh, and ksh, of which only ksh gets it right.

-- Hannes