After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763897 - Whitespace is corrupted when emailing patches
Whitespace is corrupted when emailing patches
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Composer
3.18.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Tomas Popela
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2016-03-18 21:50 UTC by David Woodhouse
Modified: 2020-04-28 15:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Woodhouse 2016-03-18 21:50:45 UTC
This is similar to bug 749579 except that instead of tabs being changed to spaces, spaces are being changed to non-breaking spaces.

See the email at http://permalink.gmane.org/gmane.comp.bios.edk2.devel/9434 for example. I used 'Insert → Text file...' in the composer to insert the patch, which had been created with 'git format-patch'. And Evolution corrupted the spaces to non-breaking spaces so it woudn't apply. The QP contents of the message as it actually got sent look like this...

--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -212,7 +212,7 @@ MemMapInitialization (
=C2=A0
=C2=A0=C2=A0=C2=A0if (!mXen) {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0UINT32=C2=A0=C2=A0TopOfLowRam;
...
Comment 1 David Woodhouse 2016-03-18 21:58:06 UTC
This was OK in 3.16. Broke in 3.18.
Comment 2 Tomas Popela 2016-04-08 08:24:17 UTC
This is partly fixed with following commit:

    EHTMLEditorView - Don't replace various whitespaces with non-breaking spaces
    when inserting into PRE element

commit 69ca5f93311bf646e0bb48036c38741d0e5ad1de in the master branch for Evolution 3.21.1+

commit 3dbaf3fdbb174e3fe198442181722b98536a6009 in the gnome-3-20 branch for Evolution 3.20.1+

Now, before you use the 'Insert → Text file...' action you need to change the current block format to 'Preformatted' as we are still missing the change that will do it automatically do it for you.
Comment 3 David Woodhouse 2016-05-13 07:42:39 UTC
What about when I use git-format-patch to drop a message into my Drafts folder, then click on it to open it in the editor. Will it do the right thing then? And any chance of a fix for 3.18 please? This was a regression there.

Thanks!
Comment 4 benh 2016-06-08 12:49:36 UTC
Same problem here, using 3.18 (fedora 23), can this be fixed ? I'm used to having to set to "Preformatted" manually so that doesn't worry me.

I've tried to manually apply that patch to 3.18 but the context is very different and whatever I did didn't actually work (even changing the regexp didn't, not too sure what's up though it could be a package building issue on my side).
Comment 5 Tomas Popela 2016-06-09 12:42:08 UTC
Hi,

(In reply to benh from comment #4)
> Same problem here, using 3.18 (fedora 23), can this be fixed ?

Sorry, but is is not possible to backport this fix to 3.18.x. The good news is that Fedora 24 should be released soon and it will contain Evolution 3.20.x.
Comment 6 Tobias Mueller 2016-07-08 13:42:07 UTC
FWIW: I consider it a bug in the diff format's logic.  Mangling the whitespace is bad enough, but acceptable when ignoring all whitespace changes when applying a diff.
The problem is that "patch" doesn't even get to the point of comparing the bytes in the file, because it bails out with "fatal: corrupt patch at line 10".

That line is one of these:

diff --git a/foo b/foo
index 56d21a1..8260cb2 100644
--- a/foo
+++ b/foo
@@ -498,10 +498,19 @@ 


and has non-breaking whitespace, either C2A0 (UTF-8) or A0 (ISO).

So it's not even gotten to the point of comparing the bytes in the files, but barfs about the format of the patch.  I guess it expected a "normal space" (0x20), but only gets the non-breaking space. I think this can and should be improved.
Comment 7 Tobias Mueller 2016-07-08 14:01:11 UTC
(In reply to David Woodhouse from comment #3)
> What about when I use git-format-patch to drop a message into my Drafts
> folder, then click on it to open it in the editor. Will it do the right
> thing then?
Nope. At least it fails for me.

I tried dragging into Drafts and double clicking the new mail.
First, I tried to send right away. Fail.
Then I tried to select Preformatted. Fail.
Then I tried to select all the body and select performatted. Fail.

When pressing Ctrl+Alt+M, Tab,Tab,Tab,Tab (to get into the actual composer), Ctrl+7 (to select Preformatted), Alt+I X (to insert Text file), Ctrl+L (to make the Location Entry widget appear), then dragging the git format-patch file from nautilus into the Entry widget, Enter, Ctrl+Home (to go all the way up), Shift+(down, down, down, down, down) (to select five header lines), Del, Shift+Tab (to get to the Subject entry), type some subject, and then Ctrl+Enter,   I get something that I can work with.

This, however, is a bit terrible to use :-/

I hope it'll be possible to use Evolution for git format-patch files, soon.
Comment 8 Tobias Mueller 2016-07-08 15:14:08 UTC
(In reply to Tobias Mueller from comment #7)
> I tried dragging into Drafts and double clicking the new mail.
> First, I tried to send right away. Fail.
> Then I tried to select Preformatted. Fail.
> Then I tried to select all the body and select performatted. Fail.
FTR: https://git.gnome.org/browse/evolution/commit/?id=e3b09b06d30d886cd3c30c55df93a8484d6317dd should show up on 3.20.4 and make it work.
Comment 9 Milan Crha 2020-04-28 15:35:30 UTC
A lot of things had been changed for 3.37.2 development version, where the composer code had been rewritten to use JavaScriptCore API. I'm closing this in favor of that change.

I tried this with it and both tabs and spaces are preserved when using Insert->text file and Preformatted paragraph format.