Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/librumphijack Avoid literal <CR> in sed regular ex...



details:   https://anonhg.NetBSD.org/src/rev/67db630a8d05
branches:  trunk
changeset: 332784:67db630a8d05
user:      apb <apb%NetBSD.org@localhost>
date:      Thu Oct 09 06:52:37 2014 +0000

description:
Avoid literal <CR> in sed regular expression.
Instead, use printf(1) to save the regexp in a shell variable,
taking advantage of the fact that printf understands "\r".

This should fix a complaint from subversion, reported in PR 49249.

diffstat:

 tests/lib/librumphijack/t_tcpip.sh |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 09b5ce133d7f -r 67db630a8d05 tests/lib/librumphijack/t_tcpip.sh
--- a/tests/lib/librumphijack/t_tcpip.sh        Thu Oct 09 06:49:53 2014 +0000
+++ b/tests/lib/librumphijack/t_tcpip.sh        Thu Oct 09 06:52:37 2014 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: t_tcpip.sh,v 1.13 2014/01/03 13:18:00 pooka Exp $
+#       $NetBSD: t_tcpip.sh,v 1.14 2014/10/09 06:52:37 apb Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -53,8 +53,9 @@
        # check that we got what we wanted
        atf_check -o match:'HTTP/1.0 200 OK' cat webfile
        atf_check -o match:'Content-Length: 95' cat webfile
+       blank_line_re="$(printf '^\r$')" # matches a line with only <CR><LF>
        atf_check -o file:"$(atf_get_srcdir)/index.html" \
-           sed -n '1,/^
$/!p' webfile
+           sed -n "1,/${blank_line_re}/!p" webfile
 }
 
 http_cleanup()



Home | Main Index | Thread Index | Old Index