]> arthur.barton.de Git - bup.git/commitdiff
Report unknown root status if getwindowsversion > 5
authorRob Browning <rlb@defaultvalue.org>
Sat, 10 Sep 2016 17:52:59 +0000 (12:52 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 10 Sep 2016 17:56:25 +0000 (12:56 -0500)
Apparently the situation is much more complicated in newer versions, so
until someone more knowledgable can help, don't try to determine
superuser status there.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/helpers.py
t/root-status

index 385647ec1b8f1d90e2b5ccba7f69c38626a4e55e..394e7a6067d07a663005d7d65abd578bde96e2ba 100644 (file)
@@ -284,8 +284,16 @@ def detect_fakeroot():
     return os.getenv("FAKEROOTKEY") != None
 
 
+_warned_about_superuser_detection = None
 def is_superuser():
     if sys.platform.startswith('cygwin'):
+        if sys.getwindowsversion()[0] > 5:
+            # Sounds like situation is much more complicated here
+            global _warned_about_superuser_detection
+            if not _warned_about_superuser_detection:
+                log("can't detect root status for OS version > 5; assuming not root")
+                _warned_about_superuser_detection = True
+            return False
         import ctypes
         return ctypes.cdll.shell32.IsUserAnAdmin()
     else:
index 5024ed3afb29b1976c5dfc4635542895adf34ccf..4f21599f83aaacb98c83b8ccbb1d0b9989d2d0fb 100755 (executable)
@@ -5,9 +5,15 @@ exec "$bup_python" "$0" ${1+"$@"}
 """
 # end of bup preamble
 
+from sys import stderr
 import sys
 
+
 if sys.platform.startswith('cygwin'):
+    if sys.getwindowsversion()[0] > 5:
+        # Sounds like the situation is much more complicated here
+        print >> stderr, "can't detect root status for OS version > 5; assuming not root"
+        print 'none'
     import ctypes
     if ctypes.cdll.shell32.IsUserAnAdmin():
         print 'root'