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

Re: [BUG] t7004 (master) busted on Leopard

From
Wincent Colaiuta <win@wincent.com>
Date
Nov 15, 2007, 15:12 UTC
Message-ID
<A3467E97-601B-45EE-816D-376F4FFE69E8@wincent.com>
In-Reply-To
<Pine.LNX.4.64.0711151434060.30886@racer.site>
El 15/11/2007, a las 15:37, Johannes Schindelin escribió:
Show 13 quoted lines
> Hi,
>
> On Thu, 15 Nov 2007, Wincent Colaiuta wrote:
>
>> Commit 4d8b1dc850 added a couple of tests to t7004, and my testing  
>> reveals
>> that this one has been broken on Leopard since then:
>>
>> * FAIL 83: message in editor has initial comment
>> GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
>> test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
>
> I think this is our good old friend, MacOSX' sed.

Yes, that's exactly what I said in the part of my post that you didn't quote.

Show 5 quoted lines
> I imagine that it is that MacOSX' sed is adding a trailing newline  
> (not
> the regexp like you suggested).  Which means that "wc -l" would  
> print "1".
> (You can see for yourself if you run the script with "sh -x ...".)

Unless I am misreading the test, any output from "wc -l" that is greater than 0 will cause the test to pass, so even if it outputted "1" as you suggest then that wouldn't be the cause of the failure.

I do think the cause of the failure is the limited regexp syntax that sed accepts on Leopard; witness: on Mac OS X the following prints 0:

   echo "# hello" | sed -n "/^\(#\|\$\)/p" | wc -l
Whereas the following prints 1:
   echo "# hello" | sed -n "/^[#\$]/p" | wc -l

Here's the output for the failing test run under "sh -x" as you suggest, although I must admit that I can't really parse it myself.

+ test_expect_success 'message in editor has initial comment' '
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
+ test 2 = 2
+ test_skip 'message in editor has initial comment' '
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
++ expr ./t7004-tag.sh : '.*/\(t[0-9]*\)-[^/]*$'
+ this_test=t7004
++ expr 82 + 1
+ this_test=t7004.83
+ to_skip=
+ case "$to_skip" in
+ false
+ say 'expecting success:
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
+ say_color info 'expecting success:
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
+ case "$1" in
+ tput setaf 3
+ shift
+ echo '* expecting success:
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
+ tput sgr0
+ test_run_ '
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
+ eval '
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
+ eval_ret=1
+ return 0
+ '[' 0 = 0 -a 1 = 0 ']'
+ test_failure_ 'message in editor has initial comment' '
	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
'
++ expr 82 + 1
+ test_count=83
++ expr 0 + 1
+ test_failure=1
+ say_color error 'FAIL 83: message in editor has initial comment'
+ case "$1" in
+ tput bold
+ tput setaf 1
+ shift
+ echo '* FAIL 83: message in editor has initial comment'
* FAIL 83: message in editor has initial comment
+ tput sgr0
+ shift
Show 5 quoted lines
> IMHO a good solution would be
>
> 	test -z "$(grep -e '^#' -e '^$' actual)"
>
> Could you test, please?

Yes, the test passes with that, although it has to be written as follows in the actual test file seeing as it's inside a single-quoted string:

test -z "$(grep -e \"^#\" -e \"^$\" actual)"
Will follow this up with a patch that implements your proposed fix.

Cheers, Wincent

Previous: David KastrupNext: Wincent Colaiuta
Message 4 of 26 in “[BUG] t7004 (master) busted on Leopard”
  1. Wincent ColaiutaNov 15, 2007
  2. Johannes SchindelinNov 15, 2007
  3. David KastrupNov 15, 2007
  4. Wincent ColaiutaNov 15, 2007
  5. Fix git-tag test breakage caused by broken sed on LeopardWincent Colaiuta, Nov 15, 2007
  6. Fix git-tag test breakage caused by broken sed on LeopardWincent Colaiuta, Nov 15, 2007
  7. Wincent ColaiutaNov 16, 2007
  8. Wincent ColaiutaNov 16, 2007
  9. Mike HommeyNov 16, 2007
  10. Wincent ColaiutaNov 16, 2007
  11. Fix t7004 which fails with retarded sedMike Hommey, Nov 16, 2007
  12. Benoit SigoureNov 16, 2007
  13. Mike HommeyNov 16, 2007
  14. Wincent ColaiutaNov 16, 2007
  15. Junio C HamanoNov 16, 2007
  16. Mike HommeyNov 16, 2007
  17. Junio C HamanoNov 16, 2007
  18. Fix and improve t7004Mike Hommey, Nov 16, 2007
  19. Benoit SigoureNov 16, 2007
  20. Mike HommeyNov 16, 2007
  21. Benoit SigoureNov 16, 2007
  22. Mike HommeyNov 16, 2007
  23. Benoit SigoureNov 16, 2007
  24. Junio C HamanoNov 16, 2007
  25. Fix and improve t7004Mike Hommey, Nov 16, 2007
  26. Junio C HamanoNov 17, 2007

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.