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

[SCM] Debian package checker branch, master, updated. 2.3.3-51-gaf6d9de



The following commit has been merged in the master branch:
commit af6d9defb866a9f1ce793c92ce93742b8b4fe6a6
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Sun Mar 21 00:17:18 2010 -0600

    Warn about CRLF EOLs in control and changelog files
    
    Even Dpkg behaves in a funny way when the changelog uses CRLF as line
    terminator.  It is unable to recognise the urgency field.
    
    * checks/cruft{,.desc}:
      + [RG] Warn about control and changelog files with CRLF end of line
        terminators.  Thanks, Michal Čihař.  (Closes: #564713)

diff --git a/checks/cruft b/checks/cruft
index 3f9f321..f6b7224 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -81,6 +81,9 @@ my @file_checks =
      [ qr,((^|/)\.[^/]+\.swp|~)$,         => 'editor-backup-file',  1 ],
     );
 
+# List of files to check for a LF-only end of line terminator, relative
+# to the debian/ source directory
+our @EOL_terminators_files = qw(control changelog);
 
 sub run {
 
@@ -145,6 +148,15 @@ for my $file (keys(%$file_info)) {
     }
 }
 
+for my $file (@EOL_terminators_files) {
+    next unless -f "debfiles/$file";
+
+    $file = "debian/$file";
+
+    tag "control-file-with-CRLF-EOLs", $file
+	if ($file_info->{$file} =~ m/\bCRLF\b/);
+}
+
 # Report any error messages from tar while unpacking the source package if it
 # isn't just tar cruft.
 for my $file (keys %ERRORS) {
diff --git a/checks/cruft.desc b/checks/cruft.desc
index 1696f07..ccb925f 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -413,3 +413,16 @@ Info: tar produced an error while unpacking this source package.  This
  probably means there's something broken or at least strange about the way
  the upstream tar file was constructed.  You may want to report this as an
  upstream bug.
+
+Tag: control-file-with-CRLF-EOLs
+Severity: important
+Certainty: possible
+Info: The given control file uses <tt>CRLF</tt> as line terminator
+ instead of the traditional UNIX <tt>LF</tt> terminator.  Since some
+ tools were only designed with the UNIX end-of-line terminators in mind,
+ it is possible that they misbehave or lead to unexpected results.
+ .
+ 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/debian/changelog b/debian/changelog
index a6b8b65..8a362b3 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ lintian (2.3.4) UNRELEASED; urgency=low
 
   * Summary of tag changes:
     + Added:
+      - control-file-with-CRLF-EOLs
       - missing-debian-source-format
       - possible-new-upstream-release-without-new-version
       - unknown-file-in-debian-source
@@ -25,12 +26,14 @@ lintian (2.3.4) UNRELEASED; urgency=low
       contain substvars other than *:Depends substvars, since substvars
       may be used to assemble the components of a dependency.  Thanks,
       Matthias Klose.  (Closes: #573815)
-  * checks/cruft.desc:
+  * checks/cruft{,.desc}:
     + [RA] Provide more information in native-package-with-dash-version
       long description about how native packages can be created by
       mistake.  Thanks, Jari Aalto.  (Closes: #573839)
     + [RA] Reword source-contains-prebuilt-windows-binary long
       description.  (Closes: #574515)
+    + [RG] Warn about control and changelog files with CRLF end of line
+      terminators.  Thanks, Michal Čihař.  (Closes: #564713)
   * checks/debconf:
     + [RA] Don't warn about the length of the short description for
       templates of type text in udebs, since they're frequently used by
diff --git a/t/templates/pedantic/debian/changelog.in b/t/tests/cruft-crlf-eols/debian/debian/changelog.in
similarity index 96%
copy from t/templates/pedantic/debian/changelog.in
copy to t/tests/cruft-crlf-eols/debian/debian/changelog.in
index f6d86c0..e6242c1 100644
--- a/t/templates/pedantic/debian/changelog.in
+++ b/t/tests/cruft-crlf-eols/debian/debian/changelog.in
@@ -1,8 +1,8 @@
 {$srcpkg} ({$version}) unstable; urgency=low
-
-  * Lintian Test Suite.
-  * Test: {$testname}
-
-  * Suppress "should close ITP bug" messages.  (Closes: #123456)
-
- -- {$author}  {$date}
+
+  * Lintian Test Suite.
+  * Test: {$testname}
+
+  * Suppress "should close ITP bug" messages.  (Closes: #123456)
+
+ -- {$author}  {$date}
diff --git a/t/templates/skel/debian/control.in b/t/tests/cruft-crlf-eols/debian/debian/control.in
similarity index 97%
copy from t/templates/skel/debian/control.in
copy to t/tests/cruft-crlf-eols/debian/debian/control.in
index fc7a0e1..b2cd55a 100644
--- a/t/templates/skel/debian/control.in
+++ b/t/tests/cruft-crlf-eols/debian/debian/control.in
@@ -1,14 +1,14 @@
-Source: {$srcpkg}
-Priority: extra
-Section: {$section}
-Maintainer: {$author}
-Standards-Version: {$standards_version}
-Build-Depends: debhelper (>= 7.0.50~)
-
-Package: {$srcpkg}
-Architecture: {$architecture}
-Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
-Description: {$description}
- 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.
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7.0.50~)
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ 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.
diff --git a/t/tests/cruft-crlf-eols/desc b/t/tests/cruft-crlf-eols/desc
new file mode 100644
index 0000000..8eef4d3
--- /dev/null
+++ b/t/tests/cruft-crlf-eols/desc
@@ -0,0 +1,6 @@
+Testname: cruft-crlf-eols
+Sequence: 6000
+Version: 1.0
+Description: Check that control files with CRLF EOLs are reported
+Test-For:
+ control-file-with-CRLF-EOLs
diff --git a/t/tests/cruft-crlf-eols/tags b/t/tests/cruft-crlf-eols/tags
new file mode 100644
index 0000000..1b102e7
--- /dev/null
+++ b/t/tests/cruft-crlf-eols/tags
@@ -0,0 +1,2 @@
+E: cruft-crlf-eols source: control-file-with-CRLF-EOLs debian/changelog
+E: cruft-crlf-eols source: control-file-with-CRLF-EOLs debian/control

-- 
Debian package checker


Reply to: