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

Re: [PATCH v2 01/10] test-chmtime: Fix exit code on Windows

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Nov 20, 2013, 14:00 UTC
Message-ID
<CABPQNSYP-LzX9Truv4UmQrmYpo5fWbk1aYKpKKVaGL8POanWiQ@mail.gmail.com>
In-Reply-To
<ba3c59d26cfb23a8c71c66ef1d49c4dca55fc556.1370636706.git.j6t@kdbg.org>
On Fri, Jun 7, 2013 at 10:53 PM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 54 quoted lines
> MinGW's bash does not recognize an exit code -1 as failure. See also
> 47e3de0e (MinGW: truncate exit()'s argument to lowest 8 bits) and 2488df84
> (builtin run_command: do not exit with -1). Exit code 1 is good enough.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
>  test-chmtime.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test-chmtime.c b/test-chmtime.c
> index 02b42ba..2e601a8 100644
> --- a/test-chmtime.c
> +++ b/test-chmtime.c
> @@ -84,7 +84,7 @@ int main(int argc, const char *argv[])
>                 if (stat(argv[i], &sb) < 0) {
>                         fprintf(stderr, "Failed to stat %s: %s\n",
>                                 argv[i], strerror(errno));
> -                       return -1;
> +                       return 1;
>                 }
>
>  #ifdef WIN32
> @@ -92,7 +92,7 @@ int main(int argc, const char *argv[])
>                                 chmod(argv[i], sb.st_mode | S_IWUSR)) {
>                         fprintf(stderr, "Could not make user-writable %s: %s",
>                                 argv[i], strerror(errno));
> -                       return -1;
> +                       return 1;
>                 }
>  #endif
>
> @@ -107,7 +107,7 @@ int main(int argc, const char *argv[])
>                 if (utb.modtime != sb.st_mtime && utime(argv[i], &utb) < 0) {
>                         fprintf(stderr, "Failed to modify time on %s: %s\n",
>                                 argv[i], strerror(errno));
> -                       return -1;
> +                       return 1;
>                 }
>         }
>
> @@ -115,5 +115,5 @@ int main(int argc, const char *argv[])
>
>  usage:
>         fprintf(stderr, "usage: %s %s\n", argv[0], usage_str);
> -       return -1;
> +       return 1;
>  }
> --
> 1.8.3.rc1.32.g8b61cbb
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hmmm. Perhaps we should do something like this?
diff --git a/compat/mingw.h b/compat/mingw.h
index 1f9ab5f..cbee8bd 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -462,7 +462,7 @@ static int mingw_main(c,v); \
 int main(c,v) \
 { \
  mingw_startup(); \
- return mingw_main(__argc, __argv); \
+ return mingw_main(__argc, __argv) & 0xff; \
 } \
 static int mingw_main(c,v)
Previous: Johannes SixtNext: Johannes Sixt
Message 26 of 35 in “Increase test coverage on Windows by removing SYMLINKS from many tests”
  1. 00/11 Increase test coverage on Windows by removing SYMLINKS from many testsJohannes Sixt, Jun 1, 2013
  2. 01/11 test-chmtime: Fix exit code on WindowsJohannes Sixt, Jun 1, 2013
  3. 02/11 t2100: modernize style and unroll a loop of test casesJohannes Sixt, Jun 1, 2013
  4. 03/11 t3010: modernize styleJohannes Sixt, Jun 1, 2013
  5. 04/11 tests: introduce test_ln_s and test_ln_s_addJohannes Sixt, Jun 1, 2013
  6. Ramkumar RamachandraJun 1, 2013
  7. Johannes SixtJun 1, 2013
  8. Ramkumar RamachandraJun 1, 2013
  9. 05/11 tests: use test_ln_s_add to remove SYMLINKS prerequisite (trivial cases)Johannes Sixt, Jun 1, 2013
  10. Junio C HamanoJun 4, 2013
  11. Johannes SixtJun 5, 2013
  12. Junio C HamanoJun 4, 2013
  13. Johannes SixtJun 5, 2013
  14. 06/11 t0000: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 1, 2013
  15. 07/11 t2100: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 1, 2013
  16. Junio C HamanoJun 4, 2013
  17. Johannes SixtJun 5, 2013
  18. 08/11 t3030: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 1, 2013
  19. 09/11 t3100: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 1, 2013
  20. 10/11 t3509, t4023, t4114: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 1, 2013
  21. Junio C HamanoJun 2, 2013
  22. 11/11 t6035: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 1, 2013
  23. 00/10 Increase test coverage on Windows by removing SYMLINKS from many testsJohannes Sixt, Jun 7, 2013
  24. Junio C HamanoJun 7, 2013
  25. 01/10 test-chmtime: Fix exit code on WindowsJohannes Sixt, Jun 7, 2013
  26. Erik Faye-LundNov 20, 2013
  27. 02/10 t3010: modernize styleJohannes Sixt, Jun 7, 2013
  28. 03/10 tests: introduce test_ln_s_addJohannes Sixt, Jun 7, 2013
  29. 04/10 tests: use test_ln_s_add to remove SYMLINKS prerequisite (trivial cases)Johannes Sixt, Jun 7, 2013
  30. 05/10 t0000: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 7, 2013
  31. 06/10 t3030: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 7, 2013
  32. 07/10 t3100: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 7, 2013
  33. 08/10 t3509, t4023, t4114: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 7, 2013
  34. 09/10 t6035: use test_ln_s_add to remove SYMLINKS prerequisiteJohannes Sixt, Jun 7, 2013
  35. 10/10 t4011: remove SYMLINKS prerequisiteJohannes Sixt, Jun 7, 2013

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.