[BUG] bundle cannot handle binary files

Alexander Belchenko bialix at ukr.net
Sat Jul 8 11:22:28 BST 2006


John Arbash Meinel пишет:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Alexander Belchenko wrote:
> 
>>I post about this bug earlier (see my recent post with subject line
>>"win32: merging bundle error"). Now I want to say again because I
>>localize problem.
>>
>>If bundle contains binary file as base64-encoded string then this bundle
>>cannot be pulled or merged in. I can reproduce this with my bzr.ico
>>(attached). Bundle (binary.patch) that contain this file also attached.
>>
...
>>This traceback was printed by most recent bzr.dev. I don't think it's a
>>windows-specific.
>>
> This seems to be win32 specific, because I just did this on my linux box:
...
> 
> That said, I do get a failure when trying to merge your binary.patch. I
> don't know what the specific problem is. But it might just be that win32
> is failing to create correct bundles for binary files. (It might also be
> that win32 is incorrectly versioning binary files). But looking at the
> various code paths, we should be opening the file in 'rb'. Which
> shouldn't be causing problems.
> We do split the file on newlines, but it should be a lossless effect. If
> it wasn't we would be having problems elsewhere.
> 
> I also tried these exact steps on a win32 machine, and got the same
> results. So something is wrong with your patch, but it doesn't seem to
> be a problem with the current bzr.dev.

If my patch is problem then I have to say that patch utility itself on
pure windows should be invoked with '--binary' flag otherwise it mangle
line-endings. Without this flag even shelf plugin does not work properly
with text files.

May be patch on win32 does not support binary files? Or diff does not
support binary files?

> I'm not sure what else to tell you. I even checked that the icon looked
> reasonable (and opened in an image viewer). So everything seems to be okay.

How I can debug this? Can you send to me your bundle with bzr.ico that
you create on Linux machine, I'd like to try to compare.

I try to shelve this binary file with shelf plugin and have similar
error (MalformedPatchHeader):

D:\user\MyCode\bzr\__test\a>bzr shelve
bzr: ERROR: bzrlib.patches.MalformedPatchHeader: Malformed patch header.
  No orig name
u'Binary files bzr.ico\t1970-01-01 00:00:00 +0000 and
bzr.ico\t2006-05-08 08:18:40 +0000 differ\n'

Traceback (most recent call last):
   File "E:\work\MyCode\bzr\devel\bzr.dev\bzrlib\commands.py", line 694,
in run_bzr_catch_errors
   File "E:\work\MyCode\bzr\devel\bzr.dev\bzrlib\commands.py", line 656,
in run_bzr
   File "E:\work\MyCode\bzr\devel\bzr.dev\bzrlib\commands.py", line 281,
in run_argv_aliases
   File "d:\user\python\bzr\plugins.work\shelf\__init__.py", line 55, in run
   File "d:\user\python\bzr\plugins.work\shelf\shelf.py", line 195, in
shelve
   File "d:\user\python\bzr\plugins.work\shelf\patchsource.py", line 14,
in readpatches
   File "E:\work\MyCode\bzr\devel\bzr.dev\bzrlib\patches.py", line 355,
in parse_patches
   File "E:\work\MyCode\bzr\devel\bzr.dev\bzrlib\patches.py", line 310,
in parse_patch
   File "E:\work\MyCode\bzr\devel\bzr.dev\bzrlib\patches.py", line 61,
in get_patch_names
MalformedPatchHeader: Malformed patch header.  No orig name
u'Binary files bzr.ico\t1970-01-01 00:00:00 +0000 and
bzr.ico\t2006-05-08 08:18:40 +0000 differ\n'

bzr 0.9.0dev0 on python 2.4.3.final.0 (win32)
arguments: ['c:\\utils\\bzr.py', 'shelve']


When I look at this error I see that shelf plugin does not like my
binary file because it gets this diff:

D:\user\MyCode\bzr\__test\a>bzr di
=== added file 'bzr.ico'
Binary files bzr.ico    1970-01-01 00:00:00 +0000 and bzr.ico
2006-05-08 08:18:40 +0000 differ

This output becomes default after Aaron create auto-detect of binary
files. In 0.7 there is real diff between binary files similar to text
files. Can be this fact the root of problem?

--
Alexander





More information about the bazaar mailing list