1 |
On 10/21/19 1:02 AM, Michał Górny wrote: |
2 |
> Bug: https://bugs.gentoo.org/697906 |
3 |
> Signed-off-by: Michał Górny <mgorny@g.o> |
4 |
> --- |
5 |
> lib/portage/_emirrordist/DeletionIterator.py | 11 ++++++++--- |
6 |
> 1 file changed, 8 insertions(+), 3 deletions(-) |
7 |
> |
8 |
> diff --git a/lib/portage/_emirrordist/DeletionIterator.py b/lib/portage/_emirrordist/DeletionIterator.py |
9 |
> index dab6eaea2..5c193911a 100644 |
10 |
> --- a/lib/portage/_emirrordist/DeletionIterator.py |
11 |
> +++ b/lib/portage/_emirrordist/DeletionIterator.py |
12 |
> @@ -27,11 +27,16 @@ class DeletionIterator(object): |
13 |
> # require at least one successful stat() |
14 |
> exceptions = [] |
15 |
> for layout in reversed(self._config.layouts): |
16 |
> + path = os.path.join(distdir, layout.get_path(filename)) |
17 |
> try: |
18 |
> - st = os.stat( |
19 |
> - os.path.join(distdir, layout.get_path(filename))) |
20 |
> + st = os.stat(path) |
21 |
> except OSError as e: |
22 |
> - exceptions.append(e) |
23 |
> + # is it a dangling symlink? |
24 |
> + try: |
25 |
> + if os.path.islink(path): |
26 |
> + os.unlink(path) |
27 |
> + except OSError as e: |
28 |
> + exceptions.append(e) |
29 |
> else: |
30 |
> if stat.S_ISREG(st.st_mode): |
31 |
> break |
32 |
> |
33 |
|
34 |
Looks good. Please merge. |
35 |
-- |
36 |
Thanks, |
37 |
Zac |