Control: tag -1 patch

On Tue, 19 Feb 2013, Niels Thykier wrote:
> """
>  $ perl -w -MDpkg::Source::Package -MDpkg::Source::Archive -e ''
>  Subroutine Dpkg::Source::Archive::getcwd redefined at 
> /usr/share/perl/5.14/Exporter.pm line 67.
>   at /usr/share/perl5/Dpkg/Source/Archive.pm line 32
> """

In fact loading Dpkg::Source::Archive is enough to trigger it. This is
due to POSIX and Cwd both exporting getcwd().

The attached patch should fix the issue. I'll let Guillem commit it
on his private 1.17.x branch unless he believes that it should be fixed
in wheezy, which might not be a bad idea. I wonder why we didn't detect
it sooner, did something changes the perl level recently ?

I have modified the getcwd into Cwd::getcwd because that's the copy we
have been using up to now and because Cwd is still needed for
Cwd::realpath but it's not really required.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Get the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/
>From 9b428318889529530920cdfd0f382841e7ad05d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= <hert...@debian.org>
Date: Wed, 20 Feb 2013 08:45:02 +0100
Subject: [PATCH] Dpkg::Source::Archive: do not import anything from Cwd.pm

Both POSIX and Cwd export "getcwd" by default so we ended up with
this annoying warning:

 Subroutine Dpkg::Source::Archive::getcwd redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/Dpkg/Source/Archive.pm line 32

Reported-by: Niels Thykier <ni...@thykier.net>
Closes: #700978
---
 scripts/Dpkg/Source/Archive.pm |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/Dpkg/Source/Archive.pm b/scripts/Dpkg/Source/Archive.pm
index 5e040ca..0257603 100644
--- a/scripts/Dpkg/Source/Archive.pm
+++ b/scripts/Dpkg/Source/Archive.pm
@@ -29,7 +29,7 @@ use POSIX;
 use File::Temp qw(tempdir);
 use File::Basename qw(basename);
 use File::Spec;
-use Cwd;
+use Cwd qw();
 
 use base 'Dpkg::Compression::FileHandle';
 
@@ -52,7 +52,7 @@ sub create {
                             '--owner', '0', '--group', '0',
                             @{$opts{"options"}}, '-cf', '-' ];
     *$self->{"pid"} = spawn(%spawn_opts);
-    *$self->{"cwd"} = getcwd();
+    *$self->{"cwd"} = Cwd::getcwd();
 }
 
 sub _add_entry {
-- 
1.7.10.4

Reply via email to