[Bug 5115] New: "ValueError: 20-byte hash required" inside histedit
mercurial-bugs at selenic.com
mercurial-bugs at selenic.com
Thu Feb 25 12:29:11 UTC 2016
https://bz.mercurial-scm.org/show_bug.cgi?id=5115
Bug ID: 5115
Summary: "ValueError: 20-byte hash required" inside histedit
Product: Mercurial
Version: default branch
Hardware: PC
OS: Linux
Status: UNCONFIRMED
Severity: feature
Priority: wish
Component: histedit
Assignee: bugzilla at selenic.com
Reporter: david at drmaciver.com
CC: mercurial-devel at selenic.com
I've managed to get histedit into a very confused state through a series of
stupid actions on my part which I can't easily reproduce. My *assumption* is
that what's going on is that histedit is insufficiently paranoid about
validating the data it finds on disk for corruption.
As a result, this is a slightly useless infodump bug. I apologise for that.
Consider this a "there is something funny going on in this area that an
interested party might feel inclined to check out" bug report and feel free to
close it as unreproducible if that's not a thing you want.
My repo is now in a state where running histedit --continue produces the
following result:
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.10 (default, Jun 28 2015, 17:39:56) [GCC 4.9.2]
** Mercurial Distributed SCM (version 3.7.1+44-9b58a734661a)
** Extensions loaded: pager, color, purge, patchbomb, record, rebase, shelve,
histedit, strip, mq
Traceback (most recent call last):
File "../hg", line 43, in <module>
mercurial.dispatch.run()
File "/home/david/projects/hg/mercurial/dispatch.py", line 54, in run
sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
File "/home/david/projects/hg/mercurial/dispatch.py", line 120, in dispatch
ret = _runcatch(req)
File "/home/david/projects/hg/mercurial/dispatch.py", line 191, in _runcatch
return _dispatch(req)
File "/home/david/projects/hg/mercurial/dispatch.py", line 924, in _dispatch
cmdpats, cmdoptions)
File "/home/david/projects/hg/mercurial/dispatch.py", line 681, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/david/projects/hg/mercurial/extensions.py", line 195, in closure
return func(*(args + a), **kw)
File "/home/david/projects/hg/hgext/color.py", line 518, in colorcmd
return orig(ui_, opts, cmd, cmdfunc)
File "/home/david/projects/hg/mercurial/extensions.py", line 195, in closure
return func(*(args + a), **kw)
File "/home/david/projects/hg/hgext/pager.py", line 143, in pagecmd
return orig(ui, options, cmd, cmdfunc)
File "/home/david/projects/hg/mercurial/dispatch.py", line 1055, in
_runcommand
return checkargs()
File "/home/david/projects/hg/mercurial/dispatch.py", line 1015, in checkargs
return cmdfunc()
File "/home/david/projects/hg/mercurial/dispatch.py", line 921, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/home/david/projects/hg/mercurial/util.py", line 991, in check
return func(*args, **kwargs)
File "/home/david/projects/hg/mercurial/extensions.py", line 195, in closure
return func(*(args + a), **kw)
File "/home/david/projects/hg/mercurial/util.py", line 991, in check
return func(*args, **kwargs)
File "/home/david/projects/hg/hgext/mq.py", line 3516, in mqcommand
return orig(ui, repo, *args, **kwargs)
File "/home/david/projects/hg/mercurial/util.py", line 991, in check
return func(*args, **kwargs)
File "/home/david/projects/hg/hgext/histedit.py", line 981, in histedit
_histedit(ui, repo, state, *freeargs, **opts)
File "/home/david/projects/hg/hgext/histedit.py", line 1217, in _histedit
cleanupnode(ui, repo, 'replaced', mapping)
File "/home/david/projects/hg/hgext/histedit.py", line 1489, in cleanupnode
nodes = sorted(n for n in nodes if n in nm)
File "/home/david/projects/hg/hgext/histedit.py", line 1489, in <genexpr>
nodes = sorted(n for n in nodes if n in nm)
ValueError: 20-byte hash required
Unfortunately I've really very little idea how, as it involved a sequence of
operations that worked approximately as follows:
a) Start histedit in a very old version of Mercurial (3.1.2)
b) Attempt to continue histedit in my local version of Mercurial but
accidentally be running Python 3.
c) Switch to Python 2 and proceed to see histedit get very confused.
d) Attempt to go back to the old version of Mercurial and get a PickleError
d) Try again with the new version and have it work but give conflicts.
e) Resolve conflict and attempt to continue.
Here is the error message I saw at stage c (attempt to rerun in 2.7.10):
$ ./hg histedit --continue
6847cd559c93: empty changeset
abort: unknown revision ']��(�}'!
Here is the error I saw when I switched to my old version of Mercurial in step
d:
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.9 (default, Apr 2 2015, 15:33:21) [GCC 4.9.2]
** Mercurial Distributed SCM (version 3.1.2)
** Extensions loaded: pager, color, purge, patchbomb, record, rebase, shelve,
histedit, strip, mq
Traceback (most recent call last):
File "/usr/bin/hg", line 43, in <module>
mercurial.dispatch.run()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 28, in
run
sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 69, in
dispatch
ret = _runcatch(req)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 138, in
_runcatch
return _dispatch(req)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 839, in
_dispatch
cmdpats, cmdoptions)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 600, in
runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 196, in
wrap
return wrapper(origfn, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/hgext/color.py", line 433, in colorcmd
return orig(ui_, opts, cmd, cmdfunc)
File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 196, in
wrap
return wrapper(origfn, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/hgext/pager.py", line 158, in pagecmd
return orig(ui, options, cmd, cmdfunc)
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 930, in
_runcommand
return checkargs()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 901, in
checkargs
return cmdfunc()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 836, in
<lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 550, in check
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 151, in
wrap
util.checksignature(origfn), *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 550, in check
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/hgext/mq.py", line 3391, in mqcommand
return orig(ui, repo, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 550, in check
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/hgext/histedit.py", line 488, in
histedit
_histedit(ui, repo, *freeargs, **opts)
File "/usr/lib/python2.7/dist-packages/hgext/histedit.py", line 535, in
_histedit
(parentctxnode, rules, keep, topmost, replacements) = readstate(repo)
File "/usr/lib/python2.7/dist-packages/hgext/histedit.py", line 751, in
readstate
return pickle.load(fp)
cPickle.UnpicklingError: invalid load key, 'v'.
(I am aware that 3.1.2 is very old and do not expect you to do anything about
this second stack trace. I only include it for completeness of information).
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list