1. Bitbucket
  2. Public Issue Tracker
  3. master
  4. Issues


Issue #631 resolved

Exception in changegroup.oberon when using hooks

Ville Säävuori
created an issue

I'm testing issues service and POST webhook with my repo. If one of those is enabled, every push ends up with following error message:

{{{ ... remote: bb/acl: Uninen is allowed. accepted payload. remote: error: changegroup.oberon hook raised an exception: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128) }}}

Comments (11)

  1. Chris Rebert

    Not a BB dev, but as a Python programmer, I can say that that exception means some encoded Unicode (bytes) with chars outside ASCII is being concatencated with a Unicode string, and thus the implicit attempt to decode the bytes back into Unicode using ASCII fails.

    So, somewhere bytes (str) and Unicode (unicode) are being mixed without explicit conversion, which is a big no-no.

  2. Jesper Noehr
    • changed status to open

    Chris is right. Some of the data you pushed must've not been ASCII, but it's hard to tell where the conversion went wrong.

    Do you have any idea whether it's from the POST handler or the issues broker?

  3. Ville Säävuori reporter

    The repo, being a test one, had only one file: readme.rst. It was an UTF-8 formatted (as are all my files in every project) text file with just "hello world" inside (no non-ascii characters).

    Both POST handler and issues broker broke when trying to use them. I tested them separately and together -- same result every time on hg push.

    In an unrelated note, the POST handler is totally undocumented, btw...

  4. Ville Säävuori reporter

    I created new testrepo at: http://bitbucket.org/Uninen/testrepo/ and added issues broker to services. I cloned it, added readme, and pushed. Attached is the whole bash transcript (and same error message). Again, no unicode characters anywhere.

    I'm using Mac OS X 10.5 and Mercurial 1.2.1

    Trinity:hg uninen$ hg clone ssh://hg@bitbucket.org/Uninen/testrepo/ bitbuckettest
    no changes found
    updating working directory
    0 files updated, 0 files merged, 0 files removed, 0 files unresolved
    Trinity:hg uninen$ cd bitbuckettest/
    Trinity:bitbuckettest uninen$ mate .
    Trinity:bitbuckettest uninen$ hg status
    ? readme.rst
    Trinity:bitbuckettest uninen$ hg add
    adding readme.rst
    Trinity:bitbuckettest uninen$ hg commit -m "Added readme"
    Trinity:bitbuckettest uninen$ hg push
    pushing to ssh://hg@bitbucket.org/Uninen/testrepo/
    searching for changes
    remote: adding changesets
    remote: adding manifests
    remote: adding file changes
    remote: added 1 changesets with 1 changes to 1 files
    remote: bb/acl: Uninen is allowed. accepted payload.
    remote: error: changegroup.oberon hook raised an exception: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
    remote: quota: 4.9 MB in use, 150.0 MB available (3.30% used)
    Trinity:bitbuckettest uninen$ 
  5. Jesper Noehr

    Whether it's UTF-8 or not doesn't matter much, since 1) hg doesn't store the encoding (although your editor might have inserted a BOM), and 2) the issues broker does not look at the file, only the commit message.

    I think what's really going on is your real name having strange finnish characters in it.

  6. Ville Säävuori reporter

    Jesper, you're propebly right -- it must be the funky Finnish characters (well, not really Finnish, but anyway) in my name.

    If the hooks only look at the commit message, this should be easy to fix. If you're still on Django, wrapping possibly problematic strings with django.utils.encoding.force_unicode (or smart_str) should help :)

  7. Tarek Ziadé

    Yes, that's because of my name (Ziadé). If I remove the 'é' in my hgrc, things work fine.

    I could use "tarek" to get my commits linked to my account, but the other problem is that I need to use my real name for other mercurial platform, and I dunno if its related but commit done with "Tarek Ziadé" will not hook to my account.

  8. Log in to comment