Max Kirillov <max@xxxxxxxxxx> writes: > Add tests for cases: > > * CONTENT_LENGTH is set, script's stdin has more data. > (Failure would make it read GIT_HTTP_MAX_REQUEST_BUFFER bytes from /dev/zero > and fail. It does not seem to cause any performance issues with the default > value of GIT_HTTP_MAX_REQUEST_BUFFER.) > * CONTENT_LENGTH is specified to a value which does not fix into ssize_t. s/fix/fit/ you meant? > diff --git a/t/helper/test-print-values.c b/t/helper/test-print-values.c > new file mode 100644 > index 0000000000..8f7e5af319 > --- /dev/null > +++ b/t/helper/test-print-values.c > @@ -0,0 +1,10 @@ > +#include <stdio.h> > +#include <string.h> > + > +int cmd_main(int argc, const char **argv) > +{ > + if (argc == 2 && strcmp(argv[1], "(size_t)(-20)") == 0) > + printf("%zu", (ssize_t)(-20)); > + > + return 0; > +} As far as I know, we avoid %zu (C99), as it may not be safe yet to do so on all platforms. e.g. c.f. https://public-inbox.org/git/64C7D52F-9030-460C-8F61-4076F5C1DDF6@xxxxxxxxx/ You may want to double check the 1/2 of this topic, too. Forcing a test command line to spell out "(size_t)(-20)" feels a bit atrocious, especially given that this program is capable of ever showing that string and nothing else, and it does not even diagnose typos as errors. I wonder if we would want to have "test-print-larger-than-ssize" and do something like #include "cache.h" int cmd_main(int ac, const char **av) { uintmax_t large = ((uintmax_t) SSIZE_MAX) + 1; printf("%" PRIuMAX "\n", large); return 0; } perhaps? Note that wrapper.c seems to assume that not everybody has SSIZE_MAX, so we might have to do something silly like size_t large = ~0; large = ~(large & ~(large >> 1)) + 1; printf("%" PRIuMAX "\n", (uintmax_t) large); just to be careful (even though we now assume 2's complement), though.