[arch-general] Where Should I Report This?

Thomas Bächler thomas at archlinux.org
Tue Jan 3 08:24:16 EST 2012


Am 03.01.2012 14:03, schrieb Bastien Dejean:
> Hi,
> 
> I've been using stderred[1] and one of the things that everyone would
> expect to work doesn't[2].
> 
> Is there a bug here?
> If so, where should I report it?
> 
> [1] https://github.com/sickill/stderred
> [2] 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
descriptor 2.

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.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-general/attachments/20120103/37555d7d/attachment.asc>


More information about the arch-general mailing list