Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 416193 - `repoman commit --echangelog` fails if sharing tree with other users
Summary: `repoman commit --echangelog` fails if sharing tree with other users
Status: RESOLVED OBSOLETE
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Repoman (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-16 02:10 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2017-03-16 01:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2012-05-16 02:10:29 UTC
In the new tinderbox host I wanted to set up a shared CVS tree for me and lu_zero in a private container. For the cvs part, this can be easily achieved by using ACLs in such a way that both the users have read/write and execute if needed permissions (this gets tricky with umasks but nevermind that now).

When you do commit that way, though, repoman commit will fail in this way:


@@ -4,0 +5,4 @@
+  16 May 2012; Diego E. Pettenò <flameeyes@gentoo.org> -apcupsd-3.14.10.ebuild,
+  -files/apcupsd.init.2:
+  Remove old version.
+

Traceback (most recent call last):
  File "/usr/bin/repoman", line 2525, in <module>
    pretend=options.pretend)
  File "/usr/lib64/portage/pym/repoman/utilities.py", line 857, in UpdateChangeLog
    shutil.move(clnew_path, cl_path)
  File "/usr/lib64/portage/pym/portage/__init__.py", line 230, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
  File "/usr/lib64/python2.7/shutil.py", line 299, in move
    copy2(src, real_dst)
  File "/usr/lib64/python2.7/shutil.py", line 129, in copy2
    copystat(src, dst)
  File "/usr/lib64/python2.7/shutil.py", line 98, in copystat
    os.utime(dst, (st.st_atime, st.st_mtime))
OSError: [Errno 1] Operation not permitted: './ChangeLog'

The reason is that it can't preserve the ownership if the ownership is not of the same user. Even most interesting is the fact that copy2() will fail _in a non-atomic way_ since the file is actually copied, but the permissions are not preserved!
Comment 1 Mike Gilbert gentoo-dev 2012-05-16 02:42:24 UTC
shutil.move calls os.rename and falls back to shutil.copy2 if that fails.

I wonder why os.rename would fail?
Comment 2 Fabian Groffen gentoo-dev 2012-05-16 06:38:10 UTC
This looks a lot like bug #413397.  Perhaps the correct error code isn't defined here either?
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-05-16 08:56:47 UTC
That was "ENOSUPP", here is "ENOPERM"... so different issue but still similar enough. For sure it sounds like Python's mainly at fault.
Comment 4 Arfrever Frehtes Taifersar Arahesis 2012-05-16 10:38:29 UTC
shutil.copy2 tries to preserve extended attributes (e.g. ACLs) only since Python 3.3.

In /usr/lib64/python2.7/shutil.py in move() function apply:
     try:
         os.rename(src, real_dst)
-     except OSError:
+     except OSError as e:
+        print(e)
         if os.path.isdir(src):

And show exception.
Comment 5 Brian Dolbec (RETIRED) gentoo-dev 2017-03-16 01:25:50 UTC
Changelogs are now obsolete, gone from the tree and even from the normal rsync tree (is an optional download, generated from git logs)