[Git][security-tracker-team/security-tracker][master] 2 commits: LTS: Ensure ~/.cache exists before writing out tracker data cache

Roberto C. Sánchez roberto at debian.org
Sat Nov 21 14:14:17 GMT 2020



Roberto C. Sánchez pushed to branch master at Debian Security Tracker / security-tracker


Commits:
04703997 by Roberto C. Sánchez at 2020-11-21T09:10:24-05:00
LTS: Ensure ~/.cache exists before writing out tracker data cache

If ~/.cache does not already exist, then this happens:

$ ./bin/lts-cve-triage.py
Updating ~/.cache/debian_security_tracker.json from https://security-tracker.debian.org/tracker/data/json ...
Traceback (most recent call last):
  File "./bin/lts-cve-triage.py", line 94, in <module>
    tracker = TrackerData(update_cache=not args.skip_cache_update)
  File "/home/roberto/src/freexian/security-tracker.git/bin/tracker_data.py", line 40, in __init__
    self.update_cache()
  File "/home/roberto/src/freexian/security-tracker.git/bin/tracker_data.py", line 77, in update_cache
    with open(self.cached_data_path, 'w') as cache_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/roberto/.cache/debian_security_tracker.json'

- - - - -
991d4223 by Roberto C. Sánchez at 2020-11-21T09:14:02-05:00
LTS: triage, add xdg-utils and imagemagick to dla-needed.txt

- - - - -


2 changed files:

- bin/tracker_data.py
- data/dla-needed.txt


Changes:

=====================================
bin/tracker_data.py
=====================================
@@ -25,6 +25,7 @@ import six
 class TrackerData(object):
     DATA_URL = "https://security-tracker.debian.org/tracker/data/json"
     GIT_URL = "https://salsa.debian.org/security-tracker-team/security-tracker.git"
+    CACHED_DATA_DIR = "~/.cache"
     CACHED_DATA_PATH = "~/.cache/debian_security_tracker.json"
     CACHED_REVISION_PATH = "~/.cache/debian_security_tracker.rev"
     GET_REVISION_COMMAND = \
@@ -33,6 +34,7 @@ class TrackerData(object):
 
     def __init__(self, update_cache=True):
         self._latest_revision = None
+        self.cached_data_dir = os.path.expanduser(self.CACHED_DATA_DIR)
         self.cached_data_path = os.path.expanduser(self.CACHED_DATA_PATH)
         self.cached_revision_path = os.path.expanduser(
             self.CACHED_REVISION_PATH)
@@ -74,6 +76,9 @@ class TrackerData(object):
                                                self.DATA_URL))
         response = requests.get(self.DATA_URL, allow_redirects=True)
         response.raise_for_status()
+        # if ~/.cache does not exist, then open() will fail; dec 448 -> octal 0700
+        if not os.path.exists(self.cached_data_dir):
+            os.mkdir(self.cached_data_dir, mode=448)
         with open(self.cached_data_path, 'w') as cache_file:
             cache_file.write(response.text)
         with open(self.cached_revision_path, 'w') as rev_file:


=====================================
data/dla-needed.txt
=====================================
@@ -64,6 +64,8 @@ golang-github-dgrijalva-jwt-go
 --
 golang-golang-x-net-dev
 --
+imagemagick (Roberto C. Sánchez)
+--
 influxdb
 --
 intel-microcode (Utkarsh)
@@ -200,6 +202,8 @@ xcftools
   NOTE: 20200523: Proposed fix https://github.com/j-jorge/xcftools/pull/15 (gladk)
   NOTE: 20200605: Patch https://salsa.debian.org/lts-team/packages/xcftools/-/blob/fix/test-CVE-2019-5087/debian/patches/CVE-2019-5087.patch (gladk)
 --
+xdg-utils
+--
 zabbix (Sylvain Beucler)
 --
 zsh (Markus Koschany)



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/d8ea8764ff0293c041e40f71bd430094582dc6b3...991d422320baca990ed6aa912b6b8e104ab71687

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/d8ea8764ff0293c041e40f71bd430094582dc6b3...991d422320baca990ed6aa912b6b8e104ab71687
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20201121/9b94d859/attachment-0001.html>


More information about the debian-security-tracker-commits mailing list