git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* t4055 failure: see error
@ 2012-10-02 12:18 Brian Charles Gernhardt
  2012-10-02 18:45 ` Junio C Hamano
  2012-10-02 19:00 ` Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Charles Gernhardt @ 2012-10-02 12:18 UTC (permalink / raw)
  To: Git List

Another problem caused by BSD v GNU sed, I think.

$ ./t4055-diff-context.sh -i -v
Initialized empty Git repository in /Users/brian/dev/git/t/trash directory.t4055-diff-context/.git/
expecting success: 
	cat >x <<-\EOF &&
	firstline
	b
	c
	d
	e
	f
	preline
	postline
	i
	j
	k
	l
	m
	n
	EOF
	git update-index --add x &&
	git commit -m initial &&

	git cat-file blob HEAD:x |
	sed "/preline/a\
	ADDED" >x &&
	git update-index --add x &&
	git commit -m next &&

	git cat-file blob HEAD:x |
	sed s/ADDED/MODIFIED/ >x

[master (root-commit) d5fa2e5] initial
 Author: A U Thor <author@example.com>
 1 file changed, 14 insertions(+)
 create mode 100644 x
sed: 1: "/preline/a	ADDED": command a expects \ followed by text

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: t4055 failure: see error
  2012-10-02 12:18 t4055 failure: see error Brian Charles Gernhardt
@ 2012-10-02 18:45 ` Junio C Hamano
  2012-10-02 18:52   ` Junio C Hamano
  2012-10-02 19:00 ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2012-10-02 18:45 UTC (permalink / raw)
  To: Brian Charles Gernhardt; +Cc: Git List

Brian Charles Gernhardt <gernhard@cs.rochester.edu> writes:

> Another problem caused by BSD v GNU sed, I think.

Oh, that again X-<.

Will patch up in a stupid-but-trivial way, unless somebody knows a
reliable workaround.

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: t4055 failure: see error
  2012-10-02 18:45 ` Junio C Hamano
@ 2012-10-02 18:52   ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2012-10-02 18:52 UTC (permalink / raw)
  To: Brian Charles Gernhardt; +Cc: Git List

Junio C Hamano <gitster@pobox.com> writes:

> Brian Charles Gernhardt <gernhard@cs.rochester.edu> writes:
>
>> Another problem caused by BSD v GNU sed, I think.
>
> Oh, that again X-<.
>
> Will patch up in a stupid-but-trivial way, unless somebody knows a
> reliable workaround.

I no longer have a BSD handy to test, so I'd appreciate it if
somebody can do a quick sanity check.

Thanks.

-- >8 --
Subject: [PATCH] t4055: avoid BSD/GNU sed incompatibilty issues

The 'a', 'i' and 'c' commands that take literal lines to be added
followed by backslash does not seem to work reliably on some BSD
systems.  Avoid it by having an extra line in a template file and
generate test vectors by deleting the line or replacing the line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4055-diff-context.sh | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/t/t4055-diff-context.sh b/t/t4055-diff-context.sh
index 3527686..97172b4 100755
--- a/t/t4055-diff-context.sh
+++ b/t/t4055-diff-context.sh
@@ -8,7 +8,7 @@ test_description='diff.context configuration'
 . ./test-lib.sh
 
 test_expect_success 'setup' '
-	cat >x <<-\EOF &&
+	cat >template <<-\EOF &&
 	firstline
 	b
 	c
@@ -16,6 +16,7 @@ test_expect_success 'setup' '
 	e
 	f
 	preline
+	TARGET
 	postline
 	i
 	j
@@ -24,17 +25,15 @@ test_expect_success 'setup' '
 	m
 	n
 	EOF
+	sed "/TARGET/d" >x <template &&
 	git update-index --add x &&
 	git commit -m initial &&
 
-	git cat-file blob HEAD:x |
-	sed "/preline/a\
-	ADDED" >x &&
+	sed "s/TARGET/ADDED/" >x <template &&
 	git update-index --add x &&
 	git commit -m next &&
 
-	git cat-file blob HEAD:x |
-	sed s/ADDED/MODIFIED/ >x
+	sed "s/TARGET/MODIFIED/" >x <template
 '
 
 test_expect_success 'the default number of context lines is 3' '
-- 
1.8.0.rc0.45.g7ce8dc5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: t4055 failure: see error
  2012-10-02 12:18 t4055 failure: see error Brian Charles Gernhardt
  2012-10-02 18:45 ` Junio C Hamano
@ 2012-10-02 19:00 ` Junio C Hamano
  2012-10-02 19:09   ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2012-10-02 19:00 UTC (permalink / raw)
  To: Brian Charles Gernhardt; +Cc: Git List

Brian Charles Gernhardt <gernhard@cs.rochester.edu> writes:

> Another problem caused by BSD v GNU sed, I think.
>
> 	git cat-file blob HEAD:x |
> 	sed "/preline/a\
> 	ADDED" >x &&

Actually, I think what is happening is that inside "", the backslash
at the end of line is eaten by the shell together with that end of
line, so it is not BSD vs GNU, but it simply is that my quoting was
wrong.

This (disregarding the previous "TARGET" patch) may be a smaller fix.

 t/t4055-diff-context.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git c/t/t4055-diff-context.sh w/t/t4055-diff-context.sh
index 3527686..0f2dd40 100755
--- c/t/t4055-diff-context.sh
+++ w/t/t4055-diff-context.sh
@@ -28,7 +28,7 @@ test_expect_success 'setup' '
 	git commit -m initial &&
 
 	git cat-file blob HEAD:x |
-	sed "/preline/a\
+	sed "/preline/a\\
 	ADDED" >x &&
 	git update-index --add x &&
 	git commit -m next &&

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: t4055 failure: see error
  2012-10-02 19:00 ` Junio C Hamano
@ 2012-10-02 19:09   ` Junio C Hamano
  2012-10-07 15:43     ` Brian Charles Gernhardt
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2012-10-02 19:09 UTC (permalink / raw)
  To: Brian Charles Gernhardt; +Cc: Git List

Junio C Hamano <gitster@pobox.com> writes:

> Brian Charles Gernhardt <gernhard@cs.rochester.edu> writes:
>
>> Another problem caused by BSD v GNU sed, I think.
>>
>> 	git cat-file blob HEAD:x |
>> 	sed "/preline/a\
>> 	ADDED" >x &&
>
> Actually, I think what is happening is that inside "", the backslash
> at the end of line is eaten by the shell together with that end of
> line, so it is not BSD vs GNU, but it simply is that my quoting was
> wrong.
>
> This (disregarding the previous "TARGET" patch) may be a smaller fix.

I'll find a brown paper bag big enough to hide in.  Please disregard
it.

-- >8 --
Subject: [PATCH] t4055: avoid use of sed 'a' command

The 'a', 'i' and 'c' commands take a literal text to be added
followed by backslash, but then in the source we cannot indent
the literal text which makes it ugly.

We need to also remember to double the backslash inside double
quotes.

Avoid these issues altogether by having an extra line in a template
file and generate test vectors by deleting the line or replacing the
line and not using the 'a' command.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4055-diff-context.sh | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/t/t4055-diff-context.sh b/t/t4055-diff-context.sh
index 3527686..97172b4 100755
--- a/t/t4055-diff-context.sh
+++ b/t/t4055-diff-context.sh
@@ -8,7 +8,7 @@ test_description='diff.context configuration'
 . ./test-lib.sh
 
 test_expect_success 'setup' '
-	cat >x <<-\EOF &&
+	cat >template <<-\EOF &&
 	firstline
 	b
 	c
@@ -16,6 +16,7 @@ test_expect_success 'setup' '
 	e
 	f
 	preline
+	TARGET
 	postline
 	i
 	j
@@ -24,17 +25,15 @@ test_expect_success 'setup' '
 	m
 	n
 	EOF
+	sed "/TARGET/d" >x <template &&
 	git update-index --add x &&
 	git commit -m initial &&
 
-	git cat-file blob HEAD:x |
-	sed "/preline/a\
-	ADDED" >x &&
+	sed "s/TARGET/ADDED/" >x <template &&
 	git update-index --add x &&
 	git commit -m next &&
 
-	git cat-file blob HEAD:x |
-	sed s/ADDED/MODIFIED/ >x
+	sed "s/TARGET/MODIFIED/" >x <template
 '
 
 test_expect_success 'the default number of context lines is 3' '
-- 
1.8.0.rc0.45.g7ce8dc5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: t4055 failure: see error
  2012-10-02 19:09   ` Junio C Hamano
@ 2012-10-07 15:43     ` Brian Charles Gernhardt
  2012-10-07 22:37       ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Charles Gernhardt @ 2012-10-07 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git List


On Oct 2, 2012, at 3:09 PM, Junio C Hamano <gitster@pobox.com> wrote:

> I'll find a brown paper bag big enough to hide in.  Please disregard
> it.
> 
> -- >8 --
> Subject: [PATCH] t4055: avoid use of sed 'a' command

Sorry about being slow to respond.  The patch does work for me.  I see it's already been committed, but thought the confirmation would be nice.

~~ Brian Gernhardt

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: t4055 failure: see error
  2012-10-07 15:43     ` Brian Charles Gernhardt
@ 2012-10-07 22:37       ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2012-10-07 22:37 UTC (permalink / raw)
  To: Brian Charles Gernhardt; +Cc: Git List

Brian Charles Gernhardt <gernhard@cs.rochester.edu> writes:

> On Oct 2, 2012, at 3:09 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
>> I'll find a brown paper bag big enough to hide in.  Please disregard
>> it.
>> 
>> -- >8 --
>> Subject: [PATCH] t4055: avoid use of sed 'a' command
>
> Sorry about being slow to respond.  The patch does work for me.  I
> see it's already been committed, but thought the confirmation
> would be nice.

Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-07 22:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02 12:18 t4055 failure: see error Brian Charles Gernhardt
2012-10-02 18:45 ` Junio C Hamano
2012-10-02 18:52   ` Junio C Hamano
2012-10-02 19:00 ` Junio C Hamano
2012-10-02 19:09   ` Junio C Hamano
2012-10-07 15:43     ` Brian Charles Gernhardt
2012-10-07 22:37       ` Junio C Hamano

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).