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

[PATCH 0/4] test-lint: detect one-shot "FOO=bar shell_func"

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 13, 2018, 05:52 UTC
Message-ID
<20180713055205.32351-1-sunshine@sunshineco.com>

One-shot "FOO=bar cmd" environment variable assignments exist only during invocation of 'cmd'. However, if 'cmd' is a shell function, then the variable is assigned in the running shell and exists until the process exits (or is unset explicitly). Such a side-effect is almost certainly unintended by a test author and is likely due to lack of familiarity with the problem.

Upgrade "make test-lint" to detect this sort of suspect usage.

Also fix a couple instances of "FOO=bar shell_func" detected by the improved linting.

This series is built atop 'jc/t3404-one-shot-export-fix'[1].
[1]: https://public-inbox.org/git/xmqqefg8w73c.fsf@gitster-ct.c.googlers.com/T/
Eric Sunshine (4):
  t6046/t9833: fix use of "VAR=VAL cmd" with a shell function
  t/check-non-portable-shell: stop being so polite
  t/check-non-portable-shell: make error messages more compact
  t/check-non-portable-shell: detect "FOO=bar shell_func"
 t/check-non-portable-shell.pl          | 31 +++++++++++++++++++++-----
 t/t6046-merge-skip-unneeded-updates.sh |  4 +++-
 t/t9833-errors.sh                      |  4 +++-
 3 files changed, 32 insertions(+), 7 deletions(-)
-- 
2.18.0.233.g985f88cf7e
Next: Eric Sunshine
Message 1 of 5 in “test-lint: detect one-shot "FOO=bar shell_func"”
  1. 0/4 test-lint: detect one-shot "FOO=bar shell_func"Eric Sunshine, Jul 13, 2018
  2. 1/4 t6046/t9833: fix use of "VAR=VAL cmd" with a shell functionEric Sunshine, Jul 13, 2018
  3. 2/4 t/check-non-portable-shell: stop being so politeEric Sunshine, Jul 13, 2018
  4. 3/4 t/check-non-portable-shell: make error messages more compactEric Sunshine, Jul 13, 2018
  5. 4/4 t/check-non-portable-shell: detect "FOO=bar shell_func"Eric Sunshine, Jul 13, 2018

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.