git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [ANNOUNCE] Git v2.9.1

From
Jeff King <peff@peff.net>
Date
Jul 12, 2016, 03:57 UTC
Message-ID
<20160712035719.GA30281@sigill.intra.peff.net>
In-Reply-To
<xmqqy4577h0o.fsf@gitster.mtv.corp.google.com>
On Mon, Jul 11, 2016 at 06:59:51PM -0700, Junio C Hamano wrote:
Show 21 quoted lines
> > diff --git a/help.c b/help.c
> > index 19328ea..0cea240 100644
> > --- a/help.c
> > +++ b/help.c
> > @@ -419,6 +419,13 @@ int cmd_version(int argc, const char **argv, const char *prefix)
> >  	 * with external projects that rely on the output of "git version".
> >  	 */
> >  	printf("git version %s\n", git_version_string);
> > +	while (*++argv) {
> > +		if (!strcmp(*argv, "--build-options")) {
> > +			printf("sizeof-unsigned-long: %d",
> > +			       (int)sizeof(unsigned long));
> > +			/* maybe also save and output GIT-BUILD_OPTIONS? */
> > +		}
> > +	}
> >  	return 0;
> >  }
> 
> I had the same thought, except that I would have expected this to go
> to one of these test-* helpers, and then a lazy prereq for 64-bit
> time_t would be written on top of it to skip these new tests.
Yeah, that would certainly work.

However, I was thinking that it might be handy to have this and some other information available for helping with debugging. E.g., that we could ask bug reporters for "git version --build-options" when we suspect something related to their config.

Something along the lines of the patch below, which lets you do:
  $ ./git version --build-options
  git version 2.9.0.243.g5c589a7.dirty
  sizeof-unsigned-long: 8
  SHELL_PATH: /bin/sh
  PERL_PATH: /usr/bin/perl
  DIFF: diff
  PYTHON_PATH: /usr/bin/python
  TAR: tar
  NO_CURL: 
  NO_EXPAT: 
  USE_LIBPCRE: YesPlease
  NO_PERL: 
  NO_PYTHON: 
  NO_UNIX_SOCKETS: 
  GIT_TEST_OPTS: --root=/var/ram/git-tests
  NO_GETTEXT: Nope
  GETTEXT_POISON: 

That's not all of the knobs, though; it's just what we stick in BUILD-OPTIONS to trigger script rebuilds and communicate with the test scripts. So I think there would potentially be further work to do. But it's at least a start. I dunno.

Show 8 quoted lines
> It is somewhat disturbing that nobody seems to be regularly building
> on 32-bit platforms these days, which is the only reason I can think
> of why this was never reported until it hit a maintenance track.
> This should have been caught last week at f6a729f3 (Merge branch
> 'jk/tzoffset-fix', 2016-07-06) when the topic hit 'master' at the
> latest, and more preferrably it should have already been caught last
> month at 08ec8c5e (Merge branch 'jk/tzoffset-fix' into next,
> 2016-06-28).

I dream of a world where there are no 32-bit platforms at all, but sadly we are stuck in the middle ground where they are rare enough that nobody bothers to test on them early, but not rare enough that somebody doesn't complain within 24 hours of making a release. :-/

-Peff
---
diff --git a/Makefile b/Makefile
index de5a030..78d96a0 100644
--- a/Makefile
+++ b/Makefile
@@ -669,6 +669,7 @@ XDIFF_LIB = xdiff/lib.a
 VCSSVN_LIB = vcs-svn/lib.a
 
 GENERATED_H += common-cmds.h
+GENERATED_H += build-options.h
 
 LIB_H = $(shell $(FIND) . \
 	-name .git -prune -o \
@@ -1711,7 +1712,7 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) git.o \
 		$(BUILTIN_OBJS) $(LIBS)
 
-help.sp help.s help.o: common-cmds.h
+help.sp help.s help.o: common-cmds.h build-options.h
 
 builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h GIT-PREFIX
 builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
@@ -1735,6 +1736,9 @@ common-cmds.h: generate-cmdlist.sh command-list.txt
 common-cmds.h: $(wildcard Documentation/git-*.txt)
 	$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@
 
+build-options.h: generate-build-options.sh GIT-BUILD-OPTIONS
+	$(QUIET_GEN)$(SHELL_PATH) ./generate-build-options.sh GIT-BUILD-OPTIONS >$@+ && mv $@+ $@
+
 SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
 	$(localedir_SQ):$(NO_CURL):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\
 	$(gitwebdir_SQ):$(PERL_PATH_SQ):$(SANE_TEXT_GREP)
diff --git a/generate-build-options.sh b/generate-build-options.sh
new file mode 100644
index 0000000..250728f
--- /dev/null
+++ b/generate-build-options.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+c_quote () {
+	printf '%s' "$1" |
+	sed -e 's/\\/\\\\/g' -e 's/"/\\"/g'
+}
+
+echo '#ifndef BUILD_OPTIONS_H'
+echo '#define BUILD_OPTIONS_H'
+echo "/* Automatically generated by $0 */"
+echo
+echo '#define BUILD_OPTIONS \'
+
+for source in "$@"; do
+	# source/eval trickery is there to unquote the values
+	. "./$source"
+	for var in $(cut -d= -f1 "$source"); do
+		printf '"%s: ' "$var"
+		eval "c_quote \"\$$var\""
+		printf '\\n" \\\n'
+	done
+done
+
+echo
+echo '#endif /* BUILD_OPTIONS_H */'
diff --git a/help.c b/help.c
index 19328ea..1cbee86 100644
--- a/help.c
+++ b/help.c
@@ -8,6 +8,7 @@
 #include "column.h"
 #include "version.h"
 #include "refs.h"
+#include "build-options.h"
 
 void add_cmdname(struct cmdnames *cmds, const char *name, int len)
 {
@@ -419,6 +420,13 @@ int cmd_version(int argc, const char **argv, const char *prefix)
 	 * with external projects that rely on the output of "git version".
 	 */
 	printf("git version %s\n", git_version_string);
+	while (*++argv) {
+		if (!strcmp(*argv, "--build-options")) {
+			printf("sizeof-unsigned-long: %d\n",
+			       (int)sizeof(unsigned long));
+			printf("%s", BUILD_OPTIONS);
+		}
+	}
 	return 0;
 }
 
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 56 in “[ANNOUNCE] Git v2.9.1”
  1. Junio C HamanoJul 11, 2016
  2. Andreas SchwabJul 11, 2016
  3. Jeff KingJul 11, 2016
  4. Anders KaseorgJul 12, 2016
  5. Jeff KingJul 12, 2016
  6. Eric WongJul 12, 2016
  7. Jeff KingJul 12, 2016
  8. Junio C HamanoJul 12, 2016
  9. Jeff KingJul 12, 2016
  10. Junio C HamanoJul 12, 2016
  11. Johannes SchindelinJul 12, 2016
  12. Jeff KingJul 12, 2016
  13. Johannes SchindelinJul 12, 2016
  14. Jeff KingJul 12, 2016
  15. Johannes SchindelinJul 13, 2016
  16. Junio C HamanoJul 13, 2016
  17. Johannes SchindelinJul 13, 2016
  18. Junio C HamanoJul 13, 2016
  19. Johannes SchindelinJul 14, 2016
  20. Junio C HamanoJul 12, 2016
  21. Junio C HamanoJul 13, 2016
  22. Jeff KingJul 13, 2016
  23. Junio C HamanoJul 13, 2016
  24. Johannes SchindelinJul 13, 2016
  25. Junio C HamanoJul 13, 2016
  26. Johannes SchindelinJul 14, 2016
  27. Andreas SchwabJul 14, 2016
  28. Jeff KingJul 14, 2016
  29. Johannes SchindelinJul 14, 2016
  30. Andreas SchwabJul 12, 2016
  31. Johannes SchindelinJul 12, 2016
  32. Andreas SchwabJul 12, 2016
  33. Johannes SchindelinJul 12, 2016
  34. Andreas SchwabJul 12, 2016
  35. Jeff KingJul 12, 2016
  36. Duy NguyenJul 12, 2016
  37. Johannes SchindelinJul 13, 2016
  38. Johannes SchindelinJul 13, 2016
  39. Junio C HamanoJul 12, 2016
  40. Jeff KingJul 12, 2016
  41. Junio C HamanoJul 12, 2016
  42. Jeff KingJul 12, 2016
  43. Junio C HamanoJul 12, 2016
  44. Jeff KingJul 12, 2016
  45. Junio C HamanoJul 12, 2016
  46. Johannes SchindelinJul 13, 2016
  47. Junio C HamanoJul 13, 2016
  48. Johannes SchindelinJul 13, 2016
  49. Andreas SchwabJul 12, 2016
  50. Junio C HamanoJul 13, 2016
  51. Lars SchneiderJul 14, 2016
  52. Duy NguyenJul 16, 2016
  53. 32-bit Travis, was Re: [ANNOUNCE] Git v2.9.1Johannes Schindelin, Jul 14, 2016
  54. Mike HommeyJul 14, 2016
  55. Johannes SchindelinJul 14, 2016
  56. Mike HommeyJul 15, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.