lkml.org 
[lkml]   [2007]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Today's 'master' leaves .idx/.pack in 0400
On Sun, 22 Apr 2007, Junio C Hamano wrote:

> Nicolas Pitre <nico@cam.org> writes:
>
> > On Sun, 22 Apr 2007, Junio C Hamano wrote:
> >
> >> With recent glibc, mkstemp() creates 0400 file. Updated
> >> pack-objects uses it in pack/idx writing without fixing this,
> >> hence this problem.
> >
> > Oops. I guess I'm guilty for this. I didn't bother looking at the
> > permission on the pack for git-pack-objects since git-repack seemed to
> > take care of that. But it only _remove_ write permissions.
>
> Ok, then probably we can change the 0444 in my "quickfix" patch
> to 0644. That should also let the 5300 test pass.

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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-22 20:37    [W:0.231 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site