aboutsummaryrefslogtreecommitdiff
path: root/scripts/maint/practracker/problem.py
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-03-05 15:03:27 +0200
committerNick Mathewson <nickm@torproject.org>2019-03-13 09:27:29 -0400
commit8c9835c6e5de6f17affb9b7d9f5802dee54a9e37 (patch)
tree11eb7d6df4d02ee844ac28368916643d582c3d4c /scripts/maint/practracker/problem.py
parent8bacc1dad170a9a29633d95c91a4139af6a2bfe7 (diff)
downloadtor-8c9835c6e5de6f17affb9b7d9f5802dee54a9e37.tar.gz
tor-8c9835c6e5de6f17affb9b7d9f5802dee54a9e37.zip
practracker: Normalize filesystem paths across Windows and Posix.
This was causing issues because the exceptions file is written using Posix paths, whereas practracker in Windows was trying to match Windows paths ("\" instead of "/").
Diffstat (limited to 'scripts/maint/practracker/problem.py')
-rw-r--r--scripts/maint/practracker/problem.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/maint/practracker/problem.py b/scripts/maint/practracker/problem.py
index 2330098ef3..00e029d1c4 100644
--- a/scripts/maint/practracker/problem.py
+++ b/scripts/maint/practracker/problem.py
@@ -7,6 +7,8 @@ problem is worse than a registered exception so that it only warns when things
get worse.
"""
+import os.path
+
class ProblemVault(object):
"""
Singleton where we store the various new problems we
@@ -70,7 +72,10 @@ class Problem(object):
def key(self):
"""Generate a unique key that describes this problem that can be used as a dictionary key"""
- return "%s:%s" % (self.problem_location, self.problem_type)
+ # Problem location is a filesystem path, so we need to normalize this
+ # across platforms otherwise same paths are not gonna match.
+ canonical_location = os.path.normcase(self.problem_location)
+ return "%s:%s" % (canonical_location, self.problem_type)
def __str__(self):
return "problem %s %s %s" % (self.problem_type, self.problem_location, self.metric_value)