diff mbox series

[v4,08/15] bugreport: include user interactive shell

Message ID 20191213004312.169753-9-emilyshaffer@google.com (mailing list archive)
State New, archived
Headers show
Series [v4,01/15] bugreport: add tool to generate debugging info | expand

Commit Message

Emily Shaffer Dec. 13, 2019, 12:43 a.m. UTC
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.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
 bugreport.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Junio C Hamano Dec. 13, 2019, 9:38 p.m. UTC | #1
Emily Shaffer <emilyshaffer@google.com> 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.

> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
> ---
>  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);
diff mbox series

Patch

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);