Bug#1070724: tmux: take flock on socket file/dir in /tmp/
On Wed, 8 May 2024 at 10:45, Luca Boccassi wrote: > > On Wed, 8 May 2024 at 08:20, Romain Francoise wrote: > > > > Hi Luca, > > > > Thanks for the heads up! Appreciate it. > > > > On Wed, May 8, 2024 at 1:33 AM Luca Boccassi wrote: > > > In order to avoid the /tmp/tmux-UID/default socket being deleted while > > > in use (e.g.: long term session), please patch tmux to take a flock(2) > > > on the directory while it's running, as per documentation: > > > > > > https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#Age > > > > I'd rather ship a tmpfiles config snippet with an 'x' directive to > > skip the tmux directories. > > Will that continue to work? > > Yes. Please ship it under /usr/lib/tmpfiles.d, and give it a clear > prefix that identifies the package (eg: tmux-something.conf). Also > please understand that any user can define any cleanup rule they want > locally, and they will override what packages ship (this is by > design), so the flock solution would be safer. But it is up to you > what you choose of course. Also note that you can start shipping this drop-in immediately, no need to wait or coordinate
Bug#1070724: tmux: take flock on socket file/dir in /tmp/
On Wed, 8 May 2024 at 08:20, Romain Francoise wrote: > > Hi Luca, > > Thanks for the heads up! Appreciate it. > > On Wed, May 8, 2024 at 1:33 AM Luca Boccassi wrote: > > In order to avoid the /tmp/tmux-UID/default socket being deleted while > > in use (e.g.: long term session), please patch tmux to take a flock(2) > > on the directory while it's running, as per documentation: > > > > https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#Age > > I'd rather ship a tmpfiles config snippet with an 'x' directive to > skip the tmux directories. > Will that continue to work? Yes. Please ship it under /usr/lib/tmpfiles.d, and give it a clear prefix that identifies the package (eg: tmux-something.conf). Also please understand that any user can define any cleanup rule they want locally, and they will override what packages ship (this is by design), so the flock solution would be safer. But it is up to you what you choose of course. > > Aside from this, it would be better to switch the location to > > XDG_RUNTIME_DIR (/run/user/UID), as a predictable name such as the one > > used by tmux can be easily hijacked by anything that manages to run > > before tmux is started, given /tmp is world writable by default. screen > > already switched some time ago to /run/. > > That's not something that I feel would be appropriate as a > Debian-specific change, but I can discuss it with the upstream author. > Not much chance of it happening though. Yes understood, that is something appropriate to do upstream and not downstream, I agree. I'd suggest to mention 'screen' as a factual example for this pattern, it might help.
Bug#1070724: tmux: take flock on socket file/dir in /tmp/
Hi Luca, Thanks for the heads up! Appreciate it. On Wed, May 8, 2024 at 1:33 AM Luca Boccassi wrote: > In order to avoid the /tmp/tmux-UID/default socket being deleted while > in use (e.g.: long term session), please patch tmux to take a flock(2) > on the directory while it's running, as per documentation: > > https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#Age I'd rather ship a tmpfiles config snippet with an 'x' directive to skip the tmux directories. Will that continue to work? > Aside from this, it would be better to switch the location to > XDG_RUNTIME_DIR (/run/user/UID), as a predictable name such as the one > used by tmux can be easily hijacked by anything that manages to run > before tmux is started, given /tmp is world writable by default. screen > already switched some time ago to /run/. That's not something that I feel would be appropriate as a Debian-specific change, but I can discuss it with the upstream author. Not much chance of it happening though. Best, -- Romain Francoise https://people.debian.org/~rfrancoise/
Bug#1070724: tmux: take flock on socket file/dir in /tmp/
Package: tmux Severity: important Hi, The default tmpfiles.d/tmp.conf will soon start cleaning up /tmp/ once a day, automatically deleting files older than 10 days (ctime/mtime/atime are all taken into account). In order to avoid the /tmp/tmux-UID/default socket being deleted while in use (e.g.: long term session), please patch tmux to take a flock(2) on the directory while it's running, as per documentation: https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#Age Aside from this, it would be better to switch the location to XDG_RUNTIME_DIR (/run/user/UID), as a predictable name such as the one used by tmux can be easily hijacked by anything that manages to run before tmux is started, given /tmp is world writable by default. screen already switched some time ago to /run/. Thanks! -- Kind regards, Luca Boccassi signature.asc Description: This is a digitally signed message part