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 17AF41389F5 for ; Sat, 15 Nov 2014 04:45:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9F6EDE0893; Sat, 15 Nov 2014 04:45:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2281AE0891 for ; Sat, 15 Nov 2014 04:45:18 +0000 (UTC) Received: from localhost.localdomain (ip70-181-96-121.oc.oc.cox.net [70.181.96.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 0964C340A8F; Sat, 15 Nov 2014 04:45:16 +0000 (UTC) From: Zac Medico To: gentoo-portage-dev@lists.gentoo.org Cc: Zac Medico Subject: [gentoo-portage-dev] [PATCH v2] NewsManager.getUnreadItems: handle EROFS (490732) Date: Fri, 14 Nov 2014 20:45:11 -0800 Message-Id: <1416026711-21913-1-git-send-email-zmedico@gentoo.org> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1415601050-29668-1-git-send-email-zmedico@gentoo.org> References: <1415601050-29668-1-git-send-email-zmedico@gentoo.org> 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: 72cf4951-2813-4970-a9c5-78f2c7d0b2d6 X-Archives-Hash: 88fd1c28dc293fddceca54f2b5d855fa When getUnreadItems tries to lock the news.unread file, it's safe to ignore EROFS. This is handled with a ReadOnlyFileSystem exception raised from the portage.locks.lockfile function. X-Gentoo-Bug: 490732 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=490732 --- This updated patch fixes the typo spotted by Brian Dolbec. pym/portage/exception.py | 1 + pym/portage/locks.py | 7 ++++++- pym/portage/news.py | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pym/portage/exception.py b/pym/portage/exception.py index ef62e7a..857a727 100644 --- a/pym/portage/exception.py +++ b/pym/portage/exception.py @@ -133,6 +133,7 @@ class AlarmSignal(TimeoutException): class ReadOnlyFileSystem(PortageException): """Read-only file system""" + from errno import EROFS as errno class CommandNotFound(PortageException): """A required binary was not available or executable""" diff --git a/pym/portage/locks.py b/pym/portage/locks.py index 0789f89..0b0f74b 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -16,7 +16,8 @@ import warnings import portage from portage import os, _encodings, _unicode_decode from portage.exception import DirectoryNotFound, FileNotFound, \ - InvalidData, TryAgain, OperationNotPermitted, PermissionDenied + InvalidData, TryAgain, OperationNotPermitted, PermissionDenied, \ + ReadOnlyFileSystem from portage.util import writemsg from portage.localization import _ @@ -110,6 +111,8 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, raise OperationNotPermitted(func_call) elif e.errno == PermissionDenied.errno: raise PermissionDenied(func_call) + elif e.errno == ReadOnlyFileSystem.errno: + raise ReadOnlyFileSystem(func_call) else: raise @@ -404,6 +407,8 @@ def hardlink_lockfile(lockfilename, max_wait=DeprecationWarning, raise OperationNotPermitted(func_call) elif e.errno == PermissionDenied.errno: raise PermissionDenied(func_call) + elif e.errno == ReadOnlyFileSystem.errno: + raise ReadOnlyFileSystem(func_call) else: raise else: diff --git a/pym/portage/news.py b/pym/portage/news.py index 0d72b00..d90d97a 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -1,5 +1,5 @@ # portage: news management code -# Copyright 2006-2013 Gentoo Foundation +# Copyright 2006-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function, unicode_literals @@ -28,7 +28,7 @@ from portage.localization import _ from portage.locks import lockfile, unlockfile from portage.output import colorize from portage.exception import InvalidLocation, OperationNotPermitted, \ - PermissionDenied + PermissionDenied, ReadOnlyFileSystem class NewsManager(object): """ @@ -180,7 +180,8 @@ class NewsManager(object): unread_lock = None try: unread_lock = lockfile(unread_filename, wantnewlockfile=1) - except (InvalidLocation, OperationNotPermitted, PermissionDenied): + except (InvalidLocation, OperationNotPermitted, PermissionDenied, + ReadOnlyFileSystem): pass try: try: -- 2.0.4