Giter Site home page Giter Site logo

Unresponsive to SIGTERM. about cage HOT 14 CLOSED

cedws avatar cedws commented on June 24, 2024
Unresponsive to SIGTERM.

from cage.

Comments (14)

Hjdskes avatar Hjdskes commented on June 24, 2024

This works for me and is implemented: https://github.com/Hjdskes/cage/blob/master/cage.c#L92.

Sometimes there's a delay, but I suppose that is the application within Cage shutting down (or crashing), since the display terminates. We should probably properly shut down the applications within Cage, if this is possible. What application are you noticing this with?

from cage.

cedws avatar cedws commented on June 24, 2024

firefox-wayland. I gave it about 10 seconds or so but it seems to ignore my requests.

image

from cage.

cedws avatar cedws commented on June 24, 2024
static int
handle_signal(int signal, void *data)
{
	struct wl_display *display = data;

	switch (signal) {
	case SIGINT:
		/* Fallthrough */
	case SIGTERM:
		wl_display_terminate(display);
+		exit(0);
-		return 0;
	default:
		return 1;
	}
}

This fixes it for me, but I suppose the int returned from this function is supposed to be used by Wayland as an exit code anyway, right?

from cage.

Hjdskes avatar Hjdskes commented on June 24, 2024

This also makes Firefox close instantly for me:

diff --git a/cage.c b/cage.c
index 7f5b6f4..cf8c71f 100644
--- a/cage.c
+++ b/cage.c
@@ -48,6 +48,9 @@ spawn_primary_client(char *argv[], pid_t *pid_out)
 {
        pid_t pid = fork();
        if (pid == 0) {
+               sigset_t set;
+               sigemptyset(&set);
+               sigprocmask(SIG_SETMASK, &set, NULL);
                execvp(argv[0], argv);
                _exit(1);
        } else if (pid == -1) {

However, Cage does segfault on close now. Still looking into that, but it'd be great if you could test the above.

from cage.

Hjdskes avatar Hjdskes commented on June 24, 2024

However, Cage does segfault on close now.

Scratch that, it did that before. If the above works for you, I'll get that in and open a new issue for the segfault.

from cage.

cedws avatar cedws commented on June 24, 2024

The patch works 👍. As you say, there is a segfault on close, but it isn't critical.

from cage.

Hjdskes avatar Hjdskes commented on June 24, 2024

Great! I'll push the fix tomorrow.

from cage.

cedws avatar cedws commented on June 24, 2024

I've just noticed this is still happening if an application isn't passed. Same unresponsiveness to SIGTERM.

from cage.

Hjdskes avatar Hjdskes commented on June 24, 2024

Can you elaborate? What do you mean when you say "an application isn't passed?"

When I launch Cage with Termite and from Termite launch Epiphany, then CTRL-C Cage, everything closes immediately.

from cage.

cedws avatar cedws commented on June 24, 2024

master currently isn't building with the latest version of wlroots so I can't retest. I mean just running cage with no parameters.

from cage.

Hjdskes avatar Hjdskes commented on June 24, 2024

For what it's worth, personally I keep wlroots at 0.3 and develop against that. It's enough work to develop Cage that I'm not wanting to constantly keep up with every breaking change in wlroots :)

from cage.

Hjdskes avatar Hjdskes commented on June 24, 2024

Hm.. you're not supposed to be able to run cage without any application to start. I'll look into that.

from cage.

cedws avatar cedws commented on June 24, 2024

I personally prefer sticking to tagged releases of wlroots, but most projects don't seem to do that. I've built master now and it is still an issue.

from cage.

Hjdskes avatar Hjdskes commented on June 24, 2024

This is fixed in 848929c.

from cage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.