Package: devscripts Version: 2.13.0 Severity: normal That last version 2.13.0 of licensecheck.pl showed a bug, on the attached file "min_dihedral_angle.h". That file is part of CGAL-4.1, and should be detected as GPLv3+, instead of UNKNOWN. The bug is in the generic detection of comments, in clean_comments(). There is a regular expression, that detects potential comments. The pattern length is computed from the last match of the regular expression. In the case of the attached file "min_dihedral_angle.h", the last match is the last "/" in the following lines (line 50):
return CGAL::sqrt(sq_distance(p0, p1)) / area(make_triangle(p0, p1, p3)) / area(make_triangle(p0, p1, p2)); That is obviously not a C++ comment. The attached patch "0001-Fix-clean_comments.patch" computes the length of the pattern from the *first* match, instead of the last one. That fixes the bug. -- Laurent Rineau, PhD R&D Engineer at GeometryFactory http://www.geometryfactory.com/ Release Manager of the CGAL Project http://www.cgal.org/
// Copyright (c) 2007-2009 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). // You can redistribute it and/or modify it under the terms of the GNU // General Public License as published by the Free Software Foundation, // either version 3 of the License, or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/releases/CGAL-4.1-branch/Mesh_3/include/CGAL/Mesh_3/min_dihedral_angle.h $ // $Id: min_dihedral_angle.h 67117 2012-01-13 18:14:48Z lrineau $ // // // Author(s) : Laurent RINEAU, Stephane Tayeb #ifndef CGAL_MESH_3_MIN_DIHEDRAL_ANGLE_H #define CGAL_MESH_3_MIN_DIHEDRAL_ANGLE_H #include <CGAL/Mesh_3/dihedral_angle_3.h> #include <cmath> namespace CGAL { namespace Mesh_3 { namespace details { template <typename K> typename K::FT min_dihedral_angle_aux_compute_quotient(const typename K::Point_3& p0, const typename K::Point_3& p1, const typename K::Point_3& p2, const typename K::Point_3& p3, K k = K()) { typename K::Construct_triangle_3 make_triangle = k.construct_triangle_3_object(); typename K::Compute_area_3 area = k.compute_area_3_object(); typename K::Compute_squared_distance_3 sq_distance = k.compute_squared_distance_3_object(); return CGAL::sqrt(sq_distance(p0, p1)) / area(make_triangle(p0, p1, p3)) / area(make_triangle(p0, p1, p2)); } } // end namespace details;
>From fb51184791246022e6d81e0bb97831a0f4ec3516 Mon Sep 17 00:00:00 2001 From: Laurent Rineau <laurent.rin...@cgal.org> Date: Tue, 19 Feb 2013 15:08:17 +0100 Subject: [PATCH 1/2] Fix clean_comments() The detection of the comments pattern was using the last match of the regular expression. That is better to use the first one. --- scripts/licensecheck.pl | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/licensecheck.pl b/scripts/licensecheck.pl index 8d31626..ba9a2f2 100755 --- a/scripts/licensecheck.pl +++ b/scripts/licensecheck.pl @@ -353,16 +353,17 @@ sub parse_copyright { sub clean_comments { local $_ = shift or return q{}; + my $first_match; # Remove generic comments: look for 4 or more lines beginning with # regular comment pattern and trim it. Fall back to old algorithm # if no such pattern found. - if( 4 <= scalar(()=m{ ^\s* + if( 4 <= scalar(($first_match)=m{ ^\s* ([^a-zA-Z0-9\s]{1,3}) \s\w }xmg) ){ - my $comment_length=length($1); + my $comment_length=length($first_match); my $comment_re=qr{\s* [$1]{${comment_length}} \s*}x; s/^$comment_re//mg; } -- 1.7.7.6