Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320452

Summary: Insufficient Permissions for adding Object to Repository
Product: Community Reporter: David Carver <d_a_carver>
Component: GitAssignee: Eclipse Webmaster <webmaster>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, florian, gabipetrovay, info, sam.neth, villard
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description David Carver CLA 2010-07-20 20:17:32 EDT
error: insufficient permission for adding an object to repository database ./objects

fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://dacarver@git.eclipse.org/gitroot/webtools/org.eclipse.webtools.incubator.git


Unfortunately I don't seem to have the necessary rights to make the appropriate changes.  According the to following blog entry we need to change the permissions on the files so the group has access to them:

http://mapopa.blogspot.com/2009/10/git-insufficient-permission-for-adding.html

This is blocking some changes from going through as the push is being rejected.
Comment 1 David Carver CLA 2010-07-20 20:17:58 EDT
This seems to be happening with the xquery-dev branch.
Comment 2 Denis Roy CLA 2010-07-21 09:26:48 EDT
Some of the file permissions were wrong.  I've fixed them.
Comment 3 David Carver CLA 2010-07-23 08:48:27 EDT
It looks like this issue has returned again.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=315667#c7
Comment 4 Denis Roy CLA 2010-07-23 08:58:24 EDT
(In reply to comment #3)
> It looks like this issue has returned again.


Can I ask you all what client you all are using?  The permissions seem to break only in your repo, and only for directories that are owned by lvillard and fthienel.  Some directories become world-writable, while others lose their group write permissions:

drwxrwsr-x 2 fthienel  webtools.incubator 104 Jul 19 17:52 f7
drwxrwsr-x 2 lvillard  webtools.incubator 160 Jul 22 10:50 f8
drwxrwsrwx 2 lvillard  webtools.incubator 104 Jul 21 17:45 f9  <-- BAD
drwxr-sr-x 2 fthienel  webtools.incubator 104 Jul 22 17:10 fd  <-- BAD
drwxrwsr-x 2 fthienel  webtools.incubator 104 Jul 19 17:52 ff
drwxrwsr-x 2 dacarver  webtools.incubator  72 Jul 12 14:06 info
drwxrwsr-x 2 dacarver  webtools.incubator 912 Jul 20 04:16 pack
Comment 5 David Carver CLA 2010-07-23 09:17:08 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > It looks like this issue has returned again.
> 
> 
> Can I ask you all what client you all are using?  The permissions seem to break
> only in your repo, and only for directories that are owned by lvillard and
> fthienel.  Some directories become world-writable, while others lose their
> group write permissions:
> 
> drwxrwsr-x 2 fthienel  webtools.incubator 104 Jul 19 17:52 f7
> drwxrwsr-x 2 lvillard  webtools.incubator 160 Jul 22 10:50 f8
> drwxrwsrwx 2 lvillard  webtools.incubator 104 Jul 21 17:45 f9  <-- BAD
> drwxr-sr-x 2 fthienel  webtools.incubator 104 Jul 22 17:10 fd  <-- BAD
> drwxrwsr-x 2 fthienel  webtools.incubator 104 Jul 19 17:52 ff
> drwxrwsr-x 2 dacarver  webtools.incubator  72 Jul 12 14:06 info
> drwxrwsr-x 2 dacarver  webtools.incubator 912 Jul 20 04:16 pack

I think Florian is on Windows and is using a combination of EGit and msysgit.

Lionel I think uses EGit and git for Mac, but may also use git for windows as well.
Comment 6 Florian Thienel CLA 2010-07-23 09:43:54 EDT
(In reply to comment #5)
> I think Florian is on Windows and is using a combination of EGit and msysgit.
Yes. I got the error the first time using the EGit nightly build on Win7 x64, JDK 1.6.0 u20. 

If this broke the permissions it is clear why my following attempts with msysgit were not working...
Comment 7 Denis Roy CLA 2010-07-23 10:00:58 EDT
Dave, would you and your team kindly help me figure this out?  Each time you push to git.eclipse.org, can you all post in this bug the sha1 hash and the client you were using?  It shouldn't take more than a couple of pushes to figure this out.

Thanks
Comment 8 David Carver CLA 2010-07-23 10:59:27 EDT
(In reply to comment #7)
> Dave, would you and your team kindly help me figure this out?  Each time you
> push to git.eclipse.org, can you all post in this bug the sha1 hash and the
> client you were using?  It shouldn't take more than a couple of pushes to
> figure this out.

Sure.  I've added all the active WTP Incubator committers on this message as well.

Guys please provide the necessary information when you make a commit to the Git repository.  Include the Commit ID and the client used to make the commit, as well as how you pushed the changes into the repo.

This will help us identify where the problem is happening.  If you are using windows please let us know if you used msysgit during this process as well.
Comment 9 Florian Thienel CLA 2010-07-24 03:50:46 EDT
Pushed "76cb5d0..6881b5d" with "git version 1.7.0.2.msysgit.0"
Comment 10 Florian Thienel CLA 2010-07-24 03:53:54 EDT
(In reply to comment #9)
> Pushed "76cb5d0..6881b5d" with "git version 1.7.0.2.msysgit.0"
Sorry, wrong hash. It was actually "6881b5d1239a13ebb67c47cca8fa960308786058" what I pushed. Still learning...
Comment 11 Florian Thienel CLA 2010-07-24 07:53:39 EDT
Pushed from "e1d7e9bf696acd0d12413feed67967e132f5abdf" to "6d0096db03ec68e6c526c2622b343dafa045f8a0" with EGit 0.9.0.201007191513
Comment 12 Gabriel Petrovay CLA 2010-07-25 13:36:50 EDT
Hi,

Another instance of this problem:
http://dev.eclipse.org/mhonarc/lists/wtp-incubator-dev/msg01326.html

Can you help please?

Thanks!
Comment 13 Gabriel Petrovay CLA 2010-07-25 13:37:28 EDT
I am using msysgit from windows.
Comment 14 David Carver CLA 2010-07-25 13:50:52 EDT
Doing some research on this.  If Msysgit is being used we may need to set the following:

git config core.filemode false

     If false, the executable bit differences between the index and the working copy are ignored; useful on broken filesystems like FAT. See git-update-index(1).

    The default is true, except git-clone(1) or git-init(1) will probe and set core.fileMode false if appropriate when the repository is created.

Denise we may need to set this on the Eclipse git repo as well.
Comment 15 Denis Roy CLA 2010-07-26 09:33:21 EDT
The directory structure is all kinds of odd this morning.  These directories all have bad permissions:

drwxrwsrwx 2 gpetrovay webtools.incubator  104 Jul 24 13:13 19
drwxrwsrwx 2 gpetrovay webtools.incubator  104 Jul 24 13:13 2e
drwxrwsrwx 2 gpetrovay webtools.incubator  104 Jul 24 13:13 2f
drwxr-sr-x 2 dschadow  webtools.incubator  104 Jul 24 08:57 79
drwxrwsrwx 2 gpetrovay webtools.incubator  104 Jul 24 13:13 80
drwxr-sr-x 2 dschadow  webtools.incubator  104 Jul 24 08:57 95
drwxr-sr-x 2 dschadow  webtools.incubator  104 Jul 24 08:57 df
drwxrwsrwx 2 gpetrovay webtools.incubator  104 Jul 24 13:13 ed
drwxrwsrwx 2 gpetrovay webtools.incubator  104 Jul 24 13:13 f3

Some of them are world-writable, some of them are missing the group write permissions.

I think the repo config is missing sharedRepository = true

    When group (or true), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable). When all (or world or everybody), the repository will be readable by all users, additionally to being group-shareable. When umask (or false), git will use permissions reported by umask(2). When 0xxx, where 0xxx is an octal number, files in the repository will have this mode value. 0xxx will override user's umask value (whereas the other options will only override requested parts of the user's umask value). Examples: 0660 will make the repo read/write-able for the owner and group, but inaccessible to others (equivalent to group unless umask is e.g. 0022). 0640 is a repository that is group-readable but not group-writable. See git-init(1). False by default.


I've reset all the permissions, and I've enabled that sharedRepository option.  Let's see what happens now.

FWIW, I've noticed this behaviour on other repos as well.
Comment 16 Gabriel Petrovay CLA 2010-07-26 10:41:28 EDT
It still doesn't work for me. At least the error changed:

My branch is updated:
$ git pull
Already up-to-date.

If I do a push, I get:

Counting objects: 70, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (39/39), 2.93 KiB, done.
Total 39 (delta 14), reused 0 (delta 0)
To ssh://gpetrovay@git.eclipse.org/gitroot/webtools/org.eclipse.webtools.incubator.git
   80951e3..c11e185  xquery-dev -> xquery-dev
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://gpetrovay@git.eclipse.org/gitroot/webtools/org.eclipse.webtools.incubator.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.
Comment 17 Denis Roy CLA 2010-07-26 11:01:47 EDT
(In reply to comment #16)
> It still doesn't work for me. At least the error changed:

That error is not related to this bug.  You seem to be pushing in changes that conflict with the content on the git server.  As the error says, Merge the remote changes before pushing again.  See the 'Note about fast-forwards' section of 'git push --help' for details.
Comment 18 Gabriel Petrovay CLA 2010-07-26 11:06:22 EDT
for my last problem above the problem was that my master was not updated.

I found out about this during a "git pull -v" and I saw that all branches are
updated:
From ssh://git.eclipse.org/gitroot/webtools/org.eclipse.webtools.incubator
 = [up to date]      master     -> origin/master
 = [up to date]      origin     -> origin/origin
 = [up to date]      vex-dev    -> origin/vex-dev
 = [up to date]      xmlsecurity-dev -> origin/xmlsecurity-dev
 = [up to date]      xquery-dev -> origin/xquery-dev
Updating c11e185..b5846b3


I was expecting to only have the branch I work into to change. :(
Comment 19 Gabriel Petrovay CLA 2010-07-26 11:07:11 EDT
The permission problem does show up now.

But let us see. I will reopen if it happens again.
Comment 20 Gabriel Petrovay CLA 2010-07-31 18:29:10 EDT
The problem still appears and it breaks the Hudson Build :(

https://build.eclipse.org/hudson/job/cbi-wtp-inc-xquery/364/console
Comment 21 Gabriel Petrovay CLA 2010-08-03 15:10:06 EDT
Any news on this?

Our buils are still failing:
Caused by: hudson.plugins.git.GitException: Command returned status code 128: error: insufficient permission for adding an object to repository database .git/objects

https://build.eclipse.org/hudson/job/cbi-wtp-inc-xquery/367/console
Comment 22 Denis Roy CLA 2010-08-04 10:12:53 EDT
Why would hudson need to write to your git repository?
Comment 23 David Carver CLA 2010-08-04 11:24:33 EDT
(In reply to comment #22)
> Why would hudson need to write to your git repository?

It doesn't.  It needs to write to it's own git repository, but when you clone from a remote repo, you get all the permission settings that are in that remote repo as well.   So if there is something messed up with the remote repos permissions, then it gets replicated down to the local repo as well.
Comment 24 Denis Roy CLA 2010-08-04 11:34:42 EDT
I've check the webtools repo, and since setting the shared setting to 'group' all the directories in ./objects have been user- and group-writable ever since.  I'm not sure what more it needs.
Comment 25 David Carver CLA 2010-08-04 11:47:17 EDT
Re-Closing as the latest build ran fine.  It looks like we ran into the remoting issues that the Hudson Emma plugin is causing when build runs on build2 that uses that plugin.  Build2 is getting all sorts of remoting issues again.