TypeError: coercing to Unicode: need string or buffer, NoneType found

Bug #831313 reported by Angel Guzman Maeso
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mercurial (Ubuntu)
Fix Released
Low
Unassigned
Oneiric
Fix Released
Low
Unassigned

Bug Description

I get this error making a transplant.

My source repository is "be" and I want transplant a revision. I can't provide info about the code, because is closed source, sorry.

$ hg --version
Mercurial Distributed SCM (version 1.9.1)

This is the backtrace:
$ hg transplant -s be '31b797c78bc8'
searching for changes
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) [GCC 4.5.2]
** Mercurial Distributed SCM (version 1.9.1)
** Extensions loaded: shelve, prompt, reviewboard, branchtools, fetch, histedit, graphlog, color, purge, mq, transplant, rebase, record, inotify
Traceback (most recent call last):
  File "/usr/bin/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 27, in run
    sys.exit(dispatch(request(sys.argv[1:])))
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 64, in dispatch
    return _runcatch(req)
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 87, in _runcatch
    return _dispatch(req)
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 679, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 454, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/pymodules/python2.7/mercurial/extensions.py", line 182, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/hgext/color.py", line 368, in colorcmd
    return orig(ui_, opts, cmd, cmdfunc)
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 733, in _runcommand
    return checkargs()
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 687, in checkargs
    return cmdfunc()
  File "/usr/lib/pymodules/python2.7/mercurial/dispatch.py", line 676, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/pymodules/python2.7/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/mercurial/extensions.py", line 137, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/hgext/mq.py", line 3218, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/hgext/transplant.py", line 568, in transplant
    onlyheads=branches, force=True)
  File "/usr/lib/pymodules/python2.7/mercurial/bundlerepo.py", line 318, in getremotechanges
    os.unlink(bundlename)
TypeError: coercing to Unicode: need string or buffer, NoneType found

description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mercurial (Ubuntu):
status: New → Confirmed
Revision history for this message
BoomSie (gideon-poort) wrote :

Experience EXACTLY the same as Angel Guzman Maeso.

Upgraded to 11.10 today, so I guess this issue sneaked into my system like that.

I've attached my log/proof to the post.

Revision history for this message
BoomSie (gideon-poort) wrote :

As a quick and dirty solution I've changed line 318 of /usr/lib/pymodules/python2.7/mercurial/bundlerepo.py

- if not incoming:
+ if not incoming and bundlename:

basicly checks if bundlename is not empty

I had to do a transplant fast and this solved the issue for the time being.

Revision history for this message
Stefano Rivera (stefanor) wrote :

That's odd, you shouldn't have a mercurial directory inside /usr/lib/pymodules/python2.7.

The directory in the traceback should have been /usr/lib/python2.7/dist-packages/mercurial

This changed in the most recent upload of mercurial, 1.9.1-1.

Are you completely up to date? What version of mercurial do you have installed? (dpkg -l mercurial)

Changed in mercurial (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
BoomSie (gideon-poort) wrote :

@Stefano Rivera:

My bad, my sample was in direct reply to the bug creator. I have tested them both (mercurial PPA repo & default Ubuntu oneiric).

My solution sample was meant for the 1.9.1-1-PPA2 version. However, it is also very much applicable for the default repository of ubuntu oneiric. (in the path you described, mercurial-1.9.1-1)

Revision history for this message
Stefano Rivera (stefanor) wrote :

Ubuntu bugs are for bugs in the main repository, not PPAs. I can't verify this bug in the main repository (I transplanted a revision, and it worked fine).

This does sound like an upstream bug, so I'd report it there. If we can find a way to reproduce it, and a patch that can be applied to the version in Ubuntu, then we can definitely do that.

Until we have a test case that can reproduce it on Ubuntu, this bug is Incomplete or Invalid.

Revision history for this message
BoomSie (gideon-poort) wrote :

Dear Stefano,

First of all, the earlier mentioned line where I change the if statement, should be line 316, not 318. At 318 the command line spits out the error, since 'bundlename' is empty.

I've made a storyboard/walkthrough in console to reproduce this. All information should be there, maybe you could reproduce it like this as well. I think the bugreporter & me only encounter this problem, when we try to do a local transplant. (as source)

Quick index of what I do:
- dpkg -l | grep mercurial
  List the mercurial packages, which are not installed

- apt-cache showpkg mercurial mercurial-common
  List mercurial packages available + origin & MD5. In advance, the come from oneiric universe, 1.9.1-1

- apt-get install mercurial mercurial-common
  Install mercurial

- dpkg -l|grep mercurial
  Show current install (status)

- mkdir tmp && cd tmp && hg clone ../Sources/Project && cd Project
  Create tmp folder, and clone another locally available repository, change dir to cloned repository

- sed -n '316p' /usr/lib/python2.7/dist-packages/mercurial/bundlerepo.py
  print the line of if statement

- hg transplant -s ../../Sources/Project 6cb94353bc49
  Transplant a change and show bundlerepo.py error

- sudo vim /usr/lib/python2.7/dist-packages/mercurial/bundlerepo.py
  Edit bundlerepo & edit line 316 where I add the earlier mentioned 'and bundlename'

- sed -n '316p' /usr/lib/python2.7/dist-packages/mercurial/bundlerepo.py
  Double check

- hg transplant -s ../../Sources/Project 6cb94353bc49
  Transplant that went pretty fine. Though I have merge conflicts, the mercurial transplant itself behaved like it should.

Hope this narrowed down the report and makes it easier to confirm & fix.

Cheers,

Gideon

Revision history for this message
Stefano Rivera (stefanor) wrote :

Thanks for a very detailed report, but it doesn't point me at the mercurial repository that is broken.

However, I can see how this was fixed upstream in 1.9.3. http://selenic.com/hg/rev/106f89299da6

Revision history for this message
Stefano Rivera (stefanor) wrote :
Revision history for this message
Stefano Rivera (stefanor) wrote :

I've synced 1.9.3-1 from Debian, to fix this for precise, and uploaded the attached debdiff for oneiric, pending SRU team review.

Changed in mercurial (Ubuntu):
status: Incomplete → Confirmed
importance: Undecided → Low
Changed in mercurial (Ubuntu Oneiric):
status: New → Confirmed
importance: Undecided → Low
Changed in mercurial (Ubuntu):
status: Confirmed → Fix Released
Changed in mercurial (Ubuntu Oneiric):
status: Confirmed → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello Angel, or anyone else affected,

Accepted mercurial into oneiric-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
BoomSie (gideon-poort) wrote :

Hi Martin,

I've tested the proposed patch. However, don't know how to 'confirm' this fix. So I did the same walk through as in the previous comment, and I've attached the log + screenshot of synaptic, to proof I've used the proposed repository including the changelog stating this bug.

Test passed, this micro-patch solves the issue!

Thank you all

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for testing!

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mercurial - 1.9.1-1ubuntu0.1

---------------
mercurial (1.9.1-1ubuntu0.1) oneiric-proposed; urgency=low

  * Apply upstream patch to bundlerepo, to check the bundlename argument
    before unlinking it. (LP: #831313)
 -- Stefano Rivera <email address hidden> Mon, 17 Oct 2011 23:22:42 +0200

Changed in mercurial (Ubuntu Oneiric):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.