From 79bf149061fa29482512d903192a0d929e82872b Mon Sep 17 00:00:00 2001 From: Jonathan Nieder <jrnieder@gmail.com> Date: Mon, 26 Jul 2010 10:06:51 -0500 Subject: [PATCH 1/3] config --get --path: check for unset $HOME If $HOME is unset (as in some automated build situations), currently git config --path path.home "~" git config --path --get path.home segfaults. Error out with Failed to expand user dir in: '~/' instead. Reported-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- path.c | 2 ++ t/t1300-repo-config.sh | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/path.c b/path.c index aaa9345ebca..f6226fcd557 100644 --- a/path.c +++ b/path.c @@ -316,6 +316,8 @@ char *expand_user_path(const char *path) size_t username_len = first_slash - username; if (username_len == 0) { const char *home = getenv("HOME"); + if (!home) + goto return_null; strbuf_add(&user_path, home, strlen(home)); } else { struct passwd *pw = getpw_str(username, username_len); diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index f11f98c3ce7..7ddab5fb766 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -707,19 +707,41 @@ test_expect_success 'set --path' ' git config --path path.trailingtilde "foo~" && test_cmp expect .git/config' +if test "${HOME+set}" +then + test_set_prereq HOMEVAR +fi + cat >expect <<EOF $HOME/ /dev/null foo~ EOF -test_expect_success 'get --path' ' +test_expect_success HOMEVAR 'get --path' ' git config --get --path path.home > result && git config --get --path path.normal >> result && git config --get --path path.trailingtilde >> result && test_cmp expect result ' +cat >expect <<\EOF +/dev/null +foo~ +EOF + +test_expect_success 'get --path copes with unset $HOME' ' + ( + unset HOME; + test_must_fail git config --get --path path.home \ + >result 2>msg && + git config --get --path path.normal >>result && + git config --get --path path.trailingtilde >>result + ) && + grep "[Ff]ailed to expand.*~/" msg && + test_cmp expect result +' + rm .git/config git config quote.leading " test" From 593ce2bea5dad436e87b5dd37c205961d73feae9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano <gitster@pobox.com> Date: Tue, 27 Jul 2010 14:07:41 -0700 Subject: [PATCH 2/3] Git 1.7.0.7 Signed-off-by: Junio C Hamano <gitster@pobox.com> --- Documentation/RelNotes-1.7.0.7.txt | 16 ++++++++++++++++ Documentation/git.txt | 3 ++- GIT-VERSION-GEN | 2 +- RelNotes | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 Documentation/RelNotes-1.7.0.7.txt diff --git a/Documentation/RelNotes-1.7.0.7.txt b/Documentation/RelNotes-1.7.0.7.txt new file mode 100644 index 00000000000..d0cb7ca7e27 --- /dev/null +++ b/Documentation/RelNotes-1.7.0.7.txt @@ -0,0 +1,16 @@ +Git v1.7.0.7 Release Notes +========================== + +Fixes since v1.7.0.6 +-------------------- + + * "make NO_CURL=NoThanks install" was broken. + + * An overlong line after ".gitdir: " in a git file caused out of bounds + access to an array on the stack. + + * "git config --path conf.var" to attempt to expand a variable conf.var + that uses "~/" short-hand segfaulted when $HOME environment variable + was not set. + +And other minor fixes and documentation updates. diff --git a/Documentation/git.txt b/Documentation/git.txt index 105b0b580bc..46a215824e2 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -43,9 +43,10 @@ unreleased) version of git, that is available from 'master' branch of the `git.git` repository. Documentation for older releases are available here: -* link:v1.7.0.6/git.html[documentation for release 1.7.0.6] +* link:v1.7.0.7/git.html[documentation for release 1.7.0.7] * release notes for + link:RelNotes-1.7.0.7.txt[1.7.0.7], link:RelNotes-1.7.0.6.txt[1.7.0.6], link:RelNotes-1.7.0.5.txt[1.7.0.5], link:RelNotes-1.7.0.4.txt[1.7.0.4], diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 8ccaba87b4a..6a3f9456363 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.7.0.6 +DEF_VER=v1.7.0.7 LF=' ' diff --git a/RelNotes b/RelNotes index a9713ed4127..c150f36749e 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes-1.7.0.6.txt \ No newline at end of file +Documentation/RelNotes-1.7.0.7.txt \ No newline at end of file From 245b10ca1b0ff21de42b12ee2c1e3c9f8d1d98a3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano <gitster@pobox.com> Date: Tue, 27 Jul 2010 15:04:49 -0700 Subject: [PATCH 3/3] Git 1.7.1.2 Signed-off-by: Junio C Hamano <gitster@pobox.com> --- Documentation/RelNotes-1.7.1.2.txt | 9 +++++++++ Documentation/git.txt | 4 +++- GIT-VERSION-GEN | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/RelNotes-1.7.1.2.txt b/Documentation/RelNotes-1.7.1.2.txt index 46b6a960c79..61ba14e262a 100644 --- a/Documentation/RelNotes-1.7.1.2.txt +++ b/Documentation/RelNotes-1.7.1.2.txt @@ -17,3 +17,12 @@ Fixes since v1.7.1.1 * "git rev-parse --parseopt --stop-at-non-option" did not stop at non option when --keep-dashdash was in effect. + + * An overlong line after ".gitdir: " in a git file caused out of bounds + access to an array on the stack. + + * "git config --path conf.var" to attempt to expand a variable conf.var + that uses "~/" short-hand segfaulted when $HOME environment variable + was not set. + +And other minor fixes and documentation updates. diff --git a/Documentation/git.txt b/Documentation/git.txt index abbd9848e44..b5a4e3d4031 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -44,9 +44,11 @@ branch of the `git.git` repository. Documentation for older releases are available here: -* link:v1.7.1/git.html[documentation for release 1.7.1] +* link:v1.7.1.2/git.html[documentation for release 1.7.1.2] * release notes for + link:RelNotes-1.7.1.2.txt[1.7.1.2], + link:RelNotes-1.7.1.1.txt[1.7.1.1], link:RelNotes-1.7.1.txt[1.7.1]. * link:v1.7.0.7/git.html[documentation for release 1.7.0.7] diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index d4cb58e5df1..31d95da4f0a 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.7.1.1 +DEF_VER=v1.7.1.2 LF=' '