git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 6/6] fsck: report invalid object type-path combinations

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 13, 2021, 09:43 UTC
Message-ID
<patch-6.6-226d2031bcf-20210413T093734Z-avarab@gmail.com>
In-Reply-To
<cover-0.6-00000000000-20210413T093734Z-avarab@gmail.com>
fsck: improve error on loose object hash mismatch

Improve the error that's emitted in cases where we find a loose object we parse, but which isn't at the location we expect it to be.

Before this change we'd prefix the error with a not-a-OID derived from the path at which the object was found, due to an emergent behavior in how we'd end up with an "OID" in these codepaths.

Now we'll instead say what object we hashed, and what path it was found at. Before this patch series e.g.:

    $ git hash-object --stdin -w -t blob </dev/null
    e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
    $ mv objects/e6/ objects/e7
Would emit ("[...]" used to abbreviate the OIDs):
    git fsck
    error: hash mismatch for ./objects/e7/9d[...] (expected e79d[...])
    error: e79d[...]: object corrupt or missing: ./objects/e7/9d[...]
Now we'll instead emit:
    error: e69d[...]: hash-path mismatch, found at: ./objects/e7/9d[...]

Furthermore, we'll do the right thing when the object type and its location are bad. I.e. this case:

    $ git hash-object --stdin -w -t garbage --literally </dev/null
    8315a83d2acc4c174aed59430f9a9c4ed926440f
    $ mv objects/83 objects/84

As noted in an earlier commits we'd simply die early in those cases, until preceding commits fixed the hard die on invalid object type:

    $ git fsck
    fatal: invalid object type
Now we'll instead emit sensible error messages:
    $ git fsck
    error: 8315[...]: hash-path mismatch, found at: ./objects/84/15[...]
    error: 8315[...]: object is of unknown type 'garbage': ./objects/84/15[...]

In both fsck.c and object-file.c we're using null_oid as a sentinel value for checking whether we got far enough to be certain that the issue was indeed this OID mismatch.

In the case of check_object_signature() I don't really trust all the moving parts there to behave consistently, in the face of future refactorings. Getting it wrong would mean that we'd potentially emit no error at all on a failing check_object_signature(), or worse misreport whatever issue we encountered. So let's use the new bug() function to ferry and return code up to fsck_loose() in that case.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/fast-export.c |  2 +-
 builtin/fsck.c        | 13 +++++++++----
 builtin/index-pack.c  |  2 +-
 builtin/mktag.c       |  3 ++-
 object-file.c         | 21 ++++++++++++---------
 object-store.h        |  4 +++-
 object.c              |  4 ++--
 pack-check.c          |  3 ++-
 t/t1450-fsck.sh       |  8 +++++---
 9 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 85a76e0ef8b..bf0e266d83a 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -312,7 +312,7 @@ static void export_blob(const struct object_id *oid)
 		if (!buf)
 			die("could not read blob %s", oid_to_hex(oid));
 		if (check_object_signature(the_repository, oid, buf, size,
-					   type_name(type)) < 0)
+					   type_name(type), NULL) < 0)
 			die("oid mismatch in blob %s", oid_to_hex(oid));
 		object = parse_object_buffer(the_repository, oid, type,
 					     size, buf, &eaten);
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 878191e53ca..7713d992960 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -602,20 +602,25 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
 	struct strbuf sb = STRBUF_INIT;
 	unsigned int oi_flags = OBJECT_INFO_ALLOW_UNKNOWN_TYPE;
 	struct object_info oi;
+	struct object_id real_oid = null_oid;
 	int found = 0;
 	oi.type_name = &sb;
 	oi.sizep = &size;
 	oi.typep = &type;
 
-	if (read_loose_object(path, oid, &contents, &oi, oi_flags) < 0) {
+	if (read_loose_object(path, oid, &real_oid, &contents, &oi, oi_flags) < 0) {
 		found |= ERROR_OBJECT;
-		error(_("%s: object corrupt or missing: %s"),
-		      oid_to_hex(oid), path);
+		if (!oideq(&real_oid, oid))
+			error(_("%s: hash-path mismatch, found at: %s"),
+			      oid_to_hex(&real_oid), path);
+		else
+			error(_("%s: object corrupt or missing: %s"),
+			      oid_to_hex(oid), path);
 	}
 	if (type < 0) {
 		found |= ERROR_OBJECT;
 		error(_("%s: object is of unknown type '%s': %s"),
-		      oid_to_hex(oid), sb.buf, path);
+		      oid_to_hex(&real_oid), sb.buf, path);
 	}
 	if (found) {
 		errors_found |= ERROR_OBJECT;
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 15507b5cff0..d5fd81ebf39 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1421,7 +1421,7 @@ static void fix_unresolved_deltas(struct hashfile *f)
 
 		if (check_object_signature(the_repository, &d->oid,
 					   data, size,
-					   type_name(type)))
+					   type_name(type), NULL))
 			die(_("local object %s is corrupt"), oid_to_hex(&d->oid));
 
 		/*
diff --git a/builtin/mktag.c b/builtin/mktag.c
index dddcccdd368..3b2dbbb37e6 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -62,7 +62,8 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type)
 
 	repl = lookup_replace_object(the_repository, tagged_oid);
 	ret = check_object_signature(the_repository, repl,
-				     buffer, size, type_name(*tagged_type));
+				     buffer, size, type_name(*tagged_type),
+				     NULL);
 	free(buffer);
 
 	return ret;
diff --git a/object-file.c b/object-file.c
index e744a06637b..ca54e76fda2 100644
--- a/object-file.c
+++ b/object-file.c
@@ -993,9 +993,11 @@ void *xmmap(void *start, size_t length,
  * the streaming interface and rehash it to do the same.
  */
 int check_object_signature(struct repository *r, const struct object_id *oid,
-			   void *map, unsigned long size, const char *type)
+			   void *map, unsigned long size, const char *type,
+			   struct object_id *real_oidp)
 {
-	struct object_id real_oid;
+	struct object_id tmp;
+	struct object_id *real_oid = real_oidp ? real_oidp : &tmp;
 	enum object_type obj_type;
 	struct git_istream *st;
 	git_hash_ctx c;
@@ -1003,8 +1005,8 @@ int check_object_signature(struct repository *r, const struct object_id *oid,
 	int hdrlen;
 
 	if (map) {
-		hash_object_file(r->hash_algo, map, size, type, &real_oid);
-		return !oideq(oid, &real_oid) ? -1 : 0;
+		hash_object_file(r->hash_algo, map, size, type, real_oid);
+		return !oideq(oid, real_oid) ? -1 : 0;
 	}
 
 	st = open_istream(r, oid, &obj_type, &size, NULL);
@@ -1029,9 +1031,9 @@ int check_object_signature(struct repository *r, const struct object_id *oid,
 			break;
 		r->hash_algo->update_fn(&c, buf, readlen);
 	}
-	r->hash_algo->final_fn(real_oid.hash, &c);
+	r->hash_algo->final_fn(real_oid->hash, &c);
 	close_istream(st);
-	return !oideq(oid, &real_oid) ? -1 : 0;
+	return !oideq(oid, real_oid) ? -1 : 0;
 }
 
 int git_open_cloexec(const char *name, int flags)
@@ -2489,6 +2491,7 @@ static int check_stream_oid(git_zstream *stream,
 
 int read_loose_object(const char *path,
 		      const struct object_id *expected_oid,
+		      struct object_id *real_oid,
 		      void **contents,
 		      struct object_info *oi,
 		      unsigned int oi_flags)
@@ -2532,9 +2535,9 @@ int read_loose_object(const char *path,
 			goto out;
 		}
 		if (check_object_signature(the_repository, expected_oid,
-					   *contents, *size, oi->type_name->buf)) {
-			error(_("hash mismatch for %s (expected %s)"), path,
-			      oid_to_hex(expected_oid));
+					   *contents, *size, oi->type_name->buf, real_oid)) {
+			if (oideq(real_oid, &null_oid))
+				BUG("should only get OID mismatch errors with mapped contents");
 			free(*contents);
 			goto out;
 		}
diff --git a/object-store.h b/object-store.h
index 3d88b8a7cd3..c9c4d211de3 100644
--- a/object-store.h
+++ b/object-store.h
@@ -384,6 +384,7 @@ int oid_object_info_extended(struct repository *r,
  */
 int read_loose_object(const char *path,
 		      const struct object_id *expected_oid,
+		      struct object_id *real_oid,
 		      void **contents,
 		      struct object_info *oi,
 		      unsigned int oi_flags);
@@ -484,7 +485,8 @@ int unpack_loose_header(git_zstream *stream, unsigned char *map,
 int parse_loose_header(const char *hdr, struct object_info *oi,
 		       unsigned int flags);
 int check_object_signature(struct repository *r, const struct object_id *oid,
-			   void *buf, unsigned long size, const char *type);
+			   void *buf, unsigned long size, const char *type,
+			   struct object_id *real_oidp);
 int finalize_object_file(const char *tmpfile, const char *filename);
 int check_and_freshen_file(const char *fn, int freshen);
 
diff --git a/object.c b/object.c
index 78343781ae7..1cb4b30acd7 100644
--- a/object.c
+++ b/object.c
@@ -262,7 +262,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
 	if ((obj && obj->type == OBJ_BLOB && repo_has_object_file(r, oid)) ||
 	    (!obj && repo_has_object_file(r, oid) &&
 	     oid_object_info(r, oid, NULL) == OBJ_BLOB)) {
-		if (check_object_signature(r, repl, NULL, 0, NULL) < 0) {
+		if (check_object_signature(r, repl, NULL, 0, NULL, NULL) < 0) {
 			error(_("hash mismatch %s"), oid_to_hex(oid));
 			return NULL;
 		}
@@ -273,7 +273,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
 	buffer = repo_read_object_file(r, oid, &type, &size);
 	if (buffer) {
 		if (check_object_signature(r, repl, buffer, size,
-					   type_name(type)) < 0) {
+					   type_name(type), NULL) < 0) {
 			free(buffer);
 			error(_("hash mismatch %s"), oid_to_hex(repl));
 			return NULL;
diff --git a/pack-check.c b/pack-check.c
index 4b089fe8ec0..e6aa4442c90 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -142,7 +142,8 @@ static int verify_packfile(struct repository *r,
 			err = error("cannot unpack %s from %s at offset %"PRIuMAX"",
 				    oid_to_hex(&oid), p->pack_name,
 				    (uintmax_t)entries[i].offset);
-		else if (check_object_signature(r, &oid, data, size, type_name(type)))
+		else if (check_object_signature(r, &oid, data, size,
+						type_name(type), NULL))
 			err = error("packed %s from %s is corrupt",
 				    oid_to_hex(&oid), p->pack_name);
 		else if (fn) {
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index 214278e134a..c7b084364b7 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -53,6 +53,7 @@ test_expect_success 'object with hash mismatch' '
 	(
 		cd hash-mismatch &&
 		oid=$(echo blob | git hash-object -w --stdin) &&
+		oldoid=$oid &&
 		old=$(test_oid_to_path "$oid") &&
 		new=$(dirname $old)/$(test_oid ff_2) &&
 		oid="$(dirname $new)$(basename $new)" &&
@@ -62,7 +63,7 @@ test_expect_success 'object with hash mismatch' '
 		cmt=$(echo bogus | git commit-tree $tree) &&
 		git update-ref refs/heads/bogus $cmt &&
 		test_must_fail git fsck 2>out &&
-		test_i18ngrep "$oid.*corrupt" out
+		grep "$oldoid: hash-path mismatch, found at: .*$new" out
 	)
 '
 
@@ -71,6 +72,7 @@ test_expect_success 'object with hash and type mismatch' '
 	(
 		cd hash-type-mismatch &&
 		oid=$(echo blob | git hash-object -w --stdin -t garbage --literally) &&
+		oldoid=$oid &&
 		old=$(test_oid_to_path "$oid") &&
 		new=$(dirname $old)/$(test_oid ff_2) &&
 		oid="$(dirname $new)$(basename $new)" &&
@@ -80,8 +82,8 @@ test_expect_success 'object with hash and type mismatch' '
 		cmt=$(echo bogus | git commit-tree $tree) &&
 		git update-ref refs/heads/bogus $cmt &&
 		test_must_fail git fsck 2>out &&
-		grep "^error: hash mismatch for " out &&
-		grep "^error: $oid: object is of unknown type '"'"'garbage'"'"'" out
+		grep "^error: $oldoid: hash-path mismatch, found at: .*$new" out &&
+		grep "^error: $oldoid: object is of unknown type '"'"'garbage'"'"'" out
 	)
 '
 
-- 
2.31.1.645.g989d83ea6a6
Previous: Jeff KingNext: Ævar Arnfjörð Bjarmason
Message 26 of 245 in “usage.c: add a non-fatal bug() + misc doc fixes”
  1. 0/4 usage.c: add a non-fatal bug() + misc doc fixesÆvar Arnfjörð Bjarmason, Mar 28, 2021
  2. 3/4 api docs: document that BUG() emits a trace2 error eventÆvar Arnfjörð Bjarmason, Mar 28, 2021
  3. 1/4 usage.c: don't copy/paste the same comment three timesÆvar Arnfjörð Bjarmason, Mar 28, 2021
  4. Eric SunshineMar 28, 2021
  5. 2/4 api docs: document BUG() in api-error-handling.txtÆvar Arnfjörð Bjarmason, Mar 28, 2021
  6. Bagas SanjayaMar 29, 2021
  7. 4/4 usage.c: add a non-fatal bug() function to go with BUG()Ævar Arnfjörð Bjarmason, Mar 28, 2021
  8. 0/5 fsck: improve error reportingÆvar Arnfjörð Bjarmason, Mar 28, 2021
  9. 2/5 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Mar 28, 2021
  10. 1/5 cache.h: move object functions to object-store.hÆvar Arnfjörð Bjarmason, Mar 28, 2021
  11. 3/5 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Mar 28, 2021
  12. 4/5 fsck: improve the error on invalid object typesÆvar Arnfjörð Bjarmason, Mar 28, 2021
  13. Johannes SixtMar 28, 2021
  14. 5/5 fsck: improve error on loose object hash mismatchÆvar Arnfjörð Bjarmason, Mar 28, 2021
  15. 0/6 fsck: better "invalid object" error reportingÆvar Arnfjörð Bjarmason, Apr 13, 2021
  16. 1/6 cache.h: move object functions to object-store.hÆvar Arnfjörð Bjarmason, Apr 13, 2021
  17. 2/6 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Apr 13, 2021
  18. 4/6 object-store.h: move read_loose_object() below 'struct object_info'Ævar Arnfjörð Bjarmason, Apr 13, 2021
  19. Jeff KingApr 23, 2021
  20. 5/6 fsck: report invalid types recorded in objectsÆvar Arnfjörð Bjarmason, Apr 13, 2021
  21. Jeff KingApr 23, 2021
  22. Ævar Arnfjörð BjarmasonApr 26, 2021
  23. Jeff KingApr 26, 2021
  24. 3/6 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Apr 13, 2021
  25. Jeff KingApr 23, 2021
  26. 6/6 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Apr 13, 2021
  27. 00/17 fsck: better "invalid object" error reportingÆvar Arnfjörð Bjarmason, May 20, 2021
  28. 01/17 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, May 20, 2021
  29. 02/17 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, May 20, 2021
  30. 04/17 cat-file tests: test that --allow-unknown-type isn't on by defaultÆvar Arnfjörð Bjarmason, May 20, 2021
  31. Jonathan NiederMay 27, 2021
  32. Ævar Arnfjörð BjarmasonMay 28, 2021
  33. 03/17 cat-file tests: test for missing object with -t and -sÆvar Arnfjörð Bjarmason, May 20, 2021
  34. 05/17 rev-list tests: test for behavior with invalid object typesÆvar Arnfjörð Bjarmason, May 20, 2021
  35. 06/17 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, May 20, 2021
  36. 07/17 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, May 20, 2021
  37. 09/17 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, May 20, 2021
  38. 11/17 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, May 20, 2021
  39. Jonathan TanMay 27, 2021
  40. 10/17 object-file.c: add missing braces to loose_object_info()Ævar Arnfjörð Bjarmason, May 20, 2021
  41. 08/17 cache.h: move object functions to object-store.hÆvar Arnfjörð Bjarmason, May 20, 2021
  42. 14/17 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, May 20, 2021
  43. Jonathan TanMay 27, 2021
  44. 17/17 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, May 20, 2021
  45. Jonathan TanMay 27, 2021
  46. 15/17 object-store.h: move read_loose_object() below 'struct object_info'Ævar Arnfjörð Bjarmason, May 20, 2021
  47. 13/17 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, May 20, 2021
  48. 12/17 object-file.c: return -2 on "header too long" in unpack_loose_header()Ævar Arnfjörð Bjarmason, May 20, 2021
  49. Jonathan TanMay 27, 2021
  50. 16/17 fsck: report invalid types recorded in objectsÆvar Arnfjörð Bjarmason, May 20, 2021
  51. Jonathan TanMay 27, 2021
  52. Jonathan TanMay 27, 2021
  53. Junio C HamanoMay 28, 2021
  54. Felipe ContrerasMay 28, 2021
  55. 00/21 fsck: better "invalid object" error reportingÆvar Arnfjörð Bjarmason, Jun 24, 2021
  56. 01/21 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Jun 24, 2021
  57. Andrei RybakJun 24, 2021
  58. Ævar Arnfjörð BjarmasonJun 24, 2021
  59. 02/21 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, Jun 24, 2021
  60. 03/21 cat-file tests: test for missing object with -t and -sÆvar Arnfjörð Bjarmason, Jun 24, 2021
  61. 04/21 cat-file tests: test that --allow-unknown-type isn't on by defaultÆvar Arnfjörð Bjarmason, Jun 24, 2021
  62. 05/21 rev-list tests: test for behavior with invalid object typesÆvar Arnfjörð Bjarmason, Jun 24, 2021
  63. 06/21 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, Jun 24, 2021
  64. 07/21 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, Jun 24, 2021
  65. 08/21 cache.h: move object functions to object-store.hÆvar Arnfjörð Bjarmason, Jun 24, 2021
  66. 10/21 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, Jun 24, 2021
  67. 09/21 object-file.c: don't set "typep" when returning non-zeroÆvar Arnfjörð Bjarmason, Jun 24, 2021
  68. 11/21 object-file.c: add missing braces to loose_object_info()Ævar Arnfjörð Bjarmason, Jun 24, 2021
  69. 12/21 object-file.c: simplify unpack_loose_short_header()Ævar Arnfjörð Bjarmason, Jun 24, 2021
  70. 13/21 object-file.c: split up ternary in parse_loose_header()Ævar Arnfjörð Bjarmason, Jun 24, 2021
  71. 14/21 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, Jun 24, 2021
  72. 15/21 object-file.c: guard against future bugs in loose_object_info()Ævar Arnfjörð Bjarmason, Jun 24, 2021
  73. 16/21 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, Jun 24, 2021
  74. 17/21 object-file.c: return -2 on "header too long" in unpack_loose_header()Ævar Arnfjörð Bjarmason, Jun 24, 2021
  75. 18/21 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Jun 24, 2021
  76. 19/21 object-store.h: move read_loose_object() below 'struct object_info'Ævar Arnfjörð Bjarmason, Jun 24, 2021
  77. 20/21 fsck: report invalid types recorded in objectsÆvar Arnfjörð Bjarmason, Jun 24, 2021
  78. 21/21 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Jun 24, 2021
  79. 00/21 fsck: lib-ify object-file.c & better fsck "invalid object" error reportingÆvar Arnfjörð Bjarmason, Jul 10, 2021
  80. 01/21 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Jul 10, 2021
  81. 05/21 rev-list tests: test for behavior with invalid object typesÆvar Arnfjörð Bjarmason, Jul 10, 2021
  82. 02/21 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, Jul 10, 2021
  83. 06/21 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, Jul 10, 2021
  84. 04/21 cat-file tests: test that --allow-unknown-type isn't on by defaultÆvar Arnfjörð Bjarmason, Jul 10, 2021
  85. 03/21 cat-file tests: test for missing object with -t and -sÆvar Arnfjörð Bjarmason, Jul 10, 2021
  86. 07/21 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, Jul 10, 2021
  87. 08/21 cache.h: move object functions to object-store.hÆvar Arnfjörð Bjarmason, Jul 10, 2021
  88. 10/21 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, Jul 10, 2021
  89. 09/21 object-file.c: don't set "typep" when returning non-zeroÆvar Arnfjörð Bjarmason, Jul 10, 2021
  90. 12/21 object-file.c: simplify unpack_loose_short_header()Ævar Arnfjörð Bjarmason, Jul 10, 2021
  91. 11/21 object-file.c: add missing braces to loose_object_info()Ævar Arnfjörð Bjarmason, Jul 10, 2021
  92. 13/21 object-file.c: split up ternary in parse_loose_header()Ævar Arnfjörð Bjarmason, Jul 10, 2021
  93. 14/21 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, Jul 10, 2021
  94. 15/21 object-file.c: guard against future bugs in loose_object_info()Ævar Arnfjörð Bjarmason, Jul 10, 2021
  95. 16/21 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, Jul 10, 2021
  96. 17/21 object-file.c: return -2 on "header too long" in unpack_loose_header()Ævar Arnfjörð Bjarmason, Jul 10, 2021
  97. 19/21 object-store.h: move read_loose_object() below 'struct object_info'Ævar Arnfjörð Bjarmason, Jul 10, 2021
  98. 18/21 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Jul 10, 2021
  99. 20/21 fsck: report invalid types recorded in objectsÆvar Arnfjörð Bjarmason, Jul 10, 2021
  100. 21/21 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Jul 10, 2021
  101. 00/22 fsck: lib-ify object-file.c & better fsck "invalid object" error reportingÆvar Arnfjörð Bjarmason, Sep 7, 2021
  102. 01/22 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Sep 7, 2021
  103. Taylor BlauSep 16, 2021
  104. Ævar Arnfjörð BjarmasonSep 17, 2021
  105. 02/22 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, Sep 7, 2021
  106. Taylor BlauSep 16, 2021
  107. Ævar Arnfjörð BjarmasonSep 17, 2021
  108. 03/22 cat-file tests: test for missing object with -t and -sÆvar Arnfjörð Bjarmason, Sep 7, 2021
  109. Taylor BlauSep 16, 2021
  110. Taylor BlauSep 16, 2021
  111. Ævar Arnfjörð BjarmasonSep 16, 2021
  112. 04/22 cat-file tests: test that --allow-unknown-type isn't on by defaultÆvar Arnfjörð Bjarmason, Sep 7, 2021
  113. 05/22 rev-list tests: test for behavior with invalid object typesÆvar Arnfjörð Bjarmason, Sep 7, 2021
  114. Taylor BlauSep 16, 2021
  115. Ævar Arnfjörð BjarmasonSep 17, 2021
  116. 06/22 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, Sep 7, 2021
  117. 07/22 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, Sep 7, 2021
  118. 08/22 object-file.c: don't set "typep" when returning non-zeroÆvar Arnfjörð Bjarmason, Sep 7, 2021
  119. Taylor BlauSep 16, 2021
  120. Jeff KingSep 16, 2021
  121. 09/22 cache.h: move object functions to object-store.hÆvar Arnfjörð Bjarmason, Sep 7, 2021
  122. Taylor BlauSep 16, 2021
  123. 10/22 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, Sep 7, 2021
  124. Taylor BlauSep 16, 2021
  125. 11/22 object-file.c: add missing braces to loose_object_info()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  126. 12/22 object-file.c: simplify unpack_loose_short_header()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  127. 14/22 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  128. Taylor BlauSep 17, 2021
  129. 13/22 object-file.c: split up ternary in parse_loose_header()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  130. Taylor BlauSep 16, 2021
  131. 16/22 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  132. 17/22 object-file.c: return -2 on "header too long" in unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  133. 15/22 object-file.c: guard against future bugs in loose_object_info()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  134. Taylor BlauSep 17, 2021
  135. 18/22 object-file.c: use "enum" return type for unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 7, 2021
  136. Taylor BlauSep 17, 2021
  137. 19/22 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Sep 7, 2021
  138. Taylor BlauSep 17, 2021
  139. 20/22 object-store.h: move read_loose_object() below 'struct object_info'Ævar Arnfjörð Bjarmason, Sep 7, 2021
  140. 21/22 fsck: report invalid types recorded in objectsÆvar Arnfjörð Bjarmason, Sep 7, 2021
  141. Taylor BlauSep 17, 2021
  142. 22/22 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Sep 7, 2021
  143. Taylor BlauSep 17, 2021
  144. Taylor BlauSep 17, 2021
  145. 00/17 fsck: lib-ify object-file.c & better fsck "invalid object" error reportingÆvar Arnfjörð Bjarmason, Sep 20, 2021
  146. 01/17 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, Sep 20, 2021
  147. 02/17 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Sep 20, 2021
  148. 03/17 fsck tests: test current hash/type mismatch behaviorÆvar Arnfjörð Bjarmason, Sep 20, 2021
  149. 07/17 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, Sep 20, 2021
  150. 06/17 cat-file tests: test for missing/bogus object with -t, -s and -pÆvar Arnfjörð Bjarmason, Sep 20, 2021
  151. Taylor BlauSep 21, 2021
  152. 05/17 cat-file tests: move bogus_* variable declarations earlierÆvar Arnfjörð Bjarmason, Sep 20, 2021
  153. 04/17 fsck tests: test for garbage appended to a loose objectÆvar Arnfjörð Bjarmason, Sep 20, 2021
  154. 09/17 object-file.c: don't set "typep" when returning non-zeroÆvar Arnfjörð Bjarmason, Sep 20, 2021
  155. 08/17 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, Sep 20, 2021
  156. 10/17 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 20, 2021
  157. 11/17 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, Sep 20, 2021
  158. 14/17 object-file.c: return ULHR_TOO_LONG on "header too long"Ævar Arnfjörð Bjarmason, Sep 20, 2021
  159. 12/17 object-file.c: simplify unpack_loose_short_header()Ævar Arnfjörð Bjarmason, Sep 20, 2021
  160. 15/17 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, Sep 20, 2021
  161. 13/17 object-file.c: use "enum" return type for unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 20, 2021
  162. 16/17 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Sep 20, 2021
  163. 17/17 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Sep 20, 2021
  164. 00/17 fsck: lib-ify object-file.c & better fsck "invalid object" error reportingÆvar Arnfjörð Bjarmason, Sep 28, 2021
  165. 01/17 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, Sep 28, 2021
  166. 02/17 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Sep 28, 2021
  167. 03/17 fsck tests: test current hash/type mismatch behaviorÆvar Arnfjörð Bjarmason, Sep 28, 2021
  168. 04/17 fsck tests: test for garbage appended to a loose objectÆvar Arnfjörð Bjarmason, Sep 28, 2021
  169. 05/17 cat-file tests: move bogus_* variable declarations earlierÆvar Arnfjörð Bjarmason, Sep 28, 2021
  170. 06/17 cat-file tests: test for missing/bogus object with -t, -s and -pÆvar Arnfjörð Bjarmason, Sep 28, 2021
  171. 07/17 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, Sep 28, 2021
  172. 08/17 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, Sep 28, 2021
  173. 09/17 object-file.c: don't set "typep" when returning non-zeroÆvar Arnfjörð Bjarmason, Sep 28, 2021
  174. 11/17 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, Sep 28, 2021
  175. 10/17 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 28, 2021
  176. 12/17 object-file.c: simplify unpack_loose_short_header()Ævar Arnfjörð Bjarmason, Sep 28, 2021
  177. 14/17 object-file.c: return ULHR_TOO_LONG on "header too long"Ævar Arnfjörð Bjarmason, Sep 28, 2021
  178. 13/17 object-file.c: use "enum" return type for unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 28, 2021
  179. 15/17 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, Sep 28, 2021
  180. 16/17 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Sep 28, 2021
  181. 17/17 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Sep 28, 2021
  182. Taylor BlauSep 29, 2021
  183. 00/17 fsck: lib-ify object-file.c & better fsck "invalid object" error reportingÆvar Arnfjörð Bjarmason, Sep 30, 2021
  184. 01/17 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, Sep 30, 2021
  185. Andrei RybakSep 30, 2021
  186. Ævar Arnfjörð BjarmasonOct 1, 2021
  187. 03/17 fsck tests: test current hash/type mismatch behaviorÆvar Arnfjörð Bjarmason, Sep 30, 2021
  188. 02/17 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Sep 30, 2021
  189. 04/17 fsck tests: test for garbage appended to a loose objectÆvar Arnfjörð Bjarmason, Sep 30, 2021
  190. 05/17 cat-file tests: move bogus_* variable declarations earlierÆvar Arnfjörð Bjarmason, Sep 30, 2021
  191. 06/17 cat-file tests: test for missing/bogus object with -t, -s and -pÆvar Arnfjörð Bjarmason, Sep 30, 2021
  192. 07/17 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, Sep 30, 2021
  193. 08/17 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, Sep 30, 2021
  194. 09/17 object-file.c: don't set "typep" when returning non-zeroÆvar Arnfjörð Bjarmason, Sep 30, 2021
  195. 10/17 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 30, 2021
  196. 12/17 object-file.c: simplify unpack_loose_short_header()Ævar Arnfjörð Bjarmason, Sep 30, 2021
  197. 11/17 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, Sep 30, 2021
  198. 13/17 object-file.c: use "enum" return type for unpack_loose_header()Ævar Arnfjörð Bjarmason, Sep 30, 2021
  199. 14/17 object-file.c: return ULHR_TOO_LONG on "header too long"Ævar Arnfjörð Bjarmason, Sep 30, 2021
  200. 15/17 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, Sep 30, 2021
  201. 16/17 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Sep 30, 2021
  202. 17/17 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Sep 30, 2021
  203. Junio C HamanoSep 30, 2021
  204. Taylor BlauSep 30, 2021
  205. 00/17 fsck: lib-ify object-file.c & better fsck "invalid object" error reportingÆvar Arnfjörð Bjarmason, Oct 1, 2021
  206. 01/17 fsck tests: add test for fsck-ing an unknown typeÆvar Arnfjörð Bjarmason, Oct 1, 2021
  207. 02/17 fsck tests: refactor one test to use a sub-repoÆvar Arnfjörð Bjarmason, Oct 1, 2021
  208. 03/17 fsck tests: test current hash/type mismatch behaviorÆvar Arnfjörð Bjarmason, Oct 1, 2021
  209. 05/17 cat-file tests: move bogus_* variable declarations earlierÆvar Arnfjörð Bjarmason, Oct 1, 2021
  210. 06/17 cat-file tests: test for missing/bogus object with -t, -s and -pÆvar Arnfjörð Bjarmason, Oct 1, 2021
  211. 04/17 fsck tests: test for garbage appended to a loose objectÆvar Arnfjörð Bjarmason, Oct 1, 2021
  212. 07/17 cat-file tests: add corrupt loose object testÆvar Arnfjörð Bjarmason, Oct 1, 2021
  213. 08/17 cat-file tests: test for current --allow-unknown-type behaviorÆvar Arnfjörð Bjarmason, Oct 1, 2021
  214. 09/17 object-file.c: don't set "typep" when returning non-zeroÆvar Arnfjörð Bjarmason, Oct 1, 2021
  215. 10/17 object-file.c: return -1, not "status" from unpack_loose_header()Ævar Arnfjörð Bjarmason, Oct 1, 2021
  216. 11/17 object-file.c: make parse_loose_header_extended() publicÆvar Arnfjörð Bjarmason, Oct 1, 2021
  217. 12/17 object-file.c: simplify unpack_loose_short_header()Ævar Arnfjörð Bjarmason, Oct 1, 2021
  218. 13/17 object-file.c: use "enum" return type for unpack_loose_header()Ævar Arnfjörð Bjarmason, Oct 1, 2021
  219. 14/17 object-file.c: return ULHR_TOO_LONG on "header too long"Ævar Arnfjörð Bjarmason, Oct 1, 2021
  220. 15/17 object-file.c: stop dying in parse_loose_header()Ævar Arnfjörð Bjarmason, Oct 1, 2021
  221. 16/17 fsck: don't hard die on invalid object typesÆvar Arnfjörð Bjarmason, Oct 1, 2021
  222. 17/17 fsck: report invalid object type-path combinationsÆvar Arnfjörð Bjarmason, Oct 1, 2021
  223. Junio C HamanoOct 1, 2021
  224. Ævar Arnfjörð BjarmasonOct 1, 2021
  225. Han XinNov 11, 2021
  226. Junio C HamanoNov 11, 2021
  227. Han XinNov 11, 2021
  228. 0/2 v2.34.0-rc2 regression: free() of uninitialized in ab/fsck-unexpected-typeÆvar Arnfjörð Bjarmason, Nov 11, 2021
  229. 1/2 object-file: fix SEGV on free() regression in v2.34.0-rc2Ævar Arnfjörð Bjarmason, Nov 11, 2021
  230. Jeff KingNov 11, 2021
  231. Junio C HamanoNov 11, 2021
  232. Ævar Arnfjörð BjarmasonNov 13, 2021
  233. 2/2 object-file: free(*contents) only in read_loose_object() callerÆvar Arnfjörð Bjarmason, Nov 11, 2021
  234. Junio C HamanoNov 11, 2021
  235. Junio C HamanoMar 28, 2021
  236. Jeff KingMar 28, 2021
  237. Ævar Arnfjörð BjarmasonMar 29, 2021
  238. Jeff KingMar 31, 2021
  239. 0/3 trace2 docs: note that BUG() sends an "error" eventÆvar Arnfjörð Bjarmason, Apr 13, 2021
  240. 3/3 api docs: document that BUG() emits a trace2 error eventÆvar Arnfjörð Bjarmason, Apr 13, 2021
  241. 1/3 usage.c: don't copy/paste the same comment three timesÆvar Arnfjörð Bjarmason, Apr 13, 2021
  242. Jeff KingApr 15, 2021
  243. 2/3 api docs: document BUG() in api-error-handling.txtÆvar Arnfjörð Bjarmason, Apr 13, 2021
  244. Jeff KingApr 15, 2021
  245. Jeff KingApr 15, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.