FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 01-03-2012, 12:03 PM
Bastien Dejean
 
Default Where Should I Report This?

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

Greetings,
--
b.d
(| |)
^ ^
 
Old 01-03-2012, 12:24 PM
Thomas Bächler
 
Default Where Should I Report This?

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.)
 
Old 01-04-2012, 03:59 PM
Bastien Dejean
 
Default Where Should I Report This?

Thomas Bächler:

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

Seems `hilite`[1] has followed that road.

[1] http://sourceforge.net/projects/hilite/

Thanks,
--
b.d
(| |)
^ ^
 

Thread Tools




All times are GMT. The time now is 11:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org