[Git][security-tracker-team/security-tracker][master] lts-cve-triage: fix cache freshness detection

Sylvain Beucler (@beuc) gitlab at salsa.debian.org
Wed Jul 9 15:54:22 BST 2025



Sylvain Beucler pushed to branch master at Debian Security Tracker / security-tracker


Commits:
140585ae by Sylvain Beucler at 2025-07-09T16:53:23+02:00
lts-cve-triage: fix cache freshness detection

The current code writes "b'<git revision>'" instead of "<git revision>" in the .rev file.
Apparently introduced back in 6ab7f10fd0ec46356e2b430ace597c6211b48c15

- - - - -


1 changed file:

- bin/tracker_data.py


Changes:

=====================================
bin/tracker_data.py
=====================================
@@ -32,7 +32,7 @@ class TrackerData(object):
     CACHED_DATA_PATH = "~/.cache/debian_security_tracker.json"
     CACHED_REVISION_PATH = "~/.cache/debian_security_tracker.rev"
     GET_REVISION_COMMAND = \
-        "LC_ALL=C git ls-remote %s | awk '/HEAD$/ { print $1 }'" % GIT_URL
+        "LC_ALL=C git ls-remote %s HEAD | cut -f1" % GIT_URL
     DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'data')
 
     def __init__(self, update_cache=True):
@@ -61,7 +61,7 @@ class TrackerData(object):
         """Verify if the cache is out of date"""
         if os.path.exists(self.cached_data_path) and os.path.exists(
                 self.cached_revision_path):
-            with open(self.cached_revision_path, 'r') as f:
+            with open(self.cached_revision_path, 'rb') as f:
                 try:
                     revision = f.read()
                 except ValueError:
@@ -84,8 +84,8 @@ class TrackerData(object):
             os.mkdir(self.cached_data_dir, mode=0o700)
         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:
-            rev_file.write('{}'.format(self.latest_revision))
+        with open(self.cached_revision_path, 'wb') as rev_file:
+            rev_file.write(self.latest_revision)
 
     def load(self):
         with open(self.cached_data_path, 'r') as f:



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/commit/140585aedf1e89c0c9ba6ce652202333131357b2

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/commit/140585aedf1e89c0c9ba6ce652202333131357b2
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/20250709/9e0bb450/attachment-0001.htm>


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