c00kiemon5ter / monsterwm

tiny but monstrous tiling window manager
https://github.com/c00kiemon5ter/monsterwm
Other
335 stars 44 forks source link

Spawning a non-existent command makes monsterwm segfault #9

Closed LemonBoy closed 12 years ago

LemonBoy commented 12 years ago

The title says it all, don't have much time to check myself where this happens but i guess it's after the forking happens.

c00kiemon5ter commented 12 years ago

a non-existent command as part of the .com, like:

static const char *fakecmd[]  = { "fakecmd", NULL };
[...]
{  MOD4,             XK_f,          spawn,             {.com = fakecmd}},

should just result in:

monsterwm: execvp fakecmd: No such file or directory

on the other hand, a non-existent command as part of the function should be caught in the compilation process, like

$ cat config.h
[...]
{  MOD4,             XK_e,          fake,              {NULL}},
[...]
$ make
[...]
config.h:92:41: error: ‘fake’ undeclared here (not in a function)
[...] // many warnings for config.h missing initializer
make: *** [monsterwm.o] Error 1

So what are you doing that causes a segfault ? or what do you mean by non-existent command ?

LemonBoy commented 12 years ago

I have the command 'urxvt -e newsbeuter' bind to a key but newsbeuter isn't installed. Urxvt exits gracefully but somehow when spawned by monsterwm it makes the whole thing segfault.

Cloudef commented 12 years ago

@LemonBoy, can you show your execution line? make sure you do 'urxvt', '-e', 'newsbeuter' I launch stuff with urxvt same way and it works fine.

c00kiemon5ter commented 12 years ago

doesn't seem to affect it here, using

static const char *fakecmd[] = { "urxvt", "-e", "newsbeuter", NULL };
[...]
{  MOD4,             XK_f,          spawn,             {.com = fakecmd}},
[...]

urxvt spawns for a split second, and exits immediately, as newsbeuter fails to start no segfault though, everything is normal.

LemonBoy commented 12 years ago
static const char *newscmd[]    = { "urxvt", "-name" , "news" , "-e", "newsbeuter" , NULL };
[...]
{  MOD1|SHIFT,       XK_n,          spawn,             {.com = newscmd}},
[...]

Same as you, i guess the bug is somewhere else then.

c00kiemon5ter commented 12 years ago

same thing as before, urxvt spawns for a split second, and exits immediately, as the command passed to -e fails to start I dont see why it would segfault.

could you give me the output of this just in case:

$ ls -l $(which cc)
$ cc --version

I use gcc 4.7.0 here

LemonBoy commented 12 years ago

Same gcc version, I'm on arch too.

c00kiemon5ter commented 12 years ago

ah! found it :D You need to have a rule set for that app, and it should spawn on another empty desktop. If you're on the desktop that the app will be spawned, then there's no problem. I'll see what I can do about it.