[evolution/wip/webkit2] EHTMLEditorView - Restore the selection end mark correctly when processing HTML to plain text

Bug #1613805 reported by Jamie Strandboge on 2016-08-16
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
evolution (Ubuntu)
Status tracked in Artful
Xenial
Undecided
Jamie Strandboge
Artful
Undecided
Unassigned

Bug Description

[Impact]
Ubuntu 16.04 evolution users sometimes send emails with ##SELECTION_END## due to a copy/paste error in the EHTMLEditorView code when converting HTML to plain text.

This is fixed in newer Ubuntu releases. The fix is a from upstream:
https://mail.gnome.org/archives/commits-list/2016-May/msg06756.html

[Test Case]
I tried to find a test case but was unable to as it doesn't seem to always happen and there is no upstream bug or steps to reproduce. The code change is obvious though. This is the broken code:

if (strstr (*text, "##SELECTION_START##")) {
 GString *tmp;

 tmp = e_str_replace_string (
  *text,
  "##SELECTION_START##",
  "<span id=\"-x-evo-selection-start-marker\"></span>");

 g_free (*text);
 *text = g_string_free (tmp, FALSE);
}

if (strstr (*text, "##SELECTION_END##")) {
 GString *tmp;

 tmp = e_str_replace_string (
  *text,
  "##SELECTION_START##",
  "<span id=\"-x-evo-selection-start-marker\"></span>");

 g_free (*text);
 *text = g_string_free (tmp, FALSE);
}

Notice how if it finds ##SELECTION_END## in the text, it will not end up replacing it because it tries to replace ##SELECTION_START## instead. Contrast that to the stanza just above it that correctly searches for and replaces ##SELECTION_START##.

Test case then is simply testing for no regressions:
1. send an html mail
2. respond to an html in html
3. respond to an html in plain text
4. send an email in plain text
5. respond to a plain text email in html
6. respond to a plain text email in plain text

[Regression Potential]
The regression potential is considered low since the change is minimal and obviously correct. In addition I personally used the patch for months (until upgrading to 17.04) and have several users that also use it without issue.

== Original description ==
From https://mail.gnome.org/archives/commits-list/2016-May/msg06756.html:

"EHTMLEditorView - Restore the selection end mark correctly when processing HTML to plain text

Otherwise the ##SELECTON_END## string could be left in the output."

I sometimes see this from people on xenial. Patch in the commit list needs a light backport. I will attach a debdiff if it works.

description: updated
Jamie Strandboge (jdstrand) wrote :

Here is a debdiff that fixes an obviously wrong piece of code that is simple for an SRU. I don't yet have a reproducer.

Jamie Strandboge (jdstrand) wrote :
Changed in evolution (Ubuntu):
status: New → Triaged
status: Triaged → New
tags: added: patch
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in evolution (Ubuntu):
status: New → Confirmed
description: updated
Changed in evolution (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
status: Confirmed → In Progress
Changed in evolution (Ubuntu Artful):
status: In Progress → Fix Released
assignee: Jamie Strandboge (jdstrand) → nobody
Changed in evolution (Ubuntu Xenial):
assignee: nobody → Jamie Strandboge (jdstrand)
status: New → In Progress
description: updated
description: updated
description: updated
Changed in evolution (Ubuntu Xenial):
status: In Progress → Fix Committed
description: updated

Hello Jamie, or anyone else affected,

Accepted evolution into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/evolution/3.18.5.2-0ubuntu3.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
description: updated
description: updated
Jamie Strandboge (jdstrand) wrote :

Upgraded to 3.18.5.2-0ubuntu3.2 in xenial-proposed. I used the test cases in this bug and I observed no regressions.

$ apt-cache policy evolution evolution-common evolution-plugins libevolution
evolution:
  Installed: 3.18.5.2-0ubuntu3.2
  Candidate: 3.18.5.2-0ubuntu3.2
  Version table:
 *** 3.18.5.2-0ubuntu3.2 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     3.18.5.2-0ubuntu3.1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
     3.18.5.2-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
evolution-common:
  Installed: 3.18.5.2-0ubuntu3.2
  Candidate: 3.18.5.2-0ubuntu3.2
  Version table:
 *** 3.18.5.2-0ubuntu3.2 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-proposed/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial-proposed/universe i386 Packages
        100 /var/lib/dpkg/status
     3.18.5.2-0ubuntu3.1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages
     3.18.5.2-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe i386 Packages
evolution-plugins:
  Installed: 3.18.5.2-0ubuntu3.2
  Candidate: 3.18.5.2-0ubuntu3.2
  Version table:
 *** 3.18.5.2-0ubuntu3.2 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     3.18.5.2-0ubuntu3.1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
     3.18.5.2-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
libevolution:
  Installed: 3.18.5.2-0ubuntu3.2
  Candidate: 3.18.5.2-0ubuntu3.2
  Version table:
 *** 3.18.5.2-0ubuntu3.2 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     3.18.5.2-0ubuntu3.1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
     3.18.5.2-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

tags: added: verification-done
removed: verification-needed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers