From 01bafdbe39c7018e535cb7be0b63c468dfa9986f Mon Sep 17 00:00:00 2001 From: "Tom G. Christensen" Date: Sun, 10 Apr 2016 11:51:18 +0200 Subject: [PATCH] git: update to 2.8.1 --- git/build.sh | 13 +++- git/meta/ChangeLog | 3 + git/src/git-2.8.1-all-non-zero-returns.patch | 37 ++++++++++ .../git-2.8.1-avoid-null-with-printf.patch | 46 ++++++++++++ git/src/git-2.8.1-handle-unset-errors.patch | 44 +++++++++++ .../git-2.8.1-lower-case-error-strings.patch | 73 +++++++++++++++++++ 6 files changed, 212 insertions(+), 4 deletions(-) create mode 100644 git/src/git-2.8.1-all-non-zero-returns.patch create mode 100644 git/src/git-2.8.1-avoid-null-with-printf.patch create mode 100644 git/src/git-2.8.1-handle-unset-errors.patch create mode 100644 git/src/git-2.8.1-lower-case-error-strings.patch diff --git a/git/build.sh b/git/build.sh index 819c1ce..3e0aa0a 100755 --- a/git/build.sh +++ b/git/build.sh @@ -6,24 +6,29 @@ ########################################################### # Check the following 4 variables before running the script topdir=git -version=2.6.4 +version=2.8.1 pkgver=1 source[0]=https://www.kernel.org/pub/software/scm/git/$topdir-$version.tar.gz source[1]=https://www.kernel.org/pub/software/scm/git/$topdir-manpages-$version.tar.gz # If there are no patches, simply comment this patch[0]=git-1.8.1.5-inet_addrstrlen.patch patch[1]=git-2.6.3-stdint_h.patch +patch[2]=git-2.8.1-avoid-null-with-printf.patch +patch[3]=git-2.8.1-lower-case-error-strings.patch +patch[4]=git-2.8.1-all-non-zero-returns.patch +patch[5]=git-2.8.1-handle-unset-errors.patch # Source function library . ${BUILDPKG_SCRIPTS}/buildpkg.functions # Global settings - no_configure=1 __configure="make" configure_args= make_build_target="V=1" make_check_target="test" +# gcc 4.3.6 will cause a SIGBUS in memcpy on 2.6/SPARC +export CC="/usr/tgcware/gcc42/bin/gcc" reg prep prep() @@ -31,7 +36,7 @@ prep() generic_prep setdir source cat << EOF > config.mak -CC=gcc +CC=$CC PERL_PATH=$prefix/bin/perl SHELL_PATH=$prefix/bin/bash ICONVDIR=$prefix @@ -73,7 +78,7 @@ install() setdir ${stagedir}${prefix}/${_mandir} ${__tar} -xf $(get_source_absfilename "${source[1]}") chmod 755 ${stagedir}${prefix}/${_mandir} - doc COPYING Documentation/RelNotes/${version}.txt README + doc COPYING Documentation/RelNotes/${version}.txt README.md # fix git symlink ${__rm} -f ${stagedir}${prefix}/libexec/git-core/git diff --git a/git/meta/ChangeLog b/git/meta/ChangeLog index b9cf8ae..5a10f94 100644 --- a/git/meta/ChangeLog +++ b/git/meta/ChangeLog @@ -1,5 +1,8 @@ CHANGELOG --------- +* Fri Apr 08 2016 Tom G. Christensen - 2.8.1-1 +- Update to 2.8.1 + * Sat Dec 12 2015 Tom G. Christensen - 2.6.4-1 - Update to 2.6.4 diff --git a/git/src/git-2.8.1-all-non-zero-returns.patch b/git/src/git-2.8.1-all-non-zero-returns.patch new file mode 100644 index 0000000..dc0b647 --- /dev/null +++ b/git/src/git-2.8.1-all-non-zero-returns.patch @@ -0,0 +1,37 @@ +From: Jeff King +Subject: [PATCH 2/3] git_config_set_multivar_in_file: all non-zero returns + are errors +Date: Sat, 9 Apr 2016 13:42:54 -0400 + +This function is just a thin wrapper for the "_gently" form +of the function. But the gently form is designed to feed +builtin/config.c, which passes our return code directly to +its exit status, and thus uses positive error values for +some cases. We check only negative values, meaning we would +fail to die in some cases (e.g., a malformed key). + +This may or may not be triggerable in practice; we tend to +use this non-gentle form only when setting internal +variables, which would not have malformed keys. + +Signed-off-by: Jeff King +--- + config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config.c b/config.c +index 6b81931..d446315 100644 +--- a/config.c ++++ b/config.c +@@ -2222,7 +2222,7 @@ void git_config_set_multivar_in_file(const char *config_filename, + const char *value_regex, int multi_replace) + { + if (git_config_set_multivar_in_file_gently(config_filename, key, value, +- value_regex, multi_replace) < 0) ++ value_regex, multi_replace)) + die(_("could not set '%s' to '%s'"), key, value); + } + +-- +2.8.1.245.g18e0f5c + diff --git a/git/src/git-2.8.1-avoid-null-with-printf.patch b/git/src/git-2.8.1-avoid-null-with-printf.patch new file mode 100644 index 0000000..5ba1fa4 --- /dev/null +++ b/git/src/git-2.8.1-avoid-null-with-printf.patch @@ -0,0 +1,46 @@ +From: Junio C Hamano +Subject: setup.c: do not feed NULL to "%.*s" even with the precision 0 + +A recent update 75faa45a (replace trivial malloc + sprintf / strcpy +calls with xstrfmt, 2015-09-24) rewrote + + prepare an empty buffer + if (len) + append the first len bytes of "prefix" to the buffer + append "path" to the buffer + +that computed "path", optionally prefixed by "prefix", into + + xstrfmt("%.*s%s", len, prefix, path); + +However, passing a NULL pointer to the printf(3) family of functions +to format it with %s conversion, even with the precision 0, i.e. + + xstrfmt("%.*s", 0, NULL) + +yields undefined results, at least on some platforms. + +Avoid this problem by substituting prefix with "" when len==0, as +prefix can legally be NULL in that case. This would mimick the +intent of the original code better. + +Reported-by: "Tom G. Christensen" +Helped-by: Jeff King +Signed-off-by: Junio C Hamano +--- + setup.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.c b/setup.c +index 3439ec6..b4a92fe 100644 +--- a/setup.c ++++ b/setup.c +@@ -103,7 +103,7 @@ char *prefix_path_gently(const char *prefix, int len, + return NULL; + } + } else { +- sanitized = xstrfmt("%.*s%s", len, prefix, path); ++ sanitized = xstrfmt("%.*s%s", len, len ? prefix : "", path); + if (remaining_prefix) + *remaining_prefix = len; + if (normalize_path_copy_len(sanitized, sanitized, remaining_prefix)) { diff --git a/git/src/git-2.8.1-handle-unset-errors.patch b/git/src/git-2.8.1-handle-unset-errors.patch new file mode 100644 index 0000000..4a9a850 --- /dev/null +++ b/git/src/git-2.8.1-handle-unset-errors.patch @@ -0,0 +1,44 @@ +From: Jeff King +Subject: [PATCH 3/3] git_config_set_multivar_in_file: handle "unset" errors +Date: Sat, 9 Apr 2016 13:43:54 -0400 + +We pass off to the "_gently" form to do the real work, and +just die() if it returned an error. However, our die message +de-references "value", which may be NULL if the request was +to unset a variable. Nobody using glibc noticed, because it +simply prints "(null)", which is good enough for the test +suite (and presumably very few people run across this in +practice). But other libc implementations (like Solaris) may +segfault. + +Let's not only fix that, but let's make the message more +clear about what is going on in the "unset" case. + +Reported-by: "Tom G. Christensen" +Signed-off-by: Jeff King +--- + config.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/config.c b/config.c +index d446315..3fe40c3 100644 +--- a/config.c ++++ b/config.c +@@ -2221,9 +2221,13 @@ void git_config_set_multivar_in_file(const char *config_filename, + const char *key, const char *value, + const char *value_regex, int multi_replace) + { +- if (git_config_set_multivar_in_file_gently(config_filename, key, value, +- value_regex, multi_replace)) ++ if (!git_config_set_multivar_in_file_gently(config_filename, key, value, ++ value_regex, multi_replace)) ++ return; ++ if (value) + die(_("could not set '%s' to '%s'"), key, value); ++ else ++ die(_("could not unset '%s'"), key); + } + + int git_config_set_multivar_gently(const char *key, const char *value, +-- +2.8.1.245.g18e0f5c diff --git a/git/src/git-2.8.1-lower-case-error-strings.patch b/git/src/git-2.8.1-lower-case-error-strings.patch new file mode 100644 index 0000000..2fb89a9 --- /dev/null +++ b/git/src/git-2.8.1-lower-case-error-strings.patch @@ -0,0 +1,73 @@ +From: Jeff King +Subject: [PATCH 1/3] config: lower-case first word of error strings +Date: Sat, 9 Apr 2016 13:42:31 -0400 + +This follows our usual style (both throughout git, and +throughout the rest of this file). + +This covers the whole file, but note that I left the capitalization in +the multi-sentence: + + error: malformed value... + error: Must be one of ... + +because it helps make it clear that we are starting a new sentence in +the second one. + +Signed-off-by: Jeff King +--- + config.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/config.c b/config.c +index 8f66519..6b81931 100644 +--- a/config.c ++++ b/config.c +@@ -108,7 +108,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc + + expanded = expand_user_path(path); + if (!expanded) +- return error("Could not expand include path '%s'", path); ++ return error("could not expand include path '%s'", path); + path = expanded; + + /* +@@ -950,7 +950,7 @@ static int git_default_branch_config(const char *var, const char *value) + else if (!strcmp(value, "always")) + autorebase = AUTOREBASE_ALWAYS; + else +- return error("Malformed value for %s", var); ++ return error("malformed value for %s", var); + return 0; + } + +@@ -976,7 +976,7 @@ static int git_default_push_config(const char *var, const char *value) + else if (!strcmp(value, "current")) + push_default = PUSH_DEFAULT_CURRENT; + else { +- error("Malformed value for %s: %s", var, value); ++ error("malformed value for %s: %s", var, value); + return error("Must be one of nothing, matching, simple, " + "upstream or current."); + } +@@ -2223,7 +2223,7 @@ void git_config_set_multivar_in_file(const char *config_filename, + { + if (git_config_set_multivar_in_file_gently(config_filename, key, value, + value_regex, multi_replace) < 0) +- die(_("Could not set '%s' to '%s'"), key, value); ++ die(_("could not set '%s' to '%s'"), key, value); + } + + int git_config_set_multivar_gently(const char *key, const char *value, +@@ -2404,7 +2404,7 @@ int git_config_rename_section(const char *old_name, const char *new_name) + #undef config_error_nonbool + int config_error_nonbool(const char *var) + { +- return error("Missing value for '%s'", var); ++ return error("missing value for '%s'", var); + } + + int parse_config_key(const char *var, +-- +2.8.1.245.g18e0f5c +