Package: dpkg-dev
Version: 1.13.13
Severity: normal

Every time controllib.pl is loaded it tries to resolv uid & gid, even
if the script using it does not need it. Fix by replacing global 
variable @fowner with function getfowner.

This patch is needed by scratchbox since it might call 
dpkg-architecture before /etc/passwd is set up. 

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.13
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages dpkg-dev depends on:
ii  binutils             2.16.1cvs20060117-1 The GNU assembler, linker and bina
ii  cpio                 2.6-10              GNU cpio -- a program to manage ar
ii  dpkg                 1.13.13             package maintenance system for Deb
ii  make                 3.81-1              The GNU version of the "make" util
ii  patch                2.5.9-4             Apply a diff file to an original
ii  perl [perl5]         5.8.8-4             Larry Wall's Practical Extraction 
ii  perl-modules         5.8.8-4             Core Perl modules

Versions of packages dpkg-dev recommends:
ii  bzip2                         1.0.3-2    high-quality block-sorting file co
ii  gcc [c-compiler]              4:4.1.1-3  The GNU C compiler
ii  gcc-3.3 [c-compiler]          1:3.3.6-10 The GNU C compiler
ii  gcc-4.0 [c-compiler]          4.0.3-1    The GNU C compiler
ii  gcc-4.1 [c-compiler]          4.1.1-16   The GNU C compiler

-- no debconf information
diff -urp dpkg-1.13.24/scripts/controllib.pl dpkg-1.13.25/scripts/controllib.pl
--- dpkg-1.13.24/scripts/controllib.pl  2006-10-12 02:46:26.000000000 +0300
+++ dpkg-1.13.25/scripts/controllib.pl  2006-11-03 11:41:19.000000000 +0200
@@ -59,18 +59,21 @@ if(!defined($getlogin)) {
        close(SAVEIN);
 }
 
-if (defined ($ENV{'LOGNAME'})) {
-    @fowner = getpwnam ($ENV{'LOGNAME'});
-    if (! @fowner) { die (sprintf (_g('unable to get login information for 
username "%s"'), $ENV{'LOGNAME'})); }
-} elsif (defined ($getlogin)) {
-    @fowner = getpwnam ($getlogin);
-    if (! @fowner) { die (sprintf (_g('unable to get login information for 
username "%s"'), $getlogin)); }
-} else {
-    &warn (sprintf (_g('no utmp entry available and LOGNAME not defined; using 
uid of process (%d)'), $<));
-    @fowner = getpwuid ($<);
-    if (! @fowner) { die (sprintf (_g('unable to get login information for uid 
%d'), $<)); }
+sub getfowner {
+       if (defined ($ENV{'LOGNAME'})) {
+       @fowner = getpwnam ($ENV{'LOGNAME'});
+           if (! @fowner) { die (sprintf (_g('unable to get login information 
for username "%s"'), $ENV{'LOGNAME'})); }
+       } elsif (defined ($getlogin)) {
+           @fowner = getpwnam ($getlogin);
+           if (! @fowner) { die (sprintf (_g('unable to get login information 
for username "%s"'), $getlogin)); }
+       } else {
+           &warn (sprintf (_g('no utmp entry available and LOGNAME not 
defined; using uid of process (%d)'), $<));
+           @fowner = getpwuid ($<);
+           if (! @fowner) { die (sprintf (_g('unable to get login information 
for uid %d'), $<)); }
+       }
+       @fowner = @fowner[2,3];
+       return @fowner;
 }
[EMAIL PROTECTED] = @fowner[2,3];
 
 sub capit {
     my @pieces = map { ucfirst(lc) } split /-/, $_[0];
diff -urp dpkg-1.13.24/scripts/dpkg-distaddfile.pl 
dpkg-1.13.25/scripts/dpkg-distaddfile.pl
--- dpkg-1.13.24/scripts/dpkg-distaddfile.pl    2006-06-21 06:40:19.000000000 
+0300
+++ dpkg-1.13.25/scripts/dpkg-distaddfile.pl    2006-11-03 11:41:57.000000000 
+0200
@@ -60,7 +60,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
 
 $fileslistfile="./$fileslistfile" if $fileslistfile =~ m/^\s/;
 open(Y,"> $fileslistfile.new") || &syserr(_g("open new files list file"));
-chown(@fowner, "$fileslistfile.new") 
+chown(getfowner(), "$fileslistfile.new") 
                || &syserr(_g("chown new files list file"));
 if (open(X,"< $fileslistfile")) {
     while (<X>) {
diff -urp dpkg-1.13.24/scripts/dpkg-gencontrol.pl 
dpkg-1.13.25/scripts/dpkg-gencontrol.pl
--- dpkg-1.13.24/scripts/dpkg-gencontrol.pl     2006-06-21 05:35:01.000000000 
+0300
+++ dpkg-1.13.25/scripts/dpkg-gencontrol.pl     2006-11-03 11:42:06.000000000 
+0200
@@ -255,7 +255,7 @@ for $f (keys %remove) { delete $f{&capit
 $fileslistfile="./$fileslistfile" if $fileslistfile =~ m/^\s/;
 open(Y,"> $fileslistfile.new") || &syserr(_g("open new files list file"));
 binmode(Y);
-chown(@fowner, "$fileslistfile.new") 
+chown(getfowner(), "$fileslistfile.new") 
                || &syserr(_g("chown new files list file"));
 if (open(X,"< $fileslistfile")) {
     binmode(X);
diff -urp dpkg-1.13.24/scripts/dpkg-shlibdeps.pl 
dpkg-1.13.25/scripts/dpkg-shlibdeps.pl
--- dpkg-1.13.24/scripts/dpkg-shlibdeps.pl      2006-06-21 05:35:01.000000000 
+0300
+++ dpkg-1.13.25/scripts/dpkg-shlibdeps.pl      2006-11-03 11:42:14.000000000 
+0200
@@ -394,7 +394,7 @@ if (!$stdout) {
     open(Y,"> $varlistfile.new") ||
         syserr(sprintf(_g("open new substvars file \`%s'"), 
"$varlistfile.new"));
     unless ($REAL_USER_ID) {
-       chown(@fowner, "$varlistfile.new") ||
+       chown(getfowner(), "$varlistfile.new") ||
            syserr(sprintf(_g("chown of \`%s'"), "$varlistfile.new"));
     }
     if (open(X,"< $varlistfile")) {
diff -urp dpkg-1.13.24/scripts/dpkg-source.pl 
dpkg-1.13.25/scripts/dpkg-source.pl
--- dpkg-1.13.24/scripts/dpkg-source.pl 2006-06-21 06:40:27.000000000 +0300
+++ dpkg-1.13.25/scripts/dpkg-source.pl 2006-11-03 11:42:27.000000000 +0200
@@ -749,7 +749,7 @@ if ($opmode eq 'build') {
        system "chmod", "g-s", $tmp;
        printf(_g("%s: unpacking %s")."\n", $progname, $tarfile);
        extracttar("$dscdir/$tarfile",$tmp,$t);
-       system "chown", '-R', '-f', join(':',@fowner), "$tmp/$t";
+       system "chown", '-R', '-f', join(':',getfowner()), "$tmp/$t";
        rename("$tmp/$t",$target)
            || &syserr(sprintf(_g("unable to rename `%s' to `%s'"), "$tmp/$t", 
$target));
        rmdir($tmp)

Reply via email to