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

Re: [PATCH v3 09/10] Fix tests breaking when checkout path contains shell metacharacters

From
Johannes Sixt <j.sixt@viscovery.net>
Date
May 5, 2008, 07:04 UTC
Message-ID
<481EB168.1070206@viscovery.net>
In-Reply-To
<1209879480-16910-10-git-send-email-bdonlan@fushizen.net>
Bryan Donlan schrieb:
> This fixes the remainder of the issues where the test script itself is at
> fault for failing when the git checkout path contains whitespace or other
> shell metacharacters.
Maybe a note along these lines would be in order:
The majority of git svn tests used the idiom
  test_expect_success "title" "test script using $svnrepo"
These were changed to have the test script in single-quotes:
  test_expect_success "title" 'test script using "$svnrepo"'

(which makes the patch so large). One consequence of this change is that in the verbose test output the value of $svnrepo (and in some cases other variables, too) is no longer expanded, i.e. previously we saw

  * expecting success:
	test script using /path/to/git/t/trash/svnrepo
but now it is:
  * expecting success:
	test script using "$svnrepo"
> 
> Signed-off-by: Bryan Donlan <bdonlan@fushizen.net>
Show 5 quoted lines
>  test_expect_success 'push with insteadOf' '
>  	mk_empty &&
> -	TRASH=$(pwd)/ &&
> -	git config url.$TRASH.insteadOf trash/ &&
> +	TRASH="$(pwd)/" &&
This one would not be necessary, but I don't mind.
Show 13 quoted lines
> -test_expect_success 'make sure r2 still has old file' '
> +test_expect_success 'make sure r2 still has old file' "
>  	cd x &&
> -		test -n "$(git svn find-rev r1)" &&
> -		git reset --hard $(git svn find-rev r1) &&
> +		test -n \"\$(git svn find-rev r1)\" &&
> +		git reset --hard \$(git svn find-rev r1) &&
>  		test -f README &&
>  		test ! -f FOLLOWME &&
> -		test x$(git svn find-rev r2) = x
> -'
> +		test x\$(git svn find-rev r2) = x
> +"
Why did you change the quoting from sq to dq here?
Show 9 quoted lines
> diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
> index 3dc261d..ae7082b 100755
> --- a/t/t9500-gitweb-standalone-no-errors.sh
> +++ b/t/t9500-gitweb-standalone-no-errors.sh
> @@ -10,6 +10,7 @@ commandline, and checks that it would not write any errors
>  or warnings to log.'
>  
>  gitweb_init () {
> +	safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
How portable is this? (Just asking...)
-- Hannes
Previous: Johannes SixtNext: Bryan Donlan
Message 52 of 60 in “Fix git's test suite to pass when the path contains spaces”
  1. 0/8 Fix git's test suite to pass when the path contains spacesBryan Donlan, Apr 9, 2008
  2. 1/8 git-rebase.sh: Fix --merge --abort failures when path contains whitespaceBryan Donlan, Apr 9, 2008
  3. 2/8 config.c: Escape backslashes in section names properlyBryan Donlan, Apr 9, 2008
  4. 3/8 git-send-email.perl: Handle shell metacharacters in $EDITOR properlyBryan Donlan, Apr 9, 2008
  5. 4/8 test-lib.sh: Fix some missing path quotingBryan Donlan, Apr 9, 2008
  6. 5/8 test-lib.sh: Add a test_set_editor function to safely set $VISUALBryan Donlan, Apr 9, 2008
  7. 6/8 lib-git-svn.sh: Fix quoting issues with paths containing shell metacharactersBryan Donlan, Apr 9, 2008
  8. 7/8 Use test_set_editor in t9001-send-email.shBryan Donlan, Apr 9, 2008
  9. 8/8 Fix tests breaking when checkout path contains shell metacharactersBryan Donlan, Apr 9, 2008
  10. Johannes SixtApr 9, 2008
  11. Bryan DonlanApr 9, 2008
  12. Junio C HamanoApr 9, 2008
  13. Johannes SixtApr 9, 2008
  14. Johannes SixtApr 9, 2008
  15. Bryan DonlanApr 9, 2008
  16. Junio C HamanoApr 10, 2008
  17. Johannes SixtApr 9, 2008
  18. Bryan DonlanApr 9, 2008
  19. Johannes SixtApr 9, 2008
  20. Junio C HamanoApr 9, 2008
  21. Johannes SixtApr 9, 2008
  22. Bryan DonlanApr 9, 2008
  23. Johannes SixtApr 9, 2008
  24. Bryan DonlanApr 9, 2008
  25. Johannes SixtApr 10, 2008
  26. 00/10 Fix git's test suite to pass when the path contains spacesBryan Donlan, Apr 10, 2008
  27. 01/10 git-rebase.sh: Fix --merge --abort failures when path contains whitespaceBryan Donlan, Apr 10, 2008
  28. 02/10 config.c: Escape backslashes in section names properlyBryan Donlan, Apr 10, 2008
  29. 03/10 git-send-email.perl: Handle shell metacharacters in $EDITOR properlyBryan Donlan, Apr 10, 2008
  30. 04/10 test-lib.sh: Add a test_set_editor function to safely set $VISUALBryan Donlan, Apr 10, 2008
  31. 05/10 Use test_set_editor in t9001-send-email.shBryan Donlan, Apr 10, 2008
  32. 06/10 test-lib.sh: Fix some missing path quotingBryan Donlan, Apr 10, 2008
  33. 07/10 lib-git-svn.sh: Fix quoting issues with paths containing shell metacharactersBryan Donlan, Apr 10, 2008
  34. 08/10 Don't use the export NAME=value form in the test scripts.Bryan Donlan, Apr 10, 2008
  35. 09/10 Fix tests breaking when checkout path contains shell metacharactersBryan Donlan, Apr 10, 2008
  36. 10/10 Rename the test trash directory to contain shell metacharacters.Bryan Donlan, Apr 10, 2008
  37. Junio C HamanoApr 10, 2008
  38. Bryan DonlanApr 10, 2008
  39. Junio C HamanoApr 11, 2008
  40. 00/10 Fix git's test suite to pass when the path contains spacesBryan Donlan, May 4, 2008
  41. 01/10 git-rebase.sh: Fix --merge --abort failures when path contains whitespaceBryan Donlan, May 4, 2008
  42. 02/10 config.c: Escape backslashes in section names properlyBryan Donlan, May 4, 2008
  43. 03/10 git-send-email.perl: Handle shell metacharacters in $EDITOR properlyBryan Donlan, May 4, 2008
  44. 04/10 test-lib.sh: Add a test_set_editor function to safely set $VISUALBryan Donlan, May 4, 2008
  45. 05/10 Use test_set_editor in t9001-send-email.shBryan Donlan, May 4, 2008
  46. 06/10 test-lib.sh: Fix some missing path quotingBryan Donlan, May 4, 2008
  47. 07/10 lib-git-svn.sh: Fix quoting issues with paths containing shell metacharactersBryan Donlan, May 4, 2008
  48. 08/10 Don't use the export NAME=value form in the test scripts.Bryan Donlan, May 4, 2008
  49. 09/10 Fix tests breaking when checkout path contains shell metacharactersBryan Donlan, May 4, 2008
  50. 10/10 Rename the test trash directory to contain spaces.Bryan Donlan, May 4, 2008
  51. Johannes SixtMay 5, 2008
  52. Johannes SixtMay 5, 2008
  53. Bryan DonlanMay 5, 2008
  54. Johannes SixtMay 5, 2008
  55. Johannes SixtMay 5, 2008
  56. Bryan DonlanMay 5, 2008
  57. Johannes SixtMay 5, 2008
  58. Johannes SixtApr 10, 2008
  59. Bryan DonlanApr 10, 2008
  60. Junio C HamanoApr 10, 2008

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.