#2417 closed defect (fixed)

HOMEDRIVE and HOMEPATH environment variables may not be set on Windows 7+

Reported by: daira Owned by: daira
Priority: major Milestone: 1.10.1
Component: code Version: 1.10.0
Keywords: windows regression blocks-release Cc:
Launchpad Bug:

Description

The windows_expanduser function in src/allmydata/util/fileutil.py assumes that the current user account's home directory can be found by joining the %HOMEDRIVE% and %HOMEPATH% environment variables. This was correct on Windows XP, but on Windows 7+ (not sure about Vista), these variables are not set, resulting in this traceback:

Traceback (most recent call last):
  File "C:\Users\Buildslave\tahoe\Daira_Win7-64_py2_7\build\support\Scripts\tahoe.pyscript", line 16, in <module>
    load_entry_point('allmydata-tahoe==1.10.0.post340', 'console_scripts', 'tahoe')()
  File "C:\Users\Buildslave\tahoe\Daira_Win7-64_py2_7\build\support\Lib\site-packages\setuptools-0.6c16dev6.egg\pkg_resources.py", line 320, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Users\Buildslave\tahoe\Daira_Win7-64_py2_7\build\support\Lib\site-packages\setuptools-0.6c16dev6.egg\pkg_resources.py", line 2265, in load_entry_point
    return ep.load()
  File "C:\Users\Buildslave\tahoe\Daira_Win7-64_py2_7\build\support\Lib\site-packages\setuptools-0.6c16dev6.egg\pkg_resources.py", line 1998, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "c:\users\buildslave\tahoe\daira_win7-64_py2_7\build\src\allmydata\scripts\runner.py", line 7, in <module>
    from allmydata.scripts.common import get_default_nodedir
  File "c:\users\buildslave\tahoe\daira_win7-64_py2_7\build\src\allmydata\scripts\common.py", line 20, in <module>
    path = abspath_expanduser_unicode(u"~/.tahoe")
  File "c:\users\buildslave\tahoe\daira_win7-64_py2_7\build\src\allmydata\util\fileutil.py", line 318, in abspath_expanduser_unicode
    path = expanduser(path)
  File "c:\users\buildslave\tahoe\daira_win7-64_py2_7\build\src\allmydata\util\fileutil.py", line 392, in expanduser
    return windows_expanduser(path)
  File "c:\users\buildslave\tahoe\daira_win7-64_py2_7\build\src\allmydata\util\fileutil.py", line 399, in windows_expanduser
    home_drive = windows_getenv(u'HOMEDRIVE')
  File "c:\users\buildslave\tahoe\daira_win7-64_py2_7\build\src\allmydata\util\fileutil.py", line 419, in windows_getenv
    % (err, name))
OSError: Windows error 203 attempting to read size of environment variable u'HOMEDRIVE'

https://tahoe-lafs.org/buildbot-tahoe-lafs/builders/Daira%20Win7-64%20py2.7/builds/17/steps/test-already-have-dep/logs/stdio

(Windows error 203 is ERROR_ENVVAR_NOT_FOUND.)

This is a regression since 1.10.0, therefore a release blocker. The correct behaviour is to use %USERPROFILE% instead.

Change History (2)

comment:1 Changed at 2015-05-09T23:48:33Z by daira

  • Status changed from new to assigned

comment:2 Changed at 2015-05-13T13:43:32Z by Daira Hopwood <daira@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 4794666df619fbfd7d36620163b51bda31322773/trunk:

On Windows, the user's home directory may be either %USERPROFILE% or %HOMEDRIVE%%HOMEPATH% depending on the Windows version. fixes ticket:2417

Signed-off-by: Daira Hopwood <daira@…>

Note: See TracTickets for help on using tickets.