bitbake-hashclient: Warn on bad .netrc
PATCH 1/1 bitbake-hashclient: Warn on bad .netrc
If there is an error parsing .netrc, warn the user on stderr
--- bitbake/bin/bitbake-hashclient | 2 ++ 1 file changed, 2 insertions(+)
bitbake/bin/bitbake-hashclient +2 -0
@@ -346,6 +346,8 @@ def main(): login, _, password = auth except FileNotFoundError: pass + except netrc.NetrcParseError as e: + sys.stderr.write(f"Error parsing {e.filename}:{e.lineno}: {e.msg}\n") func = getattr(args, 'func', None) if func:
Signature · 1 line
2.34.1
What about wget.py@370?
except (FileNotFoundError, netrc.NetrcParseError):
pass
Locally i added a the diagnostic as well because python added a permission check that will make bitbake silently skip netrc authentication on a not obvious parsing errors. From the docs[1]:
Quoted 1 line
Parse errors will raise
[NetrcParseError](https://docs.python.org/3/library/netrc.html#netrc.NetrcParseError) with diagnostic
Quoted 3 lines
information including the file name, line number, and terminating token. If no argument is specified on a POSIX system, the presence of passwords in the
.netrc
file will raise a [NetrcParseError](https://docs.python.org/3/library/netrc.html#netrc.NetrcParseError) if the file
Quoted 4 lines
ownership or permissions are insecure (owned by a user other than the user running the process, or accessible for read or write by any other user). This implements security behavior equivalent to that of ftp and other programs that use
.netrc
.
Paulo Neves
[1]
https://docs.python.org/3/library/netrc.html#netrc.netrc
Quoted 38 lines · Joshua Watt
If there is an error parsing .netrc, warn the user on stderr
Signed-off-by: Joshua Watt [<[email protected]>](mailto:[email protected])
--- bitbake/bin/bitbake-hashclient | 2 ++ 1 file changed, 2 insertions(+)bitbake/bin/bitbake-hashclient +2
-1@@ -346,6 +346,8 @@ def main(): login, _, password = auth except FileNotFoundError: pass + except netrc.NetrcParseError as e: + sys.stderr.write(f"Error parsing {e.filename}:{e.lineno}: {e.msg}\n") func = getattr(args, 'func', None) if func: --2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#16013):
https://lists.openembedded.org/g/bitbake-devel/message/16013
Mute This Topic:
https://lists.openembedded.org/mt/105140768/4454782
Group Owner:
[email protected] Unsubscribe:
https://lists.openembedded.org/g/bitbake-devel/unsub
[
[email protected]
]
-=-=-=-=-=-=-=-=-=-=-=-