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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Moulard <thomas.moulard@xxxxxxxxx> writes:

> 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.

> @@ -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).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]