[OpenSIPS-Devel] osipsconsole output to stderr

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri May 7 18:29:18 CEST 2010


Hi Brenden,

it make sense - please send an unified patch for being uploaded on SVN.

Thanks and regards,
Bogdan

Brendan Sterne wrote:
> Hi Bogdan,
>
> In these cases osipsconsole is just using 'which' to determine if an  
> executable exists.  The return code from 'which' is used.   If which  
> doesn't find the command it returns error and also dumps to stderr,  
> but osipsconsole doesn't care about the stderr text (and neither does  
> the user).
>
> For example:
>
> system("which db_dump > /dev/null 2>&1");
> if ( $? == 0 ) {
>      $DUMP_CMD = "db_dump";
> }
>
> Also, I have found a few other issues:
>
> The ospipsconsole "dr gateway" command appears to be out-of-date with  
> regard to the dynamic routing mysql schema.  It is outputing fields by  
> row position dwid=$row[0] etc, but things don't line up any more  
> (specifically description is not being output).  I have fixed this in  
> my copy, and would like to share this fix.  How would I go about it?   
> Should I send a diff to you?
>
> Cheers,
> - Brendan
>
> Brendan Sterne
> QA Lead, Callvine
>
>
>
> On May 6, 2010, at 1:07 AM, Bogdan-Andrei Iancu wrote:
>
>   
>> Hi Brendan,
>>
>> Do you think it is a good idea to hide the errors ? I guess you would
>> like to know when something went wrong with the operation you are  
>> doing.
>> The standard output is trashed as not important, but error
>> notification/handling should be.
>>
>> What was the error in your case?
>>
>> Regards,
>> Bogdan
>>
>> Brendan Sterne wrote:
>>     
>>> Greetings,
>>>
>>> osipsconsole is printing to stderr when the 'which' command fails.
>>> Although 'which' is being redirected to /dev/null, stderr is not  
>>> being
>>> redirected.
>>>
>>> The fix I have made, is to also redirect stderr.   Attached is a  
>>> diff,
>>> showing the fixes.  How do I go about getting this fix committed (I  
>>> am
>>> new here)?
>>>
>>> < system("which db_dump > /dev/null");
>>> ---
>>>       
>>>> system("which db_dump > /dev/null 2>&1");
>>>>         
>>> 594c596
>>> < system("which db4.4_dump > /dev/null");
>>> ---
>>>       
>>>> system("which db4.4_dump > /dev/null 2>&1");
>>>>         
>>> 599c601
>>> < system("which db4.5_dump > /dev/null");
>>> ---
>>>       
>>>> system("which db4.5_dump > /dev/null 2>&1");
>>>>         
>>> 604c606
>>> < system("which db4.6_dump > /dev/null");
>>> ---
>>>       
>>>> system("which db4.6_dump > /dev/null 2>&1");
>>>>         
>>> 612c614
>>> < system("which db_load > /dev/null");
>>> ---
>>>       
>>>> system("which db_load > /dev/null 2>&1");
>>>>         
>>> 617c619
>>> < system("which db4.4_load > /dev/null");
>>> ---
>>>       
>>>> system("which db4.4_load > /dev/null 2>&1");
>>>>         
>>> 622c624
>>> < system("which db4.5_load > /dev/null");
>>> ---
>>>       
>>>> system("which db4.5_load > /dev/null 2>&1");
>>>>         
>>> 627c629
>>> < system("which db4.6_load > /dev/null");
>>> ---
>>>       
>>>> system("which db4.6_load > /dev/null 2>&1");
>>>>         
>>> 890c892
>>> <                         $TOOLPATH = `which @_`;
>>> ---
>>>       
>>>>                        $TOOLPATH = `which @_ 2> /dev/null`;
>>>>         
>>> 6841c6843
>>> < 			system("echo $X | $EGREP \"ERROR 1146\" > /dev/null");
>>> ---
>>>       
>>>> 			system("echo $X | $EGREP \"ERROR 1146\" > /dev/null 2>&1");
>>>>         
>>> 6855c6857
>>> < 			system("echo $X | $EGREP \"ERROR 1146\" > /dev/null");
>>> ---
>>>       
>>>> 			system("echo $X | $EGREP \"ERROR 1146\" > /dev/null 2>&1");
>>>>         
>>> Cheers,
>>> - Brendan
>>>
>>> Brendan Sterne
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>>
>>>
>>>       
>> -- 
>> Bogdan-Andrei Iancu
>> www.voice-system.ro
>>
>>
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>>     
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Devel mailing list