Bug 5988 - Exception on searching for `wdir()`
Summary: Exception on searching for `wdir()`
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: hgweb (show other bugs)
Version: default branch
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-22 11:15 UTC by Kim "Zash" Alvefur
Modified: 2018-10-03 00:00 UTC (History)
2 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 Kim "Zash" Alvefur 2018-09-22 11:15 UTC
Run `hg serve`
Enter into the hgweb search box "wdir()"

Observe traceback like this:

::1 - - [22/Sep/2018 17:13:32] Exception happened during processing request '/log?rev=wdir%28%29':
Traceback (most recent call last):
  File "/home/zash/src/hg/mercurial/hgweb/server.py", line 102, in do_POST
    self.do_write()
  File "/home/zash/src/hg/mercurial/hgweb/server.py", line 95, in do_write
    self.do_hgweb()
  File "/home/zash/src/hg/mercurial/hgweb/server.py", line 187, in do_hgweb
    for chunk in self.server.application(env, self._start_response):
  File "/home/zash/src/hg/mercurial/hgweb/hgweb_mod.py", line 307, in run_wsgi
    for r in self._runwsgi(req, res, repo):
  File "/home/zash/src/hg/mercurial/hgweb/request.py", line 542, in sendresponse
    for chunk in self._bodygen:
  File "/home/zash/src/hg/mercurial/util.py", line 1554, in increasingchunks
    for chunk in source:
  File "/home/zash/src/hg/mercurial/templateutil.py", line 695, in flatten
    for j in flatten(context, mapping, i):
  File "/home/zash/src/hg/mercurial/templateutil.py", line 685, in flatten
    for i in thing:
  File "/home/zash/src/hg/mercurial/templateutil.py", line 958, in joinitems
    for x in itemiter:
  File "/home/zash/src/hg/mercurial/templateutil.py", line 916, in _applymap
    for lm in _iteroverlaymaps(context, mapping, diter):
  File "/home/zash/src/hg/mercurial/templateutil.py", line 902, in _iteroverlaymaps
    for i, nm in enumerate(newmappings):
  File "/home/zash/src/hg/mercurial/hgweb/webcommands.py", line 301, in changelist
    lm = webutil.commonentry(web.repo, ctx)
  File "/home/zash/src/hg/mercurial/hgweb/webutil.py", line 426, in commonentry
    'node': hex(node),
TypeError: b2a_hex() argument 1 must be string or buffer, not None
Comment 1 HG Bot 2018-09-25 12:05 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/4f44f747f094
Yuya Nishihara <yuya@tcha.org>
hgweb: use scmutil.binnode() to translate None to wdir hash (issue5988)

I left some of ctx.node() calls unchanged as they seemed unlikely to be
workingctx, or passed to diff functions where None is the default value.

Note that a None revision can also cause a similar problem, but I'm not sure
if we can simply bulk-replace ctx.rev() with scmutil.intrev(ctx) as there's
large hole between tip revision and wdir revision. If such pair were passed
in to xrange() for example, we would waste CPU time.

(please test the fix)
Comment 2 Bugzilla 2018-10-03 00:00 UTC
Bug was set to TESTING for 7 days, resolving