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

RE: [ANNOUNCE] Git v2.23.0-rc0 - Initial test failures on NonStop

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Jul 30, 2019, 18:10 UTC
Message-ID
<04a401d54702$05624290$1026c7b0$@nexbridge.com>
In-Reply-To
<xmqq7e7zton5.fsf@gitster-ct.c.googlers.com>
On July 30, 2019 1:32 PM, Junio C Hamano wrote:
Show 7 quoted lines
> "Randall S. Becker" <rsbecker@nexbridge.com> writes:
> 
> > t0066: dir-iterator
> >
> > Subtest 4 depends on a non-portable error code. ENOENT is not
> guaranteed ...
> > Subtest 5 also depends on a non-portable error code. ENOTDIR is not
gua...
> 
> Yikes, and sorry.  I've become somewhat complacent after relying on how
> good our other reviewers are, pretty much ignored the new code in fringes
> like t/helper/, and failed catch an obvious amateurish mistake like this
one.
> 
> I do not think of a portable way to map an int ENOENT to a string
"ENOENT",
> but there are only only two errors test-dir-iterator test code cares
about, so
> perhaps a patch like the following may be sufficient.
> 
> I wonder if a tool like sparse can help us catch a pattern that feeds
errno to
Show 7 quoted lines
> "%d" format.
> 
>  t/helper/test-dir-iterator.c | 11 ++++++++++-
>  t/t0066-dir-iterator.sh      |  4 ++--
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/t/helper/test-dir-iterator.c b/t/helper/test-dir-iterator.c
index
Show 18 quoted lines
> a5b96cb0dc..c7c30664da 100644
> --- a/t/helper/test-dir-iterator.c
> +++ b/t/helper/test-dir-iterator.c
> @@ -4,6 +4,15 @@
>  #include "iterator.h"
>  #include "dir-iterator.h"
> 
> +static const char *error_name(int error_number) {
> +	switch (error_number) {
> +	case ENOENT: return "ENOENT";
> +	case ENOTDIR: return "ENOTDIR";
> +	default: return "ESOMETHINGELSE";
> +	}
> +}
> +
>  /*
>   * usage:
>   * tool-test dir-iterator [--follow-symlinks] [--pedantic] directory_path
@@ -
Show 6 quoted lines
> 31,7 +40,7 @@ int cmd__dir_iterator(int argc, const char **argv)
>  	diter = dir_iterator_begin(path.buf, flags);
> 
>  	if (!diter) {
> -		printf("dir_iterator_begin failure: %d\n", errno);
> +		printf("dir_iterator_begin failure: %s\n",
error_name(errno));
Show 27 quoted lines
>  		exit(EXIT_FAILURE);
>  	}
> 
> diff --git a/t/t0066-dir-iterator.sh b/t/t0066-dir-iterator.sh index
> 9354d3f1ed..92910e4e6c 100755
> --- a/t/t0066-dir-iterator.sh
> +++ b/t/t0066-dir-iterator.sh
> @@ -55,13 +55,13 @@ test_expect_success 'dir-iterator should list files in
> the correct order' '
>  test_expect_success 'begin should fail upon inexistent paths' '
>  	test_must_fail test-tool dir-iterator ./inexistent-path \
>  		>actual-inexistent-path-output &&
> -	echo "dir_iterator_begin failure: 2" >expected-inexistent-path-
> output &&
> +	echo "dir_iterator_begin failure: ENOENT"
> +>expected-inexistent-path-output &&
>  	test_cmp expected-inexistent-path-output actual-inexistent-path-
> output  '
> 
>  test_expect_success 'begin should fail upon non directory paths' '
>  	test_must_fail test-tool dir-iterator ./dir/b >actual-non-dir-output
> &&
> -	echo "dir_iterator_begin failure: 20" >expected-non-dir-output &&
> +	echo "dir_iterator_begin failure: ENOTDIR" >expected-non-dir-
> output &&
>  	test_cmp expected-non-dir-output actual-non-dir-output  '
> 

Seems reasonable. Better than trying to use strerror(), which previously (I'm not sure whether it was this project or another) had a similar mapping issue because the error text does not match either.

Previous: Matheus Tavares BernardinoNext: Junio C Hamano
Message 4 of 24 in “RE: [ANNOUNCE] Git v2.23.0-rc0 - Initial test failures on NonStop”
  1. Randall S. BeckerJul 30, 2019
  2. Junio C HamanoJul 30, 2019
  3. Matheus Tavares BernardinoJul 30, 2019
  4. Randall S. BeckerJul 30, 2019
  5. Junio C HamanoJul 30, 2019
  6. Jeff KingJul 30, 2019
  7. Randall S. BeckerJul 30, 2019
  8. Todd ZullingerJul 30, 2019
  9. Jeff KingJul 30, 2019
  10. Junio C HamanoJul 30, 2019
  11. SZEDER GáborJul 30, 2019
  12. Jeff KingJul 31, 2019
  13. Jeff KingJul 31, 2019
  14. Jeff KingJul 31, 2019
  15. Todd ZullingerJul 31, 2019
  16. Jeff KingJul 31, 2019
  17. Jeff KingJul 31, 2019
  18. Junio C HamanoJul 31, 2019
  19. non-cryptographic hash algorithms in gitJeff King, Jul 31, 2019
  20. René ScharfeJul 31, 2019
  21. Jeff KingJul 31, 2019
  22. Todd ZullingerJul 31, 2019
  23. Junio C HamanoJul 31, 2019
  24. Randall S. BeckerJul 30, 2019

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.