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

[lintian] 01/01: Strip \par elements from files prior to license checks to avoid false-positives when checking .rtf files. Thanks to Adam Borowski for the report and testcase. (Closes: #892967)



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

lamby pushed a commit to branch master
in repository lintian.

commit 9dd5cd5f7484f30026d1f63e362e13903a678ac1
Author: Chris Lamb <lamby@debian.org>
Date:   Wed Mar 14 19:36:08 2018 -0700

    Strip \par elements from files prior to license checks to avoid false-positives when checking .rtf files. Thanks to Adam Borowski for the report and testcase. (Closes: #892967)
---
 checks/cruft.pm                                    |   3 +
 debian/changelog                                   |   4 +
 .../debian/src/false-positive.rtf                  | 125 +++++++++++++++++++++
 3 files changed, 132 insertions(+)

diff --git a/checks/cruft.pm b/checks/cruft.pm
index 9406ee0..2409fe3 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -1363,6 +1363,9 @@ sub _clean_block {
     # po comment may include html tag
     $text =~ s/\"\s?\v\#~\s?\"//gxms;
 
+    # strip .rtf paragraph marks (#892967)
+    $text =~ s/\\par\b//gxms;
+
     $text =~ s/\\url[{][^}]*?[}]/ /gxms;      # (la)?tex url
     $text =~ s/\\emph[{]/ /gxms;              # (la)?tex emph
     $text =~ s/\\href[{][^}]*?[}]
diff --git a/debian/changelog b/debian/changelog
index b7791c9..e20e2ed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,10 @@ lintian (2.5.80) UNRELEASED; urgency=medium
     + [CL] Drop apache2-module-depends-on-real-apache2-package tag as there
       are separate tags for missing apache2-api-* dependencies.  Thanks to
       Thijs Kinkhorst et al.  (Closes: #796285)
+  * checks/cruft.pm:
+    + [CL] Strip \par elements from files prior to license checks to
+      avoid false-positives when checking .rtf files.  Thanks to Adam
+      Borowski for the report and testcase.  (Closes: #892967)
   * checks/fields.pm:
     + [CL] Only check dependency fields in binary packages for
       mail-transport-agent-dependency-does-not-specify-default-mta etc.
diff --git a/t/tests/cruft-gfdl-invariants/debian/src/false-positive.rtf b/t/tests/cruft-gfdl-invariants/debian/src/false-positive.rtf
new file mode 100644
index 0000000..19560b4
--- /dev/null
+++ b/t/tests/cruft-gfdl-invariants/debian/src/false-positive.rtf
@@ -0,0 +1,125 @@
+{\rtf1\ansi\ansicpg1252\cocoartf102{\fonttbl\f2\fnil Bitstream Charter;\f0\fnil Droid Sans Mono;\f1\fnil FreeSans;}
+{\colortbl;\red0\green0\blue200;\red0\green0\blue0;\red255\green0\blue0;}
+{{\NeXTGraphic iconoGimp3.tif \width1816 \height1309}\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\f0\fs24 \'AC}\f1\fs48      \b\cf1 \'A1Welcome to FisicaLab!\cf0\fs24\b0\cf2 \par
+\par
+\fs20\i Copyright (C)  2009, 2010, 2012  German A. Arias.\par
+    Permission is granted to copy, distribute and/or modify this document\par
+    under the terms of the GNU Free Documentation License, Version 1.3\par
+    or any later version published by the Free Software Foundation;\par
+    with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.\par
+    A copy of the license is included in the section entitled "GNU\par
+    Free Documentation License".\fs24\i0 \par
+\par
+\par
+FisicaLab is an educational application to solve physics problems. Its main objective is let the user to focus in physics concepts, leaving aside the mathematical details (FisicaLab take care of them). This allows the user to become familiar with the physical concepts without running the risk of getting lost in mathematical details. And so, when the user gain confidence in applying physical concepts, will be better prepared to solve the problems by hand (with pen and paper). FisicaLab is [...]
+\par
+FisicaLab display to two windows, one named \b Modules and elements\b0  and other named \b Chalkboard\b0 . The first of these windows, contain all modules that can be used to solve problems. These modules are grouped by: kinematics, static, dynamics, ... (see image below). You can select one of these groups with the buttons at the top of the window, marked with (1) in the image. When you leave the mouse\rquote s cursor above one of these buttons, a label with the group name is displayed. [...]
+\par
+        \cf0\f0{{\NeXTGraphic FisicaLabPanel.jpg \width7680 \height10760}\'AC}\f2\cf2 \par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+\f1 The window named \b Chalkboard\b0  (see image below), have at the top two buttons, marked with (7). The button at the left let you solve the problem, and the other is to clean the chalkboard. The black box marked with (8) is the chalkboard, where you add the elements to set the problems. You need keep in mind, although you can\rquote t see, that the chalkboard is a grid formed with cells of 50x50 pixels. By default the chalkboard size is 26x18 cells. In \b Preferences\b0  panel you c [...]
+\par
+\pard\ql\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql         \cf0\f0{{\NeXTGraphic FisicaLabPizarra.jpg \width8540 \height6680}\'AC}\f2\cf2 \par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+\par
+\f1\fs28\b Handling the elements\f2\fs24\b0 \par
+        \par
+\f1 To add elements at the chalkboard, do a click above the desired element. The mouse\rquote s cursor will become in an open hand, meaning this that we will add an element. Do a click above the chalkboard in the position where you want the element, the mouse\rquote s cursor will back at its original shape. Each time you add a new element, or select one different, a yellow square will be drawn around the current element. The data of the current element are displayed, for its edition, at  [...]
+\par
+\pard\ql\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql         \cf0\f0{{\NeXTGraphic chalkboardProperties.jpg \width9020 \height4600}\'AC}\f1\cf2 \par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+If you want move an element, click above it with the \b Control\b0  key pressed, the mouse\rquote s cursor will become in a close hand, meaning this that we are moving an element. Do click in the new position and the mouse\rquote s cursor will back at its original shape. In other hand, if you want delete an element, do click above it with the \b Shift\b0  key pressed.\par
+\par
+Keep in mind that FisicaLab don\rquote t let you combine elements from different modules. The elements in each module are enough to set a wide variety of problems.\f2 \par
+\par
+\par
+\f1\fs28\b Element data\f2\fs24\b0 \par
+\par
+\f1 When you select an element in the chalkboard, or add a new element, you will see a table at the bottom of the window \b Modules and elements\b0 . With a double click above any field of the second column, you can write the data. FisicaLab supports scientific notation, to use this use the letter E. For example, to write the number 3.45x10-5, write:\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc 3.45E-5\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+All numerical data must be without spaces. For example, the following numbers are wrong:\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc - 5.3\par
+7.8E - 8\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+Also, FisicaLab can use many conversion factors. To use these, add the character @ before the conversion. If you have selected the SI system, FisicaLab assumes that all data are in meters, kg, seconds, etc. With the English system, FisicaLab assumes that all data are in feet, pounds, slugs, seconds, etc. (in the English system the mass must be in slugs). For example, if you want write an speed of 75 km/h, use:\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc 75 @ km/h\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+Here, we have one space before and after the character @, but these are for clarity, and are not required. Each module has its how conversion factors, as you can see in the sections that deal about these. \par
+\par
+You can use letters or words to represent the unknown data. If, for example, the final velocity is an unknown data, you can represent this like:\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc fv\par
+finalv\par
+fvel\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql or any other combination. But, we recommend you use letters or words that are related with the unknown data. Also, the conversion factors can be used with the unknown data. For example, if the time is unknown, and you want this in minutes, write something like:\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc t @ min\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql The scientific notation can be used with the unknowns, adding the characters #E at the end of the name. For example, for a coefficient of thermal expansion, that is a small value:\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc coefficient#E\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+Also, this can be used with a conversion factor. For example, for a very long distance that we want in kilometers:\par
+\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc distance#E @ km\par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+All the conversion factors are available in a contextual menu. After select the row of data where want add the factor, a right mouse click open a context menu with all available factors.\par
+\par
+\pard\ql\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql         \cf0\f0{{\NeXTGraphic menuContextual.jpg \width6120 \height5320}\'AC}\f1\cf2 \par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+FisicaLab allows mathematical operations directly on the fields where you enter data. Can be carried out operations of addition (+), subtraction (-), multiplication (*) and division (/). Although not allowed to group operations by parentheses. It also provides some useful functions for certain calculations. These are listed below with its description:\par
+\par
+\b cos(ang)\tab \tab Calculates the cosine of the sexagesimal angle "ang".\par
+sin(ang)\tab \tab Calculates the sine of the sexagesimal angle "ang".\par
+tan(ang)\tab \tab Calculates the tangent of the sexagesimal angle "ang".\par
+sqrt(x)\tab \tab Calculates the square root of the number "x".\par
+hypot(a,b)\tab Calculates the hypotenuse of a right triangle whose legs are "a" and "b".\par
+leg(c,a)\tab \tab Calculates the leg of the right triangle whose hypotenuse is "c" and the\par
+\tab \tab \tab other leg is "a".\par
+rd(m1,m2,d)\tab Calculates the distance of the mass "m1" to the center of mass of the\par
+\tab \tab \tab system consisting of the masses "m1" and "m2", which are spaced a\par
+\tab \tab \tab distance "d".\b0 \par
+\par
+The numbers that are passed as parameters to these functions must have consistent units. For example, in the \b hypot()\b0  function both legs must be in the same units, whether centimeters, meters, inches, etc. These functions can be used in operations of addition, subtraction, multiplication and division. In these operations blank spaces are not allowed. Here are some examples:\par
+\par
+\pard\ql\b\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\qc 8*cos(34)\par
+hypot(4,3)-2\par
+rd(3,6,40)*sin(30) @ cm\par
+15*8/hypot(13,8)\b0 \par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+Once entered the operation, FisicaLab will do the calculation and will write the result in the entry. Note that is possible to apply conversion factors. Although these can also be applied after carrying out the calculation.\par
+\par
+The fields where you enter angles do not allow the operations and functions described above. This is because these fields have their own operations and functions. For example, FisicaLab allows write the angles as slopes (a/b), and automatically convert this to sexagesimal angles. What is very useful for problems of trusses.\par
+\par
+\pard\ql\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql         \cf0\f0{{\NeXTGraphic angulos.jpg \width5080 \height2660}\'AC}\f1\cf2 \par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+For these fields are available two functions that calculates an angle from other relationships. These functions are:\par
+\par
+\b acos(a/c)\tab Calculates the sexagesimal angle whose cosine is the ratio "a/c".\par
+asin(b/c)\tab \tab Calculates the sexagesimal angle whose sine is the ratio "b/c".\b0 \par
+\par
+If an operation is entered incorrectly, for example if it contains spaces or contains a function with an incorrect number of parameters, FisicaLab will do nothing and will take that string as an unknown.\par
+\par
+\par
+\b Caution:\b0  \cf0\cf3 If, for example, you add a mass conversion factor in a time data, this will cause an error in the solution. And you will not get a message about this error.\cf0\f2\cf2 \par
+\par
+\par
+\f1\fs28\b How it works\f2\fs24\b0 \par
+\par
+\f1 FisicaLab work over the base of \i number of equations = number of unknown data\i0 . In general you don\rquote t need worry about this. But in some cases you will see the error \b "The system is undetermined"\b0 . This occurs when you write numeric data in a field that must be an unknown data. The examples show this cases.\f2 \par
+\par
+\par
+\f1\fs28\b Messages\f2\fs24\b0 \par
+\par
+\f1 FisicaLab write a wide variety of messages in the text view when a problem is wrong. However, you always will see a message about the calculation\rquote s status, as you can see in the following image:\par
+\par
+\pard\ql\f0\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql         \cf0{{\NeXTGraphic cinema44.tif \width4760 \height800}\'AC}\f1\cf2 \par
+\pard\ql\pard\tx0\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\ql \par
+The last line say \b "State = success"\b0 , meaning that the calculation was successful. Any other status different as \i success\i0 , mean that or the set problem don\rquote t have a solution, or an unexpected error occurred.\par
+\par
+}
\ No newline at end of file

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


Reply to: