[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: parsing of boolean config options

From: Karl Fogel <kfogel_at_red-bean.com>
Date: Sat, 14 Jun 2008 22:14:07 -0400

Bernd Kreuss <prof7bit_at_googlemail.com> writes:
> After digging around in the source code to find out what the default
> behavior of subversion should be I came across the following lines,
> mentioned in the posting above which may not necessarily cause the
> original error but seem to be a bug anyway:
>
> subversion/libsvn_ra_neon/session.c around line 1240 and
> subversion/libsvn_ra_dav/session.c around line 846
>
> /* See if the user wants us to trust "default" openssl CAs. */
> trust_default_ca = svn_config_get_server_setting(
> cfg, server_group,
> SVN_CONFIG_OPTION_SSL_TRUST_DEFAULT_CA,
> "true");
>
> if (svn_cstring_casecmp(trust_default_ca, "true") == 0)
> {
> ne_ssl_trust_default_ca(sess);
> ne_ssl_trust_default_ca(sess2);
> }
>
> it compares the config value with the *string* "true" which does not
> take into account that it also could be "yes"/"no", "1"/"0", "on"/"off"

Yes, we don't document our true vs false values clearly, and as a result
we ourselves don't know what we should be accepting. The only
documentation I could find in ~/.subversion/ itself was in the 'config'
file, which had this text:

   ### Set diff3-has-program-arg to 'true' or 'yes' if your 'diff3'
   ### program accepts the '--diff-program' option.
   # diff3-has-program-arg = [true | false]

So apparently we're willing to accept "yes" or "true" there... Ugh.

The solution is a function that converts string->boolean, ignoring case
and allowing various common string values to mean the obvious things.
But first we should decide

   - what things to accept (your list above looks good)

   - what things to *encourage* (imho, "true"/"false" is appropriate in
     some cases, "yes"/"no" in others)

Thoughts? Feel like writing a patch? :-)

> also all default values seem to be spread around all over the code and
> are sometimes even redundantly defined more than once.

This is a separate badness; could you give some examples? Do you mean
they're provided as the last param to svn_config_get_server_setting()
in multiple places?

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-06-15 04:14:23 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.