#1470 closed defect

tahoe.cfg with UTF-8 BOM should be accepted — at Version 1

Reported by: davidsarah Owned by: davidsarah
Priority: major Milestone: 1.9.2
Component: code Version: 1.8.2
Keywords: unicode config reviewed Cc:
Launchpad Bug:

Description (last modified by davidsarah)

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.

Change History (3)

comment:1 Changed at 2011-08-08T14:56:58Z by davidsarah

  • Description modified (diff)
  • Owner changed from somebody to davidsarah
  • Status changed from new to assigned

Changed at 2011-08-12T13:30:56Z by davidsarah

node.py: tolerate a UTF-8 BOM at the start of tahoe.cfg. fixes #1470

Changed at 2011-08-12T13:31:32Z by davidsarah

test_node.py: test that we tolerate a UTF-8 BOM at the start of tahoe.cfg, and can read UTF-8 option values. refs #1470

Note: See TracTickets for help on using tickets.