Package: dput
Version: 0.9.2.32
Severity: normal
Tags: patch

Hi,

dcut tries to scp files to host using user 'username' rather than the
current login, as dput does... I'm attaching a patch which mimicks the
dput behavior...

Thanks,

Guido

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (1001, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26.0rx00 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dput depends on:
ii  gnupg                         1.4.9-2    GNU privacy guard - a free PGP rep
ii  python                        2.5.2-1    An interactive high-level object-o

dput recommends no packages.

-- no debconf information
diff -ru dput-0.9.2.32/dcut dput-0.9.2.32+nmu1/dcut
--- dput-0.9.2.32/dcut	2008-05-01 19:56:34.000000000 +0100
+++ dput-0.9.2.32+nmu1/dcut	2008-07-14 16:45:03.000000000 +0100
@@ -210,14 +210,21 @@
             method = config.get(host, 'method')
 
         # Check now the login and redefine it if needed
-	if config.has_option(host, 'login'):
+	if config.has_option(host, 'login') and config.get(host, 'login') != 'username':
 	  login = config.get(host, 'login')
-	elif config.has_option('DEFAULT', 'login'):
+	elif config.has_option('DEFAULT', 'login') and config.get('DEFAULT', 'login') != 'username':
 	  login = config.get('DEFAULT', 'login')
 	else:
-	  print >> sys.stderr, 'Neither host "%s" not default section defines login'%(host)
-	  sys.exit(1)
-        if debug: print "D: Login to use: %s" % login
+	  # Try to get the login from the enviroment
+	  if os.environ.has_key('USER'):
+	    login = os.environ['USER']
+	  else:
+	    print "$USER not set, will use login."
+	    # Else use the current username
+	    login = pwd.getpwuid(os.getuid( ))[0]
+	    if debug: print "D: User-ID: %s" % os.getuid()
+	  if debug: print "D: Neither host %s nor default login used. Using %s" %(host,login)
+	if debug: print "D: Login to use: %s" % login
 
         # Messy, yes. But it isn't referenced by the upload method anyway.
         if config.get(host, 'method') == 'local':
diff -ru dput-0.9.2.32/debian/changelog dput-0.9.2.32+nmu1/debian/changelog
--- dput-0.9.2.32/debian/changelog	2008-05-04 10:59:20.000000000 +0100
+++ dput-0.9.2.32+nmu1/debian/changelog	2008-07-14 16:33:57.000000000 +0100
@@ -1,3 +1,10 @@
+dput (0.9.2.32+nmu1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * dcut: use a sensible default login, rather than 'username'
+
+ -- Guido Trotter <[EMAIL PROTECTED]>  Mon, 14 Jul 2008 16:33:25 +0100
+
 dput (0.9.2.32) unstable; urgency=high
 
   * don't use python2.5-only <str>.partition. Closes: #479320

Reply via email to