From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: Frank Lichtenheld <frank@lichtenheld.de>, git@vger.kernel.org
Subject: Re: [PATCH] Fix "unpack-objects --strict"
Date: Fri, 14 Aug 2009 08:03:07 +0200 [thread overview]
Message-ID: <20090814060307.GA31721@auto.tuwien.ac.at> (raw)
In-Reply-To: <7vd46zbjae.fsf@alter.siamese.dyndns.org>
On Thu, Aug 13, 2009 at 12:33:45PM -0700, Junio C Hamano wrote:
> diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c
> index 557148a..109b7c8 100644
> --- a/builtin-unpack-objects.c
> +++ b/builtin-unpack-objects.c
What about this check:
> @@ -184,7 +184,7 @@ static int check_object(struct object *obj, int type, void *data)
> if (!obj)
> return 0;
This is neccessary to skip already written objects (eg. blobs,
obj_list[i].obj == NULL). The return code is not important in this
case.
I'm not sure, if fsck_walk can call check_object with obj == NULL
under some (rare) conditions. If yes, the return code should be
changed to 1.
> We probably should write everything as they become unpackable (i.e. as
> their delta bases becomes available) while keeping track of object names
> (but not data) of structured objects that we received, and running only
> one level of reachability check on them at the end. That would certainly
> reduce the memory consumption and may simplify the complexity of the code
> at the same time.
This would defeat the whole idea of the this check: If the
precondition (fsck returns OK for a repository) is met, unpack-objects
(and index-pack) with --strict should gurantee, that this is still
true after receiving the objects (even if somebody intentionally tries
to corrupt the repository).
As we assume, that all objects (and all their ancestors) already
present in the repository are OK, we only have to check new objects
and verify, that linked objects in the repository are of the correct
type.
As soon as we start to write objects without all linked objects
already present in the repository, the repository can get inconsistant.
Lets assume, unpack-objects/receive-pack is changed according to your proposal:
* writeout all objects, as received
* checking reachability of new objects
* update refs, if everything is OK
Then a corruption HOWTO would be:
To introduce a object with one of its linked objects missing, left it
out of the pack and push it into the repository. unpack-objects will
unpack all objects and fail updating the ref (but leave all objects in
the repository). As second step, simply send a ref update request,
which should succed, as the object is present in the repository.
A variant: set the SHA1 of the missing object to the SHA1 of a object
of another type. In the second step, you can sent this object to
unpack-objects, which will unpack it, as it does not know, that the
object is already referenced in the repository.
Deleting objects in the case of an error is also not an option, as a
parallel push operation could have already used the object.
mfg Martin Köger
next prev parent reply other threads:[~2009-08-14 6:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 10:32 [BUG] Submodules problem with subdirectories and pushing Frank Lichtenheld
2009-08-13 11:19 ` Frank Lichtenheld
2009-08-13 19:33 ` [PATCH] Fix "unpack-objects --strict" Junio C Hamano
2009-08-14 6:03 ` Martin Koegler [this message]
2009-08-14 6:32 ` Junio C Hamano
2009-08-14 7:19 ` Martin Koegler
2009-08-14 7:31 ` Junio C Hamano
2009-08-14 7:41 ` Junio C Hamano
2009-08-14 9:30 ` Frank Lichtenheld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090814060307.GA31721@auto.tuwien.ac.at \
--to=mkoegler@auto.tuwien.ac.at \
--cc=frank@lichtenheld.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox