Bug#946667: Proposing patch to fix the bug

2019-12-13 Thread DarthDragon
Hi,

I dive into the problem and I thing the attached patch (generated with
quilt) should fix the problems.
I installed it on my mercurial server, and I can't see any problem yet.
I didn't find any test suite to validate I didn't break anything.

BR,
Jeremy
fix: repo.changectx method has been removed from the API
fix: repo.join method has been removed from the API
Index: mercurial-server-1.2/src/mercurialserver/changes.py
===
--- mercurial-server-1.2.orig/src/mercurialserver/changes.py	2011-09-06 12:40:10.0 +0200
+++ mercurial-server-1.2/src/mercurialserver/changes.py	2019-12-13 14:48:13.712436790 +0100
@@ -3,10 +3,10 @@
 """
 
 def changes(repo, node):
-start = repo.changectx(node).rev()
+start = repo[node].rev()
 try:
 end = len(repo.changelog)
 except:
 end = repo.changelog.count()
 for rev in xrange(start, end):
-yield repo.changectx(rev)
+yield repo[repo.changelog.node(rev)]
Index: mercurial-server-1.2/src/mercurialserver/servelog.py
===
--- mercurial-server-1.2.orig/src/mercurialserver/servelog.py	2011-09-06 12:40:10.0 +0200
+++ mercurial-server-1.2/src/mercurialserver/servelog.py	2019-12-13 14:48:13.720436800 +0100
@@ -26,7 +26,7 @@
 else:
 raise mercurial.util.Abort(_('servelog installed as wrong hook type,'
 ' must be changegroup or outgoing but is %s') % hooktype)
-log = open(repo.join("mercurial-server.log"), "a+")
+log = open(os.path.join(repo.path, "mercurial-server.log"), "a+")
 try:
 fcntl.flock(log.fileno(), fcntl.LOCK_EX)
 log.seek(0, os.SEEK_END)


Bug#946667: mercurial-server: can't clone to or push repository to server (object has no attribute 'changectx')

2019-12-13 Thread DarthDragon
Package: mercurial-server
Version: 1.2-2.2
Severity: grave
Justification: renders package unusable

Dear Maintainer,

after upgrading my mercurial server from stretch to buster, I'm not
able to push or clone to this server from a buster client, the command
fails with:

...
remote:   File
"/usr/share/mercurial-server/mercurialserver/changes.py", line 6, in changes
remote: start = repo.changectx(node).rev()
remote: AttributeError:
'derivedrepo:/var/lib/mercurial-server/repos/projec' object has no
attribute 'changectx'
abort: stream ended unexpectedly (got 0 bytes, expected 4)

Only solution found is to disable access hook in
/etc/mercurial-server/remote-hgrc.d/access.rc but since it's removing
all access control security, this is not a real solution (and it also
raises another bug in the logging hook but at least repository is
cloned/pushed).

Clone from or pull are not affected (except for the logging hook bug).

Steps to reproduce:

sudo lxc-create hgserver -t debian --
--package=mercurial-server,openssh-server,sudo,reportbug -r buster
sudo lxc-start hgserver
sudo lxc-attach hgserver
apt update
apt dist-upgrade
cd
ssh-keygen
mkdir -p /etc/mercurial-server/keys/root
cp .ssh/id_rsa.pub /etc/mercurial-server/keys/root
sed -i 's/localhost/localhost hgserver/' /etc/hosts
sudo -u hg /usr/share/mercurial-server/refresh-auth
mkdir project
cd project
hg init
touch spam
hg add spam
hg commit -m 'add spam' -u root
hg clone . ssh://hg@127.0.0.1/project

Error trace:

searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
remote: error: pretxnchangegroup.access hook raised an exception:
'derivedrepo:/var/lib/mercurial-server/repos/projec' object has no
attribute 'changectx'
remote: transaction abort!
remote: rollback completed
remote: ** unknown exception encountered, please report by visiting
remote: ** https://mercurial-scm.org/wiki/BugTracker
remote: ** Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0]
remote: ** Mercurial Distributed SCM (version 4.8.2)
remote: ** Extensions loaded:
remote: Traceback (most recent call last):
remote:   File "/usr/share/mercurial-server/hg-ssh", line 91, in

remote: dispatch.dispatch(request(['-R', repo, 'serve', '--stdio']))
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 220, in
dispatch
remote: ret = _runcatch(req) or 0
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 363, in
_runcatch
remote: return _callcatch(ui, _runcatchfunc)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 371, in
_callcatch
remote: return scmutil.callcatch(ui, func)
remote:   File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py",
line 166, in callcatch
remote: return func()
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 354, in
_runcatchfunc
remote: return _dispatch(req)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 994, in
_dispatch
remote: cmdpats, cmdoptions)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 737, in
runcommand
remote: ret = _runcommand(ui, options, cmd, d)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 1003, in
_runcommand
remote: return cmdfunc()
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 991, in

remote: d = lambda: util.checksignature(func)(ui, *args,
**strcmdopt)
remote:   File "/usr/lib/python2.7/dist-packages/mercurial/util.py",
line 1646, in check
remote: return func(*args, **kwargs)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 5207, in
serve
remote: s.serve_forever()
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 797,
in serve_forever
remote: self.serveuntil(threading.Event())
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 804,
in serveuntil
remote: _runsshserver(self._ui, self._repo, self._fin, self._fout,
ev)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/wireprotoserver.py", line 656,
in _runsshserver
remote: rsp = wireprotov1server.dispatch(repo, proto, request)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/wireprotov1server.py", line 74,
in dispatch
remote: return func(repo, proto, *args)
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/wireprotov1server.py", line
599, in unbundle
remote: proto.client())
remote:   File
"/usr/lib/python2.7/dist-packages/mercurial/exchange.py", line 2377, in
unbundle
remote: op = bundle2.p

Bug#945986: Converting a disk with a backing chain including one resized is stucked in a loop

2019-12-02 Thread DarthDragon
Package: qemu-utils
Version: 1:2.8+dfsg-6+deb9u8
Severity: important

Dear Maintainer,

I tried to consolidate a qcow2 disk with a backing chain to a new qcow2
disk without touching any of the original files.

In this backing chain I have one of the backing file that has been extended
with "qemu-img resize".

To consolidate I use "qemu-img convert" on the top file, but the process
never ends. When running with trace ('-T *') the process looks like stuck
in a loop.

How to reproduce:

  qemu-img create -f qcow2 disk0.qcow2 1G
  qemu-img create -f qcow2 -b disk0.qcow2 disk1.qcow2
  qemu-img resize disk1.qcow2 +1G
  qemu-img create -f qcow2 -b disk1.qcow2 disk2.qcow2
  qemu-img convert -O qcow2 disk2.qcow2 disk-all.qcow2

Converting from the extended disk is working:

  qemu-img convert -O qcow2 disk1.qcow2 disk-all.qcow2

Converting with buster version (1:3.1+dfsg-8+deb10u3) is working.

Thanks.

-- System Information:
Debian Release: 9.8
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages qemu-utils depends on:
ii  libaio1   0.3.110-3
ii  libc6 2.24-11+deb9u4
ii  libgcc1   1:6.3.0-18+deb9u1
ii  libglib2.0-0  2.50.3-2
ii  libgnutls30   3.5.8-5+deb9u4
ii  libnettle63.3-1+b2
ii  zlib1g1:1.2.8.dfsg-5

qemu-utils recommends no packages.

Versions of packages qemu-utils suggests:
ii  debootstrap   1.0.89
pn  qemu-block-extra  

-- no debconf information