1 |
commit: 664684f0f17c0f3570ffd9382037994db1ec66bd |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 31 20:23:15 2015 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 31 23:12:12 2015 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=664684f0 |
7 |
|
8 |
lockfile: handle EINTR for bug #538314 |
9 |
|
10 |
Use portage._eintr_func_wrapper to handle EINTR from fcntl.lockf. Since |
11 |
fcntl.lockf raises IOError, make _eintr_func_wrapper handle |
12 |
EnvironmentError (which both OSError and IOError inherit from). |
13 |
|
14 |
X-Gentoo-Bug: 538314 |
15 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=538314 |
16 |
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org> |
17 |
|
18 |
--- |
19 |
pym/portage/__init__.py | 2 +- |
20 |
pym/portage/locks.py | 2 +- |
21 |
2 files changed, 2 insertions(+), 2 deletions(-) |
22 |
|
23 |
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py |
24 |
index d96d733..1c85042 100644 |
25 |
--- a/pym/portage/__init__.py |
26 |
+++ b/pym/portage/__init__.py |
27 |
@@ -337,7 +337,7 @@ class _eintr_func_wrapper(object): |
28 |
try: |
29 |
rval = self._func(*args, **kwargs) |
30 |
break |
31 |
- except OSError as e: |
32 |
+ except EnvironmentError as e: |
33 |
if e.errno != errno.EINTR: |
34 |
raise |
35 |
|
36 |
|
37 |
diff --git a/pym/portage/locks.py b/pym/portage/locks.py |
38 |
index fdfe4a5..42ff1e3 100644 |
39 |
--- a/pym/portage/locks.py |
40 |
+++ b/pym/portage/locks.py |
41 |
@@ -146,7 +146,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, |
42 |
|
43 |
# try for a non-blocking lock, if it's held, throw a message |
44 |
# we're waiting on lockfile and use a blocking attempt. |
45 |
- locking_method = _default_lock_fn |
46 |
+ locking_method = portage._eintr_func_wrapper(_default_lock_fn) |
47 |
try: |
48 |
if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ: |
49 |
raise IOError(errno.ENOSYS, "Function not implemented") |