Clearer exceptions on config file parsing errors

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

Bug Description

While trying to open a project in Bazaar Explorer or TortoiseBzr I get the following error.

bzr: ERROR: bzrlib.util.configobj.configobj.ParseError: Invalid line at line "1".

Traceback (most recent call last):
  File "C:/Program Files/Bazaar/plugins\explorer\lib\explorer.py", line 1091, in callable_with_cleanup
  File "C:/Program Files/Bazaar/plugins\explorer\lib\explorer.py", line 1238, in _open_location_task
  File "C:/Program Files/Bazaar/plugins\explorer\lib\location.py", line 138, in __init__
  File "C:/Program Files/Bazaar/plugins\explorer\lib\location.py", line 171, in reopen_location
  File "bzrlib\branch.pyo", line 2662, in get_bound_location
  File "bzrlib\branch.pyo", line 2655, in _get_bound_location
  File "bzrlib\config.pyo", line 178, in get_user_option
  File "bzrlib\config.pyo", line 693, in _get_user_option
  File "bzrlib\config.pyo", line 369, in _get_user_option
  File "bzrlib\config.pyo", line 957, in _get_parser
  File "bzrlib\config.pyo", line 1465, in _get_configobj
  File "bzrlib\config.pyo", line 143, in ConfigObj
  File "bzrlib\util\configobj\configobj.pyo", line 1223, in __init__
  File "bzrlib\util\configobj\configobj.pyo", line 1306, in _load
ParseError: Invalid line at line "1".

bzr 2.0.3 on python 2.5.4 (win32)
arguments: ['C:\\Program Files\\Bazaar\\bzr.exe', 'explorer']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.0.1]
  explorer C:\Program Files\Bazaar\plugins\explorer [0.8.3]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [2.0.3]
  netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store [2.0.3]
  qbzr C:\Program Files\Bazaar\plugins\qbzr [0.14.5]
  rebase C:\Program Files\Bazaar\plugins\rebase [0.5.4]
  svn C:\Program Files\Bazaar\plugins\svn [1.0.0]
  upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
  xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.5]

When trying to perform a commit in Bzr I get the following error:

E:\Bazaar Source Control 2009\PYP-Byte Money-Craig Peacock>bzr commit
bzr: ERROR: bzrlib.util.configobj.configobj.ParseError: Invalid line at line "1".

Traceback (most recent call last):
  File "bzrlib\commands.pyo", line 842, in exception_to_return_code
  File "bzrlib\commands.pyo", line 1037, in run_bzr
  File "bzrlib\commands.pyo", line 654, in run_argv_aliases
  File "bzrlib\builtins.pyo", line 3058, in run
  File "bzrlib\decorators.pyo", line 192, in write_locked
  File "bzrlib\workingtree_4.pyo", line 197, in commit
  File "bzrlib\decorators.pyo", line 192, in write_locked
  File "bzrlib\mutabletree.pyo", line 195, in commit
  File "bzrlib\branch.pyo", line 240, in _get_nick
  File "bzrlib\config.pyo", line 747, in has_explicit_nickname
  File "bzrlib\config.pyo", line 750, in _get_explicit_nickname
  File "bzrlib\config.pyo", line 647, in _get_best_value
  File "bzrlib\config.pyo", line 432, in _get_nickname
  File "bzrlib\config.pyo", line 178, in get_user_option
  File "bzrlib\config.pyo", line 369, in _get_user_option
  File "bzrlib\config.pyo", line 957, in _get_parser
  File "bzrlib\config.pyo", line 1465, in _get_configobj
  File "bzrlib\config.pyo", line 143, in ConfigObj
  File "bzrlib\util\configobj\configobj.pyo", line 1223, in __init__
  File "bzrlib\util\configobj\configobj.pyo", line 1306, in _load
ParseError: Invalid line at line "1".

bzr 2.0.3 on python 2.5.4 (Windows-XP-5.1.2600-SP3)
arguments: ['bzr', 'commit']
encoding: 'cp1252', fsenc: 'mbcs', lang: None
plugins:
  bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.0.1]
  explorer C:\Program Files\Bazaar\plugins\explorer [0.8.3]
  launchpad C:\Program Files\Bazaar\plugins\launchpad [2.0.3]
  netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store [2.0.3]
  qbzr C:\Program Files\Bazaar\plugins\qbzr [0.14.5]
  rebase C:\Program Files\Bazaar\plugins\rebase [0.5.4]
  svn C:\Program Files\Bazaar\plugins\svn [1.0.0]
  upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
  xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.5]

*** 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.

Related branches

affects: bzr-explorer → bzr
Revision history for this message
Alexander Belchenko (bialix) wrote :

You have broken config file, check your .bzr/branch/branch.conf.

Revision history for this message
Zharia (craig-the-peacocks) wrote : Re: [Bug 502060] Re: Cannot open TortoiseBzr Commit window or Open project in Bazaar Explorer
Download full text (5.2 KiB)

Hi Alexander

Thank you so much, I copied the config file from a backup and it corrected
the problem.

Enjoy your day.
Craig.

--
We stand in our own shadow
and wonder why it is so dark!

2010/1/1 Alexander Belchenko <email address hidden>

> You have broken config file, check your .bzr/branch/branch.conf.
>
> --
> Cannot open TortoiseBzr Commit window or Open project in Bazaar Explorer
> https://bugs.launchpad.net/bugs/502060
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in Bazaar Version Control System: New
>
> Bug description:
> While trying to open a project in Bazaar Explorer or TortoiseBzr I get the
> following error.
>
>
> bzr: ERROR: bzrlib.util.configobj.configobj.ParseError: Invalid line at
> line "1".
>
> Traceback (most recent call last):
> File "C:/Program Files/Bazaar/plugins\explorer\lib\explorer.py", line
> 1091, in callable_with_cleanup
> File "C:/Program Files/Bazaar/plugins\explorer\lib\explorer.py", line
> 1238, in _open_location_task
> File "C:/Program Files/Bazaar/plugins\explorer\lib\location.py", line 138,
> in __init__
> File "C:/Program Files/Bazaar/plugins\explorer\lib\location.py", line 171,
> in reopen_location
> File "bzrlib\branch.pyo", line 2662, in get_bound_location
> File "bzrlib\branch.pyo", line 2655, in _get_bound_location
> File "bzrlib\config.pyo", line 178, in get_user_option
> File "bzrlib\config.pyo", line 693, in _get_user_option
> File "bzrlib\config.pyo", line 369, in _get_user_option
> File "bzrlib\config.pyo", line 957, in _get_parser
> File "bzrlib\config.pyo", line 1465, in _get_configobj
> File "bzrlib\config.pyo", line 143, in ConfigObj
> File "bzrlib\util\configobj\configobj.pyo", line 1223, in __init__
> File "bzrlib\util\configobj\configobj.pyo", line 1306, in _load
> ParseError: Invalid line at line "1".
>
> bzr 2.0.3 on python 2.5.4 (win32)
> arguments: ['C:\\Program Files\\Bazaar\\bzr.exe', 'explorer']
> encoding: 'cp1252', fsenc: 'mbcs', lang: None
> plugins:
> bzrtools C:\Program Files\Bazaar\plugins\bzrtools [2.0.1]
> explorer C:\Program Files\Bazaar\plugins\explorer [0.8.3]
> launchpad C:\Program Files\Bazaar\plugins\launchpad [2.0.3]
> netrc_credential_store C:\Program
> Files\Bazaar\plugins\netrc_credential_store [2.0.3]
> qbzr C:\Program Files\Bazaar\plugins\qbzr [0.14.5]
> rebase C:\Program Files\Bazaar\plugins\rebase [0.5.4]
> svn C:\Program Files\Bazaar\plugins\svn [1.0.0]
> upload C:\Program Files\Bazaar\plugins\upload [1.0.0dev]
> xmloutput C:\Program Files\Bazaar\plugins\xmloutput [0.8.5]
>
>
>
>
>
>
>
>
> When trying to perform a commit in Bzr I get the following error:
>
>
> E:\Bazaar Source Control 2009\PYP-Byte Money-Craig Peacock>bzr commit
> bzr: ERROR: bzrlib.util.configobj.configobj.ParseError: Invalid line at
> line "1".
>
> Traceback (most recent call last):
> File "bzrlib\commands.pyo", line 842, in exception_to_return_code
> File "bzrlib\commands.pyo", line 1037, in run_bzr
> File "bzrlib\commands.pyo", line 654, in run_argv_aliases
> File "bzrlib\builtins.pyo", line 3058, in run
> ...

Read more...

Martin Pool (mbp)
Changed in bzr:
status: New → Invalid
Revision history for this message
Alexander Belchenko (bialix) wrote : Re: Cannot open TortoiseBzr Commit window or Open project in Bazaar Explorer

Reopened.

Can we do something about such errors inside bzrlib? Maybe provide better error message to CLI user? Make a flag to force open location on GUI level even if there is no way to read branch.conf correctly? Do we lost some important information?

Changed in bzr:
status: Invalid → New
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Yeah, I think that makes sense. This error should not cause a traceback to be printed and should include the file in which the problem happened, e.g.:

bzr: ERROR: /my/path/.bzr/branch/branch.conf: Invalid line at line "1".

Changed in bzr:
status: New → Triaged
status: Triaged → Confirmed
importance: Undecided → Medium
summary: - Cannot open TortoiseBzr Commit window or Open project in Bazaar Explorer
+ Clearer exceptions on config file parsing errors
tags: added: config error-reporting
Revision history for this message
Alexander Belchenko (bialix) wrote :

> Make a flag to force open location on GUI level even if there is no way to read branch.conf correctly? Do we lost some important information?

OK, IIUC, the only one situation when we lose the important information about the bzr location is the heavyweight checkout (aka bound branch). In this case branch.conf contains very important information about master branch and bound flag, so if we can't read this information the bound branch suddenly becomes the plain branch.

That's could be a problem for someone who uses bound branches to make sure his new revisions automatically pushed to the master branch. And to detect this unwanted change bound branch -> plain branch one can only be error on `bzr update` command.

Vincent Ladeuil (vila)
Changed in bzr:
assignee: nobody → Vincent Ladeuil (vila)
status: Confirmed → In Progress
Vincent Ladeuil (vila)
Changed in bzr:
milestone: none → 2.4b5
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.