git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] test-lint: detect 'export FOO=bar'

From
Torsten Bögershausen <tboegi@web.de>
Date
Jul 8, 2013, 19:31 UTC
Message-ID
<51DB1399.9020307@web.de>
In-Reply-To
<24ee18d3b06883c4185821f5ffb5faed26e6a436.1373296313.git.trast@inf.ethz.ch>
On 2013-07-08 17.20, Thomas Rast wrote:
Show 22 quoted lines
> Some shells do not understand the one-line construct, and instead need
> 
>   FOO=bar &&
>   export FOO
> 
> Detect this in the test-lint target.
> 
> Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
> ---
> 
> I wrote:
> 
>> Torsten Bögershausen <tboegi@web.de> writes:
> [...]
>>> -		export HARNESS_ACTIVE=t &&
>>> +		HARNESS_ACTIVE=t &&
>>> +		export HARNESS_ACTIVE &&
> [...]
>> Ack.  Sorry for breaking this -- I suppose test-lint would have caught
>> me out?
> 
> Well, no, not yet.
Thanks for working on this
Show 14 quoted lines
> 
> 
>  t/check-non-portable-shell.pl | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
> index 8b5a71d..45971f4 100755
> --- a/t/check-non-portable-shell.pl
> +++ b/t/check-non-portable-shell.pl
> @@ -21,6 +21,7 @@ while (<>) {
>  	/^\s*declare\s+/ and err 'arrays/declare not portable';
>  	/^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
>  	/test\s+[^=]*==/ and err '"test a == b" is not portable (please use =)';
> +	/^\s*export\s+[^=]*=/ and err '"export FOO=bar" is not portable (please use FOO=bar && export FOO)';
I have a slightly tighter reg exp in my tree, but credits should go to Thomas: 
/^\s*export\s+\S+=\S+/
/Torsten
Previous: Thomas RastNext: Thomas Rast
Message 5 of 10 in “t0000: do not use export X=Y”
  1. t0000: do not use export X=YTorsten Bögershausen, Jul 8, 2013
  2. Thomas RastJul 8, 2013
  3. 1/2 t9902: fix 'test A == B' to use = operatorThomas Rast, Jul 8, 2013
  4. 2/2 test-lint: detect 'export FOO=bar'Thomas Rast, Jul 8, 2013
  5. Torsten BögershausenJul 8, 2013
  6. Thomas RastJul 9, 2013
  7. Torsten BögershausenJul 9, 2013
  8. Junio C HamanoJul 8, 2013
  9. Thomas RastJul 9, 2013
  10. Junio C HamanoJul 8, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.