GNOME Bugzilla – Bug 763897
Whitespace is corrupted when emailing patches
Last modified: 2020-04-28 15:35:30 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; ...
This was OK in 3.16. Broke in 3.18.
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.
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!
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).
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.
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.
(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.
(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.
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.