Where Should I Report This?
Am 03.01.2012 14:03, schrieb Bastien Dejean:
> I've been using stderred and one of the things that everyone would
> expect to work doesn't.
> Is there a bug here?
> If so, where should I report it?
>  https://github.com/sickill/stderred
>  https://github.com/sickill/stderred/issues/13
I don't really know how stderred is supposed to work, but the test case
in the bug report is wrong, and the author does not seem to understand
(or care) what is going on either - basically, I suspect that his method
of doing things (overwriting the write() call) is stupid and can never
work with a >&2 redirection (without checking further details now).
Here is what I can tell at a short glance:
$ echo foo >&2
uses the shell builtin 'echo', then the shell redirects to file
python> print('foo', file = sys.stderr)
directly writes to file descriptor 2.
$ strace -ewrite echo foo >&2
calls the binary /bin/echo, which writes to fd 1. The output to fd 1 is
then redirected to fd 2 by the shell. Needless to say, this cannot work
as you expect, as the author only intercepts calls to write(2, ...) -
while the shell actually closed fd 2, and duplicated fd 1 to be the new fd2.
I hate to say it, but considering the ignorance of the author and the
method he uses to change what happens when you write to fd 2, stderred
is probably not a project you want to use.
(Better idea: execute a wrapper that closes file descriptor 2, opens a
new one using pipe(), intercept everything that is printed to that pipe,
modify it and dump it to fd 1. That wrapper then executes your shell.
Much cleaner and more universal than a LD_PRELOAD hack.)