* [gentoo-portage-dev] [PATCH] Manifest._apply_max_mtime: handle EPERM from utime (bug 582388)
@ 2016-05-08 21:57 Zac Medico
2016-05-08 23:15 ` Brian Dolbec
0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2016-05-08 21:57 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
Only warn if utime fails due to the Manifest parent directory
being owned by a different user, since it's not a problem
unless the repo is being prepared for distribution via rsync.
X-Gentoo-bug: 582388
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=582388
---
pym/portage/manifest.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index f696f84..fe4166c 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -1,10 +1,11 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
import errno
import io
+import logging
import re
import stat
import sys
@@ -15,7 +16,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.checksum:hashfunc_map,perform_multiple_checksums,' + \
'verify_all,_apply_hash_filter,_filter_unaccelarated_hashes',
'portage.repository.config:_find_invalid_path_char',
- 'portage.util:write_atomic',
+ 'portage.util:write_atomic,writemsg_level',
)
from portage import os
@@ -387,7 +388,17 @@ class Manifest(object):
if max_mtime is not None:
for path in preserved_stats:
- os.utime(path, (max_mtime, max_mtime))
+ try:
+ os.utime(path, (max_mtime, max_mtime))
+ except OSError as e:
+ # Even though we have write permission, utime fails
+ # with EPERM if path is owned by a different user.
+ # Only warn in this case, since it's not a problem
+ # unless this repo is being prepared for distribution
+ # via rsync.
+ writemsg_level('!!! utime(\'%s\', (%s, %s)): %s\n' %
+ (path, max_mtime, max_mtime, e),
+ level=logging.WARNING, noiselevel=-1)
def sign(self):
""" Sign the Manifest """
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Manifest._apply_max_mtime: handle EPERM from utime (bug 582388)
2016-05-08 21:57 [gentoo-portage-dev] [PATCH] Manifest._apply_max_mtime: handle EPERM from utime (bug 582388) Zac Medico
@ 2016-05-08 23:15 ` Brian Dolbec
0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2016-05-08 23:15 UTC (permalink / raw
To: gentoo-portage-dev
On Sun, 8 May 2016 14:57:36 -0700
Zac Medico <zmedico@gentoo.org> wrote:
> Only warn if utime fails due to the Manifest parent directory
> being owned by a different user, since it's not a problem
> unless the repo is being prepared for distribution via rsync.
>
> X-Gentoo-bug: 582388
> X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=582388
> ---
> pym/portage/manifest.py | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
> index f696f84..fe4166c 100644
> --- a/pym/portage/manifest.py
> +++ b/pym/portage/manifest.py
> @@ -1,10 +1,11 @@
> -# Copyright 1999-2014 Gentoo Foundation
> +# Copyright 1999-2016 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
>
> from __future__ import unicode_literals
>
> import errno
> import io
> +import logging
> import re
> import stat
> import sys
> @@ -15,7 +16,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
> 'portage.checksum:hashfunc_map,perform_multiple_checksums,'
> + \ 'verify_all,_apply_hash_filter,_filter_unaccelarated_hashes',
> 'portage.repository.config:_find_invalid_path_char',
> - 'portage.util:write_atomic',
> + 'portage.util:write_atomic,writemsg_level',
> )
>
> from portage import os
> @@ -387,7 +388,17 @@ class Manifest(object):
>
> if max_mtime is not None:
> for path in preserved_stats:
> - os.utime(path, (max_mtime,
> max_mtime))
> + try:
> + os.utime(path, (max_mtime,
> max_mtime))
> + except OSError as e:
> + # Even though we have write
> permission, utime fails
> + # with EPERM if path is
> owned by a different user.
> + # Only warn in this case,
> since it's not a problem
> + # unless this repo is being
> prepared for distribution
> + # via rsync.
> + writemsg_level('!!!
> utime(\'%s\', (%s, %s)): %s\n' %
> + (path, max_mtime,
> max_mtime, e),
> +
> level=logging.WARNING, noiselevel=-1)
> def sign(self):
> """ Sign the Manifest """
Looks fine :)
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-08 23:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-08 21:57 [gentoo-portage-dev] [PATCH] Manifest._apply_max_mtime: handle EPERM from utime (bug 582388) Zac Medico
2016-05-08 23:15 ` Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox