[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: c/cruft.pm: Anchor a regex that is used inside a loop



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit fb6840c592a4d73a33ca97f909f66445b9d2b698
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jul 12 22:51:28 2014 +0200

    c/cruft.pm: Anchor a regex that is used inside a loop
    
    The regex was used to remove leading space and possibly some
    punctuation.  Unfortunately, it
    
     * matches a single whitespace anywhere
     * was used inside a loop that (at least in theory) could have it
       repeat the loop.
       - Indeed adding the /g modifier to the regex would cause it to
         remove all spaces in the text causing tests to fail.
    
    Add an "anchor" to better reflect its purpose and to safe guard
    against it going wild and taking all the desired whitespace.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/cruft.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/checks/cruft.pm b/checks/cruft.pm
index 6140648..6f9bdae 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -919,7 +919,7 @@ sub _check_gfdl_license_problem {
         $gfdlsections =~ s{ \A (as[ ])? published [ ] by [ ]
                            the [ ] free [ ] software [ ] foundation[ ]?}{}xsmo;
         $gfdlsections =~ s{\(?[ ]? fsf [ ]?\)?[ ]?}{}xsmo;
-        $gfdlsections =~ s{[,\.;]?[ ]?}{}xsmo;
+        $gfdlsections =~ s{\A [ ]? [,\.;]? [ ]?}{}xsmo;
     } while ($oldgfdlsections ne $gfdlsections);
 
     $contextbefore =~ s{

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: