Bug 6167 - ZeroDivisionError with debugrevlog
Summary: ZeroDivisionError with debugrevlog
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: stable branch
Hardware: PC Linux
: wish feature
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-01 20:51 UTC by Mike Hommey
Modified: 2019-07-16 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 Mike Hommey 2019-07-01 20:51 UTC
STR:
- hg clone --stream https://hg.mozilla.org/mozilla-unified
- cd mozilla-unified
- hg debugrevlog testing/mozmill/virtualenv/virtualenv_support/__init__.py
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.15+ (default, Nov 27 2018, 23:36:35) [GCC 7.3.0]
** Mercurial Distributed SCM (version 5.0.1)
** Extensions loaded: 
Traceback (most recent call last):
  File "/usr/local/bin/hg", line 43, in <module>
    dispatch.run()
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 99, in run
    status = dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 225, in dispatch
    ret = _runcatch(req) or 0
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 376, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 384, in _callcatch
    return scmutil.callcatch(ui, func)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/scmutil.py", line 167, in callcatch
    return func()
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 367, in _runcatchfunc
    return _dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 1021, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 756, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 1030, in _runcommand
    return cmdfunc()
  File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 1018, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/util.py", line 1680, in check
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/debugcommands.py", line 2277, in debugrevlog
    fullsize[2] /= numfull
ZeroDivisionError: integer division or modulo by zero

Presumably, this is happening because the file was empty when it existed.
Comment 1 Pierre-Yves David 2019-07-02 04:57 UTC
I can repro
Comment 2 HG Bot 2019-07-08 14:10 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/30033d56758f
Pierre-Yves David <pierre-yves.david@octobus.net>
debugrevlog: fix average size computation for empty data (issue6167)

If the file has no full snapshot (eg: was always empty), `hg debugrevlog` would
fails when trying to compute their average size.

(please test the fix)
Comment 3 Bugzilla 2019-07-16 00:00 UTC
Bug was set to TESTING for 7 days, resolving