Thread (232 messages) 232 messages, 10 authors, 2021-11-11

Re: [PATCH v3 04/17] cat-file tests: test that --allow-unknown-type isn't on by default

flat view

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-05-28 03:11:37

On Thu, May 27 2021, Jonathan Nieder wrote:
Hi,

Ævar Arnfjörð Bjarmason wrote:
quoted
Fix a blindspot in the tests added in the tests for the
--allow-unknown-type feature, added in 39e4ae38804 (cat-file: teach
cat-file a '--allow-unknown-type' option, 2015-05-03).

Before this change all the tests would succeed if --allow-unknown-type
was on by default, let's fix that by asserting that -t and -s die on a
"garbage" type without --allow-unknown-type.
nit: "tests added in the tests" seems oddly repetitive.

More importantly, I'm curious about the desired behavior here.  The
idea behind cat-file --allow-unknown-type is that I can use it to
inspect an invalid object, for example after it has been reported by
git fsck.  The commit that introduced it (39e4ae3880, "cat-file: teach
cat-file a '--allow-unknown-type' option", 2015-05-03) gives the hint
"query broken/corrupt objects" in the documentation, so I figure
that's what it's for, and I'm sympathetic.

But: why is that an option instead of something that we always do?

In other words, is there some situation where I would not want the
more permissive behavior from cat-file against a bad object?
Yes. I suggested as much in
https://lore.kernel.org/git/87r1i4qf4h.fsf@evledraar.gmail.com/ (local)

For this series though I'm sticking to testing for the existing behavior
+ fixing the immediate fsck issues. I've got some local patches queued
up for after this topic lands (after I re-roll it, re-submit etc.) that
do that.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help