git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>, git@vger.kernel.org
Subject: Re: [ANNOUNCE] Git v2.9.1
Date: Mon, 11 Jul 2016 23:57:19 -0400	[thread overview]
Message-ID: <20160712035719.GA30281@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqy4577h0o.fsf@gitster.mtv.corp.google.com>

On Mon, Jul 11, 2016 at 06:59:51PM -0700, Junio C Hamano wrote:

> > 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.

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

  reply	other threads:[~2016-07-12  3:57 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11 20:13 [ANNOUNCE] Git v2.9.1 Junio C Hamano
2016-07-11 21:35 ` Andreas Schwab
2016-07-11 23:54   ` Jeff King
2016-07-12  0:40     ` Anders Kaseorg
2016-07-12 14:06       ` Jeff King
2016-07-12  0:56     ` Eric Wong
2016-07-12  1:15       ` Jeff King
2016-07-12  1:59     ` Junio C Hamano
2016-07-12  3:57       ` Jeff King [this message]
2016-07-12 15:55         ` Junio C Hamano
2016-07-12  7:30       ` Johannes Schindelin
2016-07-12  7:39         ` Jeff King
2016-07-12 11:25           ` Johannes Schindelin
2016-07-12 14:04             ` Jeff King
2016-07-13 11:35               ` Johannes Schindelin
2016-07-13 16:03                 ` Junio C Hamano
2016-07-13 19:10                   ` Johannes Schindelin
2016-07-13 19:41                     ` Junio C Hamano
2016-07-14  7:50                       ` Johannes Schindelin
2016-07-12 18:12             ` Junio C Hamano
2016-07-13  1:53               ` Junio C Hamano
2016-07-13  2:01               ` Jeff King
2016-07-13 16:05                 ` Junio C Hamano
2016-07-13 18:52                   ` Johannes Schindelin
2016-07-13 19:07                     ` Junio C Hamano
2016-07-14  7:45                       ` Johannes Schindelin
2016-07-14  8:01                         ` Andreas Schwab
2016-07-14  8:15                         ` Jeff King
2016-07-14 16:06                       ` Johannes Schindelin
2016-07-12  7:40         ` Andreas Schwab
2016-07-12 10:57           ` Johannes Schindelin
2016-07-12 13:00             ` Andreas Schwab
2016-07-12 13:22               ` Johannes Schindelin
2016-07-12 13:31                 ` Andreas Schwab
2016-07-12 13:46                   ` Jeff King
2016-07-12 18:38                     ` Duy Nguyen
2016-07-13 11:29                       ` Johannes Schindelin
2016-07-13 11:25                   ` Johannes Schindelin
2016-07-12 14:34         ` Junio C Hamano
2016-07-12 15:16           ` Jeff King
2016-07-12 15:25             ` Junio C Hamano
2016-07-12 15:35               ` Jeff King
2016-07-12 15:41                 ` Junio C Hamano
2016-07-12 16:09                   ` Jeff King
2016-07-12 16:25                     ` Junio C Hamano
2016-07-13 14:00                       ` Johannes Schindelin
2016-07-13 16:10                         ` Junio C Hamano
2016-07-13 18:53                           ` Johannes Schindelin
2016-07-12 18:15                     ` Andreas Schwab
2016-07-13 20:43       ` Junio C Hamano
2016-07-14  7:38         ` Lars Schneider
2016-07-16  5:50           ` Duy Nguyen
2016-07-14  7:58         ` 32-bit Travis, was " Johannes Schindelin
2016-07-14  9:12           ` Mike Hommey
2016-07-14 10:58             ` Johannes Schindelin
2016-07-15  1:59               ` Mike Hommey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160712035719.GA30281@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).