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

Re: t9401 fails with OS X sed

From
Torsten Bögershausen <tboegi@web.de>
Date
Oct 25, 2012, 12:51 UTC
Message-ID
<508935CB.9020408@web.de>
In-Reply-To
<20121025084132.GB8390@sigill.intra.peff.net>
On 25.10.12 10:41, Jeff King wrote:
Show 21 quoted lines
> 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)"
Previous: Jeff KingNext: Ben Walton
Message 4 of 10 in “t9401 fails with OS X sed”
  1. Brian GernhardtOct 25, 2012
  2. Geert BoschOct 25, 2012
  3. Jeff KingOct 25, 2012
  4. Torsten BögershausenOct 25, 2012
  5. Use character class for sed expression instead of \sBen Walton, Oct 25, 2012
  6. Brian GernhardtOct 25, 2012
  7. Torsten BögershausenOct 25, 2012
  8. Ben WaltonOct 25, 2012
  9. Torsten BögershausenOct 25, 2012
  10. Jeff KingOct 26, 2012

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.