Even though it is POSIX, using backslashed grouping in 'grep' isn't
portable. It fails at least on Solaris 8, and you have to do:
egrep "^(author|summary) "
instead. Of course, I can't get your test to pass even with that change,
but I think that is just a broken iconv on Solaris.
Yuck. Solaris 8 /usr/bin/grep does not even grok "-e", so we cannot do a
more obvious:
grep -e "^author " -e "^summary "
Do people build with NO_EXTERNAL_GREP on older Solaris?
git-submodule.sh uses grep "-e" to look for two patterns and I suspect
older Solaris would have the same issue.
git-submodule.sh uses grep "-e" to look for two patterns and I suspect
older Solaris would have the same issue.
Yes, that code will break on Solaris. Most of my portability fixes have
been in direct response to tests, so I guess we are not testing
git-submodule very well.
-Peff
From: Jeff King <hidden> Date: 2016-06-15 22:45:31
On Wed, Oct 22, 2008 at 03:14:16PM -0400, Jeff King wrote:
quoted
git-submodule.sh uses grep "-e" to look for two patterns and I suspect
older Solaris would have the same issue.
Yes, that code will break on Solaris. Most of my portability fixes have
been in direct response to tests, so I guess we are not testing
git-submodule very well.
And here's a patch. Though I believe this is the last "grep -e", I
wonder if it wouldn't have been wiser to simply force people on such
platforms to use GNU grep (I already have to use GNU tools to build, and
bash to run the scripts).
-- >8 --
submodule: fix some non-portable grep invocations
Not all greps support "-e", but in this case we can easily
convert it to a single extended regex.
Signed-off-by: Jeff King <redacted>
---
Passes the test scripts, but I'm not sure they are exercising this code,
anyway, since it passed on Solaris. Please double-check my conversion.
git-submodule.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
From: Jeff King <hidden> Date: 2016-06-15 22:45:31
On Wed, Oct 22, 2008 at 10:29:39PM +0200, Johannes Schindelin wrote:
quoted
Not all greps support "-e", but in this case we can easily
convert it to a single extended regex.
I really wonder if we cannot catch these things (unportable grep, sed, etc
invokations) with a simple patch to the pre-commit hook.
We could probably write a hook for some of the simpler ones, but we
would have quite a few false negatives, I suspect.
FWIW, I am not finding these portability problems by hand. I am nightly
auto-building and testing Junio's maint, master, and next on Solaris 8
and FreeBSD, and Mike Ralphson is doing the same for AIX. So while we
could perhaps catch them sooner, I am very happy to have caught several
issues recently in next, _before_ they hit master.
-Peff