diff mbox

[nft,v2] main: display errors through stderr

Message ID 1424802770-31213-1-git-send-email-pablo@netfilter.org
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Pablo Neira Ayuso Feb. 24, 2015, 6:32 p.m. UTC
Debugging still goes through stdout as Patrick requests.

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1000
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Patrick McHardy Feb. 24, 2015, 6:35 p.m. UTC | #1
On 24.02, Pablo Neira Ayuso wrote:
> Debugging still goes through stdout as Patrick requests.
> 
> Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1000
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Thinking about it, EREC_INFORMATIONAL should also go to stdout I
suppose. But since we don't have any of those yet, we can change
it once we get the first message of this type.

> ---
>  src/main.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/main.c b/src/main.c
> index b447aad..4590c30 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -361,7 +361,7 @@ int main(int argc, char * const *argv)
>  		rc = NFT_EXIT_FAILURE;
>  out:
>  	scanner_destroy(scanner);
> -	erec_print_list(stdout, &msgs);
> +	erec_print_list(stderr, &msgs);
>  
>  	xfree(buf);
>  	return rc;
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira Ayuso Feb. 24, 2015, 7:01 p.m. UTC | #2
On Tue, Feb 24, 2015 at 06:35:05PM +0000, Patrick McHardy wrote:
> On 24.02, Pablo Neira Ayuso wrote:
> > Debugging still goes through stdout as Patrick requests.
> > 
> > Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1000
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> Thinking about it, EREC_INFORMATIONAL should also go to stdout I
> suppose. But since we don't have any of those yet, we can change
> it once we get the first message of this type.

I just remembered that bison is currently using stderr as output for
debugging.

We're also telling people to save their rulesets via:

        nft list ruleset > file

If debugging still goes to stdout this will cause them problems. Not
sure yet we should use stdout for debugging.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Patrick McHardy Feb. 24, 2015, 7:18 p.m. UTC | #3
On 24.02, Pablo Neira Ayuso wrote:
> On Tue, Feb 24, 2015 at 06:35:05PM +0000, Patrick McHardy wrote:
> > On 24.02, Pablo Neira Ayuso wrote:
> > > Debugging still goes through stdout as Patrick requests.
> > > 
> > > Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1000
> > > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > 
> > Thinking about it, EREC_INFORMATIONAL should also go to stdout I
> > suppose. But since we don't have any of those yet, we can change
> > it once we get the first message of this type.
> 
> I just remembered that bison is currently using stderr as output for
> debugging.
> 
> We're also telling people to save their rulesets via:
> 
>         nft list ruleset > file
> 
> If debugging still goes to stdout this will cause them problems. Not
> sure yet we should use stdout for debugging.

I still think it makes sense since you explicitly requested it, its not
an error, its very useful to be able to pipe it to less directly and
it preserves order between regular output and debugging without doing
anything else.

I guess people simply shouldn't save their rulesets when enabling
debugging. Its not like we're doing it by default.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/main.c b/src/main.c
index b447aad..4590c30 100644
--- a/src/main.c
+++ b/src/main.c
@@ -361,7 +361,7 @@  int main(int argc, char * const *argv)
 		rc = NFT_EXIT_FAILURE;
 out:
 	scanner_destroy(scanner);
-	erec_print_list(stdout, &msgs);
+	erec_print_list(stderr, &msgs);
 
 	xfree(buf);
 	return rc;