{"thread":{"id":"45951","subject":"[PATCH] usage.c: drop set_error_handle()","startedAt":"2017-05-13T03:48:27Z","lastAt":"2017-05-14T02:12:24Z","messageCount":3,"participants":["Jeff King","Ramsay Jones","Brandon Williams"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"319597","messageId":"20170513034818.h3aaihqmf4q43vef@sigill.intra.peff.net","threadId":"45951","inReplyTo":null,"subject":"[PATCH] usage.c: drop set_error_handle()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-05-13T03:48:18Z","receivedAt":"2017-05-13T03:48:27Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The set_error_handle() function was introduced by 3b331e926\n(vreportf: report to arbitrary filehandles, 2015-08-11) so\nthat run-command could send post-fork, pre-exec errors to\nthe parent's original stderr.\n\nThat use went away in 79319b194 (run-command: eliminate\ncalls to error handling functions in child, 2017-04-19),\nwhich pushes all of the error reporting to the parent.\nThis leaves no callers of set_error_handle(). As we're not\nlikely to add any new ones, let's drop it.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThis goes on top of bw/forking-and-threading.\n\n git-compat-util.h |  1 -\n usage.c           | 10 +---------\n 2 files changed, 1 insertion(+), 10 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 8a4a3f85e..f1f2a2d73 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -445,7 +445,6 @@ extern void (*get_error_routine(void))(const char *err, va_list params);\n extern void set_warn_routine(void (*routine)(const char *warn, va_list params));\n extern void (*get_warn_routine(void))(const char *warn, va_list params);\n extern void set_die_is_recursing_routine(int (*routine)(void));\n-extern void set_error_handle(FILE *);\n \n extern int starts_with(const char *str, const char *prefix);\n \ndiff --git a/usage.c b/usage.c\nindex ad6d2910f..2623c078e 100644\n--- a/usage.c\n+++ b/usage.c\n@@ -6,12 +6,9 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n \n-static FILE *error_handle;\n-\n void vreportf(const char *prefix, const char *err, va_list params)\n {\n \tchar msg[4096];\n-\tFILE *fh = error_handle ? error_handle : stderr;\n \tchar *p;\n \n \tvsnprintf(msg, sizeof(msg), err, params);\n@@ -19,7 +16,7 @@ void vreportf(const char *prefix, const char *err, va_list params)\n \t\tif (iscntrl(*p) && *p != '\\t' && *p != '\\n')\n \t\t\t*p = '?';\n \t}\n-\tfprintf(fh, \"%s%s\\n\", prefix, msg);\n+\tfprintf(stderr, \"%s%s\\n\", prefix, msg);\n }\n \n static NORETURN void usage_builtin(const char *err, va_list params)\n@@ -88,11 +85,6 @@ void set_die_is_recursing_routine(int (*routine)(void))\n \tdie_is_recursing = routine;\n }\n \n-void set_error_handle(FILE *fh)\n-{\n-\terror_handle = fh;\n-}\n-\n void NORETURN usagef(const char *err, ...)\n {\n \tva_list params;\n-- \n2.13.0.452.g0afc8e12b\n"},{"id":"319616","messageId":"ca13408b-0aaf-f330-5a6b-12aa8ff8e313@ramsayjones.plus.com","threadId":"45951","inReplyTo":"20170513034818.h3aaihqmf4q43vef@sigill.intra.peff.net","subject":"Re: [PATCH] usage.c: drop set_error_handle()","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2017-05-13T13:32:42Z","receivedAt":"2017-05-13T13:32:50Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 13/05/17 04:48, Jeff King wrote:\n> The set_error_handle() function was introduced by 3b331e926\n> (vreportf: report to arbitrary filehandles, 2015-08-11) so\n> that run-command could send post-fork, pre-exec errors to\n> the parent's original stderr.\n> \n> That use went away in 79319b194 (run-command: eliminate\n> calls to error handling functions in child, 2017-04-19),\n> which pushes all of the error reporting to the parent.\n> This leaves no callers of set_error_handle(). As we're not\n> likely to add any new ones, let's drop it.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n\nI have an identical patch, which I had intended to send at\nthe 'start of the next cycle'. :D (Well, you actually had\na commit message ...).\n\nSo, FWIW: ACK\n\nATB,\nRamsay Jones\n\n> ---\n> This goes on top of bw/forking-and-threading.\n> \n>  git-compat-util.h |  1 -\n>  usage.c           | 10 +---------\n>  2 files changed, 1 insertion(+), 10 deletions(-)\n> \n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index 8a4a3f85e..f1f2a2d73 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -445,7 +445,6 @@ extern void (*get_error_routine(void))(const char *err, va_list params);\n>  extern void set_warn_routine(void (*routine)(const char *warn, va_list params));\n>  extern void (*get_warn_routine(void))(const char *warn, va_list params);\n>  extern void set_die_is_recursing_routine(int (*routine)(void));\n> -extern void set_error_handle(FILE *);\n>  \n>  extern int starts_with(const char *str, const char *prefix);\n>  \n> diff --git a/usage.c b/usage.c\n> index ad6d2910f..2623c078e 100644\n> --- a/usage.c\n> +++ b/usage.c\n> @@ -6,12 +6,9 @@\n>  #include \"git-compat-util.h\"\n>  #include \"cache.h\"\n>  \n> -static FILE *error_handle;\n> -\n>  void vreportf(const char *prefix, const char *err, va_list params)\n>  {\n>  \tchar msg[4096];\n> -\tFILE *fh = error_handle ? error_handle : stderr;\n>  \tchar *p;\n>  \n>  \tvsnprintf(msg, sizeof(msg), err, params);\n> @@ -19,7 +16,7 @@ void vreportf(const char *prefix, const char *err, va_list params)\n>  \t\tif (iscntrl(*p) && *p != '\\t' && *p != '\\n')\n>  \t\t\t*p = '?';\n>  \t}\n> -\tfprintf(fh, \"%s%s\\n\", prefix, msg);\n> +\tfprintf(stderr, \"%s%s\\n\", prefix, msg);\n>  }\n>  \n>  static NORETURN void usage_builtin(const char *err, va_list params)\n> @@ -88,11 +85,6 @@ void set_die_is_recursing_routine(int (*routine)(void))\n>  \tdie_is_recursing = routine;\n>  }\n>  \n> -void set_error_handle(FILE *fh)\n> -{\n> -\terror_handle = fh;\n> -}\n> -\n>  void NORETURN usagef(const char *err, ...)\n>  {\n>  \tva_list params;\n> \n"},{"id":"319670","messageId":"20170514021215.GA82343@google.com","threadId":"45951","inReplyTo":"20170513034818.h3aaihqmf4q43vef@sigill.intra.peff.net","subject":"Re: [PATCH] usage.c: drop set_error_handle()","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-05-14T02:12:15Z","receivedAt":"2017-05-14T02:12:24Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 05/12, Jeff King wrote:\n> The set_error_handle() function was introduced by 3b331e926\n> (vreportf: report to arbitrary filehandles, 2015-08-11) so\n> that run-command could send post-fork, pre-exec errors to\n> the parent's original stderr.\n> \n> That use went away in 79319b194 (run-command: eliminate\n> calls to error handling functions in child, 2017-04-19),\n> which pushes all of the error reporting to the parent.\n> This leaves no callers of set_error_handle(). As we're not\n> likely to add any new ones, let's drop it.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n\nLooks good to me!\n\nThanks\n\n-- \nBrandon Williams\n"}]}