From: "Alex Riesen" <raa.lkml@gmail.com>
To: "Johannes Sixt" <j.sixt@viscovery.net>
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 15:17:39 +0100 [thread overview]
Message-ID: <81b0412b0811190617t4a9df151m886700672a21fad8@mail.gmail.com> (raw)
In-Reply-To: <49241AEF.1080808@viscovery.net>
2008/11/19 Johannes Sixt <j.sixt@viscovery.net>:
> Alex Riesen schrieb:
>> 2008/11/19 Nicolas Pitre <nico@cam.org>:
>>> On Wed, 19 Nov 2008, Johannes Sixt wrote:
>>>> 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>
>>> Acked-by: Nicolas Pitre <nico@cam.org>
>>
>> Are you sure? Will it work in a real repository? Were noone does
>> rename the previous pack files into packtmp-something?
>
> Oh, the patch only works around the failure in the test case. In a real
> repository there is usually no problem because the destination pack file
> does not exist.
>
> The unusual case is where you do this:
>
> $ git rev-list -10 HEAD | git pack-objects foobar
>
> twice in a row: In this case the second invocation fails on Windows
> because the destination pack file already exists *and* is open. But not
> even git-repack does this even if it is called twice. OTOH, the test case
> *does* exactly this.
>
Still bad...
BTW, the patch _does_ fix the "unusual case" for me. IOW, I plainly copied
your rev-list|pack-objects into command line. As expected, it fails for Junio's
master (after the second run) and works with the patch:
$ git rev-list -10 HEAD | ./git pack-objects .git/objects/pack/foobar
Counting objects: 10, done.
Compressing objects: 100% (9/9), done.
82864ec14cd06e6089543a1419762e4cd40f7988
Writing objects: 100% (10/10), done.
Total 10 (delta 1), reused 10 (delta 1)
$ git rev-list -10 HEAD | ./git pack-objects .git/objects/pack/foobar
Counting objects: 10, done.
Compressing objects: 100% (9/9), done.
fatal: unable to rename temporary pack file: Permission denied
$ git cherry-pick fix-fd-leak
Finished one cherry-pick.
[master]: created e629465: "Fix handle leak in builtin-pack-objects"
1 files changed, 1 insertions(+), 0 deletions(-)
$ git rev-list -10 HEAD | ./git pack-objects .git/objects/pack/foobar
Counting objects: 10, done.
Compressing objects: 100% (9/9), done.
0e43d919a2a8336fd740d8d9b8f9f78d49e855e5
Writing objects: 100% (10/10), done.
Total 10 (delta 1), reused 9 (delta 1)
$ git rev-list -10 HEAD | ./git pack-objects .git/objects/pack/foobar
Counting objects: 10, done.
Compressing objects: 100% (9/9), done.
0e43d919a2a8336fd740d8d9b8f9f78d49e855e5
Writing objects: 100% (10/10), done.
Total 10 (delta 1), reused 10 (delta 1)
$ git rev-list -10 HEAD | ./git pack-objects .git/objects/pack/foobar
Counting objects: 10, done.
Compressing objects: 100% (9/9), done.
0e43d919a2a8336fd740d8d9b8f9f78d49e855e5
Writing objects: 100% (10/10), done.
Total 10 (delta 1), reused 10 (delta 1)
next prev parent reply other threads:[~2008-11-19 14:19 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
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 [this message]
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=81b0412b0811190617t4a9df151m886700672a21fad8@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=nico@cam.org \
/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;
as well as URLs for NNTP newsgroup(s).