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

Re: [PATCH] Fixing path quoting issues

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Oct 12, 2007, 06:43 UTC
Message-ID
<470F1791.9010601@viscovery.net>
In-Reply-To
<63D5CE5B-51DD-4017-B2E2-2ADC5DCBE849@steelskies.com>
Jonathan del Strother schrieb:
Show 16 quoted lines
> 
> On 11 Oct 2007, at 21:53, David Kastrup wrote:
> 
>> Johannes Sixt <j.sixt@viscovery.net> writes:
>>
>>> Jonathan del Strother schrieb:
>>>> How are you going to test that git works on paths with spaces if the
>>>> test suite doesn't run there?
>>>
>>> By writing a specific test?
>>
>> This is going to be much less thorough.  And it does no harm if the
>> test scripts demonstrate defensive programming.
> 
> I would also point out that most tests have already been written to 
> handle this case - ones that don't quote their paths are in the minority.

Actually, reconsidering your proposed patch, there are only a handful of problematic cases, namely those where the test script is quoted with double-quotes, like this:

  test_expect_success 'load repository with strange names' "
-	svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+	svnadmin load -q '$rawsvnrepo' < ../t9115/funky-names.dump &&
  	start_httpd
  	"

The problem is that here $rawsvnrepo will be expanded before the entire test script is passed as argument to test_expect_success. Consider the case where $rawsvnrepo contains a single-quote (say, a directory named "Joe's git"): then the 'eval' inside test_expect_success sees a syntax error. The proper change is:

  test_expect_success 'load repository with strange names' "
-	svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump &&
+	svnadmin load -q \"\$rawsvnrepo\" < ../t9115/funky-names.dump &&
  	start_httpd
  	"
So, what I think you should do is:
1. Submit the change to git-rebase.sh in a separate patch.
2. Fix the patch for the double-quoted test scriptlets.
That should remove all my concerns.
-- Hannes
Previous: David KastrupNext: Wincent Colaiuta
Message 11 of 38 in “Fixing path quoting issues”
  1. Fixing path quoting issuesJonathan del Strother, Oct 10, 2007
  2. Johannes SixtOct 11, 2007
  3. David KastrupOct 11, 2007
  4. Johannes SixtOct 11, 2007
  5. Jonathan del StrotherOct 11, 2007
  6. Johannes SixtOct 11, 2007
  7. David KastrupOct 11, 2007
  8. Jonathan del StrotherOct 11, 2007
  9. Johannes SchindelinOct 11, 2007
  10. David KastrupOct 11, 2007
  11. Johannes SixtOct 12, 2007
  12. Wincent ColaiutaOct 12, 2007
  13. Johannes SchindelinOct 12, 2007
  14. Wincent ColaiutaOct 12, 2007
  15. Johannes SchindelinOct 12, 2007
  16. David KastrupOct 12, 2007
  17. Jonathan del StrotherOct 13, 2007
  18. Andreas EricssonOct 13, 2007
  19. Jonathan del StrotherOct 15, 2007
  20. 1/3 Fixing path quoting in git-rebaseJonathan del Strother, Oct 15, 2007
  21. Johannes SixtOct 15, 2007
  22. Jonathan del StrotherOct 17, 2007
  23. Quoting paths, take 3Jonathan del Strother, Oct 17, 2007
  24. 1/2 Fixing path quoting in git-rebaseJonathan del Strother, Oct 17, 2007
  25. 2/2 Quoting paths in testsJonathan del Strother, Oct 17, 2007
  26. Johannes SixtOct 17, 2007
  27. Jonathan del StrotherOct 17, 2007
  28. David KastrupOct 17, 2007
  29. David KastrupOct 17, 2007
  30. Johannes SixtOct 18, 2007
  31. Jonathan del StrotherOct 24, 2007
  32. Johannes SixtOct 17, 2007
  33. 2/3 Quoting paths in testsJonathan del Strother, Oct 15, 2007
  34. Johannes SixtOct 15, 2007
  35. Jonathan del StrotherOct 15, 2007
  36. Johannes SixtOct 15, 2007
  37. David KastrupOct 15, 2007
  38. 3/3 Fix apostrophe quoting in testsJonathan del Strother, Oct 15, 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.