Re: [PATCH v4 08/15] bugreport: include user interactive shell
From: Junio C Hamano <hidden>
Date: 2019-12-13 21:38:47
Emily Shaffer [off-list ref] writes:
It's possible a user may complain about the way that Git interacts with their interactive shell, e.g. autocompletion or shell prompt. In that case, it's useful for us to know which shell they're using interactively. $SHELL isn't set by every shell, but getenv() returns NULL in the event the variable isn't found, so we'll see a line like "$SHELL: (null)" to tell us that variable wasn't set.
Do not depend on vsnprintf() from glibc that accepts NULL and shows "(null)". You can segfault on systems without glibc that way.
quoted hunk
Signed-off-by: Emily Shaffer <redacted> --- bugreport.c | 3 +++ 1 file changed, 3 insertions(+)diff --git a/bugreport.c b/bugreport.c index f5598513d9..759cc0b0f8 100644 --- a/bugreport.c +++ b/bugreport.c@@ -45,6 +45,9 @@ static void get_system_info(struct strbuf *sys_info) strbuf_addstr(sys_info, gnu_get_libc_version()); strbuf_complete_line(sys_info); + strbuf_addf(sys_info, "$SHELL (typically, interactive shell): %s\n", + getenv("SHELL")); + strbuf_addstr(sys_info, "git-http-fetch -V:\n"); get_http_version_info(sys_info); strbuf_complete_line(sys_info);