Control: tags 692317 patch

Dear Stefan,


Am Mittwoch, den 07.11.2012, 16:20 +0100 schrieb Stefan Bühler:

> I think you're right - the spaces in the filenames lead to problems:
> 
> dh_autoreconf_clean uses the perl "split" function to split the lines 
> into checksum and filename:
> 
> * a comment says the delimiter is "comma", which is wrong: there are two 
> spaces between checksum and filename
> * split splits by default at /\s+/ - and returns as many components it finds
> 
> Fix it by replacing *both* split calls with:
> 
> my ($checksum, $filename) = split(/\s+/, $_, 2);
> 
> It uses the same delimiter, but only splits at the first one (returning 
> at most two parts).
> 
> (Also you probably should fix the comment)

thank you for your reply and your great analysis and fix. I paste the
patch below. Julian, you can just save this message and apply it with
`git am --scissors this-message.mbox`.

> @Paul: I couldn't completely check whether my fix works, because I 
> didn't want to install the dependencies.

I tested it by running `debuild clean` which invokes
`dh_autoreconf_clean` and the file was not deleted. Awesome!

> Also shallow git clone doesn't work, as it is probably stored as one
> index file which gets downloaded completely.

Hmm, strange. I have not much knowledge though as I mostly check out the
whole tree.


Thanks,

Paul

--- 8< ---- >8 ---
From f14333020d7b157a8f9fed6c18859656ef544446 Mon Sep 17 00:00:00 2001
From: Paul Menzel <pm.deb...@googlemail.com>
Date: Wed, 7 Nov 2012 16:41:30 +0100
Subject: [PATCH] dh_autoreconf_clean: Fix handling of files with spaces in 
their names (Closes: #692317)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

dh_autoreconf_clean uses the perl "split" function to split the lines
into checksum and filename:

• A comment says the delimiter is "comma", which is wrong: there are two
spaces between checksum and filename.
• `split` splits by default at `/\s+/` and returns as many components it
finds

Fix it by replacing *both* split calls with the following.

    my ($checksum, $filename) = split(/\s+/, $_, 2)

It uses the same delimiter, but only splits at the first one (returning
at most two parts).

Analysis-and-Fix-by: Stefan Bühler <stbueh...@lighttpd.net>
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692317#10
Tested-by: Paul Menzel <pm.deb...@googlemail.com>
Closes: http://bugs.debian.org/692317
---
 dh_autoreconf_clean |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dh_autoreconf_clean b/dh_autoreconf_clean
index 8d399d9..8fd9c34 100755
--- a/dh_autoreconf_clean
+++ b/dh_autoreconf_clean
@@ -43,8 +43,8 @@ open(FILE, 'debian/autoreconf.before') or die($!);
 
 while(<FILE>) {
     chomp($_);
-    # The delimiter here is a comma
-    my ($checksum, $filename) = split;
+    # The delimiter here is two spaces
+    my ($checksum, $filename) = split(/\s+/, $_, 2);
     # Put the key => value pair in the hash
     $file{$filename} = $checksum;
 }
@@ -56,7 +56,7 @@ open(FILE, 'debian/autoreconf.after') or die($!);
 my $ltcheck = "";
 while(<FILE>) {
     chomp($_);
-    my ($checksum, $filename) = split;
+    my ($checksum, $filename) = split(/\s+/, $_, 2);
 
     if ($filename eq "/usr/share/libtool/config/ltmain.sh") {
         $ltcheck = $checksum;
-- 
1.7.10.4

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to