'bzr diff' produces confusing, seemingly inaccurate diff for weird EOL marker issues

Bug #567903 reported by Cody A.W. Somerville
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

Some how a file in my branch got the EOL markers messed up for a single line and it caused me all sorts of confusion. 'bzr diff' would show me a very confusing and seemingly inaccurate diff due to a spurious CR (or lack of LF) that caused the next line to overwrite part of the line before moving to the next.

example, bzr diff would show the following:
 {% else %}
{% endif %} You're not authorized to access this page.
+I'm sorry. You're not authorized to access this page.
+{% endif %}

When the content of the file as shown in editor was:
{% else %}
I'm sorry. You're not authorized to access this page.
{% endif %}

Piping bzr diff through cat -v shows the following which is much less confusing:
 {% else %}
-I'm sorry. You're not authorized to access this page.^M{% endif %}
+I'm sorry. You're not authorized to access this page.
+{% endif %}

Now that the mystery is solved this behavior is understandable but regardless its a horribly confusing and frustrating experience for the user.

Revision history for this message
Vincent Ladeuil (vila) wrote :

As discussed on IRC, the bug was encountered when looking at a loggerhead annotated version of the file.

bzr itself should still deliver the bytes present in the file and leave the interpretation of the ascii control chars to whatever viewer is used.

affects: bzr → loggerhead
Changed in loggerhead:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Cody A.W. Somerville (cody-somerville) wrote :

There is already a bug about this against loggerhead. Robert asked me to file this particular bug against bzr so that there is a record of this issue.

affects: loggerhead → bzr
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 567903] Re: 'bzr diff' produces confusing, seemingly inaccurate diff for weird EOL marker issues

Specifically, while bzr operated 'correctly', its possible we can do
better. Some thoughts:
 - output a warning when a file has mixed EOL markers
 - like less, sanitise output unless a -R / -r is passed
 - prompt for what to do, and offer a config option to control it
 - something else...

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.