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

Re: [PATCH 3/4] Fit to Plan 9's ANSI/POSIX compatibility layer

From
Kyohei Kadota <lufia@lufia.org>
Date
Aug 10, 2020, 10:53 UTC
Message-ID
<CAFMepckAe9r1O8xrQemytHoZKeyLSjEpfdH=yP=+SzKPoCOf8w@mail.gmail.com>
In-Reply-To
<xmqq5z9vlk5q.fsf@gitster.c.googlers.com>
Show 39 quoted lines
>
> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
> > I will note that usually the project prefers to have a human's personal
> > name here and in the commit metadata instead of a username.  Junio may
> > chime in here with an opinion.
>
> Thanks, I just did.
>
> >>  command_list () {
> >> -    eval "grep -ve '^#' $exclude_programs" <"$1"
> >> +    eval "grep -v -e '^#' $exclude_programs" <"$1"
> >
> > Is it really the case that Plan 9's grep cannot deal with bundled short
> > options?  That seems to be a significant departure from POSIX and Unix
> > behavior.  Regardless, this should be explained in the commit message.
>
> I am not interested in this ball of wax, but there are some pieces
> that are worth salvaging.  This is one of those good bits.
>
> diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
> index 9db2f4feab..a7cc01caf9 100755
> --- a/GIT-VERSION-GEN
> +++ b/GIT-VERSION-GEN
> @@ -26,7 +26,7 @@ else
>         VN="$DEF_VER"
>  fi
>
> -VN=$(expr "$VN" : v*'\(.*\)')
> +VN=${VN#v}
>
>  if test -r $GVF
>  then
>
> BUT.
>
> Dealing with "grep" that cannot take "-ve" and forces developers to
> spell it as "-v -e" is not one of them.  So is forbidding use of
> "cut".
I see. I will rewrite Plan 9's ape/grep to handle bundled options well.
Show 10 quoted lines
> >>  get_categories () {
> >> -    tr ' ' '\n'|
> >> +    tr ' ' '\012'|
> >
> > Okay, I guess.  Is this something we need to handle elsewhere as well?
> > The commit message should tell us why this is necessary, and what Plan 9
> > does and doesn't support.
>
> Yeah, POSIX does want you to understand '\n' and others, but this is
> within reason for portability that I think we could swallow.
I'm happy, thanks.
Show 33 quoted lines
> >> +if test -z "$(echo -n)"
> >> +then
> >> +    alias print='echo -n'
> >> +else
> >> +    alias print='printf %s'
> >> +fi
> >
> > Let's avoid an alias here (especially with a common builtin name) and
> > instead use a shell function.  Maybe like this (not tab-indented):
> >
> >   print_nonl () {
> >     if command -v printf >/dev/null 2>&1
> >     then
> >       printf "%s" "$@"
> >     else
> >       echo -n "$@"
> >     fi
> >   }
>
> I'd rather not to see this done; "echo -n" and "echo '...\c'" are
> not portable and we do want people to use 'printf'.  This directly
> goes against it.
>
> > This is also going to need some patching in the testsuite, since we use
> > printf extensively (more than 1300 times).  I do hope you have perl
> > available.
>
> Eh, so what would Plan9 people do with Perl?  Write a single-liner
> 'printf' script and put it in a directory on their $PATH?
>
> I am not sure if it is worth crippling the toolset our developers
> are allowed to choose from and use in our scripts and tests like
> this patch tries to do.

Like other topics, I decide to implement printf(1). These new POSIX tools will be installed to Plan 9 systems from other repo or patches before building git.

Show 11 quoted lines
> If this were Windows, it might have been a different story, but what
> we are talking about is Plan 9, which had the last "fourth edition"
> in 2002, right?  During the 18 years since then, none of its users
> and developers work on porting many OSS packages, whose primary user
> base are on POSIXy systems, to it and we need to apply patches like
> these to each and every OSS packages of interest?  I would have
> expected that any exotic-minority-but-thriving-platform would be
> able to tell its users "here are ports of POSIXy programs---install
> them and it can become usable by those who only know Linux"?
>
> So, I dunno.

Final official distribution from Bell labs was released in Jan 2015. Now, There are some distributions that forked from official Plan 9 and are maintained by that community, such as 9legacy, 9front or others.

I will try to implement POSIX toolsets if it is needed because POSIX is a large spec. Thanks for your advice.

Previous: Junio C HamanoNext: brian m. carlson
Message 17 of 29 in “Fit the building tools to Plan 9 environment”
  1. 0/4 Fit the building tools to Plan 9 environmentKADOTA, Kyohei via GitGitGadget, Aug 6, 2020
  2. 2/4 Define TAR_CF and TAR_XF variables in Makefilelufia via GitGitGadget, Aug 6, 2020
  3. Junio C HamanoAug 6, 2020
  4. 1/4 Use $(SHELL_PATH) instead of sh in Makefile.lufia via GitGitGadget, Aug 6, 2020
  5. brian m. carlsonAug 6, 2020
  6. Eric SunshineAug 6, 2020
  7. Kyohei KadotaAug 6, 2020
  8. Junio C HamanoAug 6, 2020
  9. Kyohei KadotaAug 10, 2020
  10. 4/4 Use $(LD) instead of $(CC) for linking the object fileslufia via GitGitGadget, Aug 6, 2020
  11. 3/4 Fit to Plan 9's ANSI/POSIX compatibility layerlufia via GitGitGadget, Aug 6, 2020
  12. brian m. carlsonAug 6, 2020
  13. Kyohei KadotaAug 6, 2020
  14. brian m. carlsonAug 6, 2020
  15. Eric SunshineAug 6, 2020
  16. Junio C HamanoAug 6, 2020
  17. Kyohei KadotaAug 10, 2020
  18. brian m. carlsonAug 6, 2020
  19. 0/2 Fit the building tools to Plan 9 environmentKADOTA, Kyohei via GitGitGadget, Sep 9, 2020
  20. 1/2 Fit to Plan 9's ANSI/POSIX compatibility layerKyohei Kadota via GitGitGadget, Sep 9, 2020
  21. Eric SunshineSep 9, 2020
  22. Junio C HamanoSep 9, 2020
  23. Kyohei KadotaSep 10, 2020
  24. 2/2 Use $(LD) instead of $(CC) for linking the object filesKyohei Kadota via GitGitGadget, Sep 9, 2020
  25. 0/2 Fit the building tools to Plan 9 environmentKADOTA, Kyohei via GitGitGadget, Sep 10, 2020
  26. 1/2 Fit to Plan 9's ANSI/POSIX compatibility layerKyohei Kadota via GitGitGadget, Sep 10, 2020
  27. Junio C HamanoSep 10, 2020
  28. 2/2 Use $(LD) instead of $(CC) for linking the object filesKyohei Kadota via GitGitGadget, Sep 10, 2020
  29. Junio C HamanoSep 10, 2020

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.