diff options
author | Jeff King <peff@peff.net> | 2012-05-21 19:10:20 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-05-22 09:08:20 -0700 |
commit | 2f70587502b6b5a8cfda5a3eff54392f48e2db8d (patch) | |
tree | 444e6b44d4b083958ba642b9217dacecb32ef382 /Documentation | |
parent | 8587ead78ad3d2af760270b21035ffe48fde3e7b (diff) | |
download | git-2f70587502b6b5a8cfda5a3eff54392f48e2db8d.tar.gz git-2f70587502b6b5a8cfda5a3eff54392f48e2db8d.tar.xz |
ident: report passwd errors with a more friendly message
When getpwuid fails, we give a cute but cryptic message.
While it makes sense if you know that getpwuid or identity
functions are being called, this code is triggered behind
the scenes by quite a few git commands these days (e.g.,
receive-pack on a remote server might use it for a reflog;
the current message is hard to distinguish from an
authentication error). Let's switch to something that gives
a little more context.
While we're at it, we can factor out all of the
cut-and-pastes of the "you don't exist" message into a
wrapper function. Rather than provide xgetpwuid, let's make
it even more specific to just getting the passwd entry for
the current uid. That's the only way we use getpwuid anyway,
and it lets us make an even more specific error message.
The current message also fails to mention errno. While the
usual cause for getpwuid failing is that the user does not
exist, mentioning errno makes it easier to diagnose these
problems. Note that POSIX specifies that errno remain
untouched if the passwd entry does not exist (but will be
set on actual errors), whereas some systems will return
ENOENT or similar for a missing entry. We handle both cases
in our wrapper.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-commit-tree.txt | 5 | ||||
-rw-r--r-- | Documentation/git-var.txt | 5 |
2 files changed, 0 insertions, 10 deletions
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt index eb12b2dd9..eb8ee9999 100644 --- a/Documentation/git-commit-tree.txt +++ b/Documentation/git-commit-tree.txt @@ -88,11 +88,6 @@ for one to be entered and terminated with ^D. include::date-formats.txt[] -Diagnostics ------------ -You don't exist. Go away!:: - The passwd(5) gecos field couldn't be read - Discussion ---------- diff --git a/Documentation/git-var.txt b/Documentation/git-var.txt index 3f703e377..67edf5868 100644 --- a/Documentation/git-var.txt +++ b/Documentation/git-var.txt @@ -59,11 +59,6 @@ ifdef::git-default-pager[] The build you are using chose '{git-default-pager}' as the default. endif::git-default-pager[] -Diagnostics ------------ -You don't exist. Go away!:: - The passwd(5) gecos field couldn't be read - SEE ALSO -------- linkgit:git-commit-tree[1] |