uobikiemukot / yaft

yet another framebuffer terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

execvp() trouble in the git version

misutoneko opened this issue · comments

Hi,

First of all, thanks for this great little program, it's awesome.

I think I found a bug in the git version (the 0.2.9 version is not affected).
I've tested this in qemu with FreeBSD and NetBSD guests (i386, no X, using the local fb console).
I'm not sure if this problem affects other platforms, but it probably does.
There was at least some Linux lockup issue which might be related.
In the BSD guests the symptom is that running "yaft" only briefly flashes the screen and nothing else happens.
Also, no 256 colors, printing out $TERM shows that it stayed the same etc.

I tested a few git versions and it seems this problem was introduced with commit b5904bb (dated 2018-04-29).
The commit adds some command line parsing and replaces a execl() call with a execvp() one.
Which is all fine and good, but in yaft.c (line 190 or so), the third argument to fork_and_exec() is "argv + 1" which
seems to be incorrect (should be just "argv" without the +1).

As to why, well, the man page of execvp() says:
"The first argument, by convention, should point to the filename associated with the file being executed."

But that "first argument" here refers to the argument list (which is given as the second argument to execvp()).
So it's easy to get confused there.

I'm a bit baffled why this hasn't been reported before, as this bug has been in git for a couple of years already.
Everyone just happily using 0.2.9? OK yaft is in a specific niche, but still..