Re: Adding a "--dry-run" commandline option
Fabian Keil <[email protected]>
| Newsgroups | gmane.comp.web.privoxy.devel |
|---|---|
| Message-ID | <[email protected]> |
Ramkumar Chinchani <[email protected]> wrote: > One of the components of the freedombox project is the privoxy with > updated frequently from Adblock-plus and https_everywhere > projects. But the converted files will be (eventually) coming from a trusted server operated by the FreedomBox project and are properly reviewed, right? > http://www.freedomboxfoundation.org/news/freedombox-privoxy/ > > Give the frequent updates, it is most useful if privoxy had a > way to validate the rules so that one could recover if failure. In case you aren't aware of it, I suggested in the past that it might make sense to have the conversion script additionally generate Privoxy-Regression-Test tests: https://sourceforge.net/mailarchive/forum.php?thread_name=20120121190442.4d16e017.fk%40fabiankeil.de&forum_name=ijbswa-developers This would allow more thorough checks of the results. > Please consider the following patch (tested on Linux only) Thanks for the patch. I agree that it would be an improvement. I don't like "--dry-run" as it (to me) implies something else, but wouldn't mind committing the attached modified version despite the limitations noted in the commit message. Fabian ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ Ijbswa-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ijbswa-developers
0001-Add-a-config-test-option.patch
(text/x-patch, 1.7 KB)
From c6246731d41e5b5c3b3b72abff8152401aa1878b Mon Sep 17 00:00:00 2001 From: Fabian Keil <[email protected]> Date: Wed, 7 Nov 2012 12:39:00 +0100 Subject: [PATCH] Add a --config-test option It lets Privoxy exit after checking whether or not the configuration seems valid. The limitations noted in TODO #22 and #23 still apply. Logging the problem to the logfile if one is configured and --no-daemon isn't used could be considered non-intuitive and might also clobber messages emitted by an already running instance. Based on a patch by Ramkumar Chinchani. --- jcc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/jcc.c b/jcc.c index 4a76190..435771a 100644 --- a/jcc.c +++ b/jcc.c @@ -2830,7 +2830,7 @@ static int32 server_thread(void *data) static void usage(const char *myname) { printf("Privoxy version " VERSION " (" HOME_PAGE_URL ")\n" - "Usage: %s " + "Usage: %s [--config-test] " #if defined(unix) "[--chroot] " #endif /* defined(unix) */ @@ -3020,6 +3020,7 @@ int main(int argc, char **argv) #endif { int argc_pos = 0; + int do_config_test = 0; unsigned int random_seed; #ifdef unix struct passwd *pw = NULL; @@ -3150,6 +3151,11 @@ int main(int argc, char **argv) } #endif /* defined(unix) */ + else if (strcmp(argv[argc_pos], "--config-test") == 0) + { + do_config_test = 1; + } + else if (argc_pos + 1 != argc) { /* @@ -3253,6 +3259,9 @@ int main(int argc, char **argv) # endif /* def _WIN_CONSOLE */ #endif /* def _WIN32 */ + if (do_config_test) { + exit(NULL == load_config()); + } /* Initialize the CGI subsystem */ cgi_init_error_messages(); -- 1.8.0
signature.asc
(application/pgp-signature, 196 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlCaVuMACgkQSMVSH78upWM2cwCePVeoELGwvb3OiytLDDZEamCA 7DsAoI778kqwi6910zwaiK5ByRXpLt0y =iAiJ -----END PGP SIGNATURE-----