On Tue, Jun 21, 2016 at 01:11:16PM +0200, Henning Brauer wrote: > * Stefan Sperling <s...@stsp.name> [2016-06-21 11:15]: > > Generally, I would appreciate more detailed error messages from the pf.conf > > parser. I recall several occasions where pfctl threw "syntax error" and more > > specific error reporting would have saved me some time with finding the > > silly mistake I made. And in this case the ruleset loads successfully even > > though, while parsing, we already know it's not going to work as intended... > > true, that's shared by all yacc-style parsers, if the grammar doesn't > match you just get syntax error without much of a hint what's wrong.
The reason pfctl is not giving much details about the error is also determined by the way it is written. Take for example bc(1), also using a yacc parser. $ bc 1=a bc: stdin:1: syntax error: = unexpected a = b c bc: stdin:2: syntax error: c unexpected a =&9 bc: stdin:3: illegal character: & unexpected Which is more helpfull than what pfctl produces in similar cases. -Otto > > however, the ruleset in this case does NOT load. > > <brahe@quigon> $ echo '"a macro with spaces"="foo"\npass from $a\ macro\ > with\ spaces"' | pfctl -nvf - > a macro with spaces = "foo" > stdin:2: macro 'a' not defined > stdin:2: syntax error > > > Only as long as it doesn't make the parser code overly complex, of course. > > But currently the balance is tilted too much towards terse error messages > > for my taste. So I liked benno's first diff. > > it's just a tiny check indeed, which swings the "cost" (not in > financial terms) vs benefit pendulum towards the benefit side, yes. > > -- > Henning Brauer, h...@bsws.de, henn...@openbsd.org > BS Web Services GmbH, http://bsws.de, Full-Service ISP > Secure Hosting, Mail and DNS. Virtual & Dedicated Servers, Root to Fully > Managed > Henning Brauer Consulting, http://henningbrauer.com/