Skip to contentSkip to conversation

main: display errors through stderr

PATCH In review Pablo Neira Ayuso 2 participants 4 messages Feb 24, 2015 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH v2 1/1 main: display errors through stderr

Debugging still goes through stdout as Patrick requests.

---
 src/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.c +1 -1
index b447aad..4590c30 100644
@@ -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;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 4 lines · Pablo Neira Ayuso

Debugging still goes through stdout as Patrick requests.

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.

Quoted 20 lines
---
 src/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/main.c +1 -1
index b447aad..4590c30 100644
@@ -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;
Signature · 1 line
1.7.10.4
author maintainer
#2 lore raw
Quoted 9 lines · Patrick McHardy
Quoted 4 lines · Pablo Neira Ayuso

Debugging still goes through stdout as Patrick requests.

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.

#3 lore raw
Quoted 14 lines · Pablo Neira Ayuso
Quoted 9 lines · Patrick McHardy
Quoted 4 lines · Pablo Neira Ayuso

Debugging still goes through stdout as Patrick requests.

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.

Quoted 6 lines

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.