Re: Today's 'master' leaves .idx/.pack in 0400

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <junkio@...>
Cc: Linus Torvalds <torvalds@...>, <git@...>, <linux-kernel@...>
Date: Sunday, April 22, 2007 - 2:34 pm

On Sun, 22 Apr 2007, Junio C Hamano wrote:


Well, actually there is no point making pack files writable.  If they're 
modified, they get corrupted.

Here's the fix I wanted to propose:

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index c72e07a..85c6e6e 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1786,11 +1786,13 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 		if (rename(pack_tmp_name, tmpname))
 			die("unable to rename temporary pack file: %s",
 			    strerror(errno));
+		chmod(tmpname, 0444);
 		snprintf(tmpname, sizeof(tmpname), "%s-%s.idx",
 			 base_name, sha1_to_hex(object_list_sha1));
 		if (rename(idx_tmp_name, tmpname))
 			die("unable to rename temporary index file: %s",
 			    strerror(errno));
+		chmod(tmpname, 0444);
 		puts(sha1_to_hex(object_list_sha1));
 	}
 	if (progress)


Nicolas

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[ANNOUNCE] GIT 1.5.1.1, Junio C Hamano, (Wed Apr 11, 10:09 pm)
[ANNOUNCE] GIT 1.5.1.2, Junio C Hamano, (Sun Apr 22, 2:16 am)
Re: [ANNOUNCE] GIT 1.5.1.2, Linus Torvalds, (Sun Apr 22, 1:22 pm)
Re: [ANNOUNCE] GIT 1.5.1.2, Junio C Hamano, (Sun Apr 22, 2:47 pm)
Re: [ANNOUNCE] GIT 1.5.1.2, Junio C Hamano, (Sun Apr 22, 1:58 pm)
Today's 'master' leaves .idx/.pack in 0400, Junio C Hamano, (Sun Apr 22, 2:06 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Nicolas Pitre, (Sun Apr 22, 2:25 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Junio C Hamano, (Sun Apr 22, 2:27 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Nicolas Pitre, (Sun Apr 22, 2:34 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Linus Torvalds, (Sun Apr 22, 2:54 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Junio C Hamano, (Sun Apr 22, 3:03 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Junio C Hamano, (Sun Apr 22, 3:20 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Linus Torvalds, (Sun Apr 22, 3:29 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Nicolas Pitre, (Sun Apr 22, 2:47 pm)
Re: Today's 'master' leaves .idx/.pack in 0400, Junio C Hamano, (Sun Apr 22, 2:52 pm)