Re: [PATCH 1/4] t/helper: improve "genrandom" test helper
- From
Jeff King <peff@peff.net>
- Date
- Feb 23, 2026, 11:13 UTC
- Message-ID
- <20260223111346.GD215364@coredump.intra.peff.net>
- In-Reply-To
- <20260223-pks-fsck-fix-v1-1-c29036832b6e@pks.im>
On Mon, Feb 23, 2026 at 10:50:40AM +0100, Patrick Steinhardt wrote:
> Fix both of these issues by using `git_parse_ulong()` to parse the > argumemnt. This function has better error handling, and it knows to > handle unit suffixes.
Makes sense, but...
Show 8 quoted lines
> @@ -22,7 +23,9 @@ int cmd__genrandom(int argc, const char **argv)
> next = next * 11 + *c;
> } while (*c++);
>
> - count = (argc == 3) ? strtoul(argv[2], NULL, 0) : ULONG_MAX;
> + count = ULONG_MAX;
> + if (argc == 3 && git_parse_ulong(argv[2], &count) < 0)
> + return error_errno("cannot parse argument '%s'", argv[2]);...I think the return value of git_parse_ulong() is boolean 0/1, not 0/negative.
-Peff