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

Bug #251525 reported by John Carlyle-Clarke
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Breezy
Triaged
Medium
Unassigned
bzr Upload plugin
Confirmed
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]

Tags: upload
Martin Albisetti (beuno)
Changed in bzr-upload:
importance: Undecided → High
status: New → Confirmed
Revision history for this message
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...

Revision history for this message
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.

Revision history for this message
Yorik van Havre (yorikvanhavre) wrote :

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

Revision history for this message
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.

Jelmer Vernooij (jelmer)
Changed in brz:
status: New → Triaged
importance: Undecided → Medium
tags: added: upload
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.