Project

General

Profile

Actions

Bug #167

closed

batctl outputs errors to stdout

Added by M W over 11 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
12/01/2012
Due date:
% Done:

0%

Estimated time:

Description

Calls of batctl like "batctl if foo" output error messages to stdout instead of stderr.
This is important for scrips so that errors messages can be filtered out.
In short; "batctl if foo 2> /dev/null" doesn't work. :)


Files

errors_to_stderr.patch (19.4 KB) errors_to_stderr.patch M W, 12/04/2012 03:09 AM
errors_to_stderr.patch (36.2 KB) errors_to_stderr.patch M W, 12/04/2012 12:22 PM
Actions #1

Updated by M W over 11 years ago

Another but very minor thing. "batctl -h" should exit with status code 0, not 1.

Actions #2

Updated by Marek Lindner over 11 years ago

Hey, how about you provide a patch for these "minor things" ? If you need an idea how to do the stderr thingy take a look at the batctl td code. There, I already made similar changes.

Actions #3

Updated by M W over 11 years ago

I can pick that lower hanging fruit and make a patch.
But I niticed that that there are a lot of printf("Error [...]")
calls in other places than main.c. Is it ok to fix
them in one go?

Actions #4

Updated by Antonio Quartulli over 11 years ago

well, if all the changes can be grouped under the subject "print errors to stderr", I think it is doable.

Actions #5

Updated by M W over 11 years ago

I have made a preliminary patch - see attachment.

At the moment the usage information is printed
in cases of an error (atm. to stdout still).

So the question arises if the usage should be redirected
to stderr as well in case it is displayed because of an error.
Or we remove the usage display and only display it when -h
is used. Imo, this approach would make the error output less cluttered.

Actions #6

Updated by Marek Lindner over 11 years ago

The patch looks pretty good!

IMHO, you can always direct the usage to stderr. If somebody calls the help on purpose he won't redirect the error output to /dev/null ?

Personally, I like having the help displayed in case of an error. Most people don't know how to continue if something does not work as expected.

Actions #7

Updated by M W over 11 years ago

Here is the complete patch.
If it looks alright I can send it to the mailing list.
Is there a specific patch format required?

Actions #8

Updated by Marek Lindner over 11 years ago

Feel free to send it to the list. For the format please check the "submitting patches" section here: Contribute

Actions #9

Updated by Antonio Quartulli over 10 years ago

fixed in batctl 2013.0.0

Actions #10

Updated by Marek Lindner over 10 years ago

  • Status changed from New to Closed
Actions #11

Updated by Sven Eckelmann about 7 years ago

  • Target version set to 2013.0.0
Actions

Also available in: Atom PDF