4

In theory, pressing the close button kwin close button should close an xterm. It did before I did an aptitude upgrade. (I'm running Debian testing). But now it doesn't—clicking the X does nothing—but only for some xterms.

In particular, if I launch an xterm from the KDE quicklaunch thing, or the K menu, those xterms are closeable. If, however, I launch it from a keyboard shortcut (khotkeys), then that xterm is not closeable.

Further, this is recursive: if I launch an xterm from an xterm, its closeable if its parent is.

This doesn't happen in general. It's only for xterm. I've tested starting these apps from an uncloseable xterm, and they are all closeable:

  • gvim
  • xclock
  • xditview
  • dolphin
  • konsole

Interspersing another program in there breaks the chain (e.g, starting an xterm from konsole):

  • xterm (uncloseable) → xterm (unclosable) → xterm (uncloseable) → …
  • xterm (uncloseable) → konsole (closable) → xterm (closable) → …

I've checked my kwin Window Rules, I do not have any for xterm.

9

Update: It's nVidia

Stephen Dowdy responded to the Debian bug report and suggested it may be an nVidia bug. where it is corrupting signal masks. Some searching found Debian Bug #728743, and indeed switching to Nouveau/MESA (the open-source driver) has fixed the problem.

Note that downgrading to an older nVidia driver did not, which likely means that its the nVidia drivers + some newer versions of other stuff, which I didn't bother to track down as a commenter on the bug claims that its fixed in 331.38. (I'm running 331.49 now, and its indeed fixed).

Results from strace

I ran strace on both versions. After some filtering (to make diff work better), I see a bunch of lines like:

WORKING  rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
*vs*
BROKEN   rt_sigprocmask(SIG_BLOCK, NULL, [HUP], 8) = 0

It appears that the broken version has SIGHUP blocked. Clicking the X seems to send a SIGHUP, which is ignored, so the shell doesn't exit. You can make a working one broken by trapping SIGHUP in the shell, and not exiting (but not the other way around, as it seems the shell never gets the HUP).

I've filed Debian bug #733816 about this.

As a workaround, you can wrap hotkey commands using this trivial C program:

#include <signal.h>
#include <stddef.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    sigset_t set;

    if (argc < 2) {
        fprintf(stderr, "ERROR: Expected at least a command to run\n"
                "\n"
                "USAGE: %s command [arguments]\n",
                argv[0]);
        exit(EXIT_FAILURE);
    }

    sigemptyset(&set);
    sigaddset(&set, SIGHUP);
    sigprocmask(SIG_UNBLOCK, &set, NULL);

    execvp(argv[1], argv+1);
}

Use it by compiling (say, to ~/bin/unblock-hup) then call ~/bin/unblock-hup xterm instead of xterm. Note that in the Custom Shortcuts control module, you have to put the full path to your home directory; ~ doesn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.