1 |
When getUnreadItems tries to lock the news.unread file, it's safe to |
2 |
ignore EROFS. This is handled with a ReadOnlyFileSystem exception |
3 |
raised from the portage.locks.lockfile function. |
4 |
|
5 |
X-Gentoo-Bug: 490732 |
6 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=490732 |
7 |
--- |
8 |
pym/portage/exception.py | 1 + |
9 |
pym/portage/locks.py | 7 ++++++- |
10 |
pym/portage/news.py | 7 ++++--- |
11 |
3 files changed, 11 insertions(+), 4 deletions(-) |
12 |
|
13 |
diff --git a/pym/portage/exception.py b/pym/portage/exception.py |
14 |
index ef62e7a..857a727 100644 |
15 |
--- a/pym/portage/exception.py |
16 |
+++ b/pym/portage/exception.py |
17 |
@@ -133,6 +133,7 @@ class AlarmSignal(TimeoutException): |
18 |
|
19 |
class ReadOnlyFileSystem(PortageException): |
20 |
"""Read-only file system""" |
21 |
+ from errno import EROFS as errno |
22 |
|
23 |
class CommandNotFound(PortageException): |
24 |
"""A required binary was not available or executable""" |
25 |
diff --git a/pym/portage/locks.py b/pym/portage/locks.py |
26 |
index 0789f89..0b0f74b 100644 |
27 |
--- a/pym/portage/locks.py |
28 |
+++ b/pym/portage/locks.py |
29 |
@@ -16,7 +16,8 @@ import warnings |
30 |
import portage |
31 |
from portage import os, _encodings, _unicode_decode |
32 |
from portage.exception import DirectoryNotFound, FileNotFound, \ |
33 |
- InvalidData, TryAgain, OperationNotPermitted, PermissionDenied |
34 |
+ InvalidData, TryAgain, OperationNotPermitted, PermissionDenied, \ |
35 |
+ ReadOnlyFileSystem |
36 |
from portage.util import writemsg |
37 |
from portage.localization import _ |
38 |
|
39 |
@@ -110,6 +111,8 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, |
40 |
raise OperationNotPermitted(func_call) |
41 |
elif e.errno == PermissionDenied.errno: |
42 |
raise PermissionDenied(func_call) |
43 |
+ elif e.errno == ReadOnlyFileSystem.errno: |
44 |
+ raise ReadOnlyFileSystem(func_call) |
45 |
else: |
46 |
raise |
47 |
|
48 |
@@ -404,6 +407,8 @@ def hardlink_lockfile(lockfilename, max_wait=DeprecationWarning, |
49 |
raise OperationNotPermitted(func_call) |
50 |
elif e.errno == PermissionDenied.errno: |
51 |
raise PermissionDenied(func_call) |
52 |
+ elif e.errno == ReadOnlyFileSystem.errno: |
53 |
+ raise ReadOnlyFileSystem(func_call) |
54 |
else: |
55 |
raise |
56 |
else: |
57 |
diff --git a/pym/portage/news.py b/pym/portage/news.py |
58 |
index 0d72b00..7bdf716 100644 |
59 |
--- a/pym/portage/news.py |
60 |
+++ b/pym/portage/news.py |
61 |
@@ -1,5 +1,5 @@ |
62 |
# portage: news management code |
63 |
-# Copyright 2006-2013 Gentoo Foundation |
64 |
+# Copyright 2006-2014 Gentoo Foundation |
65 |
# Distributed under the terms of the GNU General Public License v2 |
66 |
|
67 |
from __future__ import print_function, unicode_literals |
68 |
@@ -28,7 +28,7 @@ from portage.localization import _ |
69 |
from portage.locks import lockfile, unlockfile |
70 |
from portage.output import colorize |
71 |
from portage.exception import InvalidLocation, OperationNotPermitted, \ |
72 |
- PermissionDenied |
73 |
+ PermissionDenied, ReadOnlyFileSystem |
74 |
|
75 |
class NewsManager(object): |
76 |
""" |
77 |
@@ -180,7 +180,8 @@ class NewsManager(object): |
78 |
unread_lock = None |
79 |
try: |
80 |
unread_lock = lockfile(unread_filename, wantnewlockfile=1) |
81 |
- except (InvalidLocation, OperationNotPermitted, PermissionDenied): |
82 |
+ except (InvalidLocation, OperationNotPermitted, PermissionDenied. |
83 |
+ ReadOnlyFileSystem): |
84 |
pass |
85 |
try: |
86 |
try: |
87 |
-- |
88 |
2.0.4 |