Package: dpkg
Version: 1.14.24ubuntu1
Severity: important

This is based on Ubuntu bug #391165 
(https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/391165)

When parsing a control file, Dpkg/Deps.pm correctly spots the missing comma in
this line:

Build-Depends: foo bar

But not in this:

Build-Depends: foo
 bar

This is because Dpkg/Deps.pm searches for whitespace using "\s", which doesn't
match newlines. This commit strips newlines from the Build-Depends line.

The attached patch is against the current git HEAD.

        - Andrew Sayers

-- System Information:
Debian Release: 5.0
  APT prefers jaunty-updates
  APT policy: (500, 'jaunty-updates'), (500, 'jaunty-security'), (500, 'jaunty')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.28-13-generic (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg depends on:
ii  coreutils                 6.10-6ubuntu1  The GNU core utilities
ii  libc6                     2.9-4ubuntu6   GNU C Library: Shared libraries
ii  lzma                      4.43-14ubuntu1 Compression method of 7z format in

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt                      0.7.20.2ubuntu6 Advanced front-end for dpkg

-- no debconf information
>From d2793445a5a56892e680f5cd6c5ad515ff142d90 Mon Sep 17 00:00:00 2001
From: Andrew Sayers <andrew-d...@pileofstuff.org>
Date: Wed, 24 Jun 2009 15:22:52 +0100
Subject: [PATCH] Dpkg::Deps: Handle newlines in Build-Depends

When parsing a control file, Dpkg/Deps.pm correctly spots the missing comma in
this line:

Build-Depends: foo bar

But not in this:

Build-Depends: foo
 bar

This is because Dpkg/Deps.pm searches for whitespace using "\s", which doesn't
match newlines. This commit strips newlines from the Build-Depends line.
---
 scripts/Dpkg/Deps.pm |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index 89a1e10..d2c2f13 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -310,6 +310,8 @@ sub parse {
     # Strip trailing/leading spaces
     $dep_line =~ s/^\s+//;
     $dep_line =~ s/\s+$//;
+    # Strip newlines
+    $dep_line =~ s/\n//g;
 
     my @dep_list;
     foreach my $dep_and (split(/\s*,\s*/m, $dep_line)) {
-- 
1.6.0.4

Reply via email to