[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: Branko ─îibej <brane_at_xbc.nu>
Date: Sun, 15 Jun 2008 04:41:11 +0200

Karl Fogel wrote:
> 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,
>> "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? :-)

Nope, config values should be consistent across all sections.

>> 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?

Maybe use the right function, a.k.a. svn_config_get_bool. Or rather, add
the equivalent server_setting variant. After all there is an int
variant, beats me why a bool variant was never added.

-- Brane

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:41:56 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.