From 0a0c342568458a15528778db1480dbbaa9a0b4d9 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 12 Oct 2009 21:37:39 +0200 Subject: [PATCH 1/7] git-stash documentation: mention default options for 'list' Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- Documentation/git-stash.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 1c64a02fe5..3ff653de84 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -66,7 +66,8 @@ stash@{1}: On master: 9cc0589... Add git-stash ---------------------------------------------------------------- + The command takes options applicable to the 'git-log' -command to control what is shown and how. See linkgit:git-log[1]. +command to control what is shown and how. If no options are set, the +default is `-n 10`. See linkgit:git-log[1]. show []:: From c6dfb399448f6de17ce417052f1bb345c9e022c9 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 13 Oct 2009 12:53:28 +0200 Subject: [PATCH 2/7] remote-curl: add missing initialization of argv0_path All programs, in particular also the stand-alone programs (non-builtins) must call git_extract_argv0_path(argv[0]) in order to help builds that derive the installation prefix at runtime, such as the MinGW build. Without this call, the program segfaults (or raises an assertion failure). Signed-off-by: Johannes Sixt Tested-by: Michael Wookey Signed-off-by: Junio C Hamano --- remote-curl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/remote-curl.c b/remote-curl.c index ad6a1637b5..d8d276a471 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -82,6 +82,7 @@ int main(int argc, const char **argv) const char *url; struct walker *walker = NULL; + git_extract_argv0_path(argv[0]); setup_git_directory(); if (argc < 2) { fprintf(stderr, "Remote needed\n"); From d01a8e32fe10f1086e5e427f85237baff218fb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Wed, 14 Oct 2009 00:11:09 +0200 Subject: [PATCH 3/7] clone: Supply the right commit hash to post-checkout when -b is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we use -b , we may checkout something else than what the remote's HEAD references, but we still used remote_head to supply the new ref value to the post-checkout hook, which is wrong. So instead of using remote_head to find the value to be passed to the post-checkout hook, we have to use our_head_points_at, which is always correctly setup, even if -b is not used. This also fixes a segfault when "clone -b " is used with a remote repo that doesn't have a valid HEAD, as in such a case remote_head is NULL, but we still tried to access it. Reported-by: Devin Cofer Signed-off-by: Björn Steinbrink Acked-by: Jeff King Signed-off-by: Junio C Hamano --- builtin-clone.c | 3 ++- remote-curl.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin-clone.c b/builtin-clone.c index 4992c2597c..5762a6f9d8 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -641,7 +641,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix) die("unable to write new index file"); err |= run_hook(NULL, "post-checkout", sha1_to_hex(null_sha1), - sha1_to_hex(remote_head->old_sha1), "1", NULL); + sha1_to_hex(our_head_points_at->old_sha1), "1", + NULL); if (!err && option_recursive) err = run_command_v_opt(argv_submodule, RUN_GIT_CMD); diff --git a/remote-curl.c b/remote-curl.c index d8d276a471..2faf1c6344 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -3,6 +3,7 @@ #include "strbuf.h" #include "walker.h" #include "http.h" +#include "exec_cmd.h" static struct ref *get_refs(struct walker *walker, const char *url) { From 583371af1f88e9cd48fedbb6bbb147d8091fd591 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 13 Oct 2009 23:02:04 -0400 Subject: [PATCH 4/7] change throughput display units with fast links Switch to MiB/s when the connection is fast enough (i.e. on a LAN). Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- progress.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/progress.c b/progress.c index 132ed95a3d..3971f49f4d 100644 --- a/progress.c +++ b/progress.c @@ -131,7 +131,13 @@ static void throughput_string(struct throughput *tp, off_t total, } else { l -= snprintf(tp->display, l, ", %u bytes", (int)total); } - if (rate) + + if (rate > 1 << 10) { + int x = rate + 5; /* for rounding */ + snprintf(tp->display + sizeof(tp->display) - l, l, + " | %u.%2.2u MiB/s", + x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10); + } else if (rate) snprintf(tp->display + sizeof(tp->display) - l, l, " | %u KiB/s", rate); } From b3118bdc91876cbc04b7e81dcf7bea71d86ce4f8 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 14 Oct 2009 07:23:51 -0700 Subject: [PATCH 5/7] sha1_file: Fix infinite loop when pack is corrupted Some types of corruption to a pack may confuse the deflate stream which stores an object. In Andy's reported case a 36 byte region of the pack was overwritten, leading to what appeared to be a valid deflate stream that was trying to produce a result larger than our allocated output buffer could accept. Z_BUF_ERROR is returned from inflate() if either the input buffer needs more input bytes, or the output buffer has run out of space. Previously we only considered the former case, as it meant we needed to move the stream's input buffer to the next window in the pack. We now abort the loop if inflate() returns Z_BUF_ERROR without consuming the entire input buffer it was given, or has filled the entire output buffer but has not yet returned Z_STREAM_END. Either state is a clear indicator that this loop is not working as expected, and should not continue. This problem cannot occur with loose objects as we open the entire loose object as a single buffer and treat Z_BUF_ERROR as an error. Reported-by: Andy Isaacson Signed-off-by: Shawn O. Pearce Acked-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- sha1_file.c | 4 ++++ t/t5303-pack-corruption-resilience.sh | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/sha1_file.c b/sha1_file.c index 4ea0b18d0a..4cc8939e4b 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1357,6 +1357,8 @@ unsigned long get_size_from_delta(struct packed_git *p, in = use_pack(p, w_curs, curpos, &stream.avail_in); stream.next_in = in; st = git_inflate(&stream, Z_FINISH); + if (st == Z_BUF_ERROR && (stream.avail_in || !stream.avail_out)) + break; curpos += stream.next_in - in; } while ((st == Z_OK || st == Z_BUF_ERROR) && stream.total_out < sizeof(delta_head)); @@ -1594,6 +1596,8 @@ static void *unpack_compressed_entry(struct packed_git *p, in = use_pack(p, w_curs, curpos, &stream.avail_in); stream.next_in = in; st = git_inflate(&stream, Z_FINISH); + if (st == Z_BUF_ERROR && (stream.avail_in || !stream.avail_out)) + break; curpos += stream.next_in - in; } while (st == Z_OK || st == Z_BUF_ERROR); git_inflate_end(&stream); diff --git a/t/t5303-pack-corruption-resilience.sh b/t/t5303-pack-corruption-resilience.sh index 5132d41309..5f6cd4f333 100755 --- a/t/t5303-pack-corruption-resilience.sh +++ b/t/t5303-pack-corruption-resilience.sh @@ -275,4 +275,13 @@ test_expect_success \ git cat-file blob $blob_2 > /dev/null && git cat-file blob $blob_3 > /dev/null' +test_expect_success \ + 'corrupting header to have too small output buffer fails unpack' \ + 'create_new_pack && + git prune-packed && + printf "\262\001" | do_corrupt_object $blob_1 0 && + test_must_fail git cat-file blob $blob_1 > /dev/null && + test_must_fail git cat-file blob $blob_2 > /dev/null && + test_must_fail git cat-file blob $blob_3 > /dev/null' + test_done From cfe370c6476392095bc3f18013d195b1cccd6184 Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Fri, 16 Oct 2009 07:13:25 -0700 Subject: [PATCH 6/7] grep: do not segfault when -f is used "git grep" would segfault if its -f option was used because it would try to use an uninitialized strbuf, so initialize the strbuf. Thanks to Johannes Sixt for the help with the test cases. Signed-off-by: Matt Kraai Signed-off-by: Junio C Hamano --- builtin-grep.c | 2 +- t/t7002-grep.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/builtin-grep.c b/builtin-grep.c index fd450bc16e..e3b940b933 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -599,7 +599,7 @@ static int file_callback(const struct option *opt, const char *arg, int unset) struct grep_opt *grep_opt = opt->value; FILE *patterns; int lno = 0; - struct strbuf sb; + struct strbuf sb = STRBUF_INIT; patterns = fopen(arg, "r"); if (!patterns) diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 6ca11d7146..5f91d82297 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -164,6 +164,72 @@ test_expect_success 'grep -e A --and --not -e B' ' test_cmp expected actual ' +test_expect_success 'grep -f, non-existent file' ' + test_must_fail git grep -f patterns +' + +cat >expected <pattern <actual && + test_cmp expected actual +' + +cat >expected <patterns <actual && + test_cmp expected actual +' + +cat >expected <patterns <actual && + test_cmp expected actual +' + cat >expected < Date: Fri, 16 Oct 2009 23:56:55 -0700 Subject: [PATCH 7/7] GIT 1.6.5.1 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.6.5.1.txt | 20 ++++++++++++++++++++ Documentation/git.txt | 1 + GIT-VERSION-GEN | 2 +- RelNotes | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 Documentation/RelNotes-1.6.5.1.txt diff --git a/Documentation/RelNotes-1.6.5.1.txt b/Documentation/RelNotes-1.6.5.1.txt new file mode 100644 index 0000000000..309ba181b2 --- /dev/null +++ b/Documentation/RelNotes-1.6.5.1.txt @@ -0,0 +1,20 @@ +GIT v1.6.5.1 Release Notes +========================== + +Fixes since v1.6.5 +------------------ + + * An corrupt pack could make codepath to read objects into an + infinite loop. + + * Download throughput display was always shown in KiB/s but on fast links + it is more appropriate to show it in MiB/s. + + * "git grep -f filename" used uninitialized variable and segfaulted. + + * "git clone -b branch" gave a wrong commit object name to post-checkout + hook. + + * "git pull" over http did not work on msys. + +Other minor documentation updates are included. diff --git a/Documentation/git.txt b/Documentation/git.txt index d97aaf5bf8..d11c5c1651 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -46,6 +46,7 @@ Documentation for older releases are available here: * link:v1.6.5/git.html[documentation for release 1.6.5] * release notes for + link:RelNotes-1.6.5.1.txt[1.6.5.1], link:RelNotes-1.6.5.txt[1.6.5]. * link:v1.6.4.4/git.html[documentation for release 1.6.4.4] diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 08e6073f33..d11e43cf31 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.6.5 +DEF_VER=v1.6.5.1 LF=' ' diff --git a/RelNotes b/RelNotes index b62449d2e2..dda06d1d8f 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes-1.6.5.txt \ No newline at end of file +Documentation/RelNotes-1.6.5.1.txt \ No newline at end of file