Bug 3088 - Mecurial 2.0 largefiles requires HOME environment variable in the server
Summary: Mecurial 2.0 largefiles requires HOME environment variable in the server
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-07 06:30 UTC by Jesús Cea Avión
Modified: 2012-05-13 04:59 UTC (History)
8 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesús Cea Avión 2011-11-07 06:30 UTC
Using the CGI and largefiles in the server, current code requires that
Apache sets the HOME environment variable.

HOME existence can't be garanteed.

Traceback:

"""
AttributeError: 'NoneType' object has no attribute 'endswith'
Traceback (most recent call last):
  File "/datos/sources/hg/cgi-bin.jcea/hgwebdir.cgi", line 67, in <module>
    wsgicgi.launch(application)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/wsgicgi.py",
line 76, in launch
    content = application(environ, start_response)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/hgwebdir_mod.py",
line 147, in __call__
    return self.run_wsgi(req)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/hgwebdir_mod.py",
line 205, in run_wsgi
    return hgweb(repo).run_wsgi(req)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/hgweb_mod.py",
line 127, in run_wsgi
    return protocol.call(self.repo, req, cmd)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/protocol.py",
line 76, in call
    rsp = wireproto.dispatch(repo, p, cmd)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/wireproto.py",
line 344, in dispatch
    return func(repo, proto, *args)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/proto.py",
line 66, in statlfile
    filename = lfutil.findfile(repo, sha)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/lfutil.py",
line 111, in findfile
    elif inusercache(repo.ui, hash):
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/lfutil.py",
line 106, in inusercache
    return os.path.exists(usercachepath(ui, hash))
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/lfutil.py",
line 100, in usercachepath
    path = os.path.join(os.getenv('HOME'), '.cache', longname, hash)
  File "/usr/local/lib/python2.7/posixpath.py", line 68, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
Traceback (most recent call last):
  File "/datos/sources/hg/cgi-bin.jcea/hgwebdir.cgi", line 67, in <module>
    wsgicgi.launch(application)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/wsgicgi.py",
line 76, in launch
    content = application(environ, start_response)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/hgwebdir_mod.py",
line 147, in __call__
    return self.run_wsgi(req)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/hgwebdir_mod.py",
line 205, in run_wsgi
    return hgweb(repo).run_wsgi(req)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/hgweb_mod.py",
line 127, in run_wsgi
    return protocol.call(self.repo, req, cmd)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/hgweb/protocol.py",
line 76, in call
    rsp = wireproto.dispatch(repo, p, cmd)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/mercurial/wireproto.py",
line 344, in dispatch
    return func(repo, proto, *args)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/proto.py",
line 32, in putlfile
    lfutil.copytostoreabsolute(repo, tmpname, sha)
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/lfutil.py",
line 224, in copytostoreabsolute
    if inusercache(repo.ui, hash):
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/lfutil.py",
line 106, in inusercache
    return os.path.exists(usercachepath(ui, hash))
  File
"/usr/local/lib/python2.7/site-packages/mercurial-2.0-py2.7-solaris-2.10-i86pc.egg/hgext/largefiles/lfutil.py",
line 100, in usercachepath
    path = os.path.join(os.getenv('HOME'), '.cache', longname, hash)
  File "/usr/local/lib/python2.7/posixpath.py", line 68, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'
"""

Mailing list thread:
http://selenic.com/pipermail/mercurial/2011-November/040685.html
Comment 1 Benoît Allard 2011-11-09 02:43 UTC
Note that by setting largefiles.usercache on your server settings, the error
does not occurs, as mercurial will then use the specified path, and will not
try to come up with a user store on its own.

That configuration is not documented though.

(downgrading to bug as there is a workaround)
Comment 2 HG Bot 2011-12-15 17:00 UTC
Fixed by http://selenic.com/repo/hg/rev/971c55ce03b8
Kevin Gessner <kevin@fogcreek.com>
largefiles: don't require a user cache (issue3088) (issue3155)

(please test the fix)
Comment 3 Bugzilla 2012-05-12 09:24 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:24 EDT  ---

This bug was previously known as _bug_ 3088 at http://mercurial.selenic.com/bts/issue3088