From: Johannes Sixt <j.sixt@viscovery.net>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: Nicolas Pitre <nico@cam.org>, Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] Fix handle leak in builtin-pack-objects
Date: Wed, 19 Nov 2008 12:54:00 +0100 [thread overview]
Message-ID: <4923FE58.3090503@viscovery.net> (raw)
In-Reply-To: <81b0412b0811190313p643c0cb4vad620ea942aeea93@mail.gmail.com>
Alex Riesen schrieb:
> The opened packs seem to stay open forever.
In my MinGW port I have the patch below that avoids that t5303 fails
because of a pack file that remains open. (Open files cannot be replaced
on Windows.) I had hoped that your patch would help, but it does not.
Something else still keeps the pack file open. Can anything be done about
that?
-- Hannes
From: Johannes Sixt <j6t@kdbg.org>
Date: Mon, 17 Nov 2008 09:25:19 +0100
Subject: [PATCH] t5303: Do not overwrite an existing pack
This test corrupts a pack file, then repacks the objects. The consequence
is that the repacked pack file has the same name as the original file
(that has been corrupted).
During its operation, git-pack-objects opens the corrupted file and keeps
it open at all times. On Windows, this is a problem because a file that is
open in any process cannot be delete or replaced, but that is what we do
in some of the test cases, and so they fail.
The work-around is to write the repacked objects to a file of a different
name, and replace the original after git-pack-objects has terminated.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t5303-pack-corruption-resilience.sh | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/t/t5303-pack-corruption-resilience.sh
b/t/t5303-pack-corruption-resilience.sh
index 5132d41..41c83e3 100755
--- a/t/t5303-pack-corruption-resilience.sh
+++ b/t/t5303-pack-corruption-resilience.sh
@@ -43,8 +43,11 @@ create_new_pack() {
do_repack() {
pack=`printf "$blob_1\n$blob_2\n$blob_3\n" |
- git pack-objects $@ .git/objects/pack/pack` &&
- pack=".git/objects/pack/pack-${pack}"
+ git pack-objects $@ .git/objects/pack/packtmp` &&
+ packtmp=".git/objects/pack/packtmp-${pack}" &&
+ pack=".git/objects/pack/pack-${pack}" &&
+ mv "${packtmp}.pack" "${pack}.pack" &&
+ mv "${packtmp}.idx" "${pack}.idx"
}
do_corrupt_object() {
--
1.6.0.4.1683.g35125
next prev parent reply other threads:[~2008-11-19 11:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 11:13 [PATCH] Fix handle leak in builtin-pack-objects Alex Riesen
2008-11-19 11:54 ` Johannes Sixt [this message]
2008-11-19 12:13 ` Alex Riesen
2008-11-19 12:26 ` Johannes Sixt
2008-11-19 12:55 ` Nicolas Pitre
2008-11-19 13:06 ` Johannes Sixt
2008-11-19 14:31 ` Nicolas Pitre
2008-11-19 13:34 ` Alex Riesen
2008-11-19 13:55 ` Johannes Sixt
2008-11-19 14:17 ` Alex Riesen
2008-11-19 14:42 ` Nicolas Pitre
2008-11-19 14:52 ` Johannes Sixt
2008-11-19 16:25 ` [PATCH] compat/mingw.c: Teach mingw_rename() to replace read-only files Johannes Sixt
2008-11-26 13:18 ` [PATCH] Fix handle leak in builtin-pack-objects Alex Riesen
2008-11-26 14:33 ` Nicolas Pitre
2008-11-26 18:43 ` Alex Riesen
2008-12-09 19:26 ` [PATCH] make sure packs to be replaced are closed beforehand Nicolas Pitre
2008-12-09 19:33 ` Alex Riesen
2008-12-10 7:37 ` Johannes Sixt
2008-12-10 8:27 ` Junio C Hamano
2008-12-10 9:36 ` Alex Riesen
2008-11-19 12:45 ` [PATCH] Fix handle leak in builtin-pack-objects Nicolas Pitre
2008-11-19 13:30 ` Alex Riesen
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=4923FE58.3090503@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nico@cam.org \
--cc=raa.lkml@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.