[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#706762: unblock: libpam-mklocaluser/0.8 to fix #706753 (serious)



[Cyril Brulebois]
> From the python doc, it isn't obvious to me what changed between 2.6
> (squeeze) and 2.7 (wheezy), if that's indeed the default version
> that's being used in both cases:
>   http://docs.python.org/2/library/subprocess.html

Me neither, but it did stop working in that time frame. :/

> Anyway, you had exception issues, and the doc says notably:
> | The most common exception raised is OSError. This occurs, for example,
> | when trying to execute a non-existent file. Applications should
> | prepare for OSError exceptions.
> 
> You may want to introduce some exception catching in later versions?

Yes, got a larger rewrite pending in svn, but held it back to try to
get the wheezy version fixed first.

> Anyway, since what's in unstable seems to do the job, please prepare
> a source debdiff against wheezy's source package, using a 0.8~deb7u1
> changelog entry on top of it, with wheezy as a distribution.

Diff attached.  Identical to the previous diff, except the version
number.

> (Once we ACK it, build with -v0.7 so that we get proper changes and
> Closes: for the BTS, and version tracking should be our friend.)

Ack.

-- 
Happy hacking
Petter Reinholdtsen
diff -ur libpam-mklocaluser-0.7/debian/changelog libpam-mklocaluser-0.8~deb7u1/debian/changelog
--- libpam-mklocaluser-0.7/debian/changelog	2011-07-28 19:20:37.000000000 +0200
+++ libpam-mklocaluser-0.8~deb7u1/debian/changelog	2013-05-22 12:53:22.000000000 +0200
@@ -1,3 +1,9 @@
+libpam-mklocaluser (0.8~deb7u1) wheezy; urgency=low
+
+  * Rewrite runcmd() to work with Python on Wheezy (Closes: #706753).
+
+ -- Petter Reinholdtsen <pere@debian.org>  Sat, 04 May 2013 08:25:53 +0200
+
 libpam-mklocaluser (0.7) unstable; urgency=low
 
   * Rewrite how Popen() is used to ensure the script wait for the
diff -ur libpam-mklocaluser-0.7/debian/pam-python.py libpam-mklocaluser-0.8~deb7u1/debian/pam-python.py
--- libpam-mklocaluser-0.7/debian/pam-python.py	2011-07-26 16:18:23.000000000 +0200
+++ libpam-mklocaluser-0.8~deb7u1/debian/pam-python.py	2013-05-04 13:35:27.000000000 +0200
@@ -16,13 +16,16 @@
 import syslog
 
 def runcmd(pamh, cmd):
-  proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,)
+  proc = subprocess.Popen(cmd, shell=True, \
+                            stdout=subprocess.PIPE, \
+                            stderr=subprocess.PIPE,)
   while proc.poll() == None:
     pass
-  result = proc.communicate(input=None)[0]
-  if result != 0:
-    syslog.syslog("Command %(command)s failed with %(msg)s" % ( cmd, proc.stderr.read()) )
-#  print "output: %s" % output
+  (resultstdout, resultstderr) = proc.communicate(input=None)
+  if proc.returncode != 0:
+    msg = "Command '%s' failed with %s" % ( cmd, resultstderr.strip())
+    syslog.syslog(msg)
+#    print "output: %s" % msg
 
 def check_and_create_localuser(pamh, user):
   # Location of local users

Reply to: