Comment 5 for bug 135320

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 135320] bzr merge - exceptions.UnicodeDecodeError

I think the encoding needs to be done earlier in the code that builds
up the dirstate; it's probably incorrect to do it here.

On 4/3/08, Matthias Müller-Reineke
<email address hidden> wrote:
> I've posted a merge request with a patch which seems to solve the bug on
> <email address hidden> .
> Unfortunately there was no reply until now.
>
> The following patch seems to solve the bug.
> Unfortunately I don't understand enough about Bazzaar
> * to write a test which reproduces the bug
> * to write a test of this patch
> Dear Edmundo, do you have a clue?
>
> === modified file 'bzrlib/dirstate.py'
> --- bzrlib/dirstate.py 2007-12-19 08:12:34 +0000
> +++ bzrlib/dirstate.py 2008-02-11 10:41:12 +0000
> @@ -1839,7 +1839,7 @@
> """
> output_lines = [DirState.HEADER_FORMAT_3]
> lines.append('') # a final newline
> - inventory_text = '\0\n\0'.join(lines)
> + inventory_text = '\0\n\0'.join(map(osutils.safe_utf8, lines))
> output_lines.append('crc32: %s\n' % (zlib.crc32(inventory_text),))
> # -3, 1 for num parents, 1 for ghosts, 1 for final newline
> num_entries = len(lines)-3
>
> --
> bzr merge - exceptions.UnicodeDecodeError
> https://bugs.launchpad.net/bugs/135320
> You received this bug notification because you are a member of Bazaar
> Developers, which is the registrant for Bazaar.
>
> Status in Bazaar Version Control System: New
>
> Bug description:
> The following occured with my branches. Many files and directories were
> added, moved, removed and renamed in the branches (gv-allgemein was removed
> from this branch but nor from the merge source):
>
> bzr merge sftp://vvw@localhost/u/users/vvw/bzr-rep/vws/
> +N .bzrignore.OTHER
>
> +N gv-allgemein/
> +N gv-allgemein/c-include/
> +N gv-allgemein/c-include/sqlnet.log
> +N gv-allgemein/c-source/
> +N gv-allgemein/c-source/spver_std_ini.c.OTHER
> +N gv-allgemein/pc-include/
> +N gv-allgemein/pc-include/sp011.c2h.OTHER
> +N gv-allgemein/pc-include/sp011.col.OTHER
> +N gv-allgemein/pc-include/sp011.d2h.OTHER
> +N gv-allgemein/pc-include/sp011.dat.OTHER
> ...
> +N src/batch/pdf/AN-Haus-und-Grund-HVK.pdf
> +N src/batch/pdf/AN-Wohn-Mehr-HVK.pdf
> +N src/batch/pdf/HGRUNDHAFT_2007.pdf
> ...
> M src/tech/allgemein/modus.kon
> M src/tech/allgemein/status.kon
> Contents conflict in .bzrignore
> Conflict adding files to gv-allgemein. Created directory.
> Conflict because gv-allgemein is not versioned, but has versioned children.
> Versioned directory.
> Conflict adding files to gv-allgemein/c-include. Created directory.
> Conflict because gv-allgemein/c-include is not versioned, but has versioned
> children. Versioned directory.
> Conflict adding files to gv-allgemein/c-source. Created directory.
> Conflict because gv-allgemein/c-source is not versioned, but has versioned
> children. Versioned directory.
> Contents conflict in gv-allgemein/c-source/spver_std_ini.c
> Conflict adding files to gv-allgemein/pc-include. Created directory.
> Conflict because gv-allgemein/pc-include is not versioned, but has versioned
> children. Versioned directory.
> Contents conflict in gv-allgemein/pc-include/sp011.c2h
> Contents conflict in gv-allgemein/pc-include/sp011.col
> ...
> Text conflict in src/geschaeft/allgemein/vws_beilage_ms.ext
> Text conflict in src/geschaeft/db/brdat_gt.pc
> 75 conflicts encountered.
>
> bzr: ERROR: exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte
> 0xc3 in position 29: ordinal not in range(128)
>
> Traceback (most recent call last):
> File "/u/users/mueller/lib/python/bzrlib/commands.py", line 817, in
> run_bzr_catch_errors
> return run_bzr(argv)
> File "/u/users/mueller/lib/python/bzrlib/commands.py", line 779, in
> run_bzr
> ret = run(*run_argv)
> File "/u/users/mueller/lib/python/bzrlib/commands.py", line 477, in
> run_argv_aliases
> return self.run(**all_cmd_args)
> File "/u/users/mueller/lib/python/bzrlib/builtins.py", line 2770, in run
> cleanup()
> File "/u/users/mueller/lib/python/bzrlib/workingtree_4.py", line 1125, in
> unlock
> self.flush()
> File "/u/users/mueller/lib/python/bzrlib/workingtree_4.py", line 312, in
> flush
> self.current_dirstate().save()
> File "/u/users/mueller/lib/python/bzrlib/dirstate.py", line 1639, in save
> self._state_file.writelines(self.get_lines())
> File "/u/users/mueller/lib/python/bzrlib/dirstate.py", line 1228, in
> get_lines
> return self._get_output_lines(lines)
> File "/u/users/mueller/lib/python/bzrlib/dirstate.py", line 1521, in
> _get_output_lines
> inventory_text = '\0\n\0'.join(lines)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 29:
> ordinal not in range(128)
>
> bzr 0.90.0candidate0 on python 2.5.0.final.0 (linux2)
> arguments: ['/u/users/mueller/bin/bzr', 'merge',
> 'sftp://vvw@localhost/u/users/vvw/bzr-rep/vws/']
>
> ** please send this report to <email address hidden>
> /u/users/mueller/lib/python/bzrlib/lockable_files.py:110: UserWarning: file
> group LockableFiles(<bzrlib.transport.local.LocalTransport
> url=file:///u/users/mueller/bzr_diagnose/C%2B%2B/.bzr/checkout/>) was not
> explicitly unlocked
> warn("file group %r was not explicitly unlocked" % self)
> /u/users/mueller/lib/python/bzrlib/lock.py:79: UserWarning: lock on <open
> file u'/u/users/mueller/bzr_diagnose/C++/.bzr/checkout/dirstate', mode 'rb+'
> at 0x40642f98> not released
> warn("lock on %r not released" % self.f)
>
>

--
Martin <http://launchpad.net/~mbp/>