Your message dated Sun, 24 Jun 2012 09:54:56 +1000
with message-id <[email protected]>
and subject line fixed in 0.60
has caused the Debian Bug report #646294,
regarding dh-make: check USER if LOGNAME is unset
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
646294: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646294
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: dh-make
Version: 0.59
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch precise

The default display manager (LightDM) in Ubuntu 11.10 unfortunately has
a bug whereby it doesn't set the LOGNAME environment variable
(https://bugs.launchpad.net/bugs/875705).  We found that (if DEBFULLNAME
and DEBEMAIL are also unset) this causes dh_make to go haywire and spew
lots of junk from /etc/passwd into debian/changelog and debian/control.

While the display manager bug clearly ought to be fixed, dh_make could
easily be more robust here.  Patch follows.

  * Try the USER environment variable if LOGNAME is not set (LP: #875705).

diff -Nru dh-make-0.59/dh_make dh-make-0.59ubuntu1/dh_make
--- dh-make-0.59/dh_make        2011-06-19 01:27:43.000000000 +0100
+++ dh-make-0.59ubuntu1/dh_make 2011-10-22 22:45:40.000000000 +0100
@@ -264,6 +264,21 @@
        }
 }
 
+sub get_logname
+{
+       # lightdm in Ubuntu 11.10 does not set LOGNAME
+       # (https://bugs.launchpad.net/bugs/875705).  Work around this by trying
+       # USER instead.
+       if (exists $ENV{LOGNAME})
+       {
+               return $ENV{LOGNAME};
+       } elsif (exists $ENV{USER}) {
+               return $ENV{USER};
+       } else {
+               die "Cannot get username; neither LOGNAME nor USER is set in 
the environment!\n";
+       }
+}
+
 sub get_username
 {
        my $tmpusername = '';
@@ -274,27 +289,28 @@
        }
        return $tmpusername if ($tmpusername ne "");
 
+       my $logname = get_logname();
        if (-x '/usr/bin/getent')
        {
-               $tmpusername = qx(/usr/bin/getent passwd $ENV{LOGNAME}|awk -F: 
'\{ print \$5; \}' | cut -f1 -d,);
+               $tmpusername = qx(/usr/bin/getent passwd $logname|awk -F: '\{ 
print \$5; \}' | cut -f1 -d,);
        }
        chomp($tmpusername);
        return $tmpusername if ($tmpusername ne "");
 
-       $tmpusername = qx(awk -F: -vUSER=$ENV{LOGNAME} '\$1 == USER \{ print 
\$5; \}' /etc/passwd | cut -f1 -d,);
+       $tmpusername = qx(awk -F: -vUSER=$logname '\$1 == USER \{ print \$5; 
\}' /etc/passwd | cut -f1 -d,);
        chomp($tmpusername);
        return $tmpusername if ($tmpusername ne "");
        
        if (-x '/usr/bin/ypmatch')
        {
-               $tmpusername = qx(ypmatch $ENV{LOGNAME} passwd.byname|awk -F: 
'\{ print \$5; \}' | cut -f1 -d,);
+               $tmpusername = qx(ypmatch $logname passwd.byname|awk -F: '\{ 
print \$5; \}' | cut -f1 -d,);
        }
        chomp($tmpusername);
        return $tmpusername if ($tmpusername ne "");
 
        if (-x '/usr/bin/ldapsearch')
        {
-               $tmpusername = [map {/^(?:gecos|cn): (.*)/} qx(ldapsearch -Q 
-LLL uid=$ENV{LOGNAME} gecos cn)]->[0];
+               $tmpusername = [map {/^(?:gecos|cn): (.*)/} qx(ldapsearch -Q 
-LLL uid=$logname gecos cn)]->[0];
        }
        chomp($tmpusername);
        return $tmpusername if ($tmpusername ne "");
@@ -306,13 +322,14 @@
 {
        return $ENV{DEBEMAIL} if ($ENV{DEBEMAIL} );
        return $ENV{EMAIL} if ($ENV{EMAIL} );
+       my $logname = get_logname();
        if (-x '/usr/bin/ldapsearch')
        {
                my $mail;
-               $mail = [map {/^mail: (.*)/ && $1} qx(ldapsearch -Q -LLL 
uid=$ENV{LOGNAME} mail)]->[0];
+               $mail = [map {/^mail: (.*)/ && $1} qx(ldapsearch -Q -LLL 
uid=$logname mail)]->[0];
                return $mail if $mail;
        }
-       if ($ENV{LOGNAME} )
+       if ($logname )
        {
                my $mailhost;
                if ( -e '/etc/mailname')
@@ -322,7 +339,7 @@
                } else {
                        $mailhost='unknown';
                } 
-               return  ($ENV{LOGNAME} . '@' . $mailhost);
+               return  ($logname . '@' . $mailhost);
        }
 }
 

Thanks,

-- 
Colin Watson                                       [[email protected]]



--- End Message ---
--- Begin Message ---
Package: dh-make
Version: 0.60

the changelog had the wrong bug number but this was fixed in 0.60
-- 
Craig Small VK2XLZ   http://enc.com.au/          csmall at : enc.com.au
Debian GNU/Linux     http://www.debian.org/      csmall at : debian.org
GPG fingerprint:     5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5


--- End Message ---

Reply via email to