_FileMover.rename may fail if the target directory is read-only

Bug #531989 reported by Karoly Negyesi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

I had a directory which was not writeable by the user and needed to run BZR_PDB=1 bzr -Derror up and then pp from_, to to figure out where it died (thanks to vila for telling me about this magical command :) ).

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

pp output:

<chx> (u'/ebs/home/kbridges/public_html/examiner-d7/.bzr/checkout/limbo/new-83', u'/ebs/home/kbridges/public_html/examiner-d7/sites/parc.dev.examiner.com/modules'

ls of the relevant dir:

<chx> dr-xr-xr-x 4 kbridges kbridges 51 Feb 25 14:33 /ebs/home/kbridges/public_html/examiner-d7/sites/parc.dev.examiner.com

and the traceback:

bzr: ERROR: exceptions.OSError: [Errno 13] Permission denied

Traceback (most recent call last):
  File "/usr/lib64/python2.4/site-packages/bzrlib/commands.py", line 842, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib64/python2.4/site-packages/bzrlib/commands.py", line 1037, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib64/python2.4/site-packages/bzrlib/commands.py", line 654, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib64/python2.4/site-packages/bzrlib/builtins.py", line 1413, in run
    view_info=view_info), possible_transports=possible_transports)
  File "/usr/lib64/python2.4/site-packages/bzrlib/workingtree.py", line 2216, in update
    return self._update_tree(old_tip, change_reporter)
  File "/usr/lib64/python2.4/site-packages/bzrlib/mutabletree.py", line 53, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib64/python2.4/site-packages/bzrlib/workingtree.py", line 2256, in _update_tree
    change_reporter=change_reporter)
  File "/usr/lib64/python2.4/site-packages/bzrlib/merge.py", line 1538, in merge_inner
    return merger.do_merge()
  File "/usr/lib64/python2.4/site-packages/bzrlib/merge.py", line 508, in do_merge
    self._do_merge_to(merge)
  File "/usr/lib64/python2.4/site-packages/bzrlib/merge.py", line 480, in _do_merge_to
    merge.do_merge()
  File "/usr/lib64/python2.4/site-packages/bzrlib/merge.py", line 622, in do_merge
    results = self.tt.apply(no_conflicts=True)
  File "/usr/lib64/python2.4/site-packages/bzrlib/transform.py", line 1453, in apply
    modified_paths = self._apply_insertions(mover)
  File "/usr/lib64/python2.4/site-packages/bzrlib/transform.py", line 1581, in _apply_insertions
    mover.rename(self._limbo_name(trans_id), full_path)
  File "/usr/lib64/python2.4/site-packages/bzrlib/transform.py", line 2798, in rename
    os.rename(from_, to)
OSError: [Errno 13] Permission denied

summary: - Permission denied error is not friendly
+ _FileMover.rename may fail if the target directory is read-only
Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Vincent Ladeuil (vila) wrote :

While it's totally unsual to have directories read-only for code, it may make sense in other contexts.

At the very least, mentioning the paths involved in that case helps the user resolve the problem.

A better fix would be to make the directory temporary writable.

Revision history for this message
Karoly Negyesi (karoly) wrote :

I agree that it's unusal and I totally said on IRC that it's a PEBKAC the error message should not be the equivalent of "stfu, n00b" :D We love bzr for its friendliness.

Jelmer Vernooij (jelmer)
tags: added: treetransform
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.