The files unused
, badunused
and tmpunused
in .git/annex/
do not have the correct permissions when the git repository is set to --shared=group
. Such files are 600
, while they should be 660
, as other files in .git/annex
.
For this reason, when those files are created, they are accessibile only to one user (the owner), triggering errors when other users in the group attempt things like git annex unused
or git annex dropunused
. At least this occurs with git-annex 6.20171018+gitgbb20b1ed3-1~ndall+1 .
To reproduce the problem:
git init --shared=group
git annex init
echo test > test
git annex add test
git commit -m test
git rm test
git commit -m removed
git annex unused
you get:
unused . (checking for unused data...) (checking master...)
Some annexed data is no longer used by any files:
NUMBER KEY
1 SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
(To see where data was previously used, try: git log --stat -S'KEY')
To remove unwanted data: git-annex dropunused NUMBER
ok
Conversely, from another user of the group you get:
> git annex unused
unused . (checking for unused data...) (checking master...)
Some annexed data is no longer used by any files:
NUMBER KEY
1 SHA256E-s5--f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
(To see where data was previously used, try: git log --stat -S'KEY')
To remove unwanted data: git-annex dropunused NUMBER
git-annex: .git/annex/unused: openFile: permission denied (Permission denied)
failed
git-annex: unused: 1 failed
Moreover:
> git annex dropunused 1
git-annex: .git/annex/misctmp/mergedrefs.0: createDirectory: permission denied (Permission denied)
This is somewhat expected, because the permissions of unused
, badunused
and tmpunused
are 600
:
> ll .git/annex/
total 40
drwxrwsr-x 5 ele testgroup 4096 dic 19 14:50 ./
drwxrwsr-x 9 ele testgroup 4096 dic 19 14:50 ../
-rw------- 1 ele testgroup 0 dic 19 14:50 badunused
-rw-rw-r-- 1 ele testgroup 345 dic 19 14:49 index
-rw-rw-r-- 1 ele testgroup 41 dic 19 14:49 index.lck
drwxrwsr-x 2 ele testgroup 4096 dic 19 14:49 journal/
-rw-rw---- 1 ele testgroup 0 dic 19 14:49 journal.lck
-rw-rw-r-- 1 ele testgroup 62 dic 19 14:49 mergedrefs
drwxrwsr-x 2 ele testgroup 4096 dic 19 14:49 misctmp/
drwxrwsr-x 3 ele testgroup 4096 dic 19 14:49 objects/
-rw-rw---- 1 ele testgroup 0 dic 19 14:49 precommit.lck
-rw-rw-r-- 1 ele testgroup 0 dic 19 14:49 sentinal
-rw-rw-r-- 1 ele testgroup 21 dic 19 14:49 sentinal.cache
-rw------- 1 ele testgroup 0 dic 19 14:50 tmpunused
-rw------- 1 ele testgroup 101 dic 19 14:50 unused
If this is the intended behavior, could you please explain me how to use git annex unused
and dropunused
in a shared repository?
unused
,badunused
andtmpunused
to660
, then other another user of the group can dogit annex unused
andgit annex dropunused 1
without errors. Unfortunately, aftergit annex unused
, the ownership ofunused
,badunused
andtmpunused
changes from the initial user to the new user, and permissions are reset to600
, which re-creates the initial problem.Fixed, but I was not able to reproduce the part where dropunused failed with a permissions error involving .git/annex/misctmp, despite having it set up the same as you did.
Joey, thanks for fixing the bug and for the larger commit (24df95f0f6ab474119aff3bbd942251373754ab2) to properly handle core.sharedRepository!
I see you couldn't reproduce the permissions error involving .git/annex/misctmp. Just to clarify: it occurs to me only with the user for which
git annex unused
fails, and not to the initial user that didgit rm
, for whichgit annex unused
works. I can still reproduce the issue in this very moment with git-annex 6.20171211+gitgba511f4de-1~ndall+1. Nevertheless, I'll try the updated code as soon as possible.And thanks to the anonymous bitcoin donor for supporting the fix of this bug!
Yes, I was running dropunused as other user, and still see no permissions problem there. .git/annex/misctmp is writable by the group.
I can confirm that the permissions I see are set as you say: .git/annex/misctmp is writable by the group. Still, the error message appears here, using git-annex 6.20171211. I will look more in detail into this one. If something interesting pops out, I'll write here.
Thanks again for your work.