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

Re: [PATCH] contrib/hooks/post-receive-email: Fix solaris portability issues.

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2009, 07:42 UTC
Message-ID
<7v3aab6ujf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1244444557-21685-1-git-send-email-thomas.moulard@gmail.com>
Thomas Moulard <thomas.moulard@gmail.com> writes:
Show 7 quoted lines
> This patch solves some issues I had on a Solaris system:
> $ showrev -c /bin/sh | grep version
> Command version: SunOS 5.10 Generic 121005-03 Oct 2006
>
> 1. Replace $(...) by backquotes.
> 2. Replace shell substitution ${var##word} by echo + sed
> 3. Replace grep -F by fgrep.
Thanks for trying to be helpful, but regrettably I have to say no.

Earlier we already declared that any Bourne variant that does not understand $() is unfit to use with git as a general rule, but that particular general rule was really meant to exclude broken /bin/sh on Solaris. We recommend using either ksh or /usr/xpg4/bin/sh on that platform.

Perhaps SunOS 5.10 has a better /bin/sh than what people tried earlier, and with this patch everything start to magically work well on the platform. I however somehow doubt it.

There are tons of "$()" construct in our scripted Porcelain commands, and I think there are even nested ones that you cannot replace with "``" without introducing new variables and contaminating the namespace.

Even though I am a traditionist, I personally would not want to see a patch to rewrite them back to ``, because that will force me to verify that de-nesting of $(foo $(bar baz)) is done properly, that interaction between `` and double quotes are handled correctly, and that namespace contamination does not have any ill effects, etc. etc.

Show 6 quoted lines
> @@ -118,12 +118,12 @@ generate_email()
>  		refs/tags/*,commit)
>  			# un-annotated tag
>  			refname_type="tag"
> -			short_refname=${refname##refs/tags/}
> +			short_refname=`echo "$refname" | sed 's|refs/tags/||'`
I think we used to write
	sed -e 's|^refs/tags/||'
all over the place, but they were later replaced with "${var#word}".

In any case, this particular rewrite is wrong; you need to anchor the pattern at the left end (so are other uses of 's|refs/xxx/||' in your patch).

Previous: Thomas Moulard
Message 2 of 2 in “contrib/hooks/post-receive-email: Fix solaris portability issues.”
  1. contrib/hooks/post-receive-email: Fix solaris portability issues.Thomas Moulard, Jun 8, 2009
  2. Junio C HamanoJun 8, 2009

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.