[Piuparts-devel] Bug#538273: Bug#538273: Piuparts fails when PATH environment variable doesn't include /usr/sbin/

Ignace Mouzannar mouzannar at gmail.com
Fri Jul 24 15:58:18 UTC 2009

> Yeah. However, piuparts really needs to be run as root, and if you are
> root but your PATH doesn't contain those directories, something's wrong.
> Can you confirm that you're not running as root?

I confirm that I was running piuparts as non root.

Even if we consider that a user with root privileges has by default
/usr/sbin/ in his path, the issue of the Python traceback remains.

You could possibly add a UID test in the __main__ function [1] ?

 Ignace M

--- piuparts-0.35.orig/piuparts.py      2009-07-24 15:30:30.000000000 +0200
+++ piuparts-0.35/piuparts.py   2009-07-24 17:52:52.000000000 +0200
@@ -1933,6 +1933,11 @@

 if __name__ == "__main__":
+    # check if user has root privileges
+    if os.getuid():
+        print "You need to be root to use this command."
+        sys.exit(0)
     if sys.argv[1:] == ["unittest"]:
         del sys.argv[1]

More information about the Piuparts-devel mailing list