Hi, I tried to make a test that triggers this tag, but it does not seem to work. According to emacs the copyright file in question has a "DOS" newline before it is handed to dpkg-deb, but the tag is still not triggered. I have attached the test I used (merged with the original patch); hopefully you can spot the issue. :)
~Niels
From 34a2a2cca6694716057253e1e03041286a89266a Mon Sep 17 00:00:00 2001 From: Niels Thykier <ni...@thykier.net> Date: Wed, 31 Aug 2011 11:28:59 +0200 Subject: [PATCH] Check for CR(LF) ending in copyright files (incl. test) --- checks/copyright-file | 4 ++ checks/copyright-file.desc | 10 +++++ .../debian/debian/control.in | 13 +++++++ .../debian/debian/copyright-crln.copyright | 36 ++++++++++++++++++++ 4 files changed, 63 insertions(+), 0 deletions(-) create mode 100644 t/tests/copyright-file-general/debian/debian/copyright-crln.copyright diff --git a/checks/copyright-file b/checks/copyright-file index 1262748..3dcaf3c 100644 --- a/checks/copyright-file +++ b/checks/copyright-file @@ -130,6 +130,10 @@ if ($line) { $_ = slurp_entire_file('copyright'); study $_; +if (m,\r,) { + tag 'copyright-has-crs'; +} + my $wrong_directory_detected = 0; if (m,\<fill in (?:http/)?ftp site\>, or m/\<Must follow here\>/) { diff --git a/checks/copyright-file.desc b/checks/copyright-file.desc index 64f774f..be1ea49 100644 --- a/checks/copyright-file.desc +++ b/checks/copyright-file.desc @@ -391,3 +391,13 @@ Info: The copyright file refers to . This file may be removed from a future version of base-files if references to it drop sufficiently. + +Tag: copyright-has-crs +Severity: pedantic +Certainty: certain +Info: The copyright file has lines ending in CRLF instead of just LF. + . + Running the following command against the given file removes any + <tt>CR</tt> character in the file: + . + <tt>sed -i 's/\r//g' path/to/file</tt> diff --git a/t/tests/copyright-file-general/debian/debian/control.in b/t/tests/copyright-file-general/debian/debian/control.in index 707959e..3cf834a 100644 --- a/t/tests/copyright-file-general/debian/debian/control.in +++ b/t/tests/copyright-file-general/debian/debian/control.in @@ -194,3 +194,16 @@ Description: checks not referring to common licenses Lintian. It is part of the Lintian test suite and may do very odd things. It should not be installed like a regular package. It may be an empty package. + +Package: copyright-crln +Architecture: all +Depends: $\{shlibs:Depends\}, $\{misc:Depends\} +Description: check for Windows newlines + This package should trigger a tag for having Windows newlines in + the copyright file. + . + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. + diff --git a/t/tests/copyright-file-general/debian/debian/copyright-crln.copyright b/t/tests/copyright-file-general/debian/debian/copyright-crln.copyright new file mode 100644 index 0000000..f3d1d5a --- /dev/null +++ b/t/tests/copyright-file-general/debian/debian/copyright-crln.copyright @@ -0,0 +1,36 @@ +This package was debianized by Tobias Toedter <t.toed...@gmx.net> on +Thu, 20 Mar 2008 23:48:15 +0100 + +It was downloaded from <http://www.example.org/> + +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?recall=184 + +Upstream Authors: + + Tobias Toedter <t.toed...@gmx.net> + +Copyright: + + Copyright (C) 2008 Tobias Toedter + +License: + + This package is free software; 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 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is Copyright 2008, Tobias Toedter <t.toed...@gmx.net> +and is licensed under the GPL, see above. -- 1.7.5.4