On Mon, Aug 21, 2006 at 03:12:56PM -0400, Jamin W. Collins wrote:
> 
> I also appear to be bitten by this one. My user accounts are also stored
> in LDAP.

Does anybody know why we use LOGNAME (in /usr/lib/dpkg/controllib.pl)?

I could find this in the ChangeLog:

dpkg (1.4.0.9) unstable; urgency=low
[...]
  * Changed controllib.pl to use $ENV{LOGNAME}, getlogin(), and $<
    (in that order) to determine the intended ownership of
    debian/{files,substvars},  (fixes #7324, #6823, #5659, #5965, #5929,
    #9239, #5366).
[...]
 -- Klee Dienes <[EMAIL PROTECTED]>  Mon, 17 Mar 1997 16:11:24 -0500

(And I can't find these bug reports; BTW does anybody have an archive of them)

If we could remove the usage of LOGNAME (and getlogin), and only keep $< and
$(, I think it would be fine (in that case, there is no need to call getpwnam).

A patch is attached, but it assumes these bugs do not apply anymore ;(

Kind Regards,
-- 
Nekral
Index: scripts/controllib.pl
===================================================================
--- scripts/controllib.pl       (révision 510)
+++ scripts/controllib.pl       (copie de travail)
@@ -35,43 +35,8 @@
 
 $progname= $0; $progname= $& if $progname =~ m,[^/]+$,;
 
-$getlogin = getlogin();
-if(!defined($getlogin)) {
-       open(SAVEIN, "<&STDIN");
-       close(STDIN);
-       open(STDIN, "<&STDERR");
[EMAIL PROTECTED] = ( $<, $( );
 
-       $getlogin = getlogin();
-
-       close(STDIN);
-       open(STDIN, "<&SAVEIN");
-       close(SAVEIN);
-}
-if(!defined($getlogin)) {
-       open(SAVEIN, "<&STDIN");
-       close(STDIN);
-       open(STDIN, "<&STDOUT");
-
-       $getlogin = getlogin();
-
-       close(STDIN);
-       open(STDIN, "<&SAVEIN");
-       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'), $<)); }
-}
[EMAIL PROTECTED] = @fowner[2,3];
-
 sub capit {
     my @pieces = map { ucfirst(lc) } split /-/, $_[0];
     return join '-', @pieces;

Reply via email to