git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thomas Moulard <thomas.moulard@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] contrib/hooks/post-receive-email: Fix solaris portability issues.
Date: Mon, 08 Jun 2009 00:42:28 -0700	[thread overview]
Message-ID: <7v3aab6ujf.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1244444557-21685-1-git-send-email-thomas.moulard@gmail.com> (Thomas Moulard's message of "Mon\,  8 Jun 2009 16\:02\:37 +0900")

Thomas Moulard <thomas.moulard@gmail.com> 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).

      reply	other threads:[~2009-06-08  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08  7:02 [PATCH] contrib/hooks/post-receive-email: Fix solaris portability issues Thomas Moulard
2009-06-08  7:42 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v3aab6ujf.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=thomas.moulard@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).