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

Re: [PATCH] annotate-tests: quote variable expansions containing path names

From
Philippe Blain <levraiphilippeblain@gmail.com>
Date
Jan 30, 2021, 17:14 UTC
Message-ID
<762b6a24-15ef-7578-6064-eb82832699a4@gmail.com>
In-Reply-To
<cec4f442-03ea-e846-2613-f390b1e4d31b@kdbg.org>
Hi Johannes,
Le 2021-01-30 à 11:22, Johannes Sixt a écrit :
> The test case added by 9466e3809d ("blame: enable funcname blaming with
> userdiff driver", 2020-11-01) forgot to quote variable expansions. This
> causes failures when the current directory contains blanks.
Woops, sorry for that.
> 
> On variable 
s/On/One/
Show 31 quoted lines
> that the test case introduces will not have IFS characters
> and could remain without quotes, but let's quote all expansions for
> consistency, not just the one that has the path name.
> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
>   t/annotate-tests.sh | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
> index ee5d2d4cf8..29ce89090d 100644
> --- a/t/annotate-tests.sh
> +++ b/t/annotate-tests.sh
> @@ -483,12 +483,12 @@ test_expect_success 'setup -L :funcname with userdiff driver' '
>   	echo "fortran-* diff=fortran" >.gitattributes &&
>   	fortran_file=fortran-external-function &&
>   	orig_file="$TEST_DIRECTORY/t4018/$fortran_file" &&
> -	cp $orig_file . &&
> -	git add $fortran_file &&
> +	cp "$orig_file" . &&
> +	git add "$fortran_file" &&
>   	GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="A@test.git" \
>   	git commit -m "add fortran file" &&
> -	sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >$fortran_file &&
> -	git add $fortran_file &&
> +	sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >"$fortran_file" &&
> +	git add "$fortran_file" &&
>   	GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="B@test.git" \
>   	git commit -m "change fortran file"
>   '
> 
The patch obviously looks good:
Acked-by: Philippe Blain <levraiphilippeblain@gmail.com>

Apart from that, maybe we could set up one of the CI jobs to clone git.git into a path with spaces, to try to avoid these kind of errors in the future ?

Thanks,
Philippe.
Previous: Johannes SixtNext: Jeff King
Message 2 of 4 in “annotate-tests: quote variable expansions containing path names”
  1. annotate-tests: quote variable expansions containing path namesJohannes Sixt, Jan 30, 2021
  2. Philippe BlainJan 30, 2021
  3. Jeff KingFeb 3, 2021
  4. Johannes SixtFeb 3, 2021

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.