Bug 166301 - Installing local help files breaks all LO Help on Ubuntu (due to Firefox installed as snap package)
Summary: Installing local help files breaks all LO Help on Ubuntu (due to Firefox inst...
Status: RESOLVED DUPLICATE of bug 148633
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://bugs.launchpad.net/snapd/+bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-23 04:04 UTC by Jim Avera
Modified: 2025-04-23 13:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Avera 2025-04-23 04:04:57 UTC
Local help files are valuable because they allow Help to work when not connected to the Internet.  But in recent Ubuntu systems, at least, Help is completely broken if local help files are installed.

The problem is the Firefox browser, which nowadays can only access file:///local/path URLs within the users Home Directory (dotnames such as .local are also excluded).  This is because Firefox is now a 'snap', which runs in a chroot sandbox, as well as changes within FF itself.  There may be ways to custom-configure access to additional local files but it istoo much to ask ordinary users to do that.

Remote help is broken too, when local help files are installed, because when the files are installed LO opens the system browser (Firefox) to access the local files and assumes it worked; there is no way to know that Firefox failed to open the help files, and so LO can not know to fall back to remote help. 

Unfortunately there is nothing we can do about Firefox or snap.

But some work-arounds might improve the situation:

------

1. Allow local help to work if LO is installed in the user's Home Directory:

(IMO this should be done in any case, and requires only simple changes)

LO creates a small redirector file /tmp/XXXXX.tmp/NewHelp0.html and points the browser to that. That file redirects to the absolute paths of the installed help/index.html (or help/nen-US/noscript.html if javascript is disabled). 

Since Firefox can not see /tmp this does not work.  To fix this, create the redirector in the users' Home Dir in e.g. $HOME/LibreOfficeDev/XXXX.tmp/NewHelp0.html (it can't be in the profile dir under $HOME/.config because FF won't access dot-names).

I've tested this (by copying the file from /tmp) and it works -- local help functions provided LO is itself installed within the user's Home Directory.

OK, this would fix the problem for a few people like us who install test versions of LibreOffice in our home dirs.


2. Fall back to remote help if local help does not work.

*Here I'm stepping beyond my knowledge, so this might or might not be possible:

Make the redirector javascript use fetch(url) or XMLHttpRequest to load a tiny test page in the local help tree, just to see if it can (examining the returned text to see if an expected signature was returned).  If not, the redirector would fall back and redirect to Internet-based help instead of the local files.

[
It might instead redirect to a special page somewhere in libreoffice.org which would first display a warning to the user, something like:

Local help files are installed but your browser <agent name> can not access them.   To prevent this message in the future, un-install the local help files, or manually delete <local path to the test page>." and display a "Try LibreOffice help on the Internet" button and wait.  After the user clicked, it would redirect to the real help page.

(all the specifics would be passed as ?query parameters from the redirector script. which does not know how to display anything really, to the hand-written intermediate page in the libreoffice.org internet.)
]
Comment 1 Christian Lohmaier 2025-04-23 10:48:29 UTC
Snap packages for browsers are broken by design. Or rather to have the default handler for local files be tied to that browser is. See also https://bugs.launchpad.net/snapd/+bug/1972762 - there are tons of tools that have their documentation stored as HTML files on the local disk and all break because of that.

I'm absolutely against creating files in directories not explicitly mentioned for use for temporary files, and especially not outside the LibreOffice profile directory. So creating an additional directory in the users's home for that is not acceptable.

"Make the redirector javascript use fetch(url) or XMLHttpRequest to load a tiny test page in the local help tree"

If firefox won't load the local page, it won't load javascript/there is nothing to probe for/we cannot tell. And even if it was possible, having a probe file create local files to track info about the users' system is also problematic in itself, or rather something that is something that should be avoided by isolating applications, so that also won't be blessed by me.

We force online help when Safari is default browser on macOS since it has similar sandboxing issues https://gerrit.libreoffice.org/c/core/+/73163 and later follow-ups/tweaks

So if it is easy to tell whether firefox is a sandboxed version, then using that is the only real way. (but I don't think we're probing actual browser, but just hand the path to xdg-open, so it really should be the system fixing the integration to rewrite that to a URL that firefox can access explaining the problem.)

For the user the workaround is to uninstall the local help-packages.
Comment 2 Olivier Hallot 2025-04-23 13:31:41 UTC
Additionally

https://bugzilla.mozilla.org/show_bug.cgi?id=1858425

*** This bug has been marked as a duplicate of bug 148633 ***