selective bzr status against a historic revision fails

Bug #403523 reported by Wouter van Heyst
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Pool

Bug Description

bzr st README -r -2 fails with:

bzr: ERROR: exceptions.UnboundLocalError: local variable 'nonexistents' referenced before assignment

Traceback (most recent call last):
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 835, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 1030, in run_bzr
    ret = run(*run_argv)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 647, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 1045, in ignore_pipe
    result = func(*args, **kwargs)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/builtins.py", line 310, in run
    show_pending=(not no_pending), verbose=verbose)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/status.py", line 162, in show_tree_status
    if nonexistents:
UnboundLocalError: local variable 'nonexistents' referenced before assignment

which hides the actual error of:

bzr: ERROR: exceptions.AttributeError: 'CHKInventory' object has no attribute 'has_filename'

Traceback (most recent call last):
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 835, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 1030, in run_bzr
    ret = run(*run_argv)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 647, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/commands.py", line 1045, in ignore_pipe
    result = func(*args, **kwargs)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/builtins.py", line 310, in run
    show_pending=(not no_pending), verbose=verbose)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/status.py", line 108, in show_tree_status
    = _filter_nonexistent(specific_files, old, new)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/status.py", line 293, in _filter_nonexistent
    s = old_tree.filter_unversioned_files(orig_paths)
  File "/media/links/home/larstiq/src/bzr/bzr.dev/bzrlib/tree.py", line 596, in filter_unversioned_files
    pred = self.inventory.has_filename
AttributeError: 'CHKInventory' object has no attribute 'has_filename'

repository is 2a fwiw

Related branches

Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Martin Pool (mbp) wrote :

A similar failure occurs (see bug 408823) when running the tests in format 2a.

Changed in bzr:
assignee: nobody → Martin Pool (mbp)
milestone: none → 2.0
status: Confirmed → In Progress
Revision history for this message
Martin Pool (mbp) wrote :

The problem, obviously, is that we're accessing the nonexistents local from the finally block when it's not guaranteed to be set. It seems wrong to me to be checking this and raising an error from the finally block, regardless of the underlying error.

I also don't see why this function needs to both print the nonexistent files and also raise an error.

This comes from a change by kfogel <email address hidden> for bug 306394.

Moving the if/raise inside the try block unmasks the error.

Revision history for this message
Martin Pool (mbp) wrote :
Changed in bzr:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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