Snap interface for /dev/shm

The purpose was to create a directory, /dev/shm/snap.shared/, shared by all snap-based applications.
If the original coder did not assume such directory - he will not even assume snap -, and the snap-packager will not by regulation take it for granted, is there really a scenario in which a rogue application may peek there?
The application will not place data on it: it will be the final user.

Right, that’s exactly the purpose of /tmp. The /dev/shm/ directory is supposed to hold content oriented towards IPC via shared memory. More details here:

https://www.kernel.org/doc/gorman/html/understand/understand015.html

Note that this is not just a convention that users follow either. The POSIX shm functions on the standard libc on Linux (e.g. shm_open) will actually refer to /dev/shm/foo internally when one asks for “/foo”.

So if the goal is using temporary files on a tmpfs (same used by /dev/shm), that’s trivially done by adding a line to /etc/fstab. That’s the real location for temporary files, and having those files in memory is a fine choice that many users make (maybe that’s why it’s named tmpfs instead of ramfs?).

Otherwise, abusing of the incorrect location may easily end up creating that sort of conflict across tools that interpret the locations after their intended purpose.

1 Like

While I fully agree with that statement, would it actually help in the snap case given a snap cant see the actual system wide /tmp dir ?

If you have working files to work across several applications, the typical place to put them is in the user’s home, or some media location. We have interfaces for sharing these already, and we also are researching user customized lists, as pointed out above.

We also have the content interface, that allows a more explicit and polished sharing across defined snaps.

Several options addressing common and slightly different cases.

1 Like

I thought /tmp is already loaded in RAM on most distros by default.

I’m having the same problem, GIMP can not access files in my simple RAM disk, which actually is a folder link in my home directory to /dev/shm/Ramdisk

Works fine with all other programs which are installed through repositories. Maybe the easiest solution is to install GIMP from a repository instead of snap store? What do you think?