netblue30 / firejail

Linux namespaces and seccomp-bpf sandbox
https://firejail.wordpress.com
GNU General Public License v2.0
5.7k stars 557 forks source link

Ctrl+c on terminal program mpsyt causes unclean termination #3100

Closed D-Nice closed 4 years ago

D-Nice commented 4 years ago

The regular behaviour on ctrl+c for mpsyt is to gracefully shutdown, and also save whatever session history happened.

When running it in firejail, with or without profile, the exit is unclean. This always results in the session history not being saved, and there being no exit message as with vanilla mpsyt, but instead

Child received signal 2, shutting down the sandbox...

Parent is shutting down, bye...

Sometimes, the terminal it was run in, also ends up 'corrupted' in that it may no longer accept input.

I understand this is likely a symptom of the architecture. One way to get around it is to use the exit keyword, which will allow mpsyt to gracefully exit before the sandbox is terminated.

I thought it worth it to still ask if there is anyway around this, due to ctrl+c being in my muscle memory, and I presume this may affect other terminal applications that have ctrl+c handlers built-in, being skipped.

glitsj16 commented 4 years ago

I stopped using mps-youtube for a while now, but if memory serves, it uses /q or /quit to exit gracefully. Being terminal based you might try with --ignore="shell none" --ignore=private-bin (or adding ignore shell none and ignore private-bin to your mpsyt.local).

D-Nice commented 4 years ago

@glitsj16 already aware of /exit, but /q and /quit are useful to know as well :).

Unfortunately the ignores did not help (put in local conf as mentioned, and I already have an existingo one for mpsyt), otherwise I would close the issue and consider it resolved.

It's not a breaking issue for me at all, but definitely could be an annoyance for certain things, and a known workaround would be useful for this and for other things. Most annoying part really is the unusable shell thereafter.

glitsj16 commented 4 years ago

@D-Nice I can see why it is annoying to end up with a broken shell. The only other suggestion I have on this is to ignore tracelog and adding quiet at the top of the mpsyt.profile. But you might have tried that already. Wen I used mpsyt I had a script that started it in a dedicated terminal that I never used for anything else and I stopped firejailing mpsyt itself, only the custom defined player. Not nice but that at least kept things from breaking on shutting down mpsyt. I'm still clueless as to why this happens in the first place though.

matu3ba commented 4 years ago

@D-Nice The roughly handling is described here. You could start with strace to see what stuff happens. My guess is that the history is not written, but buffered in memory or tmpfiles. That is however the problem of the application. This post describes the underlying problem in usage of bad specifications/designs.

@glitsj16 Suggestion to tag more information needed.

glitsj16 commented 4 years ago

@matu3ba Done. I had some email trouble lately and I think I saw another thread you asked me to label. Do you happen to remember which one?

rusty-snake commented 4 years ago

I'm closing here due to inactivity, please fell free to reopen if you still have this issue.