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

Re: [PATCH] Get rid of the non portable shell export VAR=VALUE costruct

From
David Kastrup <dak@gnu.org>
Date
May 22, 2014, 14:37 UTC
Message-ID
<871tvl98we.fsf@fencepost.gnu.org>
In-Reply-To
<537E09AA.7030901@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 29 quoted lines
> Am 5/22/2014 15:19, schrieb David Kastrup:
>> Torsten Bögershausen <tboegi@web.de> writes:
>> 
>>> On 2014-05-22 14.48, Elia Pinto wrote:
>>>> Found by check-non-portable-shell.pl
>>>
>>> Thanks for picking this up
>>>> -export TEST_DIRECTORY=$(pwd)/../../../t
>>>> +TEST_DIRECTORY=$(pwd)/../../../t && export TEST_DIRECTORY
>>> Minor remark:
>>> Both commands should go on their own line, like this:
>>>
>>> TEST_DIRECTORY=$(pwd)/../../../t &&
>>> export TEST_DIRECTORY
>>>
>>>
>>> And, unrelated to this patch, 
>>> there seem to be a lot of && missing in git-remote-testgit.sh.
>> 
>> I have a hard time taking the above && seriously.  pwd is a shell
>> builtin (when we are not talking about Version 3 UNIX or something) that
>> can hardly fail.  And when your shell does not support assignment to a
>> shell variable, you'll have a hard time getting the shell script to run.
>
> The && after an assignment makes a big difference when the assignment is
> part of an && chain. This is *very* common in our test suite, as you know.
>
> People tend to copy-and-paste. And then it is better to provide a more
> universally applicable precedent.

Copy-and-paste will not magically add the second && that would be required for that usage, and the one in the line above might mislead you into thinking that the problem "has been dealt with already".

So I'm not convinced that using && outside of a preexisting && chain makes any sense in this context.

-- 
David Kastrup
Previous: Johannes SixtNext: Elia Pinto
Message 5 of 7 in “Get rid of the non portable shell export VAR=VALUE costruct”
  1. Get rid of the non portable shell export VAR=VALUE costructElia Pinto, May 22, 2014
  2. Torsten BögershausenMay 22, 2014
  3. David KastrupMay 22, 2014
  4. Johannes SixtMay 22, 2014
  5. David KastrupMay 22, 2014
  6. Elia PintoMay 22, 2014
  7. Junio C HamanoMay 22, 2014

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.