Message ID | 20200124033436.81097-9-emilyshaffer@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | add git-bugreport tool | expand |
On Fri, 24 Jan 2020 at 04:41, <emilyshaffer@google.com> wrote: > + char *shell = NULL; (Unnecessary initialization.) > + shell = getenv("SHELL"); > + strbuf_addf(sys_info, "$SHELL (typically, interactive shell): %s\n", > + shell ? shell : "(NULL)"); Thanks for avoiding a classic pitfall. :-) "<unused>" instead of "(NULL)"? "NULL" is mostly an implementation detail. Martin
On Thu, Jan 30, 2020 at 11:28:40PM +0100, Martin Ågren wrote: > On Fri, 24 Jan 2020 at 04:41, <emilyshaffer@google.com> wrote: > > + char *shell = NULL; > > (Unnecessary initialization.) > > > + shell = getenv("SHELL"); > > + strbuf_addf(sys_info, "$SHELL (typically, interactive shell): %s\n", > > + shell ? shell : "(NULL)"); > > Thanks for avoiding a classic pitfall. :-) Thank Junio. I fell right into it because it Just Works in gcc. ;) > "<unused>" instead of "(NULL)"? "NULL" is mostly an implementation > detail. Sure, why not.
Martin Ågren <martin.agren@gmail.com> writes: > On Fri, 24 Jan 2020 at 04:41, <emilyshaffer@google.com> wrote: >> + char *shell = NULL; > > (Unnecessary initialization.) > >> + shell = getenv("SHELL"); >> + strbuf_addf(sys_info, "$SHELL (typically, interactive shell): %s\n", >> + shell ? shell : "(NULL)"); > > Thanks for avoiding a classic pitfall. :-) > > "<unused>" instead of "(NULL)"? "NULL" is mostly an implementation > detail. Isn't that <unset>?
On Wed, 5 Feb 2020 at 21:06, Junio C Hamano <gitster@pobox.com> wrote: > > Martin Ågren <martin.agren@gmail.com> writes: > > > On Fri, 24 Jan 2020 at 04:41, <emilyshaffer@google.com> wrote: > >> + char *shell = NULL; > > > > (Unnecessary initialization.) > > > >> + shell = getenv("SHELL"); > >> + strbuf_addf(sys_info, "$SHELL (typically, interactive shell): %s\n", > >> + shell ? shell : "(NULL)"); > > > > Thanks for avoiding a classic pitfall. :-) > > > > "<unused>" instead of "(NULL)"? "NULL" is mostly an implementation > > detail. > > Isn't that <unset>? Heh, yes, "SHELL: unused" sounds wrong. :-) Martin
diff --git a/bugreport.c b/bugreport.c index 73f6d39517..07b84b9c94 100644 --- a/bugreport.c +++ b/bugreport.c @@ -22,6 +22,7 @@ static void get_system_info(struct strbuf *sys_info) { struct strbuf version_info = STRBUF_INIT; struct utsname uname_info; + char *shell = NULL; /* get git version from native cmd */ strbuf_addstr(sys_info, "git version:\n"); @@ -44,6 +45,10 @@ static void get_system_info(struct strbuf *sys_info) get_compiler_info(sys_info); strbuf_complete_line(sys_info); + shell = getenv("SHELL"); + strbuf_addf(sys_info, "$SHELL (typically, interactive shell): %s\n", + shell ? shell : "(NULL)"); + strbuf_addstr(sys_info, "git-remote-https --build-info:\n"); get_curl_version_info(sys_info); strbuf_complete_line(sys_info);