Can't open files unless in ~/Documents/

I’m using version 2.1.4 installed using Flatpak.
The program doesn’t seem to be able access any file outside the “Documents” folder of the user’s home.

Here’s what I’ve tried:

  1. open a .tm file with texmacs from the file explorer, I get an error (“warning load error for /run/user/some/generated/path/file.tm, Success”), the error appears to be a form of “success”.
  2. launch texmacs, click on “open” in the menu: the file dialog box only shows the “Documents” folder within my home directory
  3. in the above dialog box, I enter the full path of a .tm file outside the “~/Documents” folder (but within a folder inside my home directory), I get an empty document
  4. I copied that .tm file I’m trying to open to the “~/Documents” folder. This file, I can open it using the menu etc, and it shows its expected content.

The file I’m trying to open is a valid .tm file (confirmed by the fact that it opens correctly when copied within the “Documents” folder), the folder it is in is within my home directory and I have full ownership and permissions on the file and all the directories above it (really it’s just a normal file in a normal directory that I created using normal means etc).

It seems that this is broken by the sandboxing system or something like that (the path in the error message on 1. isn’t the original path) - I don’t know much about how Flatpak works.

What is going on? Is there any way I could open the file wherever I want?

Note: I have other apps installed via Flatpak none of which have this issue.

As far as I know, it is a flatpak feature. For example, Wechat installed by flatpak can only access the “Downloads” folder.

1 Like

Is there anybody responsible for maintaining the flathub package? That would be great to set the sandbox permissions to allow for the native file chooser.

Hello there, welcome to the Forum :slight_smile:

The flatpak, unfortunately, has a few issues, the pdf export doesn’t work well, too. I’d recommend using another format for TeXmacs, like the distropackage, or the appimage.

If you want to use the flatpak, you can grant it access to the filesystem using Flatseal. It should then be able to open files anywhere on your computer.

About flatpak: It runs applications in a sandbox, i.e. each application sees its own storage, libraries, etc.
To be able to interact with the host computer, it needs permissions to see the host filesystem, this seems to be misconfigured in the flatpak for TeXmacs, but you can give the permission manually as described above.

1 Like

The PDF export of TeXmacs or Mogan relies on ghostscript (the gs commandline). In flatpak, for security reason, the flatpak-ed TeXmacs could not invoke the system gs command line. And also in the flakpak-ed TeXmacs, maxima plugin might not work well.

As a result, I suggest that one should not use the flatpak-ed TeXmacs.

1 Like

Thanks both for very useful answers: :slight_smile:

Let me add a point. This feature is very frequently to be used against untrusted softwares: think of the case that these softwares might contain some malicious codes to scan your personal files, analyze and upload to some server, and under sandboxes, those softwares are no longer accessible to your personal files.

3 Likes

Hi, I uploaded the package to flathub, as mentioned you can configure the access you grant:
sudo flatpak override --filesystem=path_to_directory org.texmacs.TeXmacs

I initially wanted to try TeXmacs, it’s incredibly versatile and can integrate with so many other tools that it’s almost impossible to support everything. I choose the dependencies it contains based on my tastes, if you want a specific tool you can create the manifest by moving it to the TeXmacs manifest repository on github by opening an issue.

I’ve thought about adding giac and macaulay2, but that’s something that will take some time.

3 Likes

You say you can’t export to pdf? The package has support for texlive and in my local tests it works, if you can be more specific maybe I can fix it.

2 Likes

Hey, sorry it took me some time to get back to this.

First of all, thanks for the work, I think that it is awesome to have a flatpak package of TeXmacs :slight_smile: .

I just reinstalled the TeXmacs flatpak. My system is the following:
OpenSuse, default flatpak config with no flatseal, x86-64

I have tried reproducing the issues that I had when I first tried the flatpak and haven’t been able to, hence I take back the thing about the PDFs not working.

Note: starting it gave me the following error:
>>> flatpak run org.texmacs.TeXmacs
/app/bin/texmacs: line 38: exec: texmacs.bin: not found
This is because I already have another version of TeXmacs installed. If someone else runs into this issue, it can be fixed with unset TEXMACS_PATH and re-running flatpak run org.texmacs.TeXmacs.
Just in case someone runs into the same error.

2 Likes

@bztd I’d like to try the Flatpak, but it asks me to install a 5.8 Gb TeXLive extension. Could this be made an optional plugin, as TeXmacs doesn’t rely on TeX to function?

PS: TeXstudio doesn’t seem to require TeXLive. If the extension is not installed, it uses flatpak-spawn --host.

I personally am bothered by the exaggerated size of texlive, I proposed removing the documentation and reducing the size to 3G, but I think that will not be done. Documentation is hard to find in most packages.

“Could this be made an optional plugin, as TeXmacs doesn’t rely on TeX to function?”

The problem with that is that people might think there is no support for texlive, Flathub does not report configured plugins coming from the SDK.

To install TeXmacs without texlive you have to install the packages manually:

flatpak install org.kde.Platform//5.15-24.08
flatpak install --no-deps --no-related org.texmacs.TeXmacs

The problem with this is that it will try to install texlive every time you try to update. To avoid this you can use the same two flags.

1 Like

Personally, I use Flatpak for the control it gives me over the software, which to me outweighs its shortcomings. Granting permissions that allow you to break out of the sandbox doesn’t seem reasonable to me, and beyond that, the modification would have to be done by the TeXmacs developers.
I’ll see what can be done with TeXlive, if it’s added as an optional dependency.

With TeXstudio instructions to install texlive are appended to the package description. I expect users will understand that for LaTeX plugins in TeXmacs to work TeX needs to be installed somewhere.

The above does depend on the --talk-name=org.freedesktop.Flatpak permission. If security is one’s primary reason for using Flatpak, then it makes sense to disallow it, as you do. I do expect in this case that we will be seeing people ask why their plugins (Julia, Jupyter, Octave, etc.) don’t work. A workaround might be to add a small plugin to the Flatpak that prints instructions on how to grant host spawning permissions for those who want to allow it.

Not necessarily, a patch could be applied in the Flatpak build.

I suggested that these kinds of plugins be added to the flathub list, but I don’t think anything will happen. I’ll add texlive as an optional plugin and add the hints using the wrapper.

In the description of the packages I maintain I usually put what people will find, trying to mitigate false expectations.

Personally, patching the code doesn’t seem to me to be quite adequate, it makes the repository difficult to maintain and audit. However, if the tweaks aren’t too complex that’s fine by me. I don’t know enough about TeXmacs to allow me to patch it quickly, if you can do it that would be great.

2 Likes