`bzr diff` shows diff of a binary file

Bug #320783 reported by Marius Kruger
6
Affects Status Importance Assigned to Milestone
Bazaar
Triaged
Low
Unassigned

Bug Description

I have a publicly available pdf ( http://downloads.sarsefiling.co.za/Afr%20Individual%20(ITR12)%20Guide.indd.pdf )
which is being shown by `bzr diff` and `commit --show-diff` .
In the latter case my editor (kwrite) warns that I'm trying to open a binary file and opens the commit-message file in read-only mode.

I'm not sure how we detect binary files, but it doesn't seem to work for this file.
Maybe the first part of the file sheds some light.

$ bzr dif | head -n 60
=== added file 'x.pdf'
--- x.pdf 1970-01-01 00:00:00 +0000
+++ x.pdf 2009-01-24 09:53:32 +0000
@@ -0,0 +1,1664 @@
%����-1.6
<</Subtype/XML/Length 3446/Type/Metadata>>streamR/Type/Catalog>>
+<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
+<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.0-c316 44.253921, Sun Oct 01 2006 17:08:23">
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description rdf:about=""
+ xmlns:xap="http://ns.adobe.com/xap/1.0/">
+ <xap:ModifyDate>2008-09-12T14:27:31+02:00</xap:ModifyDate>
+ <xap:CreateDate>2008-09-12T14:23:31+02:00</xap:CreateDate>
+ <xap:MetadataDate>2008-09-12T14:27:31+02:00</xap:MetadataDate>
+ </rdf:Description>
+ <rdf:Description rdf:about=""
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <dc:format>application/pdf</dc:format>
+ <dc:title>
+ <rdf:Alt>
+ <rdf:li xml:lang="x-default">untitled</rdf:li>
+ </rdf:Alt>
+ </dc:title>
+ </rdf:Description>
+ <rdf:Description rdf:about=""
+ xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
+ <pdf:Producer>Acrobat Distiller 8.0.0 (Macintosh)</pdf:Producer>
+ </rdf:Description>
+ <rdf:Description rdf:about=""
+ xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/">
+ <xapMM:DocumentID>uuid:bf5e0d7f-3562-f545-8498-361b86d021b0</xapMM:DocumentID>
+ <xapMM:InstanceID>uuid:6114a21f-e071-6a4d-bb56-6a720b7f8aa5</xapMM:InstanceID>
+ </rdf:Description>
+ </rdf:RDF>
+</x:xmpmeta>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<</CropBox[28.6411 29.5148 624.028 872.257]/Parent 63 0 R/Contents[82 0 R 83 0 R 84 0 R 85 0 R 90 0 R 91 0 R 94 0 R 95 0 R]/Rotate 0/BleedBox[28.6411 29.51<</CropBox[28.6411 29.5148 624.028 872.257]/Parent 63 0 R/Contents 3 0 R/Rotate 0/BleedBox[28.6411 29.5148 624.028 872.257]/MediaBox[0 0 654.284 900.898]/T<</CropBox[28.6411 29.5148 624.028 872.257]/Parent 63 0 R/Contents 12 0 R/Rotate 0/BleedBox[28.6411 29.5148 624.028 872.257]/MediaBox[0 0 654.284 900.898]/<</CropBox[28.6411 29.5148 624.028 872.257]/Parent 63 0 R/Contents 18 0 R/Rotate 0/BleedBox[28.6411 29.5148 624.028 872.257]/MediaBox[0 0 654.284 900.898]/<</CropBox[28.6411 29.5148 624.028 872.257]/Parent 63 0 R/Contents 24 0 R/Rotate 0/BleedBox[28.6411 29.5148 624.028 872.257]/MediaBox[0 0 654.284 900.898]/<</CropBox[28.6411 29.5148 624.028 872.257]/Parent 63 0 R/Contents 33 0 R/Rotate 0/BleedBox[28.6411 29.5148 624.028 872.257]/MediaBox[0 0 654.284 900.898]/<</CropBox[28.6411 29.5148 624.028 872.257]/Parent 63 0 R/Contents 42 0 R/Rotate 0/BleedBox[28.6411 29.5148 624.028 872.257]/MediaBox[0 0 654.284 900.898]/<</Length 3529/Filter/FlateDecode>>streamResources 41 0 R/Type/Page>>
+h��Z�r����)���_U� �׊��ڑ▒�R��rH� ��(o�C!/d��gIw�

Revision history for this message
furicle (furicle) wrote :

I just saw this behaviour with a version 1.3 pdf file. I suspect it's any pdf file.

bzr 1.3.1
python 2.5.2
Ubuntu hardy

Revision history for this message
Martin Albisetti (beuno) wrote :

I worked on this for Loggerhead, I may have time to put together a patch for it for bzr as well.

Changed in bzr:
importance: Undecided → Low
status: New → Triaged
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.