Merge lp:~brian.curtin/ubuntuone-client/fix984407-windows-is_root into lp:ubuntuone-client

Proposed by Brian Curtin on 2012-05-07
Status: Merged
Approved by: Brian Curtin on 2012-05-11
Approved revision: 1243
Merged at revision: 1242
Proposed branch: lp:~brian.curtin/ubuntuone-client/fix984407-windows-is_root
Merge into: lp:ubuntuone-client
Diff against target: 64 lines (+7/-20)
2 files modified
tests/platform/os_helper/test_windows.py (+2/-12)
ubuntuone/platform/os_helper/windows.py (+5/-8)
To merge this branch: bzr merge lp:~brian.curtin/ubuntuone-client/fix984407-windows-is_root
Reviewer Review Type Date Requested Status
Roberto Alsina (community) 2012-05-07 Approve on 2012-05-08
Review via email: mp+104967@code.launchpad.net

Commit Message

- No longer check whether or not we are actually running as administrator on Windows

Description of the Change

Fix #984407 and an issue with test builds on Jenkins. Being too smart and selective with the is_root call has caused problems for a while, and it's not overly useful for it to be accurate anyway.

To post a comment you must log in.
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (24.9 KiB)

The attempt to merge lp:~brian.curtin/ubuntuone-client/fix984407-windows-is_root into lp:ubuntuone-client failed. Below is the output from the failed tests.

/usr/bin/gnome-autogen.sh
checking for autoconf >= 2.53...
  testing autoconf2.50... not found.
  testing autoconf... found 2.68
checking for automake >= 1.10...
  testing automake-1.11... found 1.11.3
checking for libtool >= 1.5...
  testing libtoolize... found 2.4.2
checking for intltool >= 0.30...
  testing intltoolize... found 0.50.2
checking for pkg-config >= 0.14.0...
  testing pkg-config... found 0.26
checking for gtk-doc >= 1.0...
  testing gtkdocize... found 1.18
Checking for required M4 macros...
Checking for forbidden M4 macros...
Processing ./configure.ac
Running libtoolize...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Running intltoolize...
Running gtkdocize...
Running aclocal-1.11...
Running autoconf...
Running autoheader...
Running automake-1.11...
Running ./configure --enable-gtk-doc --enable-debug ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
...

1243. By Brian Curtin on 2012-05-11

Remove unused imports

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/os_helper/test_windows.py'
2--- tests/platform/os_helper/test_windows.py 2012-04-27 20:38:13 +0000
3+++ tests/platform/os_helper/test_windows.py 2012-05-11 17:23:17 +0000
4@@ -32,7 +32,6 @@
5 import os
6 import shutil
7 import sys
8-import platform
9
10 from twisted.internet import defer
11 from twisted.trial.unittest import TestCase
12@@ -482,19 +481,10 @@
13
14
15 class TestIsRoot(TestCase):
16-
17 """Tests for the is_root function."""
18
19- def test_isanadmin_called(self):
20- """Test that shell.IsUserAnAdmin is called."""
21- expected = object()
22- self.patch(os_helper.shell, 'IsUserAnAdmin', lambda: expected)
23- actual = os_helper.is_root()
24- self.assertEqual(expected, actual)
25-
26- def test_is_root_on_xp(self):
27- """Test that os_helper.is_root always returns False on XP"""
28+ def test_is_root(self):
29+ """Test that os_helper.is_root always returns False"""
30 expected = False
31- self.patch(platform, "version", "5.1.2600")
32 actual = os_helper.is_root()
33 self.assertEqual(expected, actual)
34
35=== modified file 'ubuntuone/platform/os_helper/windows.py'
36--- ubuntuone/platform/os_helper/windows.py 2012-04-27 20:38:13 +0000
37+++ ubuntuone/platform/os_helper/windows.py 2012-05-11 17:23:17 +0000
38@@ -35,7 +35,6 @@
39 import stat
40 import sys
41
42-from platform import version
43 from contextlib import contextmanager
44 from functools import wraps
45
46@@ -885,13 +884,11 @@
47
48 def is_root():
49 """Return if the user is running as root."""
50- # On Windows XP (v5.1), always return False. Nearly all users run with
51- # Administrator access, so this would restrict too many users.
52- # On Vista (v6.0) and 7 (v6.1), return the real Administrator value.
53- # The MSDN docs say this may go away in a later version, but look at what
54- # the alternative is: http://bit.ly/rXbIwc
55- is_xp = version()[0] == "5"
56- return False if is_xp else shell.IsUserAnAdmin()
57+ # Always return False. Trying to be smart about OS versions and
58+ # only calling Windows APIs under certain conditions has still
59+ # proven not to work in some cases. Overall it should not matter
60+ # if we know whether we are Administrator or not on Windows.
61+ return False
62
63
64 @windowspath()

Subscribers

People subscribed via source and target branches