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

Re: [PATCH 0/6] test: make the test suite work with zsh

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 1, 2023, 00:50 UTC
Message-ID
<CAMP44s3MSSAC9dEDo23dJw=G1X31xJgNQJZEDYEoEheeEX9JSA@mail.gmail.com>
In-Reply-To
<ZCd0MyieHOZDQeVM@nand.local>
On Fri, Mar 31, 2023 at 6:00 PM Taylor Blau <me@ttaylorr.com> wrote:
Show 14 quoted lines
>
> On Thu, Mar 30, 2023 at 03:15:48AM -0700, Junio C Hamano wrote:
> > > In truth all the patches regarding shell portability have been along
> > > the lines of: "this code makes $x shell work, doesn't break other
> > > shells, and isn't against POSIX". In some cases even when the Austin
> > > group disagreed on what POSIX actually said, we did whatever worked in
> > > most shells.
> >
> > One aspect that is missing in the above is the extra burden on our
> > developers.
>
> Well said.
>
> Having to remember that we need to write "$ARGZERO" instead of "$0"
When have you ever used "$0" in the test suite?

A quick grep shows zero results (`git log --author=me@ttaylorr.com -S'$0'`), so I think you are talking about a hypothetical, not something that would actually happen in reality.

Sometimes preemptive optimization pays off in the future, but other times it doesn't, and it's just wasted mental effort.

This is one of those times when worrying about a future that will never happen in reality does not pay off.

> Is that a big deal? Probably not. But it's a slippery slope, and a weird
> gotcha to remember when dealing with our otherwise POSIX-y test suite.

You won't have to remember that because you'll never use $0 in the test suite. Nobody does use it, and nobody ever will.

*If* for some weird reason somebody needs to use $0, we can worry about it *then*.

---

But this is a red herring. The reality is that developers do not have to worry about every little aspect of the test suite. When somebody uses `seq`, somebody else reminds them to use `test_seq` instead, and if for some reason a `seq` slips by and it breaks the test in some obscure platform, the test is updated to fix that. It's not a big deal.

Why are many tests using `chmod` instead of `test_chmod`? Did the introduction of `test_chmod` imply an extra burden to "our developers" to remember using that instead of `chmod`? No, *in reality* what everyone cares about is that the test runs on the platforms of the real world.

If we could run the test suite on 100 hypothetical platforms that don't exist in the real world, it would break all over the place.

In reality all the portability considerations of the test suite are geared towards certain platforms that exist in the real world. Nobody cares that the test suite doesn't run on some hypothetical platforms.

So no, nobody needs to remember to use test_chmod, or test_seq, and nobody will ever have to remember to use $ARGZERO instead of $0, and if some hypothetical person does use that in some hypothetical test and that breaks the tests for zsh in native mode, nobody will care, except the person running those tests (likely me), which would promptly fix that single hypothetical instance of $0.

Nobody will die if a instance of $0 slipped by (which will never happen).
This is simply not a real consideration.
Cheers.
-- 
Felipe Contreras
Previous: Taylor BlauNext: brian m. carlson
Message 26 of 29 in “test: make the test suite work with zsh”
  1. 0/6 test: make the test suite work with zshFelipe Contreras, Mar 28, 2023
  2. 3/6 test: avoid `options` variableFelipe Contreras, Mar 28, 2023
  3. 1/6 test: fix build for zshFelipe Contreras, Mar 28, 2023
  4. 5/6 test: hack for zshFelipe Contreras, Mar 28, 2023
  5. Felipe ContrerasMar 30, 2023
  6. 6/6 mergetools: vimdiff: check for empty fieldsFelipe Contreras, Mar 28, 2023
  7. 2/6 test: avoid `stat` variableFelipe Contreras, Mar 28, 2023
  8. Ævar Arnfjörð BjarmasonMar 29, 2023
  9. Taylor BlauApr 1, 2023
  10. Felipe ContrerasApr 1, 2023
  11. 4/6 test: avoid `path` variableFelipe Contreras, Mar 28, 2023
  12. brian m. carlsonMar 29, 2023
  13. Felipe ContrerasMar 29, 2023
  14. Ævar Arnfjörð BjarmasonMar 29, 2023
  15. Felipe ContrerasMar 29, 2023
  16. Felipe ContrerasMar 30, 2023
  17. Junio C HamanoMar 29, 2023
  18. Felipe ContrerasMar 29, 2023
  19. Junio C HamanoMar 30, 2023
  20. Felipe ContrerasMar 30, 2023
  21. Taylor BlauApr 1, 2023
  22. Felipe ContrerasApr 1, 2023
  23. Junio C HamanoApr 1, 2023
  24. Felipe ContrerasApr 1, 2023
  25. Taylor BlauApr 1, 2023
  26. Felipe ContrerasApr 1, 2023
  27. brian m. carlsonMar 29, 2023
  28. Junio C HamanoMar 30, 2023
  29. Felipe ContrerasMar 30, 2023

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.