bzr-upload fails on first use when site already exists at remote server

Bug #251525 reported by John Carlyle-Clarke on 2008-07-24
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bzr Upload plugin
High
Unassigned

Bug Description

It seems that if the site's directories and files already exist on the remote server, bzr-upload fails with an unhandled error.

$ bzr -Derror upload --remember ftp://ftp.example.com
FTP <email address hidden> password:
No uploaded revision id found, switching to full upload
bzr: ERROR: bzrlib.errors.FileExists: File exists: '/Foo': 550 /Foo: Access is denied.

Traceback (most recent call last):
  File "commands.py", line 846, in run_bzr_catch_errors
  File "commands.py", line 802, in run_bzr
  File "commands.py", line 504, in run_argv_aliases
  File "/home/johncc/.bazaar/plugins/upload/__init__.py", line 129, in run
    self.upload_tree()
  File "/home/johncc/.bazaar/plugins/upload/__init__.py", line 291, in upload_tree
    self.upload_full_tree()
  File "/home/johncc/.bazaar/plugins/upload/__init__.py", line 275, in upload_full_tree
    self.make_remote_dir_robustly(relpath)
  File "/home/johncc/.bazaar/plugins/upload/__init__.py", line 201, in make_remote_dir_robustly
    self.make_remote_dir(relpath, mode)
  File "/home/johncc/.bazaar/plugins/upload/__init__.py", line 181, in make_remote_dir
    self.to_transport.mkdir(relpath, mode)
  File "ftp.py", line 353, in mkdir
  File "ftp.py", line 193, in _translate_perm_error
FileExists: File exists: '/Foo': 550 /Foo: Access is denied.

bzr 1.4 on python 2.5.1 (cygwin)
arguments: ['/usr/bin/bzr', '-Derror', 'upload', '--remember', 'ftp://ftp.example.com']
encoding: 'US-ASCII', fsenc: 'US-ASCII', lang: None
plugins:
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [unknown]
  upload /home/johncc/.bazaar/plugins/upload [0.1.0]

Martin Albisetti (beuno) on 2008-08-02
Changed in bzr-upload:
importance: Undecided → High
status: New → Confirmed
Yorik van Havre (yorikvanhavre) wrote :

I think the error handling has changed a bit since 2008, but the problem continues more or less the same. Uploading a working tree to an sftp location fails if that location already exists. For example:

I first created a "testfolder" folder on my server. Then:
bzr upload -v sftp://<email address hidden>/testfolder
<email address hidden>'s password:
No uploaded revision id found, switching to full upload
bzr: ERROR: File already exists

If I then issue:
bzr upload -v sftp://<email address hidden>/anothertestfolder
(where anothertestfolder doesn't exists before running the bzr command)
then everything works as expected.

I think the problem comes from a call to transport.ensure_base() from the upload plugin's upload_full_tree() function (line 227). Looks like ensure_base() returns errors that should be handled somehow, I'll see if I can work out a patch...

Yorik van Havre (yorikvanhavre) wrote :

Better late than never, if someone still falls here, I made a little patch for /usr/lib/pythonX.X/dist-packages/bzrlib/transport/sftp.py.

The patch simply checks if the directory exists before trying to create it. It might be solved in recent bzr code, but on my debian testing the problem is (was) still there.

Yorik van Havre (yorikvanhavre) wrote :

Actually this bug is in bzrlib itself, not in the upload plugin...

Jelmer Vernooij (jelmer) wrote :

This is a bug in bzr-upload, not. bzrlib.mkdir() is supposed to create the directory, it's an error if that directory already exists and bzrlib properly raises an exception in that case.

It's a bug in bzr-upload that it doesn't check if the directory doesn't exist before it tries to create it, or handles the exception.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers