bzr unshelve crashes losing all changes

Bug #319790 reported by Rares Saftoiu
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Robert Collins

Bug Description

In a bzr working directory that is up to date
Modify 2 files
Delete one of them
do bzr shelve
do bzr unshelve
observe bzr unshelve crashes with error:
            Unshelving changes with id "1".
            bzr: ERROR: No such file: None
At this point all your shelved changes are lost (or I have not figured out how to get them back)

Traceback:

Wed 2009-01-21 14:20:19 -0800
0.017 bzr arguments: [u'unshelve']
0.024 looking for plugins in /home/xamine/.bazaar/plugins
0.025 looking for plugins in /usr/lib/python2.4/site-packages/bzrlib/plugins
0.088 encoding stdout as sys.stdout encoding 'UTF-8'
0.145 opening working tree '/wm/recycle_bin/21/wm/src/testBZR'
[31073] 2009-01-21 14:20:19.480 INFO: Unshelving changes with id "1".
3.924 Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 893, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 839, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 539, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line 4910, in run
    Unshelver.from_args(shelf_id, action).run()
  File "/usr/lib/python2.4/site-packages/bzrlib/shelf_ui.py", line 280, in run
    merger.do_merge()
  File "/usr/lib/python2.4/site-packages/bzrlib/merge.py", line 489, in do_merge
    self._do_merge_to(merge)
  File "/usr/lib/python2.4/site-packages/bzrlib/merge.py", line 461, in _do_merge_to
    merge.do_merge()
  File "/usr/lib/python2.4/site-packages/bzrlib/merge.py", line 600, in do_merge
    self._compute_transform()
  File "/usr/lib/python2.4/site-packages/bzrlib/merge.py", line 643, in _compute_transform
    file_status = self.merge_contents(file_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/merge.py", line 1122, in merge_contents
    other_pair = contents_pair(self.other_tree)
  File "/usr/lib/python2.4/site-packages/bzrlib/merge.py", line 1097, in contents_pair
    kind = tree.kind(file_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/transform.py", line 1768, in kind
    return self._transform.final_kind(trans_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/transform.py", line 546, in final_kind
    raise NoSuchFile(None)
NoSuchFile: No such file: None

3.928 return code 3

Tags: shelf

Related branches

Revision history for this message
Wesley J. Landaker (wjl) wrote :

I can confirm this bug with the latest bzr.dev.

One note is that immediately after the crash, the shelf data still seems to be in .bzr/checkout/shelf/shelf-1, so if you really need to recover data you may be able to extract it out of there manually.

Revision history for this message
Wesley J. Landaker (wjl) wrote :

I believe this bug is a critical data loss bug. Doesn't anyone want to triage this?

Revision history for this message
Wouter van Heyst (larstiq) wrote :

This is certainly a valid bug, no doubt about that.

Changed in bzr:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Robert Collins (lifeless) wrote :

bzr init foo
cd foo
touch a b
bzr commit -m 'foo'
ls > a
bzr rm b
bzr shelve --all
bzr unshelve

Changed in bzr:
importance: Medium → High
Revision history for this message
Robert Collins (lifeless) wrote :

unshelve of deletes is broken
bzr init foo
cd foo
touch a
bzr commit -m 'foo'
bzr rm a
bzr shelve --all
bzr unshelve

Revision history for this message
Robert Collins (lifeless) wrote :

Turns out to be quite simple. I've a fix which isn't as optimised as perhaps it could be, because I don't understand all the possible places PreviewTree is used; however it works.

Revision history for this message
Bob (bartzitz) wrote :

this patch helps. thanks for your great help, Robert!

Revision history for this message
Barry Warsaw (barry) wrote :

I just hit what I think is a similar bug when I tried to 'bzr unshelve all'

% bzr unshelve all
bzr: ERROR: exceptions.ValueError: invalid literal for int() with base 10: 'all'

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 893, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 839, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 539, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 4910, in run
    Unshelver.from_args(shelf_id, action).run()
  File "/usr/lib/python2.5/site-packages/bzrlib/shelf_ui.py", line 226, in from_args
    shelf_id = int(shelf_id)
ValueError: invalid literal for int() with base 10: 'all'

bzr 1.11 on python 2.5.2 (linux2)
arguments: ['/usr/bin/bzr', 'unshelve', 'all']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  bisect /home/barry/.bazaar/plugins/bisect [1.1.0.pre.0]
  gtk /usr/lib/python2.5/site-packages/bzrlib/plugins/gtk [0.95.0.final.1]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  loom /home/barry/.bazaar/plugins/loom [1.4dev]
  lpreview /home/barry/.bazaar/plugins/lpreview [unknown]
  netrc_credential_store /usr/lib/python2.5/site-packages/bzrlib/plugins/netrc_credential_store [unknown]
  pqm /home/barry/.bazaar/plugins/pqm [1.4dev]
  touch /home/barry/.bazaar/plugins/touch [unknown]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.
% bzr unshelve
bzr: ERROR: No changes are shelved.

This is indeed a critical data loss bug.

Revision history for this message
Robert Collins (lifeless) wrote :

Barry, that looks like a completely different bug. When not-completely-sure please file new bugs :). This is fixed in bzr.dev.

Changed in bzr:
assignee: nobody → lifeless
status: Confirmed → Fix Released
Revision history for this message
Dan Watkins (oddbloke) wrote :

Barry, see bug #327461 (which I just filed).

Revision history for this message
Vincent Ladeuil (vila) wrote :

Seem to be included in 1.13.

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.