RESOLVED FIXED224869
Python os.getenv calls should handle the env var being undefined
https://bugs.webkit.org/show_bug.cgi?id=224869
Summary Python os.getenv calls should handle the env var being undefined
Sam Sneddon [:gsnedders]
Reported 2021-04-21 07:46:24 PDT
Created attachment 426681 [details] Calls to os.getenv See getenv.txt for a list. The single-arg variant of os.getenv returns None when the environment variable is undefined. This can cause issues. Note that this technically isn't blocking 224640, but per https://tox.readthedocs.io/en/latest/config.html#conf-passenv only a limited set of environment variables are passed through by default, and it would be good to avoid relying on anything else being defined by default. Ignoring those in CISupport (which is also lower priority given we control the configuration in which it is run), having audited all of them, two calls are problematic when None is returned: Tools/Scripts/webkitpy/common/checkout/scm/svn.py 56: def has_authorization_for_realm(self, realm, home_directory=os.getenv("HOME")): Tools/Scripts/webkitpy/common/system/executive.py 357: command = ["killall", "-TERM", "-u", os.getenv("USER"), process_name]
Attachments
Calls to os.getenv (4.22 KB, text/plain)
2021-04-21 07:46 PDT, Sam Sneddon [:gsnedders]
no flags
Patch (3.26 KB, patch)
2021-04-21 07:56 PDT, Sam Sneddon [:gsnedders]
no flags
Radar WebKit Bug Importer
Comment 1 2021-04-21 07:46:32 PDT
Sam Sneddon [:gsnedders]
Comment 2 2021-04-21 07:56:18 PDT
EWS
Comment 3 2021-04-21 10:58:53 PDT
Committed r276374 (236851@main): <https://commits.webkit.org/236851@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 426686 [details].
Note You need to log in before you can comment on or make changes to this bug.