[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: ps output redirection problem [BUG, SOLVED]
From: Ignacio_García_Pérez <iggarpe () terra ! es>
Date: 2007-03-28 13:43:44
Message-ID: 460A7110.3060108 () terra ! es
[Download RAW message or body]
Luciano Miguel Ferreira Rocha escribió:
Ok. Mistery solved:
Have a look at the last line of format_process in procps/ps.c:
printf("%.*s\n", terminal_width, buffer);
The terminal_width variable gets initialized to INT_MAX when there is no
terminal (which is the case when we are redirecting the output), and
*for some reason, printf does not line such a huge value !!!*
I've verified that using 1000 instead of INT_MAX *solves the problem*,
but doesn't look like a good solution. Perhaps the ps.c code maintainer
could come up with a better solution.
> On Wed, Mar 28, 2007 at 12:22:30PM +0200, Ignacio García Pérez wrote:
>
>> Luciano Miguel Ferreira Rocha escribió:
>>
>>> On Wed, Mar 28, 2007 at 11:58:05AM +0200, Ignacio García Pérez wrote:
>>>
>>>
>>>> Hi,
>>>>
>>>> I just noticed that
>>>>
>>>> ps > out.txt
>>>>
>>>> ps 2>&1 > out.txt
>>>>
>>>> Produce an empty out.txt file. If no output redirection is used, the
>>>> output of the ps command is as expected.
>>>>
>>>> Any idea of what's wrong?
>>>>
>>>>
>>> Are you using busybox statically linked to glibc?
>>>
>>>
>>>
>> I'm using busybox 1.4.2 dynamically linked to glibc.
>>
>
> That clears glibc. What shell are you using?
>
> And could you please reply also to the list, to keep the discussion
> there?
>
>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic