boklm pushed to branch main at The Tor Project / Applications / 
tor-browser-build


Commits:
0b3e5edd by Nicolas Vigier at 2025-10-21T18:41:30+02:00
Bug 41607: Fix regression from #41373 in count-mar-downloads

Before 610da963fa759cf5cdccd90b05b1dda8d6c64d29 the _ALL\.mar in the
regular expression used to parse full mar filenames was excluding the
incremental\.mar. When making the _ALL part optional the regular
expression incorrectly matches incremental mar filenames.

To fix that we now parse the path in two steps:
- we get the version number from the directory, and the mar filename
- we parse the mar filename using the version number we know from the
  directory

- - - - -


1 changed file:

- tools/count-mar-downloads


Changes:

=====================================
tools/count-mar-downloads
=====================================
@@ -62,17 +62,20 @@ sub parse_log_file {
 
   my ($stdout, undef, $success) = capture_exec('xzcat', $File::Find::name);
   foreach my $line (split /\n/, $stdout) {
-    my ($version, $os) =
-      ($line =~ m|^[^\s]+ - - \[.+\] "GET 
/aus1/torbrowser/([^/]+)/tor-browser-(.*)-\d.*(_ALL)?\.mar HTTP/|);
-    if ($version) {
+    my ($version, $filename) =
+      ($line =~ m|^[^\s]+ - - \[.+\] "GET 
/aus1/torbrowser/([^/]+)/(tor-browser-.*\.mar) HTTP/|);
+    next unless $filename;
+    my ($os) =
+      ($filename =~ m|^tor-browser-(.*)-\Q$version\E(_ALL)?\.mar$|);
+    if ($os) {
       $downloads{$version}{total} += 1;
       $downloads{$version}{full_update} += 1;
       $downloads{$version}{OS}{$os} += 1;
       next;
     }
     my $incremental_from;
-    ($version, $os, $incremental_from) =
-      ($line =~ m|^[^\s]+ - - \[.+\] "GET 
/aus1/torbrowser/([^/]+)/tor-browser-(.*)--(\d[^-]+)-.*(_ALL)?\.incremental\.mar
 HTTP/|);
+    ($os, $incremental_from) =
+      ($filename =~ 
m|^tor-browser-(.*)--(\d[^-]+)-\Q$version\E(_ALL)?\.incremental\.mar$|);
     if ($incremental_from) {
       $downloads{$version}{total} += 1;
       $downloads{$version}{OS}{$os} += 1;



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/0b3e5edd430d91948a46e9238b6262e49830470b

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/0b3e5edd430d91948a46e9238b6262e49830470b
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to