diff options
author | Johannes Sixt <j6t@kdbg.org> | 2010-01-10 14:07:52 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-10 10:05:34 -0800 |
commit | a5487ddf0f8a8190b0722cf46dbe4cdd6ca9fa51 (patch) | |
tree | f040ea63783875b502bc78d998df511593a9f92e /templates | |
parent | Reset possible helper before reusing remote structure (diff) | |
download | tgif-a5487ddf0f8a8190b0722cf46dbe4cdd6ca9fa51.tar.xz |
start_command: report child process setup errors to the parent's stderr
When the child process's environment is set up in start_command(), error
messages were written to wherever the parent redirected the child's stderr
channel. However, even if the parent redirected the child's stderr, errors
during this setup process, including the exec itself, are usually an
indication of a problem in the parent's environment. Therefore, the error
messages should go to the parent's stderr.
Redirection of the child's error messages is usually only used to redirect
hook error messages during client-server exchanges. In these cases, hook
setup errors could be regarded as information leak.
This patch makes a copy of stderr if necessary and uses a special
die routine that is used for all die() calls in the child that sends the
errors messages to the parent's stderr.
The trace call that reported a failed execvp is removed (because it writes
to stderr) and replaced by die_errno() with special treatment of ENOENT.
The improvement in the error message can be seen with this sequence:
mkdir .git/hooks/pre-commit
git commit
Previously, the error message was
error: cannot run .git/hooks/pre-commit: No such file or directory
and now it is
fatal: cannot exec '.git/hooks/pre-commit': Permission denied
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'templates')
0 files changed, 0 insertions, 0 deletions