Git development
 help / color / mirror / Atom feed
* several unquoted shell variables causing test failures on Solaris
@ 2026-11-12 15:39 Jakub Kulik
  2026-11-12 20:56 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kulik @ 2026-11-12 15:39 UTC (permalink / raw)
  To: git@vger.kernel.org

Hi, when running tests on Solaris, I encountered several test failures in 't1017-cat-file-remote-object-info.sh' which look like this:

./test-lib.sh: line 1040: cd: /builds/components/git/build/amd64/t/trash directory.t1017-cat-file-remote-object-info/repo/parent/daemon_client_empty: No such file or directory
not ok 12 - requesting only objectname echoes back

The reason seems to be several unquoted variables (needed because of the space in path), and with the following change, the test is fixed again:

--- git-2.56.0/t/t1017-cat-file-remote-object-info.sh
+++ git-2.56.0/t/t1017-cat-file-remote-object-info.sh
@@ -69,7 +69,7 @@ daemon_parent=$GIT_DAEMON_DOCUMENT_ROOT_
 
 test_expect_success 'create repo to be served by git-daemon' '
      git init "$daemon_parent" &&
-     echo_without_newline "$hello_content" > $daemon_parent/hello &&
+     echo_without_newline "$hello_content" > "$daemon_parent/hello" &&
      git -C "$daemon_parent" update-index --add hello &&
      git -C "$daemon_parent" config transfer.advertiseobjectinfo true &&
      git clone "$GIT_DAEMON_URL/parent" -n "$daemon_parent/daemon_client_empty"
@@ -519,7 +519,7 @@ test_expect_success 'create repo to be s
      git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
      git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config http.receivepack true &&
      git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config transfer.advertiseobjectinfo true &&
-     echo_without_newline "$hello_content" > $HTTPD_DOCUMENT_ROOT_PATH/http_parent/hello &&
+     echo_without_newline "$hello_content" > "$HTTPD_DOCUMENT_ROOT_PATH/http_parent/hello" &&
      git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" update-index --add hello &&
      git clone "$HTTPD_URL/smart/http_parent" -n "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty"
 '

Best Regards,
Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: several unquoted shell variables causing test failures on Solaris
  2026-11-12 15:39 several unquoted shell variables causing test failures on Solaris Jakub Kulik
@ 2026-11-12 20:56 ` Junio C Hamano
  2026-11-18 15:59   ` [PATCH] t1017: add missing quotes Jakub Kulik
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2026-11-12 20:56 UTC (permalink / raw)
  To: Jakub Kulik; +Cc: git@vger.kernel.org

Jakub Kulik <jakub.kulik@oracle.com> writes:

> Hi, when running tests on Solaris, I encountered several test failures in 't1017-cat-file-remote-object-info.sh' which look like this:
>
> ./test-lib.sh: line 1040: cd: /builds/components/git/build/amd64/t/trash directory.t1017-cat-file-remote-object-info/repo/parent/daemon_client_empty: No such file or directory
> not ok 12 - requesting only objectname echoes back
>
> The reason seems to be several unquoted variables (needed because
> of the space in path), and with the following change, the test is
> fixed again:

Strictly speaking, POSIX compliant shells do not require such
quoting for pathnames that are used as redirection target.

But some shells are buggy, and our Documentation/CodingGuidelines do
require them to be quoted.  It also does require there is no space
between redirection operator '>' and the filename, so the correct
formulation would be:

> -     echo_without_newline "$hello_content" > $daemon_parent/hello &&
> +     echo_without_newline "$hello_content" > "$daemon_parent/hello" &&

	echo_without_newline "$hello_content" >"$daemon_parent/hello" &&

Care to submit an official fix with commit log message and sign off?

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] t1017: add missing quotes
  2026-11-12 20:56 ` Junio C Hamano
@ 2026-11-18 15:59   ` Jakub Kulik
  2026-11-18 17:08     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kulik @ 2026-11-18 15:59 UTC (permalink / raw)
  To: git; +Cc: gitster, Jakub Kulik

Signed-off-by: Jakub Kulik <jakub.kulik@oracle.com>
---
> Strictly speaking, POSIX compliant shells do not require such
> quoting for pathnames that are used as redirection target.

Indeed; when I run it with `bash --posix`, the test passes.

Here is the patch with space between > and the filename removed.

 t/t1017-cat-file-remote-object-info.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t1017-cat-file-remote-object-info.sh b/t/t1017-cat-file-remote-object-info.sh
index e2919aa061..8a04cfdae8 100755
--- a/t/t1017-cat-file-remote-object-info.sh
+++ b/t/t1017-cat-file-remote-object-info.sh
@@ -69,7 +69,7 @@ daemon_parent=$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent
 
 test_expect_success 'create repo to be served by git-daemon' '
 	git init "$daemon_parent" &&
-	echo_without_newline "$hello_content" > $daemon_parent/hello &&
+	echo_without_newline "$hello_content" >"$daemon_parent/hello" &&
 	git -C "$daemon_parent" update-index --add hello &&
 	git -C "$daemon_parent" config transfer.advertiseobjectinfo true &&
 	git clone "$GIT_DAEMON_URL/parent" -n "$daemon_parent/daemon_client_empty"
@@ -519,7 +519,7 @@ test_expect_success 'create repo to be served by http:// transport' '
 	git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
 	git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config http.receivepack true &&
 	git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config transfer.advertiseobjectinfo true &&
-	echo_without_newline "$hello_content" > $HTTPD_DOCUMENT_ROOT_PATH/http_parent/hello &&
+	echo_without_newline "$hello_content" >"$HTTPD_DOCUMENT_ROOT_PATH/http_parent/hello" &&
 	git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" update-index --add hello &&
 	git clone "$HTTPD_URL/smart/http_parent" -n "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty"
 '
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] t1017: add missing quotes
  2026-11-18 15:59   ` [PATCH] t1017: add missing quotes Jakub Kulik
@ 2026-11-18 17:08     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2026-11-18 17:08 UTC (permalink / raw)
  To: Jakub Kulik; +Cc: git

Jakub Kulik <jakub.kulik@oracle.com> writes:

> Signed-off-by: Jakub Kulik <jakub.kulik@oracle.com>
> ---
>> Strictly speaking, POSIX compliant shells do not require such
>> quoting for pathnames that are used as redirection target.
>
> Indeed; when I run it with `bash --posix`, the test passes.
>
> Here is the patch with space between > and the filename removed.

Thanks.

I would fabricate a log message to say something about our
CodingGuidelines ask you to quote variable references used for
redirection targets or sources while queuing.

>
>  t/t1017-cat-file-remote-object-info.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t1017-cat-file-remote-object-info.sh b/t/t1017-cat-file-remote-object-info.sh
> index e2919aa061..8a04cfdae8 100755
> --- a/t/t1017-cat-file-remote-object-info.sh
> +++ b/t/t1017-cat-file-remote-object-info.sh
> @@ -69,7 +69,7 @@ daemon_parent=$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent
>  
>  test_expect_success 'create repo to be served by git-daemon' '
>  	git init "$daemon_parent" &&
> -	echo_without_newline "$hello_content" > $daemon_parent/hello &&
> +	echo_without_newline "$hello_content" >"$daemon_parent/hello" &&
>  	git -C "$daemon_parent" update-index --add hello &&
>  	git -C "$daemon_parent" config transfer.advertiseobjectinfo true &&
>  	git clone "$GIT_DAEMON_URL/parent" -n "$daemon_parent/daemon_client_empty"
> @@ -519,7 +519,7 @@ test_expect_success 'create repo to be served by http:// transport' '
>  	git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
>  	git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config http.receivepack true &&
>  	git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config transfer.advertiseobjectinfo true &&
> -	echo_without_newline "$hello_content" > $HTTPD_DOCUMENT_ROOT_PATH/http_parent/hello &&
> +	echo_without_newline "$hello_content" >"$HTTPD_DOCUMENT_ROOT_PATH/http_parent/hello" &&
>  	git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" update-index --add hello &&
>  	git clone "$HTTPD_URL/smart/http_parent" -n "$HTTPD_DOCUMENT_ROOT_PATH/http_client_empty"
>  '

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-18 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 15:39 several unquoted shell variables causing test failures on Solaris Jakub Kulik
2026-11-12 20:56 ` Junio C Hamano
2026-11-18 15:59   ` [PATCH] t1017: add missing quotes Jakub Kulik
2026-11-18 17:08     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox