{"thread":{"id":"19985","subject":"run_hook: why special check for uncaught signal?","startedAt":"2009-06-30T20:31:45Z","lastAt":"2009-07-01T09:57:51Z","messageCount":2,"participants":["Johannes Sixt","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"117259","messageId":"200906302231.45157.j6t@kdbg.org","threadId":"19985","inReplyTo":null,"subject":"run_hook: why special check for uncaught signal?","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-06-30T20:31:45Z","receivedAt":"2009-06-30T20:31:45Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Function run_hook (in run-command.c) has this check:\n\n\tret = finish_command(&hook);\n\tif (ret == -ERR_RUN_COMMAND_WAITPID_SIGNAL)\n\t\twarning(\"%s exited due to uncaught signal\", argv[0]);\n\treturn ret;\n\nThe lines were moved to this location by ae98a008 (Move run_hook() from \nbuiltin-commit.c into run-command.c (libgit), 2009-01-16). Before this \ncommit, the check existed in builtin-gc.c. It was introduced by bde30540 \n(git-gc --auto: add pre-auto-gc hook, 2008-04-09).\n\nWhy is this check necessary?\n\nI'm asking because I'm working on a modification that would remove \nERR_RUN_COMMAND_WAITPID_SIGNAL.\n\n-- Hannes\n"},{"id":"117298","messageId":"20090701095751.GE10895@genesis.frugalware.org","threadId":"19985","inReplyTo":"200906302231.45157.j6t@kdbg.org","subject":"Re: run_hook: why special check for uncaught signal?","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-07-01T09:57:51Z","receivedAt":"2009-07-01T09:57:51Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Tue, Jun 30, 2009 at 10:31:45PM +0200, Johannes Sixt <j6t@kdbg.org> wrote:\n> Function run_hook (in run-command.c) has this check:\n> \n> \tret = finish_command(&hook);\n> \tif (ret == -ERR_RUN_COMMAND_WAITPID_SIGNAL)\n> \t\twarning(\"%s exited due to uncaught signal\", argv[0]);\n> \treturn ret;\n> \n> The lines were moved to this location by ae98a008 (Move run_hook() from \n> builtin-commit.c into run-command.c (libgit), 2009-01-16). Before this \n> commit, the check existed in builtin-gc.c. It was introduced by bde30540 \n> (git-gc --auto: add pre-auto-gc hook, 2008-04-09).\n> \n> Why is this check necessary?\n\nI do not really remember, but I think I wanted to give some error\nmessages for each return code, and somehow left out\nERR_RUN_COMMAND_WAITPID, ERR_RUN_COMMAND_WAITPID_WRONG_PID and\nERR_RUN_COMMAND_WAITPID_NOEXIT.\n\n> I'm asking because I'm working on a modification that would remove \n> ERR_RUN_COMMAND_WAITPID_SIGNAL.\n\nThat's fine, I think ideally run_hook() should call warning() for each\ncase which may be returned. Such functionality is already available in\nbuiltin-receive-pack.c::hook_status() and unpack(), probably it would\nmake sense to introduce some run_command_strerror() to avoid code\nduplication.\n\nSadly I don't have time to implement this in the near future.\n"}]}