Blame SOURCES/0002-Replace-match.groups-1-with-match.group-1.patch

79be47
From 43fac1c26c9c6bdede2d32b5243e74636bda8a98 Mon Sep 17 00:00:00 2001
79be47
From: Adam Williamson <awilliam@redhat.com>
79be47
Date: Thu, 10 May 2018 11:08:02 -0700
79be47
Subject: [PATCH 2/2] Replace `match.groups(1)` with `match.group(1)`
79be47
79be47
halfline ran into a crash in gtk-doc when trying to cut an
79be47
accountsservice release, a TypeError pointing to this re.sub
79be47
call. Looking at it, the use of `match.groups(1)` is clearly
79be47
wrong. `match.groups()` returns a tuple consisting of *all*
79be47
the match subgroups; the argument it takes is the value to use
79be47
for subgroups which didn't capture anything (the default being
79be47
None). What the code here clearly actually *wants* is not that
79be47
tuple, but the contents of the first match subgroup only, as a
79be47
string. To get that you do `match.group(1)`. So, let's fix that.
79be47
79be47
There are two other occurrences of the same error later in the
79be47
file, so let's fix that too. If I'm reading it correctly, those
79be47
ones wouldn't have caused crashes, they would only cause the
79be47
block they're in not to work properly and produce "Can't
79be47
determine package for '(something)'" log messages even when it
79be47
should have worked (because 'package' will be the tuple, not the
79be47
subgroup, and will never be 'in' `OnlineMap` or `LocalMap`).
79be47
79be47
Note, these have been lying around for a long time, but the one
79be47
that causes the crash was not hit until 1.28, because of the
79be47
regex error fixed by b77d97b. Until that regex was fixed,
79be47
ReadDevhelp never worked on this codebase, so we never hit the
79be47
bug in ReadIndex. The crash might have happened with some other
79be47
codebase for which the ReadDevhelp regex *did* work, though.
79be47
79be47
Signed-off-by: Adam Williamson <awilliam@redhat.com>
79be47
---
79be47
 gtkdoc/rebase.py | 6 +++---
79be47
 1 file changed, 3 insertions(+), 3 deletions(-)
79be47
79be47
diff --git a/gtkdoc/rebase.py b/gtkdoc/rebase.py
79be47
index 2a1d495..4b0266c 100755
79be47
--- a/gtkdoc/rebase.py
79be47
+++ b/gtkdoc/rebase.py
79be47
@@ -154,7 +154,7 @@ def ReadIndex(dir, file):
79be47
         match = re.match(r'''^<ONLINE\s+href\s*=\s*"([^"]+)"\s*>''', line)
79be47
         if match:
79be47
             # Remove trailing non-directory component.
79be47
-            onlinedir = re.sub(r'''(.*/).*''', r'\1', match.groups(1))
79be47
+            onlinedir = re.sub(r'''(.*/).*''', r'\1', match.group(1))
79be47
     return onlinedir
79be47
 
79be47
 
79be47
@@ -226,10 +226,10 @@ def RebaseLink(href, options):
79be47
         else:
79be47
             match = re.match(r'\.\./([^/]+)', href)
79be47
             if match is not None:
79be47
-                package = match.groups(1)
79be47
+                package = match.group(1)
79be47
             elif options.aggressive:
79be47
                 match = re.search(r'''([^/]+)/$''', href)
79be47
-                package = match.groups(1)
79be47
+                package = match.group(1)
79be47
 
79be47
         if package:
79be47
             if options.online and package in OnlineMap:
79be47
-- 
79be47
2.17.0
79be47