Hi,

a patch is attache,d but not tested as the nosetest stuff failed ocmpldetely -
didn't have the time to figure out why. But I think the patch is correct.

Cheers,

Bernd


On 04/10/2011 04:31 PM, Guido Günther wrote:
> severity 622103
> 
> Hi Bernd,
> On Sun, Apr 10, 2011 at 11:35:31AM +0200, Bernd Zeimetz wrote:
>> Package: git-buildpackage
>> Version: 0.5.21
>> Severity: important
>> Tags: patch
>>
>> Hi,
>>
>> in gbp/git.py, line 539:
>>             mode, objtype, commit, name = line.split()
>> fails if the filename contains a whitespace. The proper split would be
>>             mode, objtype, commit, name = line.split(None, 3)
> 
> Could you provide a test case?
> Cheers,
>  -- Guido
> 
>>
>> A patch is attached.
>>
>> Cheers,
>>
>> Bernd
>>
>>
>> -- System Information:
>> Debian Release: wheezy/sid
>>   APT prefers unstable
>>   APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
>> Architecture: amd64 (x86_64)
>>
>> Kernel: Linux 2.6.38-2-amd64 (SMP w/2 CPU cores)
>> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
>> Shell: /bin/sh linked to /bin/dash
>>
>> Versions of packages git-buildpackage depends on:
>> ii  devscripts                   2.10.71     scripts to make the life of a 
>> Debi
>> ii  git [git-core]               1:1.7.4.1-5 fast, scalable, distributed 
>> revisi
>> ii  git-core                     1:1.7.4.1-5 fast, scalable, distributed 
>> revisi
>> ii  python                       2.6.6-12    interactive high-level 
>> object-orie
>> ii  python-dateutil              1.4.1-3     powerful extensions to the 
>> standar
>> ii  python-support               1.0.11      automated rebuilding support 
>> for P
>>
>> Versions of packages git-buildpackage recommends:
>> ii  cowbuilder                    0.62+nmu2  pbuilder running on cowdancer
>> ii  pristine-tar                  1.13       regenerate pristine tarballs
>>
>> Versions of packages git-buildpackage suggests:
>> pn  git-load-dirs                 <none>     (no description available)
>> ii  python-notify                 0.1.1-2+b2 Python bindings for libnotify
>>
>> -- no debconf information
>>
>> -- debsums errors found:
>> debsums: changed file /usr/bin/git-buildpackage (from git-buildpackage 
>> package)
>> debsums: changed file /usr/share/pyshared/gbp/git.py (from git-buildpackage 
>> package)
> 
>> >From 5f76ae54b967dc299ac482a7e5097d249258fb30 Mon Sep 17 00:00:00 2001
>> From: Bernd Zeimetz <[email protected]>
>> Date: Sun, 10 Apr 2011 11:34:04 +0200
>> Subject: [PATCH] gbp/git.py: Don't split filenames with whitespaces.
>>
>> ---
>>  gbp/git.py |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/gbp/git.py b/gbp/git.py
>> index 96c2255..fb5aa53 100644
>> --- a/gbp/git.py
>> +++ b/gbp/git.py
>> @@ -536,7 +536,7 @@ class GitRepository(object):
>>  
>>          out, ret =  self.__git_getoutput('ls-tree', args, cwd=path)
>>          for line in out:
>> -            mode, objtype, commit, name = line.split()
>> +            mode, objtype, commit, name = line.split(None, 3)
>>              # A submodules is shown as "commit" object in ls-tree:
>>              if objtype == "commit":
>>                  nextpath = os.path.sep.join([path, name])
>> -- 
>> 1.7.4.1
>>
> 


-- 
 Bernd Zeimetz                            Debian GNU/Linux Developer
 http://bzed.de                                http://www.debian.org
 GPG Fingerprint: ECA1 E3F2 8E11 2432 D485  DD95 EB36 171A 6FF9 435F
>From 3655170ed2cfb908536ee19f64bbc76333bc8b18 Mon Sep 17 00:00:00 2001
From: Bernd Zeimetz <[email protected]>
Date: Sun, 10 Apr 2011 18:58:48 +0200
Subject: [PATCH 2/2] Provide a test case for file names with spaces.

---
 tests/04_test_gbp_submodules.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/04_test_gbp_submodules.py b/tests/04_test_gbp_submodules.py
index ae9d59a..8ab6722 100644
--- a/tests/04_test_gbp_submodules.py
+++ b/tests/04_test_gbp_submodules.py
@@ -20,7 +20,7 @@ submoduledir = None
 submodule_name = "test_submodule"
 
 tmpdir = None
-testfile_name = "testfile"
+testfile_names = ["testfile", "test file"]
 
 
 def setup():
@@ -51,7 +51,8 @@ def test_empty_has_submodules():
 
 
 def _add_dummy_data(msg):
-    shutil.copy(".git/HEAD", testfile_name)
+    for testfile_name in testfile_names:
+        shutil.copy(".git/HEAD", testfile_name)
     gbp.command_wrappers.GitAdd()(['-f', '.'])
     gbp.command_wrappers.GitCommand("commit", ["-m%s" % msg, "-a"])()
 
@@ -94,8 +95,9 @@ def test_dump_tree():
     dumpdir = os.path.join(tmpdir, "dump")
     os.mkdir(dumpdir)
     assert git_buildpackage.dump_tree(repo, dumpdir, "master", True)
-    assert os.path.exists(os.path.join(dumpdir, testfile_name))
-    assert os.path.exists(os.path.join(dumpdir, submodule_name, testfile_name))
+    for testfile_name in testfile_names:
+        assert os.path.exists(os.path.join(dumpdir, testfile_name))
+        assert os.path.exists(os.path.join(dumpdir, submodule_name, testfile_name))
 
 
 def test_create_tarball():
-- 
1.7.4.1

Reply via email to