Control: tag -1 + pending patch

¡Hola shirish!

El 2017-02-04 a las 01:08 +0530, shirish शिरीष escribió:
Package: decopy Version: 0.2-1 Severity: important

Dear Maintainer, I was trying the tool in the same repo. The allacrost repo.

https://bitbucket.org/allacrost/allacrost

└─[$] decopy --debug --group-by copyright

It runs for sometime and then for some unexplicable reason it stops as can be seen in the attached file.

[DEBUG] Type for ./allacrost is: application/x-executable

Thanks for the report.

Apparently one of the public-domain regex was taking forever with the content read from a binary file (decopy does something similar to strings to get the text out of an unknown binary file and processes that).

I'm attaching a patch that I have just applied, and it will be part of the next release.

Happy hacking,
--
"If you optimize everything, you will always be unhappy."
-- Donald Knuth
Saludos /\/\ /\ >< `/
commit 36f7ae2318a2c3f8404ffe2549ca46994667c5cd
Author: Maximiliano Curia <[email protected]>
Date:   Thu Feb 9 18:30:56 2017 +0100

    Fix public domain regex
    
    Apparently it was taking forever processing this, on the strings from a
    binary file (mostly long numbers).
    
    Also add variables to the frame to ease debugging (i for position and
    license_ for the license name, as the license_re items aren't reachable
    when using gdb).

diff --git a/decopy/matchers.py b/decopy/matchers.py
index f72bd88..264c57e 100755
--- a/decopy/matchers.py
+++ b/decopy/matchers.py
@@ -790,9 +790,9 @@ LICENSES_RES = (
                    r'no copyright on that code', re.IGNORECASE),
         'public-domain', None),
     ReLicense(
-        re.compile(r'[^ ]+ was written by(?: [^ ]+){,4}, and is placed in the '
-                   r'public domain. The author hereby disclaims copyright to '
-                   r'this source code.', re.IGNORECASE),
+        re.compile(r' was written by(?: [^ ]+){,4}, and is placed in the '
+                   r'public domain\. The author hereby disclaims copyright to '
+                   r'this source code\.', re.IGNORECASE),
         'public-domain', None),
     ReLicense(
         re.compile(
@@ -1688,13 +1688,14 @@ def find_licenses(text):
     '''
     licenses = {}
 
-    for license_re in LICENSES_RES:
+    for i, license_re in enumerate(LICENSES_RES):
+        # Keep the license name in this frame for easier debugging
+        license_ = license_re.license
         if license_re.license in licenses:
             continue
         match = license_re.re.search(text)
         if not match:
             continue
-        license_ = license_re.license
         if license_re.get_detail:
             license_ = license_re.get_detail(text, match, license_)
         licenses[license_re.license] = license_

Attachment: signature.asc
Description: PGP signature

Reply via email to