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