Project

General

Profile

Bug #167

batctl outputs errors to stdout

Added by M W over 8 years ago. Updated over 4 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

History

#1

Updated by M W over 8 years ago

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

#2

Updated by Marek Lindner over 8 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.

#3

Updated by M W over 8 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?

#4

Updated by Antonio Quartulli over 8 years ago

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

#5

Updated by M W over 8 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.

#6

Updated by Marek Lindner over 8 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.

#7

Updated by M W over 8 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?

#8

Updated by Marek Lindner over 8 years ago

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

#9

Updated by Antonio Quartulli almost 8 years ago

fixed in batctl 2013.0.0

#10

Updated by Marek Lindner almost 8 years ago

  • Status changed from New to Closed
#11

Updated by Sven Eckelmann over 4 years ago

  • Target version set to 2013.0.0

Also available in: Atom PDF