Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13503 - main/branches/2.1.6/pym/portage
Date: Thu, 30 Apr 2009 07:12:44
Message-Id: E1LzQRl-00087Y-Oy@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-04-30 07:12:41 +0000 (Thu, 30 Apr 2009)
3 New Revision: 13503
4
5 Modified:
6 main/branches/2.1.6/pym/portage/__init__.py
7 main/branches/2.1.6/pym/portage/locks.py
8 Log:
9 Bug #266211 - Handle ESTALE like ENOENT in fetch and locking code. Thanks to
10 Krzysztof Ol?\196?\153dzki <ole+gentoo@×××.pl> for the initial patch. (trunk r13347)
11
12 Modified: main/branches/2.1.6/pym/portage/__init__.py
13 ===================================================================
14 --- main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:12:10 UTC (rev 13502)
15 +++ main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 07:12:41 UTC (rev 13503)
16 @@ -3914,7 +3914,7 @@
17 try:
18 mysize = os.stat(myfile_path).st_size
19 except OSError, e:
20 - if e.errno != errno.ENOENT:
21 + if e.errno not in (errno.ENOENT, errno.ESTALE):
22 raise
23 del e
24 mysize = 0
25 @@ -4026,7 +4026,7 @@
26 try:
27 os.unlink(myfile_path)
28 except OSError, e:
29 - if e.errno != errno.ENOENT:
30 + if e.errno not in (errno.ENOENT, errno.ESTALE):
31 raise
32 del e
33 os.symlink(readonly_file, myfile_path)
34 @@ -4041,14 +4041,14 @@
35 " %(file)s\n" % {"file":myfile}))
36 break
37 except (IOError, OSError), e:
38 - if e.errno != errno.ENOENT:
39 + if e.errno not in (errno.ENOENT, errno.ESTALE):
40 raise
41 del e
42
43 try:
44 mystat = os.stat(myfile_path)
45 except OSError, e:
46 - if e.errno != errno.ENOENT:
47 + if e.errno not in (errno.ENOENT, errno.ESTALE):
48 raise
49 del e
50 else:
51 @@ -4192,7 +4192,7 @@
52 try:
53 mysize = os.stat(myfile_path).st_size
54 except OSError, e:
55 - if e.errno != errno.ENOENT:
56 + if e.errno not in (errno.ENOENT, errno.ESTALE):
57 raise
58 del e
59 mysize = 0
60 @@ -4216,7 +4216,7 @@
61 try:
62 mystat = os.stat(myfile_path)
63 except OSError, e:
64 - if e.errno != errno.ENOENT:
65 + if e.errno not in (errno.ENOENT, errno.ESTALE):
66 raise
67 del e
68 fetched = 0
69 @@ -4228,7 +4228,8 @@
70 try:
71 os.unlink(myfile_path)
72 except OSError, e:
73 - if e.errno != errno.ENOENT:
74 + if e.errno not in \
75 + (errno.ENOENT, errno.ESTALE):
76 raise
77 del e
78 fetched = 0
79 @@ -4282,7 +4283,7 @@
80 try:
81 mystat = os.stat(myfile_path)
82 except OSError, e:
83 - if e.errno != errno.ENOENT:
84 + if e.errno not in (errno.ENOENT, errno.ESTALE):
85 raise
86 del e
87 fetched = 0
88
89 Modified: main/branches/2.1.6/pym/portage/locks.py
90 ===================================================================
91 --- main/branches/2.1.6/pym/portage/locks.py 2009-04-30 07:12:10 UTC (rev 13502)
92 +++ main/branches/2.1.6/pym/portage/locks.py 2009-04-30 07:12:41 UTC (rev 13503)
93 @@ -74,7 +74,7 @@
94 if os.stat(lockfilename).st_gid != portage_gid:
95 os.chown(lockfilename, -1, portage_gid)
96 except OSError, e:
97 - if e.errno == errno.ENOENT: # No such file or directory
98 + if e.errno in (errno.ENOENT, errno.ESTALE):
99 return lockfile(mypath,
100 wantnewlockfile=wantnewlockfile,
101 unlinkfile=unlinkfile, waiting_msg=waiting_msg,
102 @@ -164,7 +164,7 @@
103 try:
104 return os.fstat(fd).st_nlink
105 except EnvironmentError, e:
106 - if e.errno == errno.ENOENT:
107 + if e.errno in (errno.ENOENT, errno.ESTALE):
108 # Some filesystems such as CIFS return
109 # ENOENT which means st_nlink == 0.
110 return 0