If you have some syntax error in a large filter rule
(for example because the syntax changed since last
version), privoxy doesn't start but dies with an error
message, which shows the complete rule, but doesn't
mention which line in the rule was wrong.
For example the following rule
{\
-add-header \
-block \
+deanimate-gifs{last} \
-downgrade \
+filter{html-annoyances} \
+filter{content-cookies} \
+filter{js-annoyances} \
+filter{no-popups} \
+filter{webbugs} \
#+filter{nimda} \
#+filter{banners-by-size} \
+no-compression \
+hide-forwarded \
+hide-from{block} \
+hide-referer{forge} \
+hide-user-agent{Mozilla/6.0 (compatible; en-US)
Gecko/22220101} \
-image \
+image-blocker{pattern} \
+no-cookies-keep \
-no-cookies-read \
-no-cookies-set \
+no-popups \
-vanilla-wafer \
-wafer \
}
/ # Match all URLs
gives only the error message:
Aug 11 14:17:12 Privoxy(01024) Fatal error: can't load
actions file '/etc/privoxy/my.action': invalid line
(42): {-add-header -block +deanimate-gifs{last}
-downgrade +filter{html-annoyances}
+filter{content-cookies} +filter{js-annoyances}
+filter{no-popups} +filter{webbugs} +no-compression
+hide-forwarded +hide-from{block} +hide-referer{forge}
+hide-user-agent{Mozilla/6.0 (compatible; en-US)
Gecko/22220101} -image +image-blocker{pattern}
+no-cookies-keep -no-cookies-read -no-cookies-set
+no-popups -vanilla-wafer -wafer }
But it doesn't give any hint, which command caused the
problem. Now the user has to manually remove every line
until he finds the broken one.
It would be great, if privoxy could mention the broken
command itself.
This problem was reported twice to me as the Debian
maintainer of privoxy...
Ciao
Roland
Logged In: YES
user_id=875547
Originator: NO
The problem here is that Privoxy first uses a generic
line parser to strip away comments and line breaks,
and then another function to interpret the result
and complain in case of errors.
This second function no longer knows in which line
the original problem occurred, it just sees one
normalized line and where it started.
A trivial patch to name the offending action is:
Index: actions.c
RCS file: /cvsroot/ijbswa/current/actions.c,v
retrieving revision 1.36
diff -u -r1.36 actions.c
--- actions.c 28 Dec 2006 17:15:42 -0000 1.36
+++ actions.c 27 Jan 2007 18:08:15 -0000
@@ -739,6 +739,7 @@
else
{
/* Bad action name */
+ log_error(LOG_LEVEL_ERROR, "Action or alias \'%s\' unknown.", option);
return JB_ERR_PARSE;
}
}
However it's a bit unclean from a design perspective
and has several limitations. For example it
causes two error lines for one problem:
Error: Action or alias '+unknown-action-to-test-with' unknown.
Fatal error: can't load actions file '/usr/local/etc/privoxy/fk.action': invalid line (869): {-add-header -block +deanimate-gifs{last} +image-blocker{pattern} +unknown-action-to-test-with }
the mentioned "line number problem" remains and it
only works for invalid actions but not for formatting
issues (these could probably handled in a similar
fashion, I just haven't looked into it yet).
I would argue that it would still be an improvement
and if no one objects I don't mind committing it for now
until someone feels like rewriting large parts of Privoxy's
file parsers to implement a clean solution.
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).