Created attachment 155533 [details] MathML file to test the bug Bug 117091 resurfaced. That is, Open formula editor. Copy some MathML into clipboard, e.g. the source of the attached file. Use menu Tools, item "Import MathML from Clipboard". Notice: nothing happens Expected: A formula is generated. Specifically: Importing the file works, copying it to clipboard and importing doesn't: Version: 6.2.8.2 Build ID: f82ddfca21ebc1e222a662a32b25c0c9d20169ee CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; Locale: de-DE (en_US.utf8); UI-Language: en-US Calc: threaded Neither importing from file nor from clipboard works: Version: 6.4.0.0.alpha1 Build ID: cc57df8f942f239d29cb575ea5a7cb01405db787 CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; Locale: de-DE (en_US.utf8); UI-Language: en-US Calc: threaded
Created attachment 155541 [details] clipboard content that parses into formula editor Import from clipboard works on Windows builds Version: 6.3.2.2 (x64) Build ID: 98b30e735bda24bc04ab42594c85f7fd8be07b9c CPU threads: 8; OS: Windows 10.0; UI render: GL; VCL: win; Locale: en-US (en_US); UI-Language: en-US Calc: threaded and a recent 6.4.0alpha1+ master Version: 6.4.0.0.alpha1+ (x64) Build ID: 3e8fb860d92160e41a1aef5a0a53e4447120eb2e CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: GL; VCL: win; Locale: en-US (en_US); UI-Language: en-US Calc: threaded copied text of attachment 155333 [details] to a new text document, deleted the annotation stanza (don't want that), saved document. Reopened in text editor--copied the MathML XML. With LibreOffice sm Formula editor open, Tools -> 'Import MathML from Clipboard' renders the formula into the edit bar, and produces a correct formula nodes in the view pane. InsideClipboard shows the XML as simple text clipboard formats as in attached. And that unrecognized MathML text is parsed correctly on Windows builds. Begs the question of what is present in clipboard on Linux build(s), if the same CF_ text types (no XML) then should parse into sm Formula editor the same as on Windows.
@V Stuart Foote: I am not sure whether your attached file is the correct one. In Linux, I am pretty sure that the contents of my clipboard are what I see. I checked e.g. also with copyQ. Moreover, before invoking 'Import from clipboard' I simply pasted the clipboard into the formula editor, and from there cut it into the clipboard again – to no avail.
I think, the problem is in version 6.2.8. Juang Dse: Can you please try with the newest version of LibreOffice of the 6.3 family or with a LibreOffice daily build?
I don't think so. As mentioned above, neither importing from file nor from clipboard works for the current dev build (6.3 or 6.4).
Confirming the 'Import MathML from Clipboard' control is not functioning on Linux (Fedora 31). The attached .mml will open into LibreOffice Math formula editor. But content edited and clipped below does not import. Verified it is clipped and available to paste--pasting the XML into the edit pane, which of course gives nonsensical formmula nodes. Version: 6.3.2.2 Build ID: 6.3.2.2-1.fc31 CPU threads: 2; OS: Linux 5.3; UI render: default; VCL: gtk3; Locale: en-US (en_US.UTF-8); UI-Language: en-US Calc: threaded <clip> <?xml version="1.0" encoding="UTF-8"?> <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <semantics> <mrow> <msub> <mi>f</mi> <mi>c</mi> </msub> <mo stretchy="false">=</mo> <mfrac> <mn>1</mn> <msub> <mi>K</mi> <mi>m</mi> </msub> </mfrac> </mrow> </semantics> </math> </clip>
If I disable the UTF-16 hackery in there then it imports so its apparently related to that
(In reply to Caolán McNamara from comment #6) > If I disable the UTF-16 hackery in there then it imports so its apparently > related to that I know that my code is not good, but it had worked before the Math module has been switched to fast parser. The "UTF-16 hackery" was needed for Windows "Math Input Panel", which puts the MathML only with encoding="utf-16" into the clipboard.
I presume windows is still working ? So there must be somewhere that is rejecting utf-16 under linux
(In reply to Caolán McNamara from comment #8) > I presume windows is still working ? Import from Windows Math Input Panel still works, using Windows 10 and LO daily.
Why do you want to import MathML from clipboard, you can just import it from the source folder. Do you love UNO games? Then you should try playing UNO online. Download here https://uno.onl/
On pc Debian x86-64 with master sources updated today, I could reproduce this. I noticed this log on console: warn:legacy.osl:80149:80149:starmath/source/mathmlimport.cxx:117: different SfxMedium found
It works if I put: <?xml version="1.0" encoding="UTF-8"?> <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <semantics> <mrow> <msub> <mi>f</mi> <mi>c</mi> </msub> <mo stretchy="false">=</mo> <mfrac> <mn>1</mn> <msub> <mi>K</mi> <mi>m</mi> </msub> </mfrac> </mrow> </semantics> </math> I got this formula: {f_c = 1 over K_m} + this on console: warn:starmath:80560:80560:starmath/source/mathmlimport.cxx:771: unknown attribute stretchy=false but it doesn't work if I use the same block with xml declaration.
This issue is reproduced on linux Version: 7.4.0.0.alpha0+ / LibreOffice Community Build ID: 53560aa06462f1cf04d69acafed20da971bc5c27 CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3 Locale: es-ES (es_ES.UTF-8); UI: en-US Calc: threaded but not on windows Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community Build ID: b1fe159fa39b2fc5217848e14d68c674979c181c CPU threads: 16; OS: Windows 6.3 Build 9600; UI render: default; VCL: win Locale: en-GB (en_GB); UI: en-US Calc: threaded which was fixed by Regina in bug 117091
(In reply to Caolán McNamara from comment #8) > I presume windows is still working ? So there must be somewhere that is > rejecting utf-16 under linux yes, windows is still working
(In reply to Julien Nabet from comment #12) > It works if I put: > <?xml version="1.0" encoding="UTF-8"?> > <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> > <semantics> > <mrow> > <msub> > <mi>f</mi> > <mi>c</mi> > </msub> > <mo stretchy="false">=</mo> > <mfrac> > <mn>1</mn> > <msub> > <mi>K</mi> > <mi>m</mi> > </msub> > </mfrac> > </mrow> > </semantics> > </math> > > I got this formula: > {f_c = 1 over K_m} > + this on console: > warn:starmath:80560:80560:starmath/source/mathmlimport.cxx:771: unknown > attribute stretchy=false > > but it doesn't work if I use the same block with xml declaration. Not working for me. you are using "Import MathML from Clipboard", right ?
indeed, it works on Linux if UTF-16 is disabled. @Mike, I thought you might be interested in this issue
Could you please provide *exact* steps to reproduce? Specifically: how should the XML be put to clipboard. Should I open attachment 155533 [details] in a plain text editor, select it there and copy? Which one is known to produce the bug on which platform? Or should I import it into Math, select and copy there? (In reply to Regina Henschel from comment #9) > (In reply to Caolán McNamara from comment #8) > > I presume windows is still working ? > > Import from Windows Math Input Panel still works, using Windows 10 and LO > daily. For the record. Math Input Panel on Windows puts data to clipboard in MathML clipboard format, which results in import code using the 'aDataHelper.HasFormat(SotClipboardFormatId::MATHML)' path, so it doesn't hit the UTF-16 replacement code. Trying to open the MathML from the attachment into clipboard on Windows, using Notepad++ for that, and then trying to paste into Math using Tools->Import MathML from Clipboard does not insert anything, exactly because of the replacement of UTF-8 into UTF-16. So I need to know what exactly this replacement should enable, to not break that scenario. Thank you!
Doesn't work in Version: 5.2.0.0.alpha0+ Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53 Threads 4; Ver: 5.10; Render: default; Locale: en-US (en_US.UTF-8) either
Steps to reproduce: 1. Copy <?xml version="1.0" encoding="UTF-8"?> <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"> <semantics> <mrow> <msub> <mi>f</mi> <mi>c</mi> </msub> <mo stretchy="false">=</mo> <mfrac> <mn>1</mn> <msub> <mi>K</mi> <mi>m</mi> </msub> </mfrac> </mrow> </semantics> </math> 2. Open Math 3. Go to Tools - Import MathML from Clipboard -> Nothing happens. This issue is only happening on Linux. On windows, it was fixed by Regina in bug 117091. On linux, the issue is fixed if - bForceUTF16 = true; + bForceUTF16 = false; is changed in starmath/source/view.cxx:1847
Acording to https://wiki.documentfoundation.org/ReleaseNotes/5.1#Import_MathML_from_Clipboard, this feature was introduced in LibreOffice 5.1 by Regina, I'm wondering if it even worked on Linux
(In reply to Xisco Faulí from comment #19) > This issue is only happening on Linux. On windows, it was fixed by Regina in > bug 117091. Wrong. I do the steps on Windows, copying the text you supplied, from Chrome (and from Notepad++ in earlier tests) into clipboard; and Tools - Import MathML from Clipboard does *not* put anything to Math, *unless* I change the code to avoid the UTF-16 replacement. That is why I'm asking also which steps are needed to reproduce the scenario where that replacement is *needed*. Note that you never mentioned *from which program* you copy the data to clipboard, as if it doesn't matter, despite I asked that explicitly ;)
(In reply to Mike Kaganski from comment #21) > (In reply to Xisco Faulí from comment #19) > > This issue is only happening on Linux. On windows, it was fixed by Regina in > > bug 117091. > > Wrong. I do the steps on Windows, copying the text you supplied, from Chrome > (and from Notepad++ in earlier tests) into clipboard; and Tools - Import > MathML from Clipboard does *not* put anything to Math, *unless* I change the > code to avoid the UTF-16 replacement. > > That is why I'm asking also which steps are needed to reproduce the scenario > where that replacement is *needed*. > > Note that you never mentioned *from which program* you copy the data to > clipboard, as if it doesn't matter, despite I asked that explicitly ;) mmm, this is interesting... In order to test windows issue, I connect to a win machine using Remmina. If I copy the code from Firefox on the windows machine it doesn't work. However, If I copy the code from Firefox on my linux machine and then I use "Import MathML from Clipboard" on the windows machine, then it works.
(In reply to Xisco Faulí from comment #22) Great! Could you please create a InsideClipboard capture on Windows machine, when the clipboard is defined using that procedure please?
(In reply to Xisco Faulí from comment #22) > (In reply to Mike Kaganski from comment #21) > > (In reply to Xisco Faulí from comment #19) > > > This issue is only happening on Linux. On windows, it was fixed by Regina in > > > bug 117091. > > > > Wrong. I do the steps on Windows, copying the text you supplied, from Chrome > > (and from Notepad++ in earlier tests) into clipboard; and Tools - Import > > MathML from Clipboard does *not* put anything to Math, *unless* I change the > > code to avoid the UTF-16 replacement. > > > > That is why I'm asking also which steps are needed to reproduce the scenario > > where that replacement is *needed*. > > > > Note that you never mentioned *from which program* you copy the data to > > clipboard, as if it doesn't matter, despite I asked that explicitly ;) > > mmm, this is interesting... In order to test windows issue, I connect to a > win machine using Remmina. If I copy the code from Firefox on the windows > machine it doesn't work. However, If I copy the code from Firefox on my > linux machine and then I use "Import MathML from Clipboard" on the windows > machine, then it works. it also works if you copy from Firefox to notepad and then from notepad to LibreOffice
(In reply to Xisco Faulí from comment #24) > it also works if you copy from Firefox to notepad and then from notepad to > LibreOffice Doesn't work here. Please attach an InsideClipboard capture if possible. That would exclude any ambiguity.
Created attachment 178785 [details] InsideClipboard captures the bad file is when coping from Firefox. The good one when copying from notepad
(In reply to Xisco Faulí from comment #26) > Created attachment 178785 [details] > InsideClipboard captures > > the bad file is when coping from Firefox. The good one when copying from > notepad Are you sure about the files? They are identical.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c964700d16d99d1569373a1eb9a1352fb3512915 Related: tdf#128610 Avoid use-after-free It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
This ^ has fixed this issue. And the following one removes the replacement obsoleted by use of libxml2 instead of expat.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/344353495c60dcdc69f7975ec4e51a753ebfb81f Related: tdf#128610 drop obsolete encoding attribute replacement It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
On pc Debian x86-64 with master sources updated today, I don't reproduce this anymore. Thank you Mike for the fix!
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/aa705140c1891599202f918018ef54a6260174ce Related: tdf#128610 Avoid use-after-free It will be available in 7.3.3. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/360e7eaef92ed38f25a454c8f0f605e7cda974f7 tdf#128610: math: add UItest It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-7-2": https://git.libreoffice.org/core/commit/6fb5a87e31b7df01f4b212ab979ae57e8d4ab4fb Related: tdf#128610 Avoid use-after-free It will be available in 7.2.7. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Verified in Version: 7.2.7.0.0+ / LibreOffice Community Build ID: 6fb5a87e31b7df01f4b212ab979ae57e8d4ab4fb CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3 Locale: es-ES (es_ES.UTF-8); UI: en-US Calc: threaded @Mike, thanks for fixing this issue!!