[tahoe-lafs-trac-stream] [tahoe-lafs] #1470: tahoe.cfg with UTF-8 BOM should be accepted

tahoe-lafs trac at tahoe-lafs.org
Mon Aug 8 07:56:58 PDT 2011


#1470: tahoe.cfg with UTF-8 BOM should be accepted
----------------------------+----------------------------
     Reporter:  davidsarah  |      Owner:  davidsarah
         Type:  defect      |     Status:  assigned
     Priority:  major       |  Milestone:  soon
    Component:  code        |    Version:  1.8.2
   Resolution:              |   Keywords:  unicode config
Launchpad Bug:              |
----------------------------+----------------------------
Changes (by davidsarah):

 * owner:  somebody => davidsarah
 * status:  new => assigned


Old description:

> {{{tahoe.cfg}}} is supposed to be encoded in UTF-8. Most editors on
> Windows save UTF-8 files with an initial Byte Order Mark, but that causes
> an error on starting the node:
>
> {{{
> C:\tahoe\furry>bin\tahoe start
> STARTING 'C:\Documents and Settings\David-Sarah\.tahoe'
> Traceback (most recent call last):
>   File "C:\Python27\lib\site-
> packages\twisted-10.2.0-py2.7-win32.egg\twisted\application\app.py", li
> ne 631, in run
>     runApp(config)
>   File "C:\Python27\lib\site-
> packages\twisted-10.2.0-py2.7-win32.egg\twisted\scripts\twistd.py", lin
> e 23, in runApp
>     _SomeApplicationRunner(config).run()
>   File "C:\Python27\lib\site-
> packages\twisted-10.2.0-py2.7-win32.egg\twisted\application\app.py", li
> ne 374, in run
>     self.application = self.createOrGetApplication()
>   File "C:\Python27\lib\site-
> packages\twisted-10.2.0-py2.7-win32.egg\twisted\application\app.py", li
> ne 439, in createOrGetApplication
>     application = getApplication(self.config, passphrase)
> --- <exception caught here> ---
>   File "C:\Python27\lib\site-
> packages\twisted-10.2.0-py2.7-win32.egg\twisted\application\app.py", li
> ne 450, in getApplication
>     application = service.loadApplication(filename, style, passphrase)
>   File "C:\Python27\lib\site-
> packages\twisted-10.2.0-py2.7-win32.egg\twisted\application\service.py"
> , line 400, in loadApplication
>     application = sob.loadValueFromFile(filename, 'application',
> passphrase)
>   File "C:\Python27\lib\site-
> packages\twisted-10.2.0-py2.7-win32.egg\twisted\persisted\sob.py", line
>  210, in loadValueFromFile
>     exec fileObj in d, d
>   File "tahoe-client.tac", line 10, in <module>
>     c = client.Client()
>   File "c:\tahoe\furry\src\allmydata\client.py", line 133, in __init__
>     node.Node.__init__(self, basedir)
>   File "c:\tahoe\furry\src\allmydata\node.py", line 73, in __init__
>     self.read_config()
>   File "c:\tahoe\furry\src\allmydata\node.py", line 122, in read_config
>     self.config.read([os.path.join(self.basedir, "tahoe.cfg")])
>   File "C:\Python27\lib\ConfigParser.py", line 297, in read
>     self._read(fp, filename)
>   File "C:\Python27\lib\ConfigParser.py", line 504, in _read
>     raise MissingSectionHeaderError(fpname, lineno, line)
> ConfigParser.MissingSectionHeaderError: File contains no section headers.
> file: C:\Documents and Settings\David-Sarah\.tahoe\tahoe.cfg, line: 1
> '\xef\xbb\xbf# -*- mode: conf; coding: utf-8 -*-\n'
>
> Failed to load application: File contains no section headers.
> file: C:\Documents and Settings\David-Sarah\.tahoe\tahoe.cfg, line: 1
> '\xef\xbb\xbf# -*- mode: conf; coding: utf-8 -*-\n'
> }}}
>
> This may also apply to other configuration files.

New description:

 {{{tahoe.cfg}}} is supposed to be encoded in UTF-8. Most editors on
 Windows save UTF-8 files with an initial Byte Order Mark, but that causes
 an error on starting the node:

 {{{
 C:\tahoe\furry>bin\tahoe start
 STARTING 'C:\Documents and Settings\David-Sarah\.tahoe'
 Traceback (most recent call last):
 [...]
   File "c:\tahoe\furry\src\allmydata\client.py", line 133, in __init__
     node.Node.__init__(self, basedir)
   File "c:\tahoe\furry\src\allmydata\node.py", line 73, in __init__
     self.read_config()
   File "c:\tahoe\furry\src\allmydata\node.py", line 122, in read_config
     self.config.read([os.path.join(self.basedir, "tahoe.cfg")])
   File "C:\Python27\lib\ConfigParser.py", line 297, in read
     self._read(fp, filename)
   File "C:\Python27\lib\ConfigParser.py", line 504, in _read
     raise MissingSectionHeaderError(fpname, lineno, line)
 ConfigParser.MissingSectionHeaderError: File contains no section headers.
 file: C:\Documents and Settings\David-Sarah\.tahoe\tahoe.cfg, line: 1
 '\xef\xbb\xbf# -*- mode: conf; coding: utf-8 -*-\n'

 Failed to load application: File contains no section headers.
 file: C:\Documents and Settings\David-Sarah\.tahoe\tahoe.cfg, line: 1
 '\xef\xbb\xbf# -*- mode: conf; coding: utf-8 -*-\n'
 }}}

 This may also apply to other configuration files.

--

-- 
Ticket URL: <http://tahoe-lafs.org/trac/tahoe-lafs/ticket/1470#comment:1>
tahoe-lafs <http://tahoe-lafs.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list