1 |
commit: 1ca5b822133171b131cef3dc15dc43583893ad6b |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Oct 29 00:56:47 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Oct 29 01:07:45 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1ca5b822 |
7 |
|
8 |
fetch: remove symlink created by FETCHCOMMAND_RSYNC (bug 698046) |
9 |
|
10 |
This avoids confusing "No such file or directory" errors as demonstrated |
11 |
by the following test case: |
12 |
|
13 |
$ ln -s /foo/bar /tmp/sudo-1.8.29rc1.tar.gz |
14 |
$ wget http://distfiles.gentoo.org/distfiles/sudo-1.8.29rc1.tar.gz -O /tmp/sudo-1.8.29rc1.tar.gz |
15 |
/tmp/sudo-1.8.29rc1.tar.gz: No such file or directory |
16 |
|
17 |
Bug: https://bugs.gentoo.org/698046 |
18 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
19 |
|
20 |
lib/portage/package/ebuild/fetch.py | 3 ++- |
21 |
1 file changed, 2 insertions(+), 1 deletion(-) |
22 |
|
23 |
diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py |
24 |
index 58718b568..4612532c5 100644 |
25 |
--- a/lib/portage/package/ebuild/fetch.py |
26 |
+++ b/lib/portage/package/ebuild/fetch.py |
27 |
@@ -1283,7 +1283,8 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, |
28 |
# trust the return value from the fetcher. Remove the |
29 |
# empty file and try to download again. |
30 |
try: |
31 |
- if os.stat(download_path).st_size == 0: |
32 |
+ mystat = os.lstat(download_path) |
33 |
+ if mystat.st_size == 0 or (stat.S_ISLNK(mystat.st_mode) and not os.path.exists(download_path)): |
34 |
os.unlink(download_path) |
35 |
fetched = 0 |
36 |
continue |