From: Jonathan del Strother Date: Wed, 17 Oct 2007 17:07:38 GMT Subject: Re: [PATCH 2/2] Quoting paths in tests Message-ID: <6E65762D-FBC4-4A7C-97A9-20F6744E25DE@steelskies.com> In-Reply-To: <4715F2E6.1000708@viscovery.net> On 17 Oct 2007, at 12:32, Johannes Sixt wrote: > Jonathan del Strother schrieb: >> --- a/t/lib-git-svn.sh >> +++ b/t/lib-git-svn.sh >> @@ -25,7 +25,7 @@ perl -w -e " >> use SVN::Core; >> use SVN::Repos; >> \$SVN::Core::VERSION gt '1.1.0' or exit(42); >> -system(qw/svnadmin create --fs-type fsfs/, '$svnrepo') == 0 or >> exit(41); >> +system(qw/svnadmin create --fs-type fsfs/, \"$svnrepo\") == 0 or >> exit(41); > > Here you have to work harder: The reason is that this is part of a > perl expression (as opposed to an eval'd string), which does not > have access to $svnrepo of the shell by which it is invoked. The > original version failed if there were single-quotes in $svnrepo, the > new version fails if it contains double-quotes. ... > > May I recommend that you run the test suite in a directory named > like this: > > $ mkdir \"\ \$GIT_DIR\ \' > $ ls > " $GIT_DIR ' Eww. I'm struggling a bit with paths this perverse, actually. For instance, git_editor in git-sh-setup expects the editor path to be pre-quoted. So in t3404, you need to produce escaped double quotes & dollar signs, resulting in unpleasantness like this : VISUAL="`pwd`/fake-editor.sh" VISUAL=${VISUAL//\"/\\\"} VISUAL=${VISUAL//$/\\\$} VISUAL=\"$VISUAL\" export VISUAL And I'm struggling to come up with neat ways of rewriting things like, eg, this bit from t5500 - test_expect_success "clone shallow" "git-clone --depth 2 \"file:// `pwd`/.\" shallow" - to handle paths like that properly. Suggestions? Jon