ppd / freecad-ppd

5 stars 1 forks source link

Network Drive Access with Snap #20

Closed paddy0407 closed 2 years ago

paddy0407 commented 2 years ago

I don't know if this is a known issue, or maybe due to the nature of a snap package, it is more of a feature than a bug or issue, but when using the snap image, I lost the ability to save to an NFS mounted network drive which limited my use case for the program. Issue originally added to: https://www.reddit.com/r/FreeCAD/comments/skwcw2/network_access/hvvrwje/?context=3

ppd commented 2 years ago

I think you're referring to the switch from the nice portal file dialog to the "old school" internal one? The portal file dialog shows your network devices etc.

Why did we do this?

Older xdg-portal-desktop versions proxy every file access, i.e. they mount the file into some special directory to decouple the snap or flatpak from the host. Only with version 1.8.1, they started supporting not proxying file accesses for directories where you have access anyway, like /home.

The original discussion: https://github.com/ppd/freecad-ppd/issues/15

Why is proxying a problem?

  1. When opening: FreeCAD does not understand that this path is not a real path. If you have external links, it will try to look them up in this virtual mount directory, and, of course, it will not find them. So e.g. assemblies are broken.
  2. When saving: FreeCAD tries to append its FCStd suffix if you do not type it in yourself. But if you use proxied file access, this is not allowed, and files get lost.
  3. The majority of freecad-ppd's userbase is on old LTS releases, like 20.04 and 18.04. They do not have a sufficiently recent portal. Only with 21.04 we have this.

How can I fix it?

a) You can enable the old portal file dialog if you have a recent enough host, or if you do not use external links in your files anyway etc. Do this by creating a new setting, as show in this link: https://github.com/realthunder/FreeCAD_assembly3/issues/1086#issuecomment-1022043527 In any case, understand that FreeCAD is not 100% portal-aware as of now. Saving to gvfs mounts is still proxied, even for newer portal versions. This might be a problem for you, depending on your specific use case.

or

b) Mount your NFS drive in your home directory or in /media. A systemd mount unit would be perfect for this (see e.g. https://cloudnull.io/2017/05/nfs-mount-via-systemd/).

paddy0407 commented 2 years ago

In my case, neither of these methods worked. I have tried adding the parameter: Preferences > Dialog - DontUseNativeDialog / Boolean / true I have also mounted via systemd within the home folder as well as separately mounting in /media/... to no avail... The mounted location remains blank.

ppd commented 2 years ago

So what's the issue exactly? You get the portal dialog, navigate to the folder, and the folder appears blank? Or do you just not have the remote devices in the panel on the left? Because that is by design of the desktop portal. The internal file dialog does also not care about mounted remote devices; you have to navigate to the folder yourself.

paddy0407 commented 2 years ago

My issue is that I can not access to the mounted folder within freecad at all. When I go to the mounted location, it appears blank, no matter what way it has been mounted. I have no problem navigating to it using files or other programs such as inkscape. This leaves me unable to use a mounted location for use with the program. I would have to save a file and when finished, copy and paste it to the desired location and when wanting to use it again, copy it from my mounted location into my home folder to allow me to navigate to it within freecad.

luzpaz commented 2 years ago

That is so weird

ppd commented 2 years ago

Okay, seems odd. I have no access to a NFS server, but I have access to a server via SSH. Let's try it.

maxi@maxi-desktop:~$ mkdir sftp-mount
maxi@maxi-desktop:~$ sshfs developer@server:/home/developer sftp-mount/ -p 22122 -o idmap=user -o uid=$(id -u) -o gid=$(id -g) 
maxi@maxi-desktop:~$ cd sftp-mount/
maxi@maxi-desktop:~/sftp-mount$ ls
nodesource_setup.sh

Okay, so we have a sftp mount up in my home directory. Let's try from FreeCAD:

https://user-images.githubusercontent.com/6652223/153560691-213be7b1-9947-46aa-9d39-dea014499006.mp4

Result: It works. SMB/CIFS works too. The host is Ubuntu 22.04, but that shouldn't matter much if you stick to the default, internal file chooser.

There is little reason why this should not work for NFS mounts, provided the mount options are appropriate. But to confirm that, I'd need to set up a NFS server. Maybe later, but it does not seem to be a FreeCAD problem, which makes this general snap troubleshooting, which would fit much better in https://forum.snapcraft.io.

luzpaz commented 2 years ago

could you find an open snapcraft forum thread discussing this issue?