diff --git a/setup.c b/setup.c index 87c21f02e0..2769160527 100644 --- a/setup.c +++ b/setup.c @@ -170,6 +170,8 @@ static int is_git_directory(const char *suspect) char path[PATH_MAX]; size_t len = strlen(suspect); + if (PATH_MAX <= len + strlen("/objects")) + die("Too long path: %.*s", 60, suspect); strcpy(path, suspect); if (getenv(DB_ENVIRONMENT)) { if (access(getenv(DB_ENVIRONMENT), X_OK)) diff --git a/t/README b/t/README index b906ceb476..a590142438 100644 --- a/t/README +++ b/t/README @@ -451,8 +451,10 @@ library for your script to use. - test_must_fail Run a git command and ensure it fails in a controlled way. Use - this instead of "! " to fail when git commands - segfault. + this instead of "! ". When git-command dies due to a + segfault, test_must_fail diagnoses it as an error; "! " + treats it as just another expected failure, which would let such a + bug go unnoticed. - test_might_fail diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index 71effc5bec..e733f6516f 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -145,7 +145,7 @@ test_http_push_nonff() { echo "changed" > path2 && git commit -a -m path2 --amend && - !(git push -v origin >output 2>&1) && + test_must_fail git push -v origin >output 2>&1 && (cd "$REMOTE_REPO" && test $HEAD = $(git rev-parse --verify HEAD)) ' diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 47fbf5362f..d03495dc7a 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -268,7 +268,7 @@ test_expect_success 'git add --dry-run of existing changed file' " test_expect_success 'git add --dry-run of non-existing file' " echo ignored-file >>.gitignore && - ! (git add --dry-run track-this ignored-file >actual 2>&1) && + test_must_fail git add --dry-run track-this ignored-file >actual 2>&1 && echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual " @@ -281,7 +281,7 @@ add 'track-this' EOF test_expect_success 'git add --dry-run --ignore-missing of non-existing file' ' - !(git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1) && + test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1 && test_cmp expect actual ' diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index 504884b9f8..b0c2a2c3ae 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push.sh @@ -128,7 +128,7 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he # push master too; this ensures there is at least one '"'push'"' command to # the remote helper and triggers interaction with the helper. - !(git push -v origin +master master:retsam >output 2>&1) && + test_must_fail git push -v origin +master master:retsam >output 2>&1 && grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output && grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&