All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Jonathan del Strother <maillist@steelskies.com>
Cc: git@vger.kernel.org,
	Jonathan del Strother <jon.delStrother@bestbefore.tv>
Subject: Re: [PATCH 2/2] Quoting paths in tests
Date: Wed, 17 Oct 2007 13:32:54 +0200	[thread overview]
Message-ID: <4715F2E6.1000708@viscovery.net> (raw)
In-Reply-To: <11926134961275-git-send-email-maillist@steelskies.com>

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.

>  " >&3 2>&4


> -	svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
> +	svn import -m 'import for git-svn' . \"$svnrepo\" >/dev/null &&

This must be

	svn import -m 'import for git-svn' . \"\$svnrepo\" >/dev/null &&

to be safe. Your version would break with names with double-quotes, because 
$svnrepo would be expanded and then eval'd inside test_expect_*. This error 
recurs numerous times until the end of the patch.

May I recommend that you run the test suite in a directory named like this:

	$ mkdir \"\ \$GIT_DIR\ \'
	$ ls
	" $GIT_DIR '

> -		( mkdir -p $GIT_DIR/svn/\$ref/info/ &&
> -		echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1;
> +		( mkdir -p \"$GIT_DIR\"/svn/\$ref/info/ &&
> +		echo \"$svnrepo\"\$path > \"$GIT_DIR\"/svn/\$ref/info/url ) || exit 1;

I assume $path is under control of the test script, otherwise it must be 
inside the double-quotes, too.

>  test_expect_success  ".rev_db auto-converted to .rev_db.UUID" "
>  	git-svn fetch -i trunk &&
> -	expect=$GIT_DIR/svn/trunk/.rev_db.* &&
> +	expect=\"\`find \"\$GIT_DIR\"/svn/trunk/ -name '.rev_db.*'\`\" &&

Why is this trickery with find needed? Isn't it easier to put the whole test 
case in single-quotes instead?

-- Hannes

  reply	other threads:[~2007-10-17 11:33 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10 21:13 [PATCH] Fixing path quoting issues Jonathan del Strother
2007-10-11  6:19 ` Johannes Sixt
2007-10-11  6:47   ` David Kastrup
2007-10-11  7:10     ` Johannes Sixt
2007-10-11  7:30       ` Jonathan del Strother
2007-10-11  7:41         ` Johannes Sixt
2007-10-11 20:53           ` David Kastrup
2007-10-11 21:22             ` Jonathan del Strother
2007-10-11 21:31               ` Johannes Schindelin
2007-10-11 21:40                 ` David Kastrup
2007-10-12  6:43               ` Johannes Sixt
2007-10-12 11:17             ` Wincent Colaiuta
2007-10-12 11:37               ` Johannes Schindelin
2007-10-12 12:20                 ` Wincent Colaiuta
2007-10-12 12:51                   ` Johannes Schindelin
2007-10-12 13:14                     ` David Kastrup
2007-10-13 18:12   ` Jonathan del Strother
2007-10-13 22:36     ` Andreas Ericsson
2007-10-15 13:13       ` Jonathan del Strother
2007-10-15 13:13       ` [PATCH 1/3] Fixing path quoting in git-rebase Jonathan del Strother
2007-10-15 13:39         ` Johannes Sixt
2007-10-17  9:14           ` Jonathan del Strother
2007-10-17  9:31             ` [PATCH] Quoting paths, take 3 Jonathan del Strother
2007-10-17  9:31               ` [PATCH 1/2] Fixing path quoting in git-rebase Jonathan del Strother
2007-10-17  9:31                 ` [PATCH 2/2] Quoting paths in tests Jonathan del Strother
2007-10-17 11:32                   ` Johannes Sixt [this message]
2007-10-17 17:07                     ` Jonathan del Strother
2007-10-17 17:15                       ` David Kastrup
2007-10-17 20:03                         ` David Kastrup
2007-10-18  6:08                       ` Johannes Sixt
2007-10-24 13:07                         ` Jonathan del Strother
2007-10-17 10:41                 ` [PATCH 1/2] Fixing path quoting in git-rebase Johannes Sixt
2007-10-15 13:13       ` [PATCH 2/3] Quoting paths in tests Jonathan del Strother
2007-10-15 13:47         ` Johannes Sixt
2007-10-15 14:00           ` Jonathan del Strother
2007-10-15 14:17             ` Johannes Sixt
2007-10-15 14:03           ` David Kastrup
2007-10-15 13:13       ` [PATCH 3/3] Fix apostrophe quoting " Jonathan del Strother

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4715F2E6.1000708@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=jon.delStrother@bestbefore.tv \
    --cc=maillist@steelskies.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.