[sabayon] Remove the 'uninterruptible...' calls, and replace with subprocess.call



commit b99b6285fa6a11487b674961a1d64ca142aff243
Author: Scott Balneaves <sbalneav ltsp org>
Date:   Thu Sep 3 22:59:46 2009 -0500

    Remove the 'uninterruptible...' calls, and replace with subprocess.call
    
    See http://bugs.python.org/issue686667 about the EINTR issue in os.spawn*()

 lib/protosession.py |    2 +-
 lib/usermod.py      |    6 +++---
 lib/util.py         |   19 -------------------
 3 files changed, 4 insertions(+), 23 deletions(-)
---
diff --git a/lib/protosession.py b/lib/protosession.py
index cd91a69..904ee0a 100644
--- a/lib/protosession.py
+++ b/lib/protosession.py
@@ -92,7 +92,7 @@ def clobber_user_processes (username):
     # FIXME: my, what a big hammer you have!
     argv = CLOBBER_USER_PROCESSES_ARGV + [ pw.pw_name ]
     dprint ("Clobbering existing processes running as user '%s': %s", pw.pw_name, argv)
-    util.uninterruptible_spawnv (os.P_WAIT, argv[0], argv)
+    subprocess.call (argv)
 
 def find_free_display ():
     def is_display_free (display_number):
diff --git a/lib/usermod.py b/lib/usermod.py
index 29f99c7..de043bb 100755
--- a/lib/usermod.py
+++ b/lib/usermod.py
@@ -20,7 +20,7 @@ import os
 import os.path
 import tempfile
 import shutil
-import util
+import subprocess
 from config import *
 import debuglog
 
@@ -30,7 +30,7 @@ def dprint (fmt, *args):
 def set_shell (username, shell):
     argv = USERMOD_ARGV + [ "-s", shell, username ]
     dprint ("Executing %s" % argv)
-    util.uninterruptible_spawnv (os.P_WAIT, argv[0], argv)
+    subprocess.call (argv)
 
 #
 # FIXME:
@@ -41,7 +41,7 @@ def set_shell (username, shell):
 def set_homedir (username, homedir):
     argv = USERMOD_ARGV + [ "-d", homedir, username ]
     dprint ("Executing %s" % argv)
-    util.uninterruptible_spawnv (os.P_WAIT, argv[0], argv)
+    subprocess.call (argv)
 
 def create_temporary_homedir (uid, gid):
     temp_homedir = tempfile.mkdtemp (prefix = "sabayon-temp-home-")
diff --git a/lib/util.py b/lib/util.py
index 5aa8bff..a6c3502 100755
--- a/lib/util.py
+++ b/lib/util.py
@@ -173,25 +173,6 @@ def split_path(path, head=None, tail=None):
 
     raise ValueError
 
-#
-# os.spawn() doesn't handle EINTR from waitpid() on Linux:
-#  http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=686667
-# Best we can do is ignore the exception and carry on
-# See bug #303034
-#
-def uninterruptible_spawnve (mode, file, args, env):
-    try:
-        if env is None:
-            os.spawnv (mode, file, args)
-        else:
-            os.spawnve (mode, file, args, env)
-    except os.error, (err, errstr):
-        if err != errno.EINTR:
-            raise
-
-def uninterruptible_spawnv (mode, file, args):
-    uninterruptible_spawnve (mode, file, args, None)
-
 def run_unit_tests ():
     home_dir = get_home_dir ()
     assert home_dir != ""



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