git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Jeff King <peff@peff.net>
Cc: "Geert Bosch" <bosch@adacore.com>,
	"Brian Gernhardt" <brian@gernhardtsoftware.com>,
	"Git List" <git@vger.kernel.org>,
	"Torsten Bögershausen" <tboegi@web.de>
Subject: Re: t9401 fails with OS X sed
Date: Thu, 25 Oct 2012 14:51:23 +0200	[thread overview]
Message-ID: <508935CB.9020408@web.de> (raw)
In-Reply-To: <20121025084132.GB8390@sigill.intra.peff.net>

On 25.10.12 10:41, Jeff King wrote:
> On Thu, Oct 25, 2012 at 01:04:11AM -0400, Geert Bosch wrote:
> 
>> On Oct 24, 2012, at 23:54, Brian Gernhardt <brian@gernhardtsoftware.com> wrote:
>>
>>> It works if I change \s to [[:space:]], but I don't know how portable that is.
>>
>> As \s is shorthand for the POSIX character class [:space:], I'd say the latter
>> should be more portable: anything accepting the shorthand should also accept
>> the full character class. If not, you probably only care about horizontal tab
>> and space, for which you could just use a simple regular expression. Just a
>> literal space and tab character between square brackets is probably going to be
>> most portable, though not most readable.
> 
> I agree that the POSIX character class would be more portable than "\s",
> but we do not have any existing uses of them, and I would worry a little
> about older systems like Solaris. If we can simply use a literal space
> and tab, that seems like the safest.
> 
> Brian, can you work up a patch?
> 
> -Peff

Would this be portable:
(It works on my Mac OS X box after installing cvs)
But I don't have solaris


diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index cdb8360..f2ec9d2 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -46,7 +46,7 @@ check_status_options() {
        echo "Error from cvs status: $1 $2" >> "${WORKDIR}/marked.log"
        return 1;
     fi
-    got="$(sed -n -e 's/^\s*Sticky Options:\s*//p' "${WORKDIR}/status.out")"
+    got="$(tr '\t' ' ' < "${WORKDIR}/status.out" | sed -n -e 's/^ *Sticky Options: *//p')"
     expect="$3"
     if [ x"$expect" = x"" ] ; then
        expect="(none)"

  reply	other threads:[~2012-10-25 12:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25  3:54 t9401 fails with OS X sed Brian Gernhardt
2012-10-25  5:04 ` Geert Bosch
2012-10-25  8:41   ` Jeff King
2012-10-25 12:51     ` Torsten Bögershausen [this message]
2012-10-25 15:58       ` [PATCH] Use character class for sed expression instead of \s Ben Walton
2012-10-25 16:00         ` Brian Gernhardt
2012-10-25 16:28           ` Torsten Bögershausen
2012-10-25 18:08             ` Ben Walton
2012-10-25 20:09               ` Torsten Bögershausen
2012-10-26 12:38         ` Jeff King

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

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

  git send-email \
    --in-reply-to=508935CB.9020408@web.de \
    --to=tboegi@web.de \
    --cc=bosch@adacore.com \
    --cc=brian@gernhardtsoftware.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
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 NNTP newsgroup(s).