"bzr push" fails with vsftpd

Bug #129786 reported by Marcus Trautwig
6
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Unassigned

Bug Description

bzr 0.18
Transport: FTP
Server: vsFTPd 2.0.3

I'm able to branch/checkout from a certain FTP server, but any write operation (push, init, merge, ...) to that FTP server fails with an error message like this:
bzr: ERROR: Generic path error: '/test/.bzr/repository/lock/72k47q9ysd.tmp/info': : unable to rename to u'/test/.bzr/repository/lock/72k47q9ysd.tmp/tmp.info.1185998528.367719889.13603.9k0x24hwtr': 550 RNFR command failed.)

Log:
FTP put: /test/.bzr/repository/lock/72k47q9ysd.tmp/info
unable to understand error for path: /test/.bzr/repository/lock/72k47q9ysd.tmp/info: 550 RNFR command failed.
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 729, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 691, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 389, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 791, in run
    push_result = br_from.push(br_to, overwrite)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 127, in read_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1544, in push
    target.lock_write()
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1320, in lock_write
    repo_token = self.repository.lock_write()
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 252, in lock_write
    return self.control_files.lock_write(token=token)
  File "/usr/lib/python2.5/site-packages/bzrlib/lockable_files.py", line 258, in lock_write
    token_from_lock = self._lock.lock_write(token=token)
  File "/usr/lib/python2.5/site-packages/bzrlib/lockdir.py", line 556, in lock_write
    return self.wait_lock()
  File "/usr/lib/python2.5/site-packages/bzrlib/lockdir.py", line 485, in wait_lock
    return self.attempt_lock()
  File "/usr/lib/python2.5/site-packages/bzrlib/lockdir.py", line 451, in attempt_lock
    return self._attempt_lock()
  File "/usr/lib/python2.5/site-packages/bzrlib/lockdir.py", line 217, in _attempt_lock
    tmpname = self._create_pending_dir()
  File "/usr/lib/python2.5/site-packages/bzrlib/lockdir.py", line 277, in _create_pending_dir
    info_bytes)
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/__init__.py", line 730, in put_bytes_non_atomic
    dir_mode=dir_mode)
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/__init__.py", line 771, in put_file_non_atomic
    return self.put_file(relpath, f, mode=mode)
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/ftp.py", line 323, in put_file
    self._rename_and_overwrite(tmp_abspath, abspath, f)
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/ftp.py", line 477, in _rename_and_overwrite
    unlink_func=lambda p: self._delete(p, f))
  File "/usr/lib/python2.5/site-packages/bzrlib/osutils.py", line 205, in fancy_rename
    rename_func(new, tmp_name)
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/ftp.py", line 476, in <lambda>
    rename_func=lambda p1, p2: self._rename(p1, p2, f),
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/ftp.py", line 455, in _rename
    ': unable to rename to %r' % (abs_to))
  File "/usr/lib/python2.5/site-packages/bzrlib/transport/ftp.py", line 181, in _translate_perm_error
    raise unknown_exc(path, extra=extra)
FtpPathError: Generic path error: '/test/.bzr/repository/lock/72k47q9ysd.tmp/info': : unable to rename to u'/test/.bzr/repository/lock/72k47q9ysd.tmp/tmp.info.1185998528.367719889.13603.9k0x24hwtr': 550 RNFR command failed.)

return code 3

In order to see what's going on I monitored the connection with Wireshark. What happens is that bzr stores a file under a temporary name, then tries to rename the file using its final name (I suspect this is intended because of concurrency reasons) and finally fails to interpret the error message correctly:
C: STOR /test/.bzr/branch-lock/aptufh7qnq.tmp/info.tmp.1185994540.531426907.8842.385769306

S: 150 Ok to send data.

S: 226 File receive OK.

-------------------------------------------------------------------------------------------------
C: RNFR /test/.bzr/branch-lock/aptufh7qnq.tmp/info

S: 550 RNFR command failed.

On another FTP server, write operations work perfectly because that server returns a different error message for the first RNFR (ReName FRom) with the "wrong" file name:
C: STOR /bzr/test/.bzr/branch-lock/yif8vj7efe.tmp/info.tmp.1185995047.747515917.9064.1607528267

S: 150 Opening BINARY mode data connection for /bzr/test/.bzr/branch-lock/yif8vj7efe.tmp/info.tmp.1185995047.747515917.9064.1607528267

S: 226 Transfer complete.
-------------------------------------------------------------------------------------------------

C: RNFR /bzr/test/.bzr/branch-lock/yif8vj7efe.tmp/info

S: 550 /bzr/test/.bzr/branch-lock/yif8vj7efe.tmp/info: No such file or directory

-------------------------------------------------------------------------------------------------
C: RNFR /bzr/test/.bzr/branch-lock/yif8vj7efe.tmp/info.tmp.1185995047.747515917.9064.1607528267

S: 350 File or directory exists, ready for destination name.

C: RNTO /bzr/test/.bzr/branch-lock/yif8vj7efe.tmp/info

S: 250 Rename successful

C: RNFR /bzr/test/.bzr/branch-lock/yif8vj7efe.tmp

S: 350 File or directory exists, ready for destination name.

C: RNTO /bzr/test/.bzr/branch-lock/held

S: 250 Rename successful

As can be seen in the vsFTPd source code (ftp://vsftpd.beasts.org/users/cevans/untar/vsftpd-2.0.5/postlogin.c; lines 1206-1220), vsFTPd always returns "550 RNFR command failed." if a source file doesn't exist, so bzr should interpret this message as errors.NoSuchFile exception.

Related branches

Revision history for this message
Marcus Trautwig (marcus-trautwig) wrote :

This patch against bzr.dev (works also for 0.18) should fix this bug by translating the vsFTPd specific error message to the correct exception

Aaron Bentley (abentley)
Changed in bzr:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
RML00 (rml-image) wrote :

Hi.

As of version 1.0, this patch works but has still not been applied to the distribution.

Revision history for this message
Christian Tschabuschnig (tschaboo) wrote :

Will this patch be integrated into v1.2?
If not, why?

Currently I have to patch every single installation of bzr because I'm using vsftp.

Revision history for this message
Christian Tschabuschnig (tschaboo) wrote :

The patch is now in bzr.dev (Rev# 3322, 2008-04-01) and should be in Bazaar 1.4

Changed in bzr:
status: Triaged → Fix Committed
Changed in bzr:
status: Fix Committed → Fix Released
milestone: none → 1.4rc1
Changed in bzr:
milestone: 1.4rc1 → 1.4
Revision history for this message
Wrwrwr (wrwrwr) wrote :

The current Hardy version (1.3.1) still has the problem (550 RNFR ..., with vsftpd), installing package from Interpid (1.6.1) or compiling the latest upstream version works fine.

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.