bzr config fails to unquote non-string values

Bug #908050 reported by Vincent Ladeuil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Vincent Ladeuil

Bug Description

With the recent support for proper quoting (so to speak ;) a new failure mode has been introduced leading to 'bzr config' crashing:

 bzr config
locations:
  [/home/vila/src/bzr]
  post_commit_to = <email address hidden>
  news_merge_files = doc/en/release-notes/bzr-2.5.txt
  mypush = lp:~vila/bzr/{basename}
branch:
  parent_location = bzr+ssh://bazaar.launchpad.net/+branch/bzr/
  gtk_global_commit_message = Bogus implementation passing smoke test
  gtk_file_commit_messages = de
  push_location = bzr+ssh://bazaar.launchpad.net/~vila/bzr/832046-globs-store-ordered/
bzr: ERROR: exceptions.KeyError: 0

Traceback (most recent call last):
  File "/home/vila/src/bzr/trunk/bzrlib/commands.py", line 919, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/vila/src/bzr/trunk/bzrlib/commands.py", line 1124, in run_bzr
    ret = run(*run_argv)
  File "/home/vila/src/bzr/trunk/bzrlib/commands.py", line 672, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/vila/src/bzr/trunk/bzrlib/commands.py", line 694, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/home/vila/src/bzr/trunk/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/home/vila/src/bzr/trunk/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/home/vila/src/bzr/trunk/bzrlib/commands.py", line 1141, in ignore_pipe
    result = func(*args, **kwargs)
  File "/home/vila/src/bzr/trunk/bzrlib/config.py", line 3840, in run
    self._show_matching_options('.*', directory, scope)
  File "/home/vila/src/bzr/trunk/bzrlib/config.py", line 3928, in _show_matching_options
    value = store.unquote(value)
  File "/home/vila/src/bzr/trunk/bzrlib/config.py", line 3134, in unquote
    value = self._config_obj._unquote(value)
  File "/home/vila/src/bzr/trunk/bzrlib/util/configobj/configobj.py", line 1710, in _unquote
    if (value[0] == value[-1]) and (value[0] in ('"', "'")):
  File "/home/vila/src/bzr/trunk/bzrlib/util/configobj/configobj.py", line 587, in __getitem__
    val = dict.__getitem__(self, key)
KeyError: 0

bzr 2.5.0dev5 on python 2.7.2 (Linux-3.0.0-14-generic-x86_64-with-
    Ubuntu-11.10-oneiric)
arguments: ['/home/vila/bin/bzr', 'config']
plugins: bash_completion[2.5.0dev5], bisect[1.1.0dev], bookmarks[2.3.0dev],
    builddeb[2.7.0dev], builder[unknown], bzrtools[2.4.0],
    changelog_merge[2.5.0dev5], defaultToUrllib[unknown], diffstat[0.2.0],
    email[unknown], explorer[1.2.1], gardener[1.0.0dev], graph[1.0.0],
    grep[0.5.0dev], gtk[0.101.0dev], guess[unknown], hg[0.2.0dev],
    launchpad[2.5.0dev5], local_test_server[unknown], loom[2.2.1dev],
    netrc_credential_store[2.5.0dev5], news_merge[2.5.0dev5],
    po_merge[2.5.0dev5], pqm[1.4.0dev], qbzr[0.22.0dev], rewrite[0.6.2dev],
    stats[0.1.0dev], svn[1.1.2dev], tiplog[0.0.1dev],
    update_copyright[0.1.0dev], upload[1.0.1dev], weave_fmt[2.5.0dev5],
    webdav[1.12.3dev], wikkid[unknown], xmloutput[0.8.7]
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Annoying but rather trivial to fix, the culprit being the very naive implementation of unquote in configobj

Related branches

Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.5b5
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.