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

Re: ~/.subversion/server too picky

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-03-24 01:14:07 CET

On Fri, 23 Mar 2007, Andrew Brampton wrote:

> Hi,
> Recently I had to configure a few machines to use a webcache when accessing
> external http svn servers.
>
> The section in the servers file I changed looks like:
>
> [global]
> # http-proxy-exceptions = *.exception.com, www.internal-site.org
> # http-proxy-host = defaultproxy.whatever.com
> # http-proxy-port = 8080
>
> I changed it to:
> [global]
> # http-proxy-exceptions = *.exception.com, www.internal-site.org
> http-proxy-host = defaultproxy.whatever.com
> http-proxy-port = 8080
>
> Notice the spaces before the two uncommented lines. When I tried to use svn
> it complained:
> svn: /home/user/.subversion/servers:68: Option expected
>
> This took me a minute or two to figure out that the space was causing the
> problems, and if I removed it then it works how I wanted it.

Our configuration files attempt to be compatible with Python's
ConfigParser API. It appears that we differ from ConfigParser (circa
Python 2.4) here:

$ cat /tmp/cfg
[DEFAULT]
 foo = bar
$ python
...
>>> from ConfigParser import ConfigParser
>>> cfg = ConfigParser()
>>> cfg.read("/tmp/cfg")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/ConfigParser.py", line 267, in read
    self._read(fp, filename)
  File "/usr/lib/python2.4/ConfigParser.py", line 490, in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: /tmp/cfg
        [line 2]: ' foo = bar\n'

If I strip the leading whitespace, the configuration file reads in
fine:

$ cat /tmp/cfg
[DEFAULT]
foo = bar
>>> cfg.read("/tmp/cfg")
['/tmp/cfg']
>>> cfg
<ConfigParser.ConfigParser instance at 0xb7f00b0c>
>>> cfg.get("DEFAULT", "foo")
'bar'

> I was looking at filling a bug report, and possibly submitting a patch that
> made the parsing a little less picky (i.e. to ignore whitespace before an
> option). Now if others agree with this change I'll be happy to look into
> doing it.

I'd say we should either:

a) Error out just like Python's ConfigParser.

...or:

b) Strip leading whitespace.

  • application/pgp-signature attachment: stored
Received on Sat Mar 24 01:19:20 2007

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.