From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8821013824A for ; Sun, 8 May 2016 21:58:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E8DAC21C093; Sun, 8 May 2016 21:58:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8017C21C084 for ; Sun, 8 May 2016 21:58:04 +0000 (UTC) Received: from localhost.localdomain (ip68-5-185-102.oc.oc.cox.net [68.5.185.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 627AF340B5D; Sun, 8 May 2016 21:58:03 +0000 (UTC) From: Zac Medico To: gentoo-portage-dev@lists.gentoo.org Cc: Zac Medico Subject: [gentoo-portage-dev] [PATCH] Manifest._apply_max_mtime: handle EPERM from utime (bug 582388) Date: Sun, 8 May 2016 14:57:36 -0700 Message-Id: <1462744656-16090-1-git-send-email-zmedico@gentoo.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: dc78d50b-e0ae-4fb3-a4e5-6c5425af5ed8 X-Archives-Hash: 844d320c43a43eb63748878c29addc8c 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