Merge ~iconstantin/ubuntu-cve-tracker:master into ubuntu-cve-tracker:master
Status: | Merged |
---|---|
Merge reported by: | Ian Constantin |
Merged at revision: | ea1ddb690ff9e1b0b852c44df5886250c86e3876 |
Proposed branch: | ~iconstantin/ubuntu-cve-tracker:master |
Merge into: | ubuntu-cve-tracker:master |
Diff against target: |
146 lines (+38/-13) 1 file modified
scripts/cve_lib.py (+38/-13) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alex Murray | Approve | ||
Review via email: mp+430354@code.launchpad.net |
Commit message
Updated file handling to ensure files are closed after use.
Description of the change
There is a mix of how files are handled in cve_lib and at times the files are not being closed. The sample code below results in the following warnings:
Warning (from warnings module):
File "/home/
for line in codecs.open(cve, encoding=
ResourceWa
Warning (from warnings module):
File "/home/
for line in codecs.open(cve, encoding=
ResourceWa
Warning (from warnings module):
File "/home/
for line in codecs.open(cve, encoding=
ResourceWa
~~~
#!/usr/bin/python3
import optparse, os, sys, warnings
uct_path = "/home/
sys.path.insert(0, uct_path + "/scripts") # Need $UCT/scripts in path to find cve_lib
os.chdir(uct_path) # cd'ing to $UCT before importing cve_lib (required)
import cve_lib
with warnings.
warnings.
parser = optparse.
opt, args = parser.parse_args()
opt.pkgfamily = ""
opt.debug= ""
opt.packages = []
cves = ["CVE-2020-25717", "CVE-2020-25718", "CVE-2020-25719"]
uems = []
cve_
~~~
LGTM! Thanks.