From 289796dd29dd656734cfd59b657deb943a71cf6a Mon Sep 17 00:00:00 2001 From: Don Zickus Date: Thu, 14 Aug 2008 11:35:42 -0400 Subject: mailinfo: re-fix MIME multipart boundary parsing Recent changes to is_multipart_boundary() caused git-mailinfo to segfault. The reason was after handling the end of the boundary the code tried to look for another boundary. Because the boundary list was empty, dereferencing the pointer to the top of the boundary caused the program to go boom. The fix is to check to see if the list is empty and if so go on its merry way instead of looking for another boundary. I also fixed a couple of increments and decrements that didn't look correct relating to content_top. The boundary test case was updated to catch future problems like this again. Signed-off-by: Don Zickus Signed-off-by: Junio C Hamano --- builtin-mailinfo.c | 6 +++--- t/t5100/sample.mbox | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c index 3577382d70..26d3e5d7af 100644 --- a/builtin-mailinfo.c +++ b/builtin-mailinfo.c @@ -175,7 +175,7 @@ static void handle_content_type(struct strbuf *line) message_type = TYPE_OTHER; if (slurp_attr(line->buf, "boundary=", boundary)) { strbuf_insert(boundary, 0, "--", 2); - if (content_top++ >= &content[MAX_BOUNDARIES]) { + if (++content_top > &content[MAX_BOUNDARIES]) { fprintf(stderr, "Too many boundaries to handle\n"); exit(1); } @@ -603,7 +603,7 @@ static void handle_filter(struct strbuf *line); static int find_boundary(void) { while (!strbuf_getline(&line, fin, '\n')) { - if (is_multipart_boundary(&line)) + if (*content_top && is_multipart_boundary(&line)) return 1; } return 0; @@ -626,7 +626,7 @@ again: /* technically won't happen as is_multipart_boundary() will fail first. But just in case.. */ - if (content_top-- < content) { + if (--content_top < content) { fprintf(stderr, "Detected mismatched boundaries, " "can't recover\n"); exit(1); diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox index d7ca79b1fc..4bf7947b41 100644 --- a/t/t5100/sample.mbox +++ b/t/t5100/sample.mbox @@ -500,3 +500,4 @@ index 3e5fe51..aabfe5c 100644 1.6.0.rc2 --=-=-=-- + -- cgit v1.2.3 From da9973c6f9600d90e64aac647f3ed22dfd692f70 Mon Sep 17 00:00:00 2001 From: Robert Schiele Date: Mon, 18 Aug 2008 16:17:04 +0200 Subject: adapt git-cvsserver manpage to dash-free syntax Signed-off-by: Robert Schiele Signed-off-by: Junio C Hamano --- Documentation/git-cvsserver.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt index c2d3c90d27..785779e221 100644 --- a/Documentation/git-cvsserver.txt +++ b/Documentation/git-cvsserver.txt @@ -11,7 +11,7 @@ SYNOPSIS SSH: [verse] -export CVS_SERVER=git-cvsserver +export CVS_SERVER="git cvsserver" 'cvs' -d :ext:user@server/path/repo.git co pserver (/etc/inetd.conf): @@ -109,7 +109,7 @@ Note: Newer CVS versions (>= 1.12.11) also support specifying CVS_SERVER directly in CVSROOT like ------ -cvs -d ":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git" co +cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co ------ This has the advantage that it will be saved in your 'CVS/Root' files and you don't need to worry about always setting the correct environment @@ -158,7 +158,7 @@ allowing access over SSH. -- ------ export CVSROOT=:ext:user@server:/var/git/project.git - export CVS_SERVER=git-cvsserver + export CVS_SERVER="git cvsserver" ------ -- 4. For SSH clients that will make commits, make sure their server-side @@ -283,7 +283,7 @@ To get a checkout with the Eclipse CVS client: Protocol notes: If you are using anonymous access via pserver, just select that. Those using SSH access should choose the 'ext' protocol, and configure 'ext' access on the Preferences->Team->CVS->ExtConnection pane. Set CVS_SERVER to -'git-cvsserver'. Note that password support is not good when using 'ext', +"'git cvsserver'". Note that password support is not good when using 'ext', you will definitely want to have SSH keys setup. Alternatively, you can just use the non-standard extssh protocol that Eclipse -- cgit v1.2.3 From 26e08a0190cb3354e43bab13ea693a5c826a8fe1 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Mon, 18 Aug 2008 18:17:53 -0500 Subject: t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0' Some old platforms have an old diff which doesn't have the -U option. 'git diff' can be used in its place. Adjust the comparison function to strip git's additional header lines to make this possible. Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- t/t1002-read-tree-m-u-2way.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh index aa9dd580a6..5e40cec530 100755 --- a/t/t1002-read-tree-m-u-2way.sh +++ b/t/t1002-read-tree-m-u-2way.sh @@ -14,6 +14,8 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" compare_change () { sed >current \ + -e '1{/^diff --git /d;}' \ + -e '2{/^index /d;}' \ -e '/^--- /d; /^+++ /d; /^@@ /d;' \ -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1" test_cmp expected current @@ -75,7 +77,7 @@ test_expect_success \ git update-index --add yomin && git read-tree -m -u $treeH $treeM && git ls-files --stage >4.out || return 1 - diff -U0 M.out 4.out >4diff.out + git diff -U0 --no-index M.out 4.out >4diff.out compare_change 4diff.out expected && check_cache_at yomin clean && sum bozbar frotz nitfol >actual4.sum && @@ -94,7 +96,7 @@ test_expect_success \ echo yomin yomin >yomin && git read-tree -m -u $treeH $treeM && git ls-files --stage >5.out || return 1 - diff -U0 M.out 5.out >5diff.out + git diff -U0 --no-index M.out 5.out >5diff.out compare_change 5diff.out expected && check_cache_at yomin dirty && sum bozbar frotz nitfol >actual5.sum && @@ -206,7 +208,7 @@ test_expect_success \ git update-index --add nitfol && git read-tree -m -u $treeH $treeM && git ls-files --stage >14.out || return 1 - diff -U0 M.out 14.out >14diff.out + git diff -U0 --no-index M.out 14.out >14diff.out compare_change 14diff.out expected && sum bozbar frotz >actual14.sum && grep -v nitfol M.sum > expected14.sum && @@ -227,7 +229,7 @@ test_expect_success \ echo nitfol nitfol nitfol >nitfol && git read-tree -m -u $treeH $treeM && git ls-files --stage >15.out || return 1 - diff -U0 M.out 15.out >15diff.out + git diff -U0 --no-index M.out 15.out >15diff.out compare_change 15diff.out expected && check_cache_at nitfol dirty && sum bozbar frotz >actual15.sum && -- cgit v1.2.3