Re: Where Should I Report This?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux