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

Re: [PATCH v2] CodingGuidelines: explicitly allow "local" for test scripts

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 5, 2021, 03:59 UTC
Message-ID
<6092180651fdc_105ac2088a@natae.notmuch>
In-Reply-To
<YJH712E2kT9yJkGT@camp.crustytoothpaste.net>
brian m. carlson wrote:
Show 20 quoted lines
> On 2021-05-05 at 00:08:17, Felipe Contreras wrote:
> > brian m. carlson wrote:
> > > On 2021-05-04 at 15:09:54, Ævar Arnfjörð Bjarmason wrote:
> > > > My aim here was to discover if we had any reason to think that "local"
> > > > was less universally implemented than other POSIX/C89-plus features we
> > > > rely on. It seems that it's not.
> > > 
> > > "local" is missing in AT&T ksh.
> > 
> > It's not missing, it's supported only in "functions", which have a
> > different syntax in ksh:
> > 
> >   function f { local x="foo"; echo $x; }; f
> 
> I believe there's a bash compatibility mode that enables this, but I
> don't see support for it in the version Debian ships[0], which doesn't
> enable that mode:
> 
>   ksh -c 'function f { local x="foo"; echo $x; }; f'
>   ksh: f[1]: local: not found [No such file or directory]

I tried to build ksh myself to make sure, and apparently there's a mess of different versions of it. I manually applied some patches and tried three times before giving up.

It's clear the Debian version and the Arch Linux version are completely different.

> Regardless of the specifics, I think we can both agree that it doesn't
> work in sh-style functions, so for Git's purposes, AT&T ksh does not
> meet our needs in terms of support for local.

Indeed. But it also probably doesn't meet many other needs. A quick check shows 54 failed tests just on t0000-basic.sh. I don't think it's something we should even consider.

Cheers.
-- 
Felipe Contreras
Previous: brian m. carlsonNext: Jeff King
Message 15 of 17 in “CodingGuidelines: explicitly allow "local" for test scripts”
  1. CodingGuidelines: explicitly allow "local" for test scriptsJunio C Hamano, May 3, 2021
  2. Eric SunshineMay 3, 2021
  3. Junio C HamanoMay 3, 2021
  4. CodingGuidelines: explicitly allow "local" for test scriptsJunio C Hamano, May 3, 2021
  5. Ævar Arnfjörð BjarmasonMay 3, 2021
  6. Junio C HamanoMay 4, 2021
  7. Ævar Arnfjörð BjarmasonMay 4, 2021
  8. Junio C HamanoMay 4, 2021
  9. Ævar Arnfjörð BjarmasonMay 4, 2021
  10. Felipe ContrerasMay 4, 2021
  11. brian m. carlsonMay 4, 2021
  12. Junio C HamanoMay 4, 2021
  13. Felipe ContrerasMay 5, 2021
  14. brian m. carlsonMay 5, 2021
  15. Felipe ContrerasMay 5, 2021
  16. Jeff KingMay 5, 2021
  17. Felipe ContrerasMay 5, 2021

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.