Skip to contentSkip to conversation

bitbake: fetch2/wget: fixup case with no netrc data

PATCH Superseded Mark Asselstine 1 participant 2 messages Dec 21, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake: fetch2/wget: fixup case with no netrc data

Commit 873e33d0479e977520106b65d149ff1799195bf6 [bitbake: fetch2/wget:
add Basic Auth from netrc to checkstatus()] causes "Fetcher failure for URL: 'https://www.example.com/'. URL https://www.example.com/
doesn't work." on new builds when a user has a .netrc file but there is no default and no matching host. The call to netrc.authenticators() will return None in these cases and the attempted assignment to the 3-tuple will raise a TypeError exception. Add the TypeError to the exceptions caught to get around this issue.

---
 lib/bb/fetch2/wget.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/wget.py +1 -1
index 88349c9..737b98d 100644
@@ -320,7 +320,7 @@ class Wget(FetchMethod):
                 n = netrc.netrc()
                 login, unused, password = n.authenticators(urllib.parse.urlparse(uri).hostname)
                 add_basic_auth("%s:%s" % (login, password), r)
-            except (ImportError, IOError, netrc.NetrcParseError):
+            except (TypeError, ImportError, IOError, netrc.NetrcParseError):
                  pass
 
             opener.open(r)
Signature · 1 line
2.7.4
#1 lore raw

Sorry, I just noticed I left the 'bitbake:' prefix on the short log as I originally prepared this commit in poky. I will send a V2 with this dropped. Sorry for the noise.

Mark

Quoted 28 lines · EST Mark Asselstine

Commit 873e33d0479e977520106b65d149ff1799195bf6 [bitbake: fetch2/wget:
add Basic Auth from netrc to checkstatus()] causes "Fetcher failure for URL: 'https://www.example.com/'. URL https://www.example.com/
doesn't work." on new builds when a user has a .netrc file but there is no default and no matching host. The call to netrc.authenticators() will return None in these cases and the attempted assignment to the 3-tuple will raise a TypeError exception. Add the TypeError to the exceptions caught to get around this issue.

---
 lib/bb/fetch2/wget.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/wget.py +1 -1
index 88349c9..737b98d 100644
@@ -320,7 +320,7 @@ class Wget(FetchMethod):
                 n = netrc.netrc()
                 login, unused, password =
 n.authenticators(urllib.parse.urlparse(uri).hostname)
 add_basic_auth("%s:%s" % (login, password), r)
-            except (ImportError, IOError, netrc.NetrcParseError):
+            except (TypeError, ImportError, IOError,

netrc.NetrcParseError): pass

opener.open(r)