jmzambon / libreoffice-code-highlighter

Code snippet highlighter for LibreOffice.
https://extensions.libreoffice.org/en/extensions/show/5814
Other
80 stars 5 forks source link

LO build extension manager thrown an error when I tried to update libreoffice-code-highlighter to version 2.2.1. #1

Closed PranavBhattarai closed 2 years ago

PranavBhattarai commented 2 years ago

Distro: Fedora 35 Workstation

Error message:

Error while installing extension Code Highlighter 2. The error message is: Cannot detect media-type: file:///tmp/STi7Zu/NVcmI1/b39f3a31-6a1e-41fc-bcdd-aee458de120f /builddir/build/BUILD/libreoffice-7.2.5.2/desktop/source/deployment/registry/dp_registry.cxx:481 The extension will not be installed.

Proof: image

Info:

Version: 7.2.5.2.0+
Build ID: 20(Build:2)
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

For now, I'm installing this from outside LO. Please do fix this so that it doesn't break for future updates.

jmzambon commented 2 years ago

Hi Pranav,

Thanks for reporting. I can't see what causes this error, and I can't reproduce it by now. Sounds like some registry corruption. Have you tried to remove the extension, restart LibreOffice and reinstall it? I'll take some time as soon as possible to dig into that.

PranavBhattarai commented 2 years ago

Have you tried to remove the extension, restart LibreOffice and reinstall it?

I uninstalled the old extension and reinstalled the new version. Works fine. But the LO internal inbuilt "extension manager" (which fetches an update of all installed extensions), failed.

I think it should be reproducable. But can't confirm since I only use 1 distro. Have you tried updating the extension from the old one to the new one, using the "Check for updates" option in the LO extension manager?

jmzambon commented 2 years ago

The problem seems to lie in the extension registry, where an entry type has been change from 'string' to 'short'. Event if the value is unchanged (0 or 1), LibreOffice does not allow it and raises an error. The problem is not easy to solve, as bringing back the type to 'string' will give error for anyone who install Code Highlighter from v2.2.1 :( . I have to think a little bit on that...

jmzambon commented 2 years ago

Finally found a simple and (not) so obvious solution: remove the problematic property and add a new one with similar name...! Could you try to install that new version (v2.2.3)?

PranavBhattarai commented 2 years ago

Could you try to install that new version (v2.2.3)?

Well, I tried but failed to update from 2.2.2 to 2.2.3 as you can see in the gif uploaded below:

Screencast from 02-15-2022 12 13 32 PM

Error message goes like this, "Error while installing extension Code Highlighter 2. The error message is: Cannot detect media-type: file:///tmp/Rj4tqi/GL9sQn/3620c081-539e-4390-8052-ca9a423d1616 /builddir/build/BUILD/libreoffice-7.2.5.2/desktop/source/deployment/registry/dp_registry.cxx:481"

jmzambon commented 2 years ago

Hi,

What I tried, from within the Extension Manager:

I can't see what that "media-type" detection error is. Probably some kind of user profile corruption in _unopackages/cache/registry...

Last chance: deleting/renaming the uno_packages folder in the user profile and see if the error still raises.

LibreOffice 7.2.5.2, Linux Mint 20.3 Cinnamon 64-bit

PranavBhattarai commented 2 years ago

Probably some kind of user profile corruption in uno_packages/cache/registry...

I tried to search this folder by going inside /tmp directory, I can't see any directory named "Rj4tqi_", as you can see:

image

Can you tell me how can I delete this "uno_packages/cache/registry...", to see if the problem still persists while updating the extensions or not?

Shall I cross-post by linking this post in AskLibre community? They might know things in more detail.

jmzambon commented 2 years ago

In /home/\<user>/.config/libreoffice/4/user, rename the folder "uno_packages". A clean one will be restored on the next LibreOffice start. This is the folder where user's extensions are installed, so you will need to reinstall every extension you use. But you also will be rid of any corrupted registry file.

Do not hesitate to ask for help. I'ill be the first interested in any hint.

PranavBhattarai commented 2 years ago

ln command is used to create link of a file (aka, symlink). Is that a typing mistake!?

rename the folder "uno_packages".

I renamed "uno_packages" folder to "uno_packages_bak" using this command: mv uno_packages/ uno_packages_bak When I start LO, it didn't have any extension installed. By the way, I only use one extension which is this extension.

So I installed Code-highlighter 2.2.2 and restart LO and went to extension manager to upgrade to version 2.2.3. And yet again it thrown the error below:

Error while installing extension Code Highlighter 2. The error message is: Cannot detect media-type: file:///tmp/1mVLPM/8Z1LDg/3620c081-539e-4390-8052-ca9a423d1616 /builddir/build/BUILD/libreoffice-7.2.5.2/desktop/source/deployment/registry/dp_registry.cxx:481

jmzambon commented 2 years ago

I finally found the time to dive into that issue. After wasting a lot of time looking for a bug in the extension's code, I found out that the problem is accessing the oxt (located on Github relases page) from the extension manager. I installed a workaround, waiting to understand what exactly is going wrong.

PranavBhattarai commented 2 years ago

That's good to know. Let me know, the update on the hotfix release.

jmzambon commented 2 years ago

By chance there is no need to modify the extension, only a xml file located on the serveur.

If you go now to the extension manager, the autoupdate should work normally.

PranavBhattarai commented 2 years ago

Finally the extension updates pretty fine without any error message. Thank you. image To verify, I uninstalled new version > Check for updates > Update & installed new version without getting error/crash.

jmzambon commented 2 years ago

Thanks again for your return and your help.