Message ID | 20191213004312.169753-6-emilyshaffer@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v4,01/15] bugreport: add tool to generate debugging info | expand |
Emily Shaffer <emilyshaffer@google.com> writes: > The contents of uname() can give us some insight into what sort of > system the user is running on, and help us replicate their setup if need > be. The domainname field is not guaranteed to be available, so don't > collect it. It was surprising to me that we do use "struct utsname" somewhere in the system ;-) ... so at least we know this is just as portable as the remainder of Git, which is good. > Signed-off-by: Emily Shaffer <emilyshaffer@google.com> > --- > bugreport.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/bugreport.c b/bugreport.c > index 59d8b5a3af..9c69e3fa34 100644 > --- a/bugreport.c > +++ b/bugreport.c > @@ -8,12 +8,25 @@ > static void get_system_info(struct strbuf *sys_info) > { > struct strbuf version_info = STRBUF_INIT; > + struct utsname uname_info; > > /* get git version from native cmd */ > strbuf_addstr(sys_info, "git version:\n"); > list_version_info(&version_info, 1); > strbuf_addbuf(sys_info, &version_info); > strbuf_complete_line(sys_info); > + > + /* system call for other version info */ > + strbuf_addstr(sys_info, "uname -a: "); > + if (uname(&uname_info)) > + strbuf_addf(sys_info, "uname() failed with code %d\n", errno); > + else > + strbuf_addf(sys_info, "%s %s %s %s %s\n", > + uname_info.sysname, > + uname_info.nodename, > + uname_info.release, > + uname_info.version, > + uname_info.machine); > } > > static const char * const bugreport_usage[] = {
At 16:43 -0800 12 Dec 2019, Emily Shaffer <emilyshaffer@google.com> wrote: >The contents of uname() can give us some insight into what sort of >system the user is running on, and help us replicate their setup if need >be. The domainname field is not guaranteed to be available, so don't >collect it. The manpage on Linux says that it's a GNU extension; on Mac OS it isn't mentioned. So it would be more accurate to say that it's known not to be available on many systems rather than just not being guaranteed. Besides that I think in some cases it may be considered sensitive information, so another reason to not include it. Perhaps even worthy of being mentioned as the primary reason. >+ uname_info.nodename, I think in some cases this could also be considered as sensitive information, and is unlikely to help in diagnosing problems. So I'd move to exclude this as well.
diff --git a/bugreport.c b/bugreport.c index 59d8b5a3af..9c69e3fa34 100644 --- a/bugreport.c +++ b/bugreport.c @@ -8,12 +8,25 @@ static void get_system_info(struct strbuf *sys_info) { struct strbuf version_info = STRBUF_INIT; + struct utsname uname_info; /* get git version from native cmd */ strbuf_addstr(sys_info, "git version:\n"); list_version_info(&version_info, 1); strbuf_addbuf(sys_info, &version_info); strbuf_complete_line(sys_info); + + /* system call for other version info */ + strbuf_addstr(sys_info, "uname -a: "); + if (uname(&uname_info)) + strbuf_addf(sys_info, "uname() failed with code %d\n", errno); + else + strbuf_addf(sys_info, "%s %s %s %s %s\n", + uname_info.sysname, + uname_info.nodename, + uname_info.release, + uname_info.version, + uname_info.machine); } static const char * const bugreport_usage[] = {
The contents of uname() can give us some insight into what sort of system the user is running on, and help us replicate their setup if need be. The domainname field is not guaranteed to be available, so don't collect it. Signed-off-by: Emily Shaffer <emilyshaffer@google.com> --- bugreport.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)