Calling external snap-installed apps with temp files
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Calling external snap-installed apps with temp files
I'm working on the OpenSCAD workbench, and the way we are sending data to OpenSCAD does not work if OpenSCAD is installed as a Snap package (or presumably if FreeCAD is installed as a snap package, though I have not tested that) -- we are currently using Python's temp directory functionality, but on Linux that end up being /tmp, which is unique to each snap so can't be used as a location to share information between apps. What is the preferred workaround for this? Is there a "standard" place for interprocess-communication-type temp files?
Re: Calling external snap-installed apps with temp files
I want to bump this up to see if anyone else has an opinion on how I approach this, before I start coding. As near as I can tell, the only way I can accomplish this is to simply write the files to someplace like $HOME (they obviously get deleted later so the litter is temporary). I'd like a solution that will work when either FreeCAD or OpenSCAD is running as a flatpak/snap/whatever.
Pinging a couple of people who might know more about this than me!
Pinging a couple of people who might know more about this than me!
keithsloan52 wrote: ping
NormandC wrote: ping
vejmarie wrote: ping
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Calling external snap-installed apps with temp files
I got the impression the whole point of snap installing was to place an application in a sand box with no ability to interact.
As such I don't think you should try and support and should just state that if people want to use OpenSCAD with FreeCAD then
they should not use a snap installation version of OpenSCAD or FreeCAD
As such I don't think you should try and support and should just state that if people want to use OpenSCAD with FreeCAD then
they should not use a snap installation version of OpenSCAD or FreeCAD
Re: Calling external snap-installed apps with temp files
I think there are a number of reasons people install packages via Snap or Flatpak, but (anecdotally, I just chatted with a few people around the building), at least some people are doing it for ease and convenience, not for ultra-strict sandboxing. And I'm not a big fan of just saying that people who install FreeCAD via Snap can't use the OpenSCAD WB. Snap and flatpak provide specific mechanisms for users to allow home directory access, and both the OpenSCAD and the FreeCAD Snap have that plug enabled.
Re: Calling external snap-installed apps with temp files
As a packager, this has been my experience as well. Users want an easy way to deal with FreeCAD, or other heavy packages, dependencies.chennes wrote: ↑Wed Sep 01, 2021 6:15 pm I think there are a number of reasons people install packages via Snap or Flatpak, but (anecdotally, I just chatted with a few people around the building), at least some people are doing it for ease and convenience, not for ultra-strict sandboxing. And I'm not a big fan of just saying that people who install FreeCAD via Snap can't use the OpenSCAD WB. Snap and flatpak provide specific mechanisms for users to allow home directory access, and both the OpenSCAD and the FreeCAD Snap have that plug enabled.
We add more and more stuff to the AppImage to make it easier.
To the original question, I would put the tmp files, that would be cleaned up, in .FreeCAD/ someplace. FreeCAD is writing them.
On Win %appdata%/FreeCAD/OpenSCAD/tmp?
"fight the good fight"
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Calling external snap-installed apps with temp files
And other operating systems?
Python has facilities for temp files https://docs.python.org/3/library/tempfile.html independent of OS and that I believe is what OpenSCAD uses.
If the python facilities do not work for snap installed applications, then I don't think people should be coming up with work arounds.
Either somebody fixes the python facility or it should be stated not supported.
Re: Calling external snap-installed apps with temp files
Code: Select all
~.FreeCAD/OpenSCAD/tmp
I understand, but if both programs allow the interface? Maybe it is a feature, not a bug?keithsloan52 wrote: ↑Wed Sep 01, 2021 6:52 pm If the python facilities do not work for snap installed applications, then I don't think people should be coming up with work arounds.
Either somebody fixes the python facility or it should be stated not supported.
"fight the good fight"
Re: Calling external snap-installed apps with temp files
Python's temp stuff is not designed for interoperability, it just writes to the system temp location ("/tmp" on Linux, for example). We're sort of abusing it in this case to transmit data between apps, and Snap and Flatpak both explicitly do not share /tmp.
- adrianinsaval
- Veteran
- Posts: 5553
- Joined: Thu Apr 05, 2018 5:15 pm
Re: Calling external snap-installed apps with temp files
in the snap too? Haven't ever used it but I remember the flatpak used a different directory for it's cfg files although it still used the same for everything else (workbench, macros, etc.)sgrogan wrote: ↑Wed Sep 01, 2021 7:16 pmFreeCAD is already writing stuff, preferences ( for example user.cfg ).Code: Select all
~.FreeCAD/OpenSCAD/tmp
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Calling external snap-installed apps with temp files
NOT on a MAC, but I guess one could use FreeCAD facilities to determine where preferences are stored.sgrogan wrote: ↑Wed Sep 01, 2021 7:16 pmFreeCAD is already writing stuff, preferences ( for example user.cfg ).Code: Select all
~.FreeCAD/OpenSCAD/tmp
Disagree that we are miss using the python facilities for temp files. Snap is restricting access to /tmp on an application basis for sandbox reasons.
Passing data in a file in another location is miss using snap, I would suggest. I stand by my opinion that it should just be unsupported until snap get their act together and supply some official mechanism for inter application transfer. I assume they don't allow applications to share /tmp because it is a security vulnerability, in that some third party could otherwise write a temp file in /tmp and then invoke the receiving application, hence passing data via a back door.