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

Bug #567903 reported by Cody A.W. Somerville on 2010-04-21
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
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.

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

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

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) on 2017-11-09
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers