bugreport: add tool to generate debugging info
Subsystems (2)
PATCH v9 5/5 bugreport: add compiler info
In reply to Emily ShafferTo help pinpoint the source of a regression, it is useful to know some info about the compiler which the user's Git client was built with. By adding a generic get_compiler_info() in 'compat/' we can choose which relevant information to share per compiler; to get started, let's demonstrate the version of glibc if the user built with 'gcc'.
--- Documentation/git-bugreport.txt | 1 + bugreport.c | 6 ++++++ compat/compiler.h | 38 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 compat/compiler.h
Documentation/git-bugreport.txt +1 -0
@@ -27,6 +27,7 @@ The following information is captured automatically: - 'git version --build-options' - uname sysname, release, version, and machine strings + - Compiler-specific info string This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file
bugreport.c +6 -0
@@ -4,6 +4,7 @@#include "strbuf.h" #include "time.h" #include "help.h" +#include "compat/compiler.h" static void get_system_info (struct strbuf *sys_info) {
@@ -25,6 +26,11 @@ static void get_system_info(struct strbuf *sys_info) uname_info.release, uname_info.version, uname_info.machine); + +strbuf_addstr (sys_info,_ ("compiler info: " )); +get_compiler_info (sys_info); +strbuf_addstr (sys_info,_ ("libc info: " )); +get_libc_info (sys_info); }static const char *const bugreport_usage[] = {
compat/compiler.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef COMPILER_H +#define COMPILER_H + +#include "git-compat-util.h" +#include "strbuf.h" + +#ifdef __GLIBC__ +#include <gnu/libc-version.h> +#endif + +static inline void get_compiler_info (struct strbuf *info) +{ +int len = info->len; +#ifdef __GNUC__ +strbuf_addf (info,"gnuc: %d.%d\n" , __GNUC__, __GNUC_MINOR__); +#endif + +#ifdef _MSC_VER +strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER); +#endif + +if (len == info->len) +strbuf_addf (info,_ ("no compiler information available\n" )); +} + +static inline void get_libc_info (struct strbuf *info) +{ +int len = info->len; + +#ifdef __GLIBC__ +strbuf_addf (info,"glibc: %s\n" ,gnu_get_libc_version ()); +#endif + +if (len == info->len) +strbuf_addf (info,_ ("no libc information available\n" )); +} + +#endif /* COMPILER_H */
Signature · 1 line
2.25.0.265.gbab2e86ba0-goog
Re: [PATCH v9 5/5] bugreport: add compiler info
Quoted 62 lines · Emily Shaffer
To help pinpoint the source of a regression, it is useful to know some info about the compiler which the user's Git client was built with. By adding a generic
get_compiler_info()in 'compat/' we can choose which relevant information to share per compiler; to get started, let's demonstrate the version of glibc if the user built with 'gcc'.Signed-off-by Emily Shaffer <[email protected]>--- Documentation/git-bugreport.txt | 1 + bugreport.c | 6 ++++++ compat/compiler.h | 38 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 compat/compiler.hDocumentation/git-bugreport.txt +1
-0@@ -27,6 +27,7 @@ The following information is captured automatically: - 'git version --build-options' - uname sysname, release, version, and machine strings + - Compiler-specific info string This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config filebugreport.c +6
-0@@ -4,6 +4,7 @@#include "strbuf.h" #include "time.h" #include "help.h" +#include "compat/compiler.h" static void get_system_info (struct strbuf *sys_info) {@@ -25,6 +26,11 @@ static void get_system_info(struct strbuf *sys_info) uname_info.release, uname_info.version, uname_info.machine); + +strbuf_addstr (sys_info,_ ("compiler info: " )); +get_compiler_info (sys_info); +strbuf_addstr (sys_info,_ ("libc info: " )); +get_libc_info (sys_info); }static const char *const bugreport_usage[] = {compat/compiler.h new file +6
-0@@ -0,0 +1,38 @@ +#ifndef COMPILER_H +#define COMPILER_H + +#include "git-compat-util.h" +#include "strbuf.h" +
compat/compiler.h line 16
Quoted 10 lines
compat/compiler.h new file +10
-0+#ifdef __GLIBC__ +#include <gnu/libc-version.h> +#endif + +static inline void get_compiler_info (struct strbuf *info) +{ +int len = info->len; +#ifdef __GNUC__ +strbuf_addf (info,"gnuc: %d.%d\n" , __GNUC__, __GNUC_MINOR__); +#endif
This fixup can be used for clang on Linux, I guess it could be applied for macOS too (since default gcc on macOS is symlinked to clang?)
--------------8<----------------------
compat/compiler.h +3 -1
@@ -11,7 +11,9 @@static inline void get_compiler_info (struct strbuf *info) {int len = info->len; -#ifdef __GNUC__ +#ifdef __clang__ +strbuf_addf (info,"clang: %s\n" , __clang_version__); +#elif defined(__GNUC__)strbuf_addf (info,"gnuc: %d.%d\n" , __GNUC__, __GNUC_MINOR__);#endif
-------------------->8---------------------
Quoted 25 lines
compat/compiler.h new file +22
-0+ +#ifdef _MSC_VER +strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER); +#endif + +if (len == info->len) + strbuf_addf(info, _("no compiler information available\n")); +} + +static inline void get_libc_info (struct strbuf *info) +{ +int len = info->len; + +#ifdef __GLIBC__ +strbuf_addf (info,"glibc: %s\n" ,gnu_get_libc_version ()); +#endif + +if (len == info->len) +strbuf_addf (info,_ ("no libc information available\n" )); +} + +#endif /* COMPILER_H */ Signature · 1 line
2.25.0.265.gbab2e86ba0-goog
Signature · 1 line
Danh
Re: [PATCH v9 5/5] bugreport: add compiler info
In reply to Emily Shaffercompat/compiler.h line 23
Quoted 5 lines · Emily Shaffer
compat/compiler.h new file +5
-0+static inline void get_compiler_info (struct strbuf *info) +{ + ... +if (len == info->len) +strbuf_addf (info,_ ("no compiler information available\n" ));
s/addf/addstr/ to squelch https://travis-ci.org/git/git/jobs/657572439
compat/compiler.h line 35
Quoted 7 lines
compat/compiler.h new file +7
-0+} + +static inline void get_libc_info (struct strbuf *info) +{ + ... +if (len == info->len) +strbuf_addf (info,_ ("no libc information available\n" ));
Ditto.
Quoted 3 lines
compat/compiler.h new file +3
-0+} + +#endif /* COMPILER_H */
Re: [PATCH v9 5/5] bugreport: add compiler info
In reply to Emily ShafferHi Emily,
Quoted 15 lines · Emily Shaffer
compat/compiler.h new file +9
-0@@ -0,0 +1,38 @@ +#ifndef COMPILER_H +#define COMPILER_H + +#include "git-compat-util.h" +#include "strbuf.h" + +#ifdef __GLIBC__ +#include <gnu/libc-version.h> +#endif
compat/compiler.h line 19
Quoted 10 lines
compat/compiler.h new file +10
-0+ +static inline void get_compiler_info (struct strbuf *info) +{ +int len = info->len; +#ifdef __GNUC__ +strbuf_addf (info,"gnuc: %d.%d\n" , __GNUC__, __GNUC_MINOR__); +#endif + +#ifdef _MSC_VER +strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER);
I need this to fix a crash in the Visual Studio build's test run:
-- snip --
Subject: [PATCH] fixup??? bugreport: add compiler info
As documented at
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019,_MSC_FULL_VER is an integer, not a string. Therefore this fix is needed to prevent a segmentation fault in the test t0091.1.
--- compat/compiler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
compat/compiler.h +2 -1
@@ -16,7 +16,8 @@ static inline void get_compiler_info(struct strbuf *info)#endif #ifdef _MSC_VER -strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER); +strbuf_addf (info,"MSVC version: %02d.%02d.%05d\n" , + _MSC_VER /100 , _MSC_VER %100 , _MSC_FULL_VER %100000 );#endif if (len == info->len)
-- snap --
Could you squash that in, please?
BTW the two issues I reported in the earlier round are still problems. Could you squash my fixes, please? For your convenience, you can pluck all four of them right off of
https://github.com/git-for-windows/git/commits/shears/pu
Just replace the ??? by ! and you can even use git rebase --autosquash.
Ciao,
Dscho
Quoted 23 lines
compat/compiler.h new file +19
-1+#endif + +if (len == info->len) + strbuf_addf(info, _("no compiler information available\n")); +} + +static inline void get_libc_info (struct strbuf *info) +{ +int len = info->len; + +#ifdef __GLIBC__ +strbuf_addf (info,"glibc: %s\n" ,gnu_get_libc_version ()); +#endif + +if (len == info->len) +strbuf_addf (info,_ ("no libc information available\n" )); +} + +#endif /* COMPILER_H */ --2.25.0.265.gbab2e86ba0-goog
Re: [PATCH v9 5/5] bugreport: add compiler info
Quoted 23 lines · Johannes Schindelin
Hi Emily,
Quoted 19 lines · Emily Shaffer
compat/compiler.h new file +13
-0@@ -0,0 +1,38 @@ +#ifndef COMPILER_H +#define COMPILER_H + +#include "git-compat-util.h" +#include "strbuf.h" + +#ifdef __GLIBC__ +#include <gnu/libc-version.h> +#endif + +static inline void get_compiler_info (struct strbuf *info) +{ +int len = info->len;
Quoted 8 lines
compat/compiler.h line 19
Quoted 6 lines
compat/compiler.h new file +6
-0+#ifdef __GNUC__ +strbuf_addf (info,"gnuc: %d.%d\n" , __GNUC__, __GNUC_MINOR__); +#endif + +#ifdef _MSC_VER +strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER);I need this to fix a crash in the Visual Studio build's test run:
Hummm, is that not part of the GGG suite? I saw it pass (and then failed to include the updated patches with v9 with the changes you mentioned below).
Quoted 30 lines
-- snip --
Subject: [PATCH] fixup??? bugreport: add compiler infoAs documented at
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019,_MSC_FULL_VERis an integer, not a string. Therefore this fix is needed to prevent a segmentation fault in the test t0091.1.Signed-off-by Johannes Schindelin <[email protected]>--- compat/compiler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)compat/compiler.h +2
-2@@ -16,7 +16,8 @@ static inline void get_compiler_info(struct strbuf *info)#endif #ifdef _MSC_VER -strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER); +strbuf_addf (info,"MSVC version: %02d.%02d.%05d\n" , + _MSC_VER /100 , _MSC_VER %100 , _MSC_FULL_VER %100000 );#endif if (len == info->len) -- snap --
Quoted 6 lines
Could you squash that in, please?
BTW the two issues I reported in the earlier round are still problems. Could you squash my fixes, please? For your convenience, you can pluck all four of them right off of
https://github.com/git-for-windows/git/commits/shears/pu
Yes, I think these two issues earlier I have locally and thumbfingered running format-patch.
Quoted 31 lines
Just replace the
???by!and you can even usegit rebase --autosquash.Ciao,
DschoQuoted 23 lines
compat/compiler.h new file +19
-1+#endif + +if (len == info->len) + strbuf_addf(info, _("no compiler information available\n")); +} + +static inline void get_libc_info (struct strbuf *info) +{ +int len = info->len; + +#ifdef __GLIBC__ +strbuf_addf (info,"glibc: %s\n" ,gnu_get_libc_version ()); +#endif + +if (len == info->len) +strbuf_addf (info,_ ("no libc information available\n" )); +} + +#endif /* COMPILER_H */ --2.25.0.265.gbab2e86ba0-goog
v10 cover add git-bugreport tool
In reply to Emily ShafferSince v9, a few minor fixes only related to MS and clang compatibility, plus a warning about strbuf_addf vs strbuf_addstr. I have made no changes to the build setup for v10, so it's still built as a standalone which is invoked via the cmd_main helper. There is plenty of time to change the way we build it later if we want, but I generally agree with the sentiment "let's get something checked in".
GitGitGadget CI is running at:
https://github.com/gitgitgadget/git/pull/573
- Emily
Emily Shaffer (5):
help: move list_config_help to builtin/help
bugreport: add tool to generate debugging info
bugreport: gather git version and build info
bugreport: add uname info
bugreport: add compiler info
.gitignore | 2 + Documentation/git-bugreport.txt | 52 ++++++++++++ Makefile | 18 +++- bugreport.c | 142 ++++++++++++++++++++++++++++++++ builtin/help.c | 86 +++++++++++++++++++ command-list.txt | 1 + compat/compiler.h | 38 +++++++++ generate-cmdlist.sh | 19 ----- generate-configlist.sh | 21 +++++ help.c | 131 +++++++---------------------- help.h | 2 +- strbuf.c | 4 + strbuf.h | 1 + t/t0091-bugreport.sh | 61 ++++++++++++++ 14 files changed, 452 insertions(+), 126 deletions(-) create mode 100644 Documentation/git-bugreport.txt create mode 100644 bugreport.c create mode 100644 compat/compiler.h create mode 100755 generate-configlist.sh create mode 100755 t/t0091-bugreport.sh
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v10 1/5 help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o, builtin/clean.o, and builtin/config.o. This meant that help.o was unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help() into builtin/help.c (where it makes sense to assume other builtin libraries are present).
When command-list.h is included but a member is not used, we start to hear a compiler warning. Since the config list is generated in a fairly different way than the command list, and since commands and config options are semantically different, move the config list into its own header and move the generator into its own script and build rule.
--- .gitignore | 1 + Makefile | 13 +++++-- builtin/help.c | 86 ++++++++++++++++++++++++++++++++++++++++++ generate-cmdlist.sh | 19 ---------- generate-configlist.sh | 21 +++++++++++ help.c | 85 ----------------------------------------- help.h | 1 - 7 files changed, 118 insertions(+), 108 deletions(-) create mode 100755 generate-configlist.sh
.gitignore +1 -0
@@ -189,6 +189,7 @@ /gitweb/gitweb.cgi /gitweb/static/gitweb.js /gitweb/static/gitweb.min.* +/config-list.h /command-list.h *.tar.gz *.dsc
Makefile +10 -3
@@ -815,6 +815,7 @@ LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a VCSSVN_LIB = vcs-svn/lib.a +GENERATED_H += config-list.h GENERATED_H += command-list.h LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
@@ -2132,7 +2133,7 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS) help.sp help.s help.o: command-list.h -builtin/help.sp builtin/help.s builtin/help.o: command-list.h GIT-PREFIX +builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \ '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \ '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
@@ -2152,6 +2153,12 @@ $(BUILT_INS): git$X ln -s $< $@ 2>/dev/null || \ cp $< $@ +config-list.h: generate-configlist.sh + +config-list.h: + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \ + >$@+ && mv $@+ $@ + command-list.h: generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
@@ -2785,7 +2792,7 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE .PHONY: sparse $(SP_OBJ) sparse: $(SP_OBJ) -EXCEPT_HDRS := command-list.h unicode-width.h compat/% xdiff/% +EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/% ifndef GCRYPT_SHA256 EXCEPT_HDRS += sha256/gcrypt.h endif
@@ -2807,7 +2814,7 @@ hdr-check: $(HCO) style: git clang-format --style file --diff --extensions c,h -check: command-list.h +check: config-list.h command-list.h @if sparse; \ then \ echo >&2 "Use 'make sparse' instead"; \
builtin/help.c +86 -0
98 lines not on this page · raw message
generate-cmdlist.sh +0 -19
@@ -76,23 +76,6 @@ print_command_list () { echo "};" } -print_config_list () { - cat <<EOF -static const char *config_name_list[] = { -EOF - grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | - sed '/deprecated/d; s/::$//; s/, */\n/g' | - sort | - while read line - do - echo " \"$line\"," - done - cat <<EOF - NULL, -}; -EOF -} - exclude_programs= while test "--exclude-program" = "$1" do
@@ -113,5 +96,3 @@ echo define_category_names "$1" echo print_command_list "$1" -echo -print_config_list
generate-configlist.sh new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh + +echo "/* Automatically generated by generate-configlist.sh */" +echo + +print_config_list () { + cat <<EOF +static const char *config_name_list[] = { +EOF + grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | + sed '/deprecated/d; s/::$//; s/, */\n/g' | + sort | + sed 's/^.*$/ "&",/' + cat <<EOF + NULL, +}; +EOF +} + +echo +print_config_list
help.c +0 -85
91 lines not on this page · raw message
help.h +0 -1
@@ -22,7 +22,6 @@ static inline void mput_char(char c, unsigned int num)void list_common_cmds_help (void );void list_all_cmds_help (void );void list_common_guides_help (void ); -void list_config_help (int for_human);void list_all_main_cmds (struct string_list *list);void list_all_other_cmds (struct string_list *list);
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v10 2/5 bugreport: add tool to generate debugging info
In reply to Emily ShafferTeach Git how to prompt the user for a good bug report: reproduction steps, expected behavior, and actual behavior. Later, Git can learn how to collect some diagnostic information from the repository.
If users can send us a well-written bug report which contains diagnostic information we would otherwise need to ask the user for, we can reduce the number of question-and-answer round trips between the reporter and the Git contributor.
Users may also wish to send a report like this to their local "Git expert" if they have put their repository into a state they are confused by.
--- .gitignore | 1 + Documentation/git-bugreport.txt | 46 ++++++++++++++ Makefile | 5 ++ bugreport.c | 105 ++++++++++++++++++++++++++++++++ command-list.txt | 1 + strbuf.c | 4 ++ strbuf.h | 1 + t/t0091-bugreport.sh | 61 +++++++++++++++++++ 8 files changed, 224 insertions(+) create mode 100644 Documentation/git-bugreport.txt create mode 100644 bugreport.c create mode 100755 t/t0091-bugreport.sh
.gitignore +1 -0
@@ -25,6 +25,7 @@ /git-bisect--helper /git-blame /git-branch +/git-bugreport /git-bundle /git-cat-file /git-check-attr
Documentation/git-bugreport.txt new file +46 -0
46 lines not on this page · raw message
Makefile +5 -0
@@ -681,6 +681,7 @@ EXTRA_PROGRAMS = # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS += $(EXTRA_PROGRAMS) +PROGRAM_OBJS += bugreport.o PROGRAM_OBJS += credential-store.o PROGRAM_OBJS += daemon.o PROGRAM_OBJS += fast-import.o
@@ -2461,6 +2462,10 @@ endif git-%$X: %.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) +git-bugreport$X: bugreport.o GIT-LDFLAGS $(GITLIBS) + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ + $(LIBS) + git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(IMAP_SEND_LDFLAGS) $(LIBS)
bugreport.c new file +105 -0
105 lines not on this page · raw message
command-list.txt +1 -0
@@ -54,6 +54,7 @@ git-archive mainporcelain git-bisect mainporcelain info git-blame ancillaryinterrogators complete git-branch mainporcelain history +git-bugreport ancillaryinterrogators git-bundle mainporcelain git-cat-file plumbinginterrogators git-check-attr purehelpers
strbuf.c +4 -0
@@ -539,6 +539,10 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)return sb->len ?fwrite (sb->buf,1 , sb->len, f) :0 ; } +ssize_t strbuf_write_fd (struct strbuf *sb,int fd) +{ +return sb->len ?write (fd, sb->buf, sb->len) :0 ; +}#define STRBUF_MAXLINK (2*PATH_MAX)
strbuf.h +1 -0
@@ -462,6 +462,7 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);* NUL bytes. */ ssize_t strbuf_write (struct strbuf *sb,FILE *stream); +ssize_t strbuf_write_fd (struct strbuf *sb,int fd);/** * Read a line from a FILE *, overwriting the existing contents of
t/t0091-bugreport.sh new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v10 3/5 bugreport: gather git version and build info
In reply to Emily ShafferKnowing which version of Git a user has and how it was built allows us to more precisely pin down the circumstances when a certain issue occurs, so teach bugreport how to tell us the same output as 'git version --build-options'.
It's not ideal to directly call 'git version --build-options' because that output goes to stdout. Instead, wrap the version string in a helper within help.[ch] library, and call that helper from within the bugreport library.
--- Documentation/git-bugreport.txt | 4 +++ bugreport.c | 19 +++++++++++++- help.c | 46 ++++++++++++++++++++------------- help.h | 1 + 4 files changed, 51 insertions(+), 19 deletions(-)
Documentation/git-bugreport.txt +4 -0
@@ -23,6 +23,10 @@ The following information is requested from the user: - Expected behavior - Actual behavior +The following information is captured automatically: + + - 'git version --build-options' + This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file is unreadable. In this kind of scenario, it may be helpful to manually gather
bugreport.c +18 -1
@@ -1,8 +1,17 @@ -#include "builtin.h" +#include "cache.h" #include "parse-options.h" #include "stdio.h" #include "strbuf.h" #include "time.h" +#include "help.h" + +static void get_system_info (struct strbuf *sys_info) +{ +/* get git version from native cmd */ +strbuf_addstr (sys_info,_ ("git version:\n" )); +get_version_info (sys_info,1 ); +strbuf_complete_line (sys_info); +}static const char *const bugreport_usage[] = {N_ ("git bugreport [-o|--output-directory <file>] [-s|--suffix <format>]" ),
@@ -32,6 +41,11 @@ static int get_bug_template(struct strbuf *template)return 0 ; } +static void get_header (struct strbuf *buf,const char *title) +{ +strbuf_addf (buf,"\n\n[%s]\n" , title); +} +int cmd_main (int argc,const char **argv) {struct strbuf buffer =STRBUF_INIT ;
@@ -79,6 +93,9 @@ int cmd_main(int argc, const char **argv)/* Prepare the report contents */ get_bug_template (&buffer); +get_header (&buffer,_ ("System Info" )); +get_system_info (&buffer); +/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */ report =open (report_path.buf,O_CREAT |O_EXCL |O_WRONLY ,0666 );
help.c +28 -18
61 lines not on this page · raw message
help.h +1 -0
@@ -37,6 +37,7 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len);void exclude_cmds (struct cmdnames *cmds,struct cmdnames *excludes);int is_in_cmdlist (struct cmdnames *cmds,const char *name);void list_commands (unsigned int colopts,struct cmdnames *main_cmds,struct cmdnames *other_cmds); +void get_version_info (struct strbuf *buf,int show_build_options);/* * call this to die(), when it is suspected that the user mistyped a
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v10 4/5 bugreport: add uname info
In reply to Emily ShafferThe 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.
--- Documentation/git-bugreport.txt | 1 + bugreport.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-)
Documentation/git-bugreport.txt +1 -0
@@ -26,6 +26,7 @@ The following information is requested from the user: The following information is captured automatically: - 'git version --build-options' + - uname sysname, release, version, and machine strings This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file
bugreport.c +15 -1
@@ -7,10 +7,24 @@static void get_system_info (struct strbuf *sys_info) { +struct utsname uname_info; +/* get git version from native cmd */ strbuf_addstr (sys_info,_ ("git version:\n" ));get_version_info (sys_info,1 ); -strbuf_complete_line (sys_info); + +/* system call for other version info */ +strbuf_addstr (sys_info,"uname: " ); +if (uname (&uname_info)) +strbuf_addf (sys_info,_ ("uname() failed with error '%s' (%d)\n" ), +strerror (errno), + errno); +else +strbuf_addf (sys_info,"%s %s %s %s\n" , + uname_info.sysname, + uname_info.release, + uname_info.version, + uname_info.machine); }static const char *const bugreport_usage[] = {
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v10 5/5 bugreport: add compiler info
In reply to Emily ShafferTo help pinpoint the source of a regression, it is useful to know some info about the compiler which the user's Git client was built with. By adding a generic get_compiler_info() in 'compat/' we can choose which relevant information to share per compiler; to get started, let's demonstrate the version of glibc if the user built with 'gcc'.
--- Documentation/git-bugreport.txt | 1 + bugreport.c | 6 ++++++ compat/compiler.h | 38 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 compat/compiler.h
Documentation/git-bugreport.txt +1 -0
@@ -27,6 +27,7 @@ The following information is captured automatically: - 'git version --build-options' - uname sysname, release, version, and machine strings + - Compiler-specific info string This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file
bugreport.c +6 -0
@@ -4,6 +4,7 @@#include "strbuf.h" #include "time.h" #include "help.h" +#include "compat/compiler.h" static void get_system_info (struct strbuf *sys_info) {
@@ -25,6 +26,11 @@ static void get_system_info(struct strbuf *sys_info) uname_info.release, uname_info.version, uname_info.machine); + +strbuf_addstr (sys_info,_ ("compiler info: " )); +get_compiler_info (sys_info); +strbuf_addstr (sys_info,_ ("libc info: " )); +get_libc_info (sys_info); }static const char *const bugreport_usage[] = {
compat/compiler.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef COMPILER_H +#define COMPILER_H + +#include "git-compat-util.h" +#include "strbuf.h" + +#ifdef __GLIBC__ +#include <gnu/libc-version.h> +#endif + +static inline void get_compiler_info (struct strbuf *info) +{ +int len = info->len; +#ifdef __GNUC__ +strbuf_addf (info,"gnuc: %d.%d\n" , __GNUC__, __GNUC_MINOR__); +#endif + +#ifdef _MSC_VER +strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER); +#endif + +if (len == info->len) +strbuf_addstr (info,_ ("no compiler information available\n" )); +} + +static inline void get_libc_info (struct strbuf *info) +{ +int len = info->len; + +#ifdef __GLIBC__ +strbuf_addf (info,"glibc: %s\n" ,gnu_get_libc_version ()); +#endif + +if (len == info->len) +strbuf_addstr (info,_ ("no libc information available\n" )); +} + +#endif /* COMPILER_H */
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
Re: [PATCH v10 5/5] bugreport: add compiler info
Review
Quoted 3 lines · Emily Shaffer
(quoted diff) +3
-0+#ifdef _MSC_VER + strbuf_addf(info, "MSVC version: %s\n", _MSC_FULL_VER); +#endif
This part is a bit different from what Dscho suggested to be squashed (and I have had on top of v9 series).
Below is a diff between (v9 + SQUASH???) and v10. I think the change in the strftime format is a strict improvement.
Thanks.
bugreport.c | 2 +- compat/compiler.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
bugreport.c +1 -1
@@ -73,7 +73,7 @@ int cmd_main(int argc, const char **argv)int report =-1 ;time_t now =time (NULL );char *option_output =NULL ; -char *option_suffix ="%F-%H%M" ; +char *option_suffix ="%Y-%m-%d-%H%M" ;int nongit_ok =0 ;const char *prefix =NULL ;const char *user_relative_path =NULL ;
compat/compiler.h +1 -2
@@ -16,8 +16,7 @@ static inline void get_compiler_info(struct strbuf *info)#endif #ifdef _MSC_VER -strbuf_addf (info,"MSVC version: %02d.%02d.%05d\n" , - _MSC_VER /100 , _MSC_VER %100 , _MSC_FULL_VER %100000 ); +strbuf_addf (info,"MSVC version: %s\n" , _MSC_FULL_VER);#endif if (len == info->len)
Re: [PATCH v10 5/5] bugreport: add compiler info
Quoted 11 lines · Junio C Hamano
Review
Quoted 3 lines · Emily Shaffer
(quoted diff) +3
-0+#ifdef _MSC_VER + strbuf_addf(info, "MSVC version: %s\n", _MSC_FULL_VER); +#endifThis part is a bit different from what Dscho suggested to be squashed (and I have had on top of v9 series).
Below is a diff between (v9 + SQUASH???) and v10. I think the change in the strftime format is a strict improvement.
Hmph. This is different than what I have in local. Please ignore this entire v10, I've made a mistake in my tooling. I'm sorry about the noise and for not checking over my patches better before mailing.
- Emily
v11 cover add git-bugreport tool
In reply to Emily ShafferPlease ignore v10; it seemed that I had a ref .git/bugreport as well as a ref .git/refs/heads/bugreport and the former was pointing somewhere stale, so v10 was identical at least to v9 if not also to v8. :|
This hopefully really does include the MSVC changes as well as the clang changes and addstr noise fixes. I'm really sorry for the noise.
- Emily
Emily Shaffer (5):
help: move list_config_help to builtin/help
bugreport: add tool to generate debugging info
bugreport: gather git version and build info
bugreport: add uname info
bugreport: add compiler info
.gitignore | 2 + Documentation/git-bugreport.txt | 52 ++++++++++++ Makefile | 18 +++- bugreport.c | 142 ++++++++++++++++++++++++++++++++ builtin/help.c | 86 +++++++++++++++++++ command-list.txt | 1 + compat/compiler.h | 41 +++++++++ generate-cmdlist.sh | 19 ----- generate-configlist.sh | 21 +++++ help.c | 131 +++++++---------------------- help.h | 2 +- strbuf.c | 4 + strbuf.h | 1 + t/t0091-bugreport.sh | 61 ++++++++++++++ 14 files changed, 455 insertions(+), 126 deletions(-) create mode 100644 Documentation/git-bugreport.txt create mode 100644 bugreport.c create mode 100644 compat/compiler.h create mode 100755 generate-configlist.sh create mode 100755 t/t0091-bugreport.sh
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v11 1/5 help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o, builtin/clean.o, and builtin/config.o. This meant that help.o was unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help() into builtin/help.c (where it makes sense to assume other builtin libraries are present).
When command-list.h is included but a member is not used, we start to hear a compiler warning. Since the config list is generated in a fairly different way than the command list, and since commands and config options are semantically different, move the config list into its own header and move the generator into its own script and build rule.
--- .gitignore | 1 + Makefile | 13 +++++-- builtin/help.c | 86 ++++++++++++++++++++++++++++++++++++++++++ generate-cmdlist.sh | 19 ---------- generate-configlist.sh | 21 +++++++++++ help.c | 85 ----------------------------------------- help.h | 1 - 7 files changed, 118 insertions(+), 108 deletions(-) create mode 100755 generate-configlist.sh
.gitignore +1 -0
@@ -189,6 +189,7 @@ /gitweb/gitweb.cgi /gitweb/static/gitweb.js /gitweb/static/gitweb.min.* +/config-list.h /command-list.h *.tar.gz *.dsc
Makefile +10 -3
@@ -815,6 +815,7 @@ LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a VCSSVN_LIB = vcs-svn/lib.a +GENERATED_H += config-list.h GENERATED_H += command-list.h LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
@@ -2132,7 +2133,7 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS) help.sp help.s help.o: command-list.h -builtin/help.sp builtin/help.s builtin/help.o: command-list.h GIT-PREFIX +builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \ '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \ '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
@@ -2152,6 +2153,12 @@ $(BUILT_INS): git$X ln -s $< $@ 2>/dev/null || \ cp $< $@ +config-list.h: generate-configlist.sh + +config-list.h: + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \ + >$@+ && mv $@+ $@ + command-list.h: generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
@@ -2785,7 +2792,7 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE .PHONY: sparse $(SP_OBJ) sparse: $(SP_OBJ) -EXCEPT_HDRS := command-list.h unicode-width.h compat/% xdiff/% +EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/% ifndef GCRYPT_SHA256 EXCEPT_HDRS += sha256/gcrypt.h endif
@@ -2807,7 +2814,7 @@ hdr-check: $(HCO) style: git clang-format --style file --diff --extensions c,h -check: command-list.h +check: config-list.h command-list.h @if sparse; \ then \ echo >&2 "Use 'make sparse' instead"; \
builtin/help.c +86 -0
98 lines not on this page · raw message
generate-cmdlist.sh +0 -19
@@ -76,23 +76,6 @@ print_command_list () { echo "};" } -print_config_list () { - cat <<EOF -static const char *config_name_list[] = { -EOF - grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | - sed '/deprecated/d; s/::$//; s/, */\n/g' | - sort | - while read line - do - echo " \"$line\"," - done - cat <<EOF - NULL, -}; -EOF -} - exclude_programs= while test "--exclude-program" = "$1" do
@@ -113,5 +96,3 @@ echo define_category_names "$1" echo print_command_list "$1" -echo -print_config_list
generate-configlist.sh new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh + +echo "/* Automatically generated by generate-configlist.sh */" +echo + +print_config_list () { + cat <<EOF +static const char *config_name_list[] = { +EOF + grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | + sed '/deprecated/d; s/::$//; s/, */\n/g' | + sort | + sed 's/^.*$/ "&",/' + cat <<EOF + NULL, +}; +EOF +} + +echo +print_config_list
help.c +0 -85
91 lines not on this page · raw message
help.h +0 -1
@@ -22,7 +22,6 @@ static inline void mput_char(char c, unsigned int num)void list_common_cmds_help (void );void list_all_cmds_help (void );void list_common_guides_help (void ); -void list_config_help (int for_human);void list_all_main_cmds (struct string_list *list);void list_all_other_cmds (struct string_list *list);
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v11 2/5 bugreport: add tool to generate debugging info
In reply to Emily ShafferTeach Git how to prompt the user for a good bug report: reproduction steps, expected behavior, and actual behavior. Later, Git can learn how to collect some diagnostic information from the repository.
If users can send us a well-written bug report which contains diagnostic information we would otherwise need to ask the user for, we can reduce the number of question-and-answer round trips between the reporter and the Git contributor.
Users may also wish to send a report like this to their local "Git expert" if they have put their repository into a state they are confused by.
--- .gitignore | 1 + Documentation/git-bugreport.txt | 46 ++++++++++++++ Makefile | 5 ++ bugreport.c | 105 ++++++++++++++++++++++++++++++++ command-list.txt | 1 + strbuf.c | 4 ++ strbuf.h | 1 + t/t0091-bugreport.sh | 61 +++++++++++++++++++ 8 files changed, 224 insertions(+) create mode 100644 Documentation/git-bugreport.txt create mode 100644 bugreport.c create mode 100755 t/t0091-bugreport.sh
.gitignore +1 -0
@@ -25,6 +25,7 @@ /git-bisect--helper /git-blame /git-branch +/git-bugreport /git-bundle /git-cat-file /git-check-attr
Documentation/git-bugreport.txt new file +46 -0
46 lines not on this page · raw message
Makefile +5 -0
@@ -681,6 +681,7 @@ EXTRA_PROGRAMS = # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS += $(EXTRA_PROGRAMS) +PROGRAM_OBJS += bugreport.o PROGRAM_OBJS += credential-store.o PROGRAM_OBJS += daemon.o PROGRAM_OBJS += fast-import.o
@@ -2461,6 +2462,10 @@ endif git-%$X: %.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) +git-bugreport$X: bugreport.o GIT-LDFLAGS $(GITLIBS) + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ + $(LIBS) + git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(IMAP_SEND_LDFLAGS) $(LIBS)
bugreport.c new file +105 -0
105 lines not on this page · raw message
command-list.txt +1 -0
@@ -54,6 +54,7 @@ git-archive mainporcelain git-bisect mainporcelain info git-blame ancillaryinterrogators complete git-branch mainporcelain history +git-bugreport ancillaryinterrogators git-bundle mainporcelain git-cat-file plumbinginterrogators git-check-attr purehelpers
strbuf.c +4 -0
@@ -539,6 +539,10 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)return sb->len ?fwrite (sb->buf,1 , sb->len, f) :0 ; } +ssize_t strbuf_write_fd (struct strbuf *sb,int fd) +{ +return sb->len ?write (fd, sb->buf, sb->len) :0 ; +}#define STRBUF_MAXLINK (2*PATH_MAX)
strbuf.h +1 -0
@@ -462,6 +462,7 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);* NUL bytes. */ ssize_t strbuf_write (struct strbuf *sb,FILE *stream); +ssize_t strbuf_write_fd (struct strbuf *sb,int fd);/** * Read a line from a FILE *, overwriting the existing contents of
t/t0091-bugreport.sh new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
Quoted 25 lines · Emily Shaffer
t/t0091-bugreport.sh new file +19
-0@@ -0,0 +1,61 @@ +#!/bin/sh + +test_description='git bugreport' + +. ./test-lib.sh + +# Headers "[System Info]" will be followed by a non-empty line if we put some +# information there; we can make sure all our headers were followed by some +# information to check if the command was successful. +HEADER_PATTERN="^\[.*\]$" + +check_all_headers_populated () { + while read -r line + do + if test "$(grep "$HEADER_PATTERN" "$line")" + then + echo "$line" + read -r nextline + if test -z "$nextline"; then
t/t0091-bugreport.sh line 29
Quoted 10 lines
t/t0091-bugreport.sh new file +10
-0+ return 1; + fi + fi + done +} + +test_expect_success 'creates a report with content in the right places' ' + git bugreport -s check-headers && + check_all_headers_populated <git-bugreport-check-headers.txt && + test_when_finished rm git-bugreport-check-headers.txt
'test_when_finished' should be at the beginning of the test, otherwise it will have no effect if a command before it were to fail.
Quoted 35 lines
t/t0091-bugreport.sh new file +32
-0+' + +test_expect_success 'dies if file with same name as report already exists' ' + >>git-bugreport-duplicate.txt && + test_must_fail git bugreport --suffix duplicate && + test_when_finished rm git-bugreport-duplicate.txt +' + +test_expect_success '--output-directory puts the report in the provided dir' ' + git bugreport -o foo/ && + test_path_is_file foo/git-bugreport-* && + test_when_finished rm -fr foo/ +' + +test_expect_success 'incorrect arguments abort with usage' ' + test_must_fail git bugreport --false 2>output && + test_i18ngrep usage output && + test_path_is_missing git-bugreport-* +' + +test_expect_success 'runs outside of a git dir' ' + nongit git bugreport && + test_when_finished rm non-repo/git-bugreport-* +' + +test_expect_success 'can create leading directories outside of a git dir' ' + nongit git bugreport -o foo/bar/baz && + test_when_finished rm -fr foo/bar/baz +' + + +test_doneSignature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v11 3/5 bugreport: gather git version and build info
In reply to Emily ShafferKnowing which version of Git a user has and how it was built allows us to more precisely pin down the circumstances when a certain issue occurs, so teach bugreport how to tell us the same output as 'git version --build-options'.
It's not ideal to directly call 'git version --build-options' because that output goes to stdout. Instead, wrap the version string in a helper within help.[ch] library, and call that helper from within the bugreport library.
--- Documentation/git-bugreport.txt | 4 +++ bugreport.c | 19 +++++++++++++- help.c | 46 ++++++++++++++++++++------------- help.h | 1 + 4 files changed, 51 insertions(+), 19 deletions(-)
Documentation/git-bugreport.txt +4 -0
@@ -23,6 +23,10 @@ The following information is requested from the user: - Expected behavior - Actual behavior +The following information is captured automatically: + + - 'git version --build-options' + This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file is unreadable. In this kind of scenario, it may be helpful to manually gather
bugreport.c +18 -1
@@ -1,8 +1,17 @@ -#include "builtin.h" +#include "cache.h" #include "parse-options.h" #include "stdio.h" #include "strbuf.h" #include "time.h" +#include "help.h" + +static void get_system_info (struct strbuf *sys_info) +{ +/* get git version from native cmd */ +strbuf_addstr (sys_info,_ ("git version:\n" )); +get_version_info (sys_info,1 ); +strbuf_complete_line (sys_info); +}static const char *const bugreport_usage[] = {N_ ("git bugreport [-o|--output-directory <file>] [-s|--suffix <format>]" ),
@@ -32,6 +41,11 @@ static int get_bug_template(struct strbuf *template)return 0 ; } +static void get_header (struct strbuf *buf,const char *title) +{ +strbuf_addf (buf,"\n\n[%s]\n" , title); +} +int cmd_main (int argc,const char **argv) {struct strbuf buffer =STRBUF_INIT ;
@@ -79,6 +93,9 @@ int cmd_main(int argc, const char **argv)/* Prepare the report contents */ get_bug_template (&buffer); +get_header (&buffer,_ ("System Info" )); +get_system_info (&buffer); +/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */ report =open (report_path.buf,O_CREAT |O_EXCL |O_WRONLY ,0666 );
help.c +28 -18
61 lines not on this page · raw message
help.h +1 -0
@@ -37,6 +37,7 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len);void exclude_cmds (struct cmdnames *cmds,struct cmdnames *excludes);int is_in_cmdlist (struct cmdnames *cmds,const char *name);void list_commands (unsigned int colopts,struct cmdnames *main_cmds,struct cmdnames *other_cmds); +void get_version_info (struct strbuf *buf,int show_build_options);/* * call this to die(), when it is suspected that the user mistyped a
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v11 4/5 bugreport: add uname info
In reply to Emily ShafferThe 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.
--- Documentation/git-bugreport.txt | 1 + bugreport.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-)
Documentation/git-bugreport.txt +1 -0
@@ -26,6 +26,7 @@ The following information is requested from the user: The following information is captured automatically: - 'git version --build-options' + - uname sysname, release, version, and machine strings This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file
bugreport.c +15 -1
@@ -7,10 +7,24 @@static void get_system_info (struct strbuf *sys_info) { +struct utsname uname_info; +/* get git version from native cmd */ strbuf_addstr (sys_info,_ ("git version:\n" ));get_version_info (sys_info,1 ); -strbuf_complete_line (sys_info); + +/* system call for other version info */ +strbuf_addstr (sys_info,"uname: " ); +if (uname (&uname_info)) +strbuf_addf (sys_info,_ ("uname() failed with error '%s' (%d)\n" ), +strerror (errno), + errno); +else +strbuf_addf (sys_info,"%s %s %s %s\n" , + uname_info.sysname, + uname_info.release, + uname_info.version, + uname_info.machine); }static const char *const bugreport_usage[] = {
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
PATCH v11 5/5 bugreport: add compiler info
In reply to Emily ShafferTo help pinpoint the source of a regression, it is useful to know some info about the compiler which the user's Git client was built with. By adding a generic get_compiler_info() in 'compat/' we can choose which relevant information to share per compiler; to get started, let's demonstrate the version of glibc if the user built with 'gcc'.
--- Documentation/git-bugreport.txt | 1 + bugreport.c | 6 +++++ compat/compiler.h | 41 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 compat/compiler.h
Documentation/git-bugreport.txt +1 -0
@@ -27,6 +27,7 @@ The following information is captured automatically: - 'git version --build-options' - uname sysname, release, version, and machine strings + - Compiler-specific info string This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file
bugreport.c +6 -0
@@ -4,6 +4,7 @@#include "strbuf.h" #include "time.h" #include "help.h" +#include "compat/compiler.h" static void get_system_info (struct strbuf *sys_info) {
@@ -25,6 +26,11 @@ static void get_system_info(struct strbuf *sys_info) uname_info.release, uname_info.version, uname_info.machine); + +strbuf_addstr (sys_info,_ ("compiler info: " )); +get_compiler_info (sys_info); +strbuf_addstr (sys_info,_ ("libc info: " )); +get_libc_info (sys_info); }static const char *const bugreport_usage[] = {
compat/compiler.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
v12 cover bugreport: add tool to generate debugging info
In reply to Emily ShafferSince v11, reordered tests per SZEDER's comment so that the test_when_finished lines come first in each test.
Emily Shaffer (5):
help: move list_config_help to builtin/help
bugreport: add tool to generate debugging info
bugreport: gather git version and build info
bugreport: add uname info
bugreport: add compiler info
.gitignore | 2 + Documentation/git-bugreport.txt | 52 ++++++++++++ Makefile | 18 +++- bugreport.c | 142 ++++++++++++++++++++++++++++++++ builtin/help.c | 86 +++++++++++++++++++ command-list.txt | 1 + compat/compiler.h | 41 +++++++++ generate-cmdlist.sh | 19 ----- generate-configlist.sh | 21 +++++ help.c | 131 +++++++---------------------- help.h | 2 +- strbuf.c | 4 + strbuf.h | 1 + t/t0091-bugreport.sh | 61 ++++++++++++++ 14 files changed, 455 insertions(+), 126 deletions(-) create mode 100644 Documentation/git-bugreport.txt create mode 100644 bugreport.c create mode 100644 compat/compiler.h create mode 100755 generate-configlist.sh create mode 100755 t/t0091-bugreport.sh
Signature · 1 line
2.26.0.292.g33ef6b2f38-goog
PATCH v12 1/5 help: move list_config_help to builtin/help
Starting in 3ac68a93fd2, help.o began to depend on builtin/branch.o, builtin/clean.o, and builtin/config.o. This meant that help.o was unusable outside of the context of the main Git executable.
To make help.o usable by other commands again, move list_config_help() into builtin/help.c (where it makes sense to assume other builtin libraries are present).
When command-list.h is included but a member is not used, we start to hear a compiler warning. Since the config list is generated in a fairly different way than the command list, and since commands and config options are semantically different, move the config list into its own header and move the generator into its own script and build rule.
--- .gitignore | 1 + Makefile | 13 +++++-- builtin/help.c | 86 ++++++++++++++++++++++++++++++++++++++++++ generate-cmdlist.sh | 19 ---------- generate-configlist.sh | 21 +++++++++++ help.c | 85 ----------------------------------------- help.h | 1 - 7 files changed, 118 insertions(+), 108 deletions(-) create mode 100755 generate-configlist.sh
.gitignore +1 -0
@@ -188,6 +188,7 @@ /gitweb/gitweb.cgi /gitweb/static/gitweb.js /gitweb/static/gitweb.min.* +/config-list.h /command-list.h *.tar.gz *.dsc
Makefile +10 -3
@@ -815,6 +815,7 @@ LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a VCSSVN_LIB = vcs-svn/lib.a +GENERATED_H += config-list.h GENERATED_H += command-list.h LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \
@@ -2133,7 +2134,7 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS) help.sp help.s help.o: command-list.h -builtin/help.sp builtin/help.s builtin/help.o: command-list.h GIT-PREFIX +builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \ '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \ '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
@@ -2153,6 +2154,12 @@ $(BUILT_INS): git$X ln -s $< $@ 2>/dev/null || \ cp $< $@ +config-list.h: generate-configlist.sh + +config-list.h: + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \ + >$@+ && mv $@+ $@ + command-list.h: generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
@@ -2786,7 +2793,7 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE .PHONY: sparse $(SP_OBJ) sparse: $(SP_OBJ) -EXCEPT_HDRS := command-list.h unicode-width.h compat/% xdiff/% +EXCEPT_HDRS := command-list.h config-list.h unicode-width.h compat/% xdiff/% ifndef GCRYPT_SHA256 EXCEPT_HDRS += sha256/gcrypt.h endif
@@ -2808,7 +2815,7 @@ hdr-check: $(HCO) style: git clang-format --style file --diff --extensions c,h -check: command-list.h +check: config-list.h command-list.h @if sparse; \ then \ echo >&2 "Use 'make sparse' instead"; \
builtin/help.c +86 -0
98 lines not on this page · raw message
generate-cmdlist.sh +0 -19
@@ -76,23 +76,6 @@ print_command_list () { echo "};" } -print_config_list () { - cat <<EOF -static const char *config_name_list[] = { -EOF - grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | - sed '/deprecated/d; s/::$//; s/, */\n/g' | - sort | - while read line - do - echo " \"$line\"," - done - cat <<EOF - NULL, -}; -EOF -} - exclude_programs= while test "--exclude-program" = "$1" do
@@ -113,5 +96,3 @@ echo define_category_names "$1" echo print_command_list "$1" -echo -print_config_list
generate-configlist.sh new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh + +echo "/* Automatically generated by generate-configlist.sh */" +echo + +print_config_list () { + cat <<EOF +static const char *config_name_list[] = { +EOF + grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | + sed '/deprecated/d; s/::$//; s/, */\n/g' | + sort | + sed 's/^.*$/ "&",/' + cat <<EOF + NULL, +}; +EOF +} + +echo +print_config_list
help.c +0 -85
91 lines not on this page · raw message
help.h +0 -1
@@ -22,7 +22,6 @@ static inline void mput_char(char c, unsigned int num)void list_common_cmds_help (void );void list_all_cmds_help (void );void list_common_guides_help (void ); -void list_config_help (int for_human);void list_all_main_cmds (struct string_list *list);void list_all_other_cmds (struct string_list *list);
Signature · 1 line
2.26.0.292.g33ef6b2f38-goog
Re: [PATCH v12 1/5] help: move list_config_help to builtin/help
Quoted 3 lines · Emily Shaffer
Starting in
3ac68a93fd2, help.o began to depend onbuiltin/branch.o,builtin/clean.o, andbuiltin/config.o. This meant that help.o was unusable outside of the context of the main Git executable.
Quite straight-forward. Thanks for the clean-up.
PATCH v12 2/5 bugreport: add tool to generate debugging info
In reply to Emily ShafferTeach Git how to prompt the user for a good bug report: reproduction steps, expected behavior, and actual behavior. Later, Git can learn how to collect some diagnostic information from the repository.
If users can send us a well-written bug report which contains diagnostic information we would otherwise need to ask the user for, we can reduce the number of question-and-answer round trips between the reporter and the Git contributor.
Users may also wish to send a report like this to their local "Git expert" if they have put their repository into a state they are confused by.
--- .gitignore | 1 + Documentation/git-bugreport.txt | 46 ++++++++++++++ Makefile | 5 ++ bugreport.c | 105 ++++++++++++++++++++++++++++++++ command-list.txt | 1 + strbuf.c | 4 ++ strbuf.h | 1 + t/t0091-bugreport.sh | 61 +++++++++++++++++++ 8 files changed, 224 insertions(+) create mode 100644 Documentation/git-bugreport.txt create mode 100644 bugreport.c create mode 100755 t/t0091-bugreport.sh
.gitignore +1 -0
@@ -25,6 +25,7 @@ /git-bisect--helper /git-blame /git-branch +/git-bugreport /git-bundle /git-cat-file /git-check-attr
Documentation/git-bugreport.txt new file +46 -0
46 lines not on this page · raw message
Makefile +5 -0
@@ -680,6 +680,7 @@ EXTRA_PROGRAMS = # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS += $(EXTRA_PROGRAMS) +PROGRAM_OBJS += bugreport.o PROGRAM_OBJS += credential-store.o PROGRAM_OBJS += daemon.o PROGRAM_OBJS += fast-import.o
@@ -2462,6 +2463,10 @@ endif git-%$X: %.o GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) +git-bugreport$X: bugreport.o GIT-LDFLAGS $(GITLIBS) + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ + $(LIBS) + git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS) $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(IMAP_SEND_LDFLAGS) $(LIBS)
bugreport.c new file +105 -0
105 lines not on this page · raw message
command-list.txt +1 -0
@@ -54,6 +54,7 @@ git-archive mainporcelain git-bisect mainporcelain info git-blame ancillaryinterrogators complete git-branch mainporcelain history +git-bugreport ancillaryinterrogators git-bundle mainporcelain git-cat-file plumbinginterrogators git-check-attr purehelpers
strbuf.c +4 -0
@@ -554,6 +554,10 @@ ssize_t strbuf_write(struct strbuf *sb, FILE *f)return sb->len ?fwrite (sb->buf,1 , sb->len, f) :0 ; } +ssize_t strbuf_write_fd (struct strbuf *sb,int fd) +{ +return sb->len ?write (fd, sb->buf, sb->len) :0 ; +}#define STRBUF_MAXLINK (2*PATH_MAX)
strbuf.h +1 -0
@@ -468,6 +468,7 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);* NUL bytes. */ ssize_t strbuf_write (struct strbuf *sb,FILE *stream); +ssize_t strbuf_write_fd (struct strbuf *sb,int fd);/** * Read a line from a FILE *, overwriting the existing contents of
t/t0091-bugreport.sh new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.26.0.292.g33ef6b2f38-goog
PATCH v12 3/5 bugreport: gather git version and build info
In reply to Emily ShafferKnowing which version of Git a user has and how it was built allows us to more precisely pin down the circumstances when a certain issue occurs, so teach bugreport how to tell us the same output as 'git version --build-options'.
It's not ideal to directly call 'git version --build-options' because that output goes to stdout. Instead, wrap the version string in a helper within help.[ch] library, and call that helper from within the bugreport library.
--- Documentation/git-bugreport.txt | 4 +++ bugreport.c | 19 +++++++++++++- help.c | 46 ++++++++++++++++++++------------- help.h | 1 + 4 files changed, 51 insertions(+), 19 deletions(-)
Documentation/git-bugreport.txt +4 -0
@@ -23,6 +23,10 @@ The following information is requested from the user: - Expected behavior - Actual behavior +The following information is captured automatically: + + - 'git version --build-options' + This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file is unreadable. In this kind of scenario, it may be helpful to manually gather
bugreport.c +18 -1
@@ -1,8 +1,17 @@ -#include "builtin.h" +#include "cache.h" #include "parse-options.h" #include "stdio.h" #include "strbuf.h" #include "time.h" +#include "help.h" + +static void get_system_info (struct strbuf *sys_info) +{ +/* get git version from native cmd */ +strbuf_addstr (sys_info,_ ("git version:\n" )); +get_version_info (sys_info,1 ); +strbuf_complete_line (sys_info); +}static const char *const bugreport_usage[] = {N_ ("git bugreport [-o|--output-directory <file>] [-s|--suffix <format>]" ),
@@ -32,6 +41,11 @@ static int get_bug_template(struct strbuf *template)return 0 ; } +static void get_header (struct strbuf *buf,const char *title) +{ +strbuf_addf (buf,"\n\n[%s]\n" , title); +} +int cmd_main (int argc,const char **argv) {struct strbuf buffer =STRBUF_INIT ;
@@ -79,6 +93,9 @@ int cmd_main(int argc, const char **argv)/* Prepare the report contents */ get_bug_template (&buffer); +get_header (&buffer,_ ("System Info" )); +get_system_info (&buffer); +/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */ report =open (report_path.buf,O_CREAT |O_EXCL |O_WRONLY ,0666 );
help.c +28 -18
61 lines not on this page · raw message
help.h +1 -0
@@ -37,6 +37,7 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len);void exclude_cmds (struct cmdnames *cmds,struct cmdnames *excludes);int is_in_cmdlist (struct cmdnames *cmds,const char *name);void list_commands (unsigned int colopts,struct cmdnames *main_cmds,struct cmdnames *other_cmds); +void get_version_info (struct strbuf *buf,int show_build_options);/* * call this to die(), when it is suspected that the user mistyped a
Signature · 1 line
2.26.0.292.g33ef6b2f38-goog
Re: [PATCH v12 3/5] bugreport: gather git version and build info
Quoted 4 lines · Emily Shaffer
It's not ideal to directly call 'git version --build-options' because that output goes to stdout. Instead, wrap the version string in a helper within help.[ch] library, and call that helper from within the bugreport library.
This means that "git-bugreport" that can be a different binary from say "git-remote-curl" (or "git-version" for that matter) would still report whatever version string that was compiled into "bugreport".
Reporting the version of "bugreport" is *not* useless, and what this step adds to the report is good.
But the version number of "bugreport" may not have much to do with the binary the end user is having trouble with, so we'd also want the version of the main part of "git", and other standalone "git" subprograms like "git-remote-curl", reported separately, probably together with $PATH, $GIT_EXEC_PATH and what appears in the directories listed on these environment variables.
If "git version --build-options" writes to its standard output stream, that is a good thing, as it makes it easy to spawn and read what it says via the run_command() API, and there is one less thing to worry about (it would be a bit more cumbersome if the output goes to the standard error stream).
As "git-remote-curl" would also be a separate binary, we'd have to use the same technique to report version number (and perhaps curl's library version and its configuration?), perhaps by teaching the subcommand a new option to dump such details to its standard output.
Using the same technique to report the version about the "git" itself would be consistent thing to do, as a preparation for future steps that reports the details about "git-remote-curl".
Thanks.
Re: [PATCH v12 3/5] bugreport: gather git version and build info
Quoted 27 lines · Junio C Hamano
Quoted 4 lines · Emily Shaffer
It's not ideal to directly call 'git version --build-options' because that output goes to stdout. Instead, wrap the version string in a helper within help.[ch] library, and call that helper from within the bugreport library.
This means that "git-bugreport" that can be a different binary from say "git-remote-curl" (or "git-version" for that matter) would still report whatever version string that was compiled into "bugreport".
Reporting the version of "bugreport" is *not* useless, and what this step adds to the report is good.
But the version number of "bugreport" may not have much to do with the binary the end user is having trouble with, so we'd also want the version of the main part of "git", and other standalone "git" subprograms like "git-remote-curl", reported separately, probably together with $PATH, $GIT_EXEC_PATH and what appears in the directories listed on these environment variables.
If "git version --build-options" writes to its standard output stream, that is a good thing, as it makes it easy to spawn and read what it says via the
run_command()API, and there is one less thing to worry about (it would be a bit more cumbersome if the output goes to the standard error stream).
Quoted 8 lines
As "git-remote-curl" would also be a separate binary, we'd have to use the same technique to report version number (and perhaps curl's library version and its configuration?), perhaps by teaching the subcommand a new option to dump such details to its standard output.
Using the same technique to report the version about the "git" itself would be consistent thing to do, as a preparation for future steps that reports the details about "git-remote-curl".
Sure. I will include a run_command() call to "git version --build-options" (or is it --build-info?) in the same series where I re-introduce the call to "git-remote-curl", since they will look pretty similar; around that time I will clean up what "git-bugreport" reports about its own version/build info, too.
To be clear, do you want me to include the output of get_compiler_info() in "git version --build-options" when I do that change, too?
- Emily
Re: [PATCH v12 3/5] bugreport: gather git version and build info
Quoted 2 lines · Emily Shaffer
To be clear, do you want me to include the output of
get_compiler_info()in "git version --build-options" when I do that change, too?
In the endgame, there are two kinds of information we'd want to gather and report, I would think.
Ones that can be different per-binary are things like:
- what version of the source code the binary was compiled from
- with what compiler options
- using which compiler and
- linking with what libraries,
- where in the filesystem is the binary located
The others are various properties of the system the user is using, and having trouble using, Git on:
- how many CPUs do we have,
- how much free memory,
- is the repository's filesystem case sensitive,
- what version of 'wish' is being used.
We'd want the former to be reported for each binary that matters, so "git version --build-options" would want to say it, "git remote-curl --build-options" would want to say it, and being different binaries, they may say different things.
There is not much point in duplicating the latter that are not binary specific, so it probably makes sense to gather them inside, and report them from, "git bugreport" itself.
Thanks.
Re: [PATCH v12 3/5] bugreport: gather git version and build info
Quoted 24 lines · Junio C Hamano
Quoted 2 lines · Emily Shaffer
To be clear, do you want me to include the output of
get_compiler_info()in "git version --build-options" when I do that change, too?In the endgame, there are two kinds of information we'd want to gather and report, I would think.
Ones that can be different per-binary are things like:
- what version of the source code the binary was compiled from
- with what compiler options
- using which compiler and
- linking with what libraries,
- where in the filesystem is the binary locatedThe others are various properties of the system the user is using, and having trouble using, Git on:
- how many CPUs do we have,
- how much free memory,
- is the repository's filesystem case sensitive,
- what version of 'wish' is being used.
Quoted 8 lines
We'd want the former to be reported for each binary that matters, so "git version --build-options" would want to say it, "git remote-curl --build-options" would want to say it, and being different binaries, they may say different things.
There is not much point in duplicating the latter that are not binary specific, so it probably makes sense to gather them inside, and report them from, "git bugreport" itself.
Sure. Sounds great. Thanks for laying it out, this is very clear.
- Emily
PATCH v12 4/5 bugreport: add uname info
In reply to Emily ShafferThe 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.
--- Documentation/git-bugreport.txt | 1 + bugreport.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-)
Documentation/git-bugreport.txt +1 -0
@@ -26,6 +26,7 @@ The following information is requested from the user: The following information is captured automatically: - 'git version --build-options' + - uname sysname, release, version, and machine strings This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file
bugreport.c +15 -1
@@ -7,10 +7,24 @@static void get_system_info (struct strbuf *sys_info) { +struct utsname uname_info; +/* get git version from native cmd */ strbuf_addstr (sys_info,_ ("git version:\n" ));get_version_info (sys_info,1 ); -strbuf_complete_line (sys_info); + +/* system call for other version info */ +strbuf_addstr (sys_info,"uname: " ); +if (uname (&uname_info)) +strbuf_addf (sys_info,_ ("uname() failed with error '%s' (%d)\n" ), +strerror (errno), + errno); +else +strbuf_addf (sys_info,"%s %s %s %s\n" , + uname_info.sysname, + uname_info.release, + uname_info.version, + uname_info.machine); }static const char *const bugreport_usage[] = {
Signature · 1 line
2.26.0.292.g33ef6b2f38-goog
Re: [PATCH v12 4/5] bugreport: add uname info
Quoted 4 lines · Emily Shaffer
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.
Unlike "what's the verison of 'git'?" and "with what versions of which libraries does the 'git' the user is having trouble with links with?" I mentioned earlier in my review of [3/5], what this step deals with, i.e. "what are these properties of the running system?", is perfectly good to report from "git bugreport" itself.
Looking good.
Thanks.
Quoted 49 lines
Signed-off-by Emily Shaffer <[email protected]>--- Documentation/git-bugreport.txt | 1 + bugreport.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-)Documentation/git-bugreport.txt +1
-0@@ -26,6 +26,7 @@ The following information is requested from the user: The following information is captured automatically: - 'git version --build-options' + - uname sysname, release, version, and machine strings This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config filebugreport.c +15
-1@@ -7,10 +7,24 @@static void get_system_info (struct strbuf *sys_info) { +struct utsname uname_info; +/* get git version from native cmd */ strbuf_addstr (sys_info,_ ("git version:\n" ));get_version_info (sys_info,1 ); -strbuf_complete_line (sys_info); + +/* system call for other version info */ +strbuf_addstr (sys_info,"uname: " ); +if (uname (&uname_info)) +strbuf_addf (sys_info,_ ("uname() failed with error '%s' (%d)\n" ), +strerror (errno), + errno); +else +strbuf_addf (sys_info,"%s %s %s %s\n" , + uname_info.sysname, + uname_info.release, + uname_info.version, + uname_info.machine); }static const char *const bugreport_usage[] = {
PATCH v12 5/5 bugreport: add compiler info
In reply to Emily ShafferTo help pinpoint the source of a regression, it is useful to know some info about the compiler which the user's Git client was built with. By adding a generic get_compiler_info() in 'compat/' we can choose which relevant information to share per compiler; to get started, let's demonstrate the version of glibc if the user built with 'gcc'.
--- Documentation/git-bugreport.txt | 1 + bugreport.c | 6 +++++ compat/compiler.h | 41 +++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 compat/compiler.h
Documentation/git-bugreport.txt +1 -0
@@ -27,6 +27,7 @@ The following information is captured automatically: - 'git version --build-options' - uname sysname, release, version, and machine strings + - Compiler-specific info string This tool is invoked via the typical Git setup process, which means that in some cases, it might not be able to launch - for example, if a relevant config file
bugreport.c +6 -0
@@ -4,6 +4,7 @@#include "strbuf.h" #include "time.h" #include "help.h" +#include "compat/compiler.h" static void get_system_info (struct strbuf *sys_info) {
@@ -25,6 +26,11 @@ static void get_system_info(struct strbuf *sys_info) uname_info.release, uname_info.version, uname_info.machine); + +strbuf_addstr (sys_info,_ ("compiler info: " )); +get_compiler_info (sys_info); +strbuf_addstr (sys_info,_ ("libc info: " )); +get_libc_info (sys_info); }static const char *const bugreport_usage[] = {
compat/compiler.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.26.0.292.g33ef6b2f38-goog
Re: [PATCH v12 5/5] bugreport: add compiler info
Quoted 5 lines · Emily Shaffer
To help pinpoint the source of a regression, it is useful to know some info about the compiler which the user's Git client was built with. By adding a generic
get_compiler_info()in 'compat/' we can choose which relevant information to share per compiler; to get started, let's demonstrate the version of glibc if the user built with 'gcc'.
This one is not about "what system are we running on", but more about "how were the various pieces of Git binaries the user has trouble running built?". While it may be useful to learn how "git bugreport" was compiled, the same question about the other binaries of Git (e.g. "git" itself, or "git ls-files" that is builtin) may have different answers. It should be fairly trivial to teach the "git" binaries (i.e. "git" itself plus builtins, and standalone subcommands like "git-remote-curl" and "git-bugreport") to report how they were built (e.g. with what library and compiler) by calling the helpers you added in [3/5] and [5/5] and once that is done, it would be straight-forward to teach "git bugreport" to collect properties of them by invoking them and reading their output via the run_command() interface, as I mentioned in my review on [3/5] earlire.
Thanks.
Re: [PATCH v12 5/5] bugreport: add compiler info
In reply to Emily ShafferQuoted 1 line · Emily Shaffer
Helped-by Danh Doan <[email protected]>
If you ever send another version of this series, my Git identity is:
Đoàn Trần Công Danh <[email protected]>
Thanks,
Signature · 1 line
Danh
Re: [PATCH v12 5/5] bugreport: add compiler info
Quoted 8 lines · Danh Doan
Quoted 1 line · Emily Shaffer
Helped-by Danh Doan <[email protected]>If you ever send another version of this series, my Git identity is:
Đoàn Trần Công Danh <[email protected]>
Thanks,
Thanks.
Re: [PATCH v12 5/5] bugreport: add compiler info
Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Danh Doan
Quoted 1 line · Emily Shaffer
Helped-by Danh Doan <[email protected]>
Quoted 8 lines
Quoted 5 lines
If you ever send another version of this series, my Git identity is:
Đoàn Trần Công Danh <[email protected]>
Thanks,
Thanks.
Thanks Danh - I copied it from the email header, my apologies. Junio, since you replied as well does that mean you updated your copy and I don't need to re-send? (I haven't read the other comments yet, but your comment on the cover letter makes me think you don't want a v13.)
- Emily
Quoted 9 lines · Emily Shaffer
Since v11, reordered tests per SZEDER's comment so that the
test_when_finishedlines come first in each test.Emily Shaffer (5):
help: movelist_config_helpto builtin/help
bugreport: add tool to generate debugging info
bugreport: gather git version and build info
bugreport: add uname info
bugreport: add compiler info
Overall it was a pleasnt read.
Just to avoid misunderstanding, those comments in which I envisioned a way to report versions and attributes on different parts of "git" (and I expect we'd be reporting versions and add-ons to tools like 'wish' that runs gitk and git-gui, 'perl' and 'python' in a similar way---by finding them on the $PATH and asking them who they are) are NOT "without these, the bugreport tool would not be useful", but "we will in time need these, so let's keep them in mind" issues [*1*].
So, I am hoping that this is ready to move to 'next'.
Thanks.
[Footnote]
*1* What we saw here in the review showed us a very good starting point to report the version of the source one binary was built from, and the compiler and library that binary was built with, and various attributes of the system that is running that binary. Thanks to step [1/5], these helper functions can also be linked to help other parts of "git" (like the transport) report the first two (some code may further need to be moved so that they can be called from the built-ins and standalones). The system that the binary is running on would be the same anyway, so there is no need to duplicate that part of the report.