Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 582388

Summary: sys-apps/portage-2.2.28: PermissionError: [Errno 1] Operation not permitted from os.utime when generating manifest
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: aklhfex, srcshelton
Priority: Normal Keywords: InVCS
Version: 2.2   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 573774    

Description Zac Medico gentoo-dev 2016-05-07 23:20:42 UTC
The utime function will fail with EPERM if the caller's effective UID does not match the owner of the file. This is triggered when attempting to set the mtime of a parent directory that is owned by a different user:

>>> Creating Manifest for /usr/portage/sci-biology/bwa
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.5/ebuild", line 338, in <module>
    vartree=portage.db[portage.root]['vartree'])
  File "/usr/lib64/python3.5/site-packages/portage/package/ebuild/doebuild.py", line 1066, in doebuild
    return not digestgen(mysettings=mysettings, myportdb=mydbapi)
  File "/usr/lib64/python3.5/site-packages/portage/proxy/objectproxy.py", line 31, in __call__
    return result(*args, **kwargs)
  File "/usr/lib64/python3.5/site-packages/portage/package/ebuild/digestgen.py", line 178, in digestgen
    mf.write(sign=False)
  File "/usr/lib64/python3.5/site-packages/portage/manifest.py", line 316, in write
    self._apply_max_mtime(preserved_stats, myentries)
  File "/usr/lib64/python3.5/site-packages/portage/manifest.py", line 390, in _apply_max_mtime
    os.utime(path, (max_mtime, max_mtime))
  File "/usr/lib64/python3.5/site-packages/portage/__init__.py", line 259, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
PermissionError: [Errno 1] Operation not permitted
Comment 1 Zac Medico gentoo-dev 2016-05-07 23:30:29 UTC
Since the utime call is non-essential except when generating manifests for distribution via rsync, we can simply display a warning message when it fails.
Comment 2 Zac Medico gentoo-dev 2016-05-08 22:06:53 UTC
There's a patch in the following branch:

https://github.com/zmedico/portage/tree/bug_582388

I've posted it for review here:

https://archives.gentoo.org/gentoo-portage-dev/message/844d320c43a43eb63748878c29addc8c
Comment 4 Zac Medico gentoo-dev 2017-08-11 19:55:56 UTC
Fixed in 2.3.0.