git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gc changes permissions of files
@ 2008-06-15  3:59 Allan Wind
  2008-06-15  5:38 ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Allan Wind @ 2008-06-15  3:59 UTC (permalink / raw)
  To: git

Is anyone looking into fixing gc so it does not change permission on 
files?  I would think it should consider current permissions of files 
before umask.

I believe Nigel reported this issue with:
http://thread.gmane.org/gmane.comp.version-control.git/79213/focus=79237
and still seeing issues with 1.5.5.4.


/Allan

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

* Re: gc changes permissions of files
  2008-06-15  3:59 gc changes permissions of files Allan Wind
@ 2008-06-15  5:38 ` Johannes Schindelin
  2008-06-15  6:27   ` Allan Wind
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2008-06-15  5:38 UTC (permalink / raw)
  To: Allan Wind; +Cc: git

Hi,

On Sat, 14 Jun 2008, Allan Wind wrote:

> Is anyone looking into fixing gc so it does not change permission on 
> files?  I would think it should consider current permissions of files 
> before umask.
> 
> I believe Nigel reported this issue with:
> http://thread.gmane.org/gmane.comp.version-control.git/79213/focus=79237
> and still seeing issues with 1.5.5.4.

It would have been nice to briefly illustrate the problem again.

In the message you referred to, it seems to suggest that git-gc (in 
fact, git pack-refs) set the permissions wrong in a shared repository.

However, I cannot reproduce at all:

-- snip --
[PATCH] Verify that permissions for packed-refs are set correctly

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1301-shared-repo.sh |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 5e4252a..c4d3239 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -43,6 +43,24 @@ test_expect_success 'update-server-info honors core.sharedRepository' '
 	esac
 '
 
+test_expect_success 'pack-refs honors core.sharedRepository' '
+
+	(umask 0217 &&
+	 : > a2 &&
+	 git pack-refs) &&
+	actual="$(ls -l .git/packed-refs)" &&
+	case "$actual" in
+	-r--r--r--*)
+		: happy
+		;;
+	*)
+		echo Oops, .git/packed-refs is not 0444
+		false
+		;;
+	esac
+
+'
+
 for u in	0660:rw-rw---- \
 		0640:rw-r----- \
 		0600:rw------- \
-- snap --

This succeeds.

Indeed, it should succeed, since the relevant part in lockfile.c was fixed 
in version v1.4.0~4.

However, I suspect from the original message that the reflogs did not have 
the correct permissions.  But again, a simple test succeeds:

-- snip --
[PATCH] Add a test for logrefs in bare repositories

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1301-shared-repo.sh |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 5e4252a..8530a56 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -24,6 +24,39 @@ test_expect_success 'shared=all' '
 	test 2 = $(git config core.sharedrepository)
 '
 
+test_expect_success 'reflogs honor core.sharedRepository' '
+	git config core.logAllRefUpdates true &&
+	echo 2 > a1 &&
+	git add a1 &&
+	test_tick &&
+	git commit -m a1 &&
+	actual="$(ls -l .git/logs/refs/heads/master)" &&
+	case "$actual" in
+	-rw-rw-r--*)
+		: happy
+		;;
+	*)
+		echo Oops, .git/logs/refs/heads/master is not 0664
+		false
+		;;
+	esac &&
+	(mkdir bare.git &&
+	 cd bare.git &&
+	 git --bare init --shared &&
+	 git config core.logAllRefUpdates true) &&
+	git push bare.git master:refs/heads/new &&
+	actual="$(ls -l bare.git/logs/refs/heads/new)" &&
+	case "$actual" in
+	-rw-rw-*)
+		: happy
+		;;
+	*)
+		echo Oops, bare.git/logs/refs/heads/new is not 0664
+		false
+		;;
+	esac
+'
+
 test_expect_success 'update-server-info honors core.sharedRepository' '
 	: > a1 &&
 	git add a1 &&
-- 
1.5.5.1.780.g346de
-- snap --

So now I got curious and tested it with v1.5.4.4, and indeed, it failed.

If you are curious who/what fixed it, go ahead, bisect it.

I wrote all this down so that the next time, you could verify yourself if 
the bug was fixed or not, instead of having to ask here.

Ciao,
Dscho

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

* Re: gc changes permissions of files
  2008-06-15  5:38 ` Johannes Schindelin
@ 2008-06-15  6:27   ` Allan Wind
  2008-06-15  6:41     ` Allan Wind
  2008-06-15 22:31     ` Allan Wind
  0 siblings, 2 replies; 6+ messages in thread
From: Allan Wind @ 2008-06-15  6:27 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On 2008-06-15T06:38:21+0100, Johannes Schindelin wrote:
> On Sat, 14 Jun 2008, Allan Wind wrote:
> 
> > Is anyone looking into fixing gc so it does not change permission on 
> > files?  I would think it should consider current permissions of files 
> > before umask.
> > 
> > I believe Nigel reported this issue with:
> > http://thread.gmane.org/gmane.comp.version-control.git/79213/focus=79237
> > and still seeing issues with 1.5.5.4.
> 
> It would have been nice to briefly illustrate the problem again.

Of course.

# umask
umask 0022
# find . -ls > /tmp/before
# git gc
Counting objects: 1435, done.
Compressing objects: 100% (747/747), done.
Writing objects: 100% (1435/1435), done.
Total 1435 (delta 690), reused 1422 (delta 682)
# find . -ls > /tmp/after

On these files group write is revoked when running gc (g-w).  /tmp/before:

 16420 662752 -rw-rw----   1 root     users    677990209 Jun 15 01:49 ./objects/pack/pack-f962a3321392570
5b321ad2ba6ccb0037114f92d.pack
 16432   36 -rw-rw----   1 root     users       35504 Jun 15 01:49 ./objects/pack/pack-f962a33213925705b3
21ad2ba6ccb0037114f92d.idx
...
 18258    4 drwxrwx---   2 allan    users        4096 Jun 15 01:47 ./logs/refs/heads
 16481    8 -rw-rw----   1 root     users        6100 Jun 15 01:47 ./logs/refs/heads/master

and /tmp/after:

 16401 662752 -r--r--r--   1 root     root     677990209 Jun 15 01:59 ./objects/pack/pack-f962a3321392570
5b321ad2ba6ccb0037114f92d.pack
 16404   36 -r--r--r--   1 root     root        35504 Jun 15 01:59 ./objects/pack/pack-f962a33213925705b3
21ad2ba6ccb0037114f92d.idx
...
 16402    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/refs/heads/master
 16403    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/HEAD

and these on these other read permissions (o+r) is added.  /tmp/before:

 16394    4 -rw-rw----   1 root     users          54 Jun 15 01:49 ./objects/info/packs
 16481    8 -rw-rw----   1 root     users        6100 Jun 15 01:47 ./logs/refs/heads/master
 16475    8 -rw-rw----   1 root     users        6100 Jun 15 01:47 ./logs/HEAD
 16485   16 -rw-rw----   1 root     users       14773 Jun 15 01:47 ./packed-refs

and /tmp/after:

 16393    4 -rw-rw-r--   1 root     root           54 Jun 15 01:59 ./objects/info/packs
 16402    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/refs/heads/master
 16403    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/HEAD
 16386   16 -rw-rw-r--   1 root     root        14773 Jun 15 01:57 ./packed-refs

I seem to recall that push to the repository also introduces files without
group write permission.  Unfortunately it looks something broke when I ran
gc.  Any help in getting my repository back up would be appreciated:

allan@vent:~/var/git/www2$ git clone ssh://pawan.localnet./var/lib/git/www.git
Initialized empty Git repository in /home/allan/var/git/www2/www/.git/
fatal: git-upload-pack: cannot find object 56032c4f35fd39fe4151fca2d010d299a8901101:
fatal: The remote end hung up unexpectedly
fetch-pack from 'ssh://pawan.localnet./var/lib/git/www.git' failed.


/Allan

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

* Re: gc changes permissions of files
  2008-06-15  6:27   ` Allan Wind
@ 2008-06-15  6:41     ` Allan Wind
  2008-06-15  7:10       ` Allan Wind
  2008-06-15 22:31     ` Allan Wind
  1 sibling, 1 reply; 6+ messages in thread
From: Allan Wind @ 2008-06-15  6:41 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

On 2008-06-15T02:27:36-0400, Allan Wind wrote:
> I seem to recall that push to the repository also introduces files without
> group write permission.  Unfortunately it looks something broke when I ran
> gc.  Any help in getting my repository back up would be appreciated:
> 
> allan@vent:~/var/git/www2$ git clone ssh://pawan.localnet./var/lib/git/www.git
> Initialized empty Git repository in /home/allan/var/git/www2/www/.git/
> fatal: git-upload-pack: cannot find object 56032c4f35fd39fe4151fca2d010d299a8901101:
> fatal: The remote end hung up unexpectedly
> fetch-pack from 'ssh://pawan.localnet./var/lib/git/www.git' failed.

# git fsck
dangling commit 2b0da4aabfba6c61baf9f351b2dfbd5a88a8a999

Re-running this returns the same dangling commit, so fsck does not seem 
to fix anything.


/Allan

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

* Re: gc changes permissions of files
  2008-06-15  6:41     ` Allan Wind
@ 2008-06-15  7:10       ` Allan Wind
  0 siblings, 0 replies; 6+ messages in thread
From: Allan Wind @ 2008-06-15  7:10 UTC (permalink / raw)
  To: git, Johannes Schindelin

On 2008-06-15T02:41:33-0400, Allan Wind wrote:
> On 2008-06-15T02:27:36-0400, Allan Wind wrote:
> > I seem to recall that push to the repository also introduces files without
> > group write permission.  Unfortunately it looks something broke when I ran
> > gc.  Any help in getting my repository back up would be appreciated:
> > 
> > allan@vent:~/var/git/www2$ git clone ssh://pawan.localnet./var/lib/git/www.git
> > Initialized empty Git repository in /home/allan/var/git/www2/www/.git/
> > fatal: git-upload-pack: cannot find object 56032c4f35fd39fe4151fca2d010d299a8901101:
> > fatal: The remote end hung up unexpectedly
> > fetch-pack from 'ssh://pawan.localnet./var/lib/git/www.git' failed.
> 
> # git fsck
> dangling commit 2b0da4aabfba6c61baf9f351b2dfbd5a88a8a999
> 
> Re-running this returns the same dangling commit, so fsck does not seem 
> to fix anything.

Looking at the log I see that 56032c4f35fd39fe4151fca2d010d299a8901101 is HEAD on orgin,
and 2b0da4aabfba6c61baf9f351b2dfbd5a88a8a999 is what I tried to commit 
when I got the initially error.  I will catch the howto when git.or.cz 
is back online.  If anyone wants some data before I try to fix my 
repository please let me know soon.


/Allan

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

* Re: gc changes permissions of files
  2008-06-15  6:27   ` Allan Wind
  2008-06-15  6:41     ` Allan Wind
@ 2008-06-15 22:31     ` Allan Wind
  1 sibling, 0 replies; 6+ messages in thread
From: Allan Wind @ 2008-06-15 22:31 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

On 2008-06-15T02:27:36-0400, Allan Wind wrote:
> On 2008-06-15T06:38:21+0100, Johannes Schindelin wrote:
> > On Sat, 14 Jun 2008, Allan Wind wrote:
> > 
> > > Is anyone looking into fixing gc so it does not change permission on 
> > > files?  I would think it should consider current permissions of files 
> > > before umask.
> > > 
> > > I believe Nigel reported this issue with:
> > > http://thread.gmane.org/gmane.comp.version-control.git/79213/focus=79237
> > > and still seeing issues with 1.5.5.4.
> > 
> > It would have been nice to briefly illustrate the problem again.
> 
> Of course.
> 
> # umask
> umask 0022
> # find . -ls > /tmp/before
> # git gc
> Counting objects: 1435, done.
> Compressing objects: 100% (747/747), done.
> Writing objects: 100% (1435/1435), done.
> Total 1435 (delta 690), reused 1422 (delta 682)
> # find . -ls > /tmp/after
> 
> On these files group write is revoked when running gc (g-w).  /tmp/before:
> 
>  16420 662752 -rw-rw----   1 root     users    677990209 Jun 15 01:49 ./objects/pack/pack-f962a3321392570
> 5b321ad2ba6ccb0037114f92d.pack
>  16432   36 -rw-rw----   1 root     users       35504 Jun 15 01:49 ./objects/pack/pack-f962a33213925705b3
> 21ad2ba6ccb0037114f92d.idx
> ...
>  18258    4 drwxrwx---   2 allan    users        4096 Jun 15 01:47 ./logs/refs/heads
>  16481    8 -rw-rw----   1 root     users        6100 Jun 15 01:47 ./logs/refs/heads/master
> 
> and /tmp/after:
> 
>  16401 662752 -r--r--r--   1 root     root     677990209 Jun 15 01:59 ./objects/pack/pack-f962a3321392570
> 5b321ad2ba6ccb0037114f92d.pack
>  16404   36 -r--r--r--   1 root     root        35504 Jun 15 01:59 ./objects/pack/pack-f962a33213925705b3
> 21ad2ba6ccb0037114f92d.idx
> ...
>  16402    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/refs/heads/master
>  16403    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/HEAD
> 
> and these on these other read permissions (o+r) is added.  /tmp/before:
> 
>  16394    4 -rw-rw----   1 root     users          54 Jun 15 01:49 ./objects/info/packs
>  16481    8 -rw-rw----   1 root     users        6100 Jun 15 01:47 ./logs/refs/heads/master
>  16475    8 -rw-rw----   1 root     users        6100 Jun 15 01:47 ./logs/HEAD
>  16485   16 -rw-rw----   1 root     users       14773 Jun 15 01:47 ./packed-refs
> 
> and /tmp/after:
> 
>  16393    4 -rw-rw-r--   1 root     root           54 Jun 15 01:59 ./objects/info/packs
>  16402    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/refs/heads/master
>  16403    8 -rw-r--r--   1 root     root         6100 Jun 15 01:57 ./logs/HEAD
>  16386   16 -rw-rw-r--   1 root     root        14773 Jun 15 01:57 ./packed-refs
> 
> I seem to recall that push to the repository also introduces files without
> group write permission.  Unfortunately it looks something broke when I ran
> gc.  Any help in getting my repository back up would be appreciated:

This above was without core.sharedrepository set.  Setting 
core.sharedrepository to true, and repeating the experiment I get the 
following changes (starting out with files being 660):

245865    0 -rw-rw-r--   1 allan    users           0 Jun 15 18:25 ./info/refs
245883    4 -rw-rw-r--   1 allan    users          54 Jun 15 18:25 ./objects/info/packs
245882 662464 -r--r--r--   1 allan    users    677691559 Jun 15 18:25 ./objects/pack/pack-7d2c630cc2bf7621e14487fdde5907765ebb5d4d.pack
245886   36 -r--r--r--   1 allan    users       36128 Jun 15 18:25 ./objects/pack/pack-7d2c630cc2bf7621e14487fdde5907765ebb5d4d.idx
245885    4 -rw-rw-r--   1 allan    users          26 Jun 15 18:24 ./packed-refs

write permission is removed from the two pack files, and read 
permissions is granted for the other files which did not have them 
before.


/Allan

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

end of thread, other threads:[~2008-06-15 22:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-15  3:59 gc changes permissions of files Allan Wind
2008-06-15  5:38 ` Johannes Schindelin
2008-06-15  6:27   ` Allan Wind
2008-06-15  6:41     ` Allan Wind
2008-06-15  7:10       ` Allan Wind
2008-06-15 22:31     ` Allan Wind

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