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

Re: [PATCH v2 2/2] tests: fix and add lint for non-portable seq

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 23, 2018, 16:08 UTC
Message-ID
<xmqqefepjcam.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180823152502.3886-2-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> GNU seq is not a POSIX command, and doesn't exist on

s/GNU //; the command did not even originate there, but came from V8 and/or Plan9 IIRC.

Show 14 quoted lines
> e.g. OpenBSD. We've had the test_seq wrapper since d17cf5f3a3 ("tests:
> Introduce test_seq", 2012-08-04), but use of it keeps coming back,
> e.g. in the recently added "fetch negotiator" tests being added here.
>
> So let's also add a check to "make test-lint". The regex is aiming to
> capture the likes of $(seq ..) and "seq" as a stand-alone command,
> without capturing some existing cases where we e.g. have files called
> "seq".
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>
> Now with a fix & check in v2 for the seq issue mentioned in
> https://public-inbox.org/git/87a7pdfltp.fsf@evledraar.gmail.com/
Thanks.
Show 14 quoted lines
>  t/check-non-portable-shell.pl        |  1 +
>  t/t5552-skipping-fetch-negotiator.sh | 12 ++++++------
>  t/t5703-upload-pack-ref-in-want.sh   |  4 ++--
>  3 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
> index c8f10d40a1..75f38298d7 100755
> --- a/t/check-non-portable-shell.pl
> +++ b/t/check-non-portable-shell.pl
> @@ -42,6 +42,7 @@ sub err {
>  	/\btest\s+[^=]*==/ and err '"test a == b" is not portable (use =)';
>  	/\bwc -l.*"\s*=/ and err '`"$(wc -l)"` is not portable (use test_line_count)';
>  	/\bhead\s+-c\b/ and err 'head -c is not portable (use test_copy_bytes BYTES <file >out)';
> +	/(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)';

Looking at $(wc -l) thing a few lines above, I am not sure if this deviation is a good idea. Wouldn't /\bseq\s/ be sufficient?

Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 7 of 33 in “tests: fix and add lint for non-portable head -c N”
  1. tests: fix and add lint for non-portable head -c NÆvar Arnfjörð Bjarmason, Aug 23, 2018
  2. Test failures on OpenBSDÆvar Arnfjörð Bjarmason, Aug 23, 2018
  3. Junio C HamanoAug 23, 2018
  4. 1/2 tests: fix and add lint for non-portable head -c NÆvar Arnfjörð Bjarmason, Aug 23, 2018
  5. Jeff KingAug 23, 2018
  6. 2/2 tests: fix and add lint for non-portable seqÆvar Arnfjörð Bjarmason, Aug 23, 2018
  7. Junio C HamanoAug 23, 2018
  8. Ævar Arnfjörð BjarmasonAug 23, 2018
  9. 0/5 OpenBSD & AIX etc. portability fixesÆvar Arnfjörð Bjarmason, Aug 23, 2018
  10. 1/5 tests: fix and add lint for non-portable head -c NÆvar Arnfjörð Bjarmason, Aug 23, 2018
  11. 2/5 tests: fix and add lint for non-portable seqÆvar Arnfjörð Bjarmason, Aug 23, 2018
  12. 3/5 tests: use shorter here-docs in chainlint.sed for AIX sedÆvar Arnfjörð Bjarmason, Aug 23, 2018
  13. Junio C HamanoAug 23, 2018
  14. Eric SunshineAug 23, 2018
  15. 0/6 OpenBSD & AIX etc. portability fixesÆvar Arnfjörð Bjarmason, Aug 24, 2018
  16. 1/6 tests: fix and add lint for non-portable head -c NÆvar Arnfjörð Bjarmason, Aug 24, 2018
  17. 2/6 tests: fix and add lint for non-portable seqÆvar Arnfjörð Bjarmason, Aug 24, 2018
  18. 3/6 tests: fix comment syntax in chainlint.sed for AIX sedÆvar Arnfjörð Bjarmason, Aug 24, 2018
  19. Eric SunshineAug 24, 2018
  20. 4/6 tests: use shorter here-docs in chainlint.sed for AIX sedÆvar Arnfjörð Bjarmason, Aug 24, 2018
  21. Eric SunshineAug 24, 2018
  22. Ævar Arnfjörð BjarmasonAug 28, 2018
  23. Eric SunshineAug 28, 2018
  24. Junio C HamanoAug 27, 2018
  25. 5/6 tests: fix version-specific portability issue in Perl JSONÆvar Arnfjörð Bjarmason, Aug 24, 2018
  26. Eric SunshineAug 24, 2018
  27. 6/6 tests: fix and add lint for non-portable grep --fileÆvar Arnfjörð Bjarmason, Aug 24, 2018
  28. 4/5 tests: fix version-specific portability issue in Perl JSONÆvar Arnfjörð Bjarmason, Aug 23, 2018
  29. 5/5 tests: fix and add lint for non-portable grep --fileÆvar Arnfjörð Bjarmason, Aug 23, 2018
  30. Junio C HamanoAug 23, 2018
  31. Derrick StoleeAug 24, 2018
  32. Junio C HamanoAug 23, 2018
  33. Ævar Arnfjörð BjarmasonAug 23, 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.