git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Q: does index-pack work in place on windows?
@ 2011-02-02 20:21 Junio C Hamano
  2011-02-02 20:30 ` Erik Faye-Lund
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2011-02-02 20:21 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, Shawn O. Pearce

... or any other (operating / file) system where you cannot unlink a file
that is open?

When you run

    $ git clone git://some.where/repo/sitory.git local
    $ cd local
    $ git index-pack .git/objects/pack/pack-*.pack

there is a call to write_idx_file() in builtin/index-pack.c, that feeds
the correct (and existing) name of the corresponding pack idx file.

The callee in pack-write.c, after sorting the list of objects contained in
the pack, does this:

	if (!index_name) {
		static char tmpfile[PATH_MAX];
		fd = odb_mkstemp(tmpfile, sizeof(tmpfile), "pack/tmp_idx_XXXXXX");
		index_name = xstrdup(tmpfile);
	} else {
		unlink(index_name);
		fd = open(index_name, O_CREAT|O_EXCL|O_WRONLY, 0600);
	}
 
and then writes out the pack index to the file descriptor.  But index-pack
uses the usual has_sha1_file() and read_sha1_file() interface to validate
the "existing" objects, and is likely to have mmapped the .idx file when
it called use_pack_window().  Which makes me suspect that this unlink (or
the open that immediately follows) may fail on systems that do not allow
unlink on inode that has still users.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-04  2:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-02 20:21 Q: does index-pack work in place on windows? Junio C Hamano
2011-02-02 20:30 ` Erik Faye-Lund
2011-02-03  5:32   ` Nicolas Pitre
2011-02-03  7:24     ` Junio C Hamano
2011-02-04  1:14       ` Nicolas Pitre
2011-02-04  1:59         ` Junio C Hamano
2011-02-04  2:45           ` Nicolas Pitre

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).