[BUG] ftp transport and push operation

John Arbash Meinel john at arbash-meinel.com
Mon Jan 16 01:34:57 GMT 2006


Alexander Belchenko wrote:
> I try to push my bzr.exe branch to site via ftp. I got permanent error
> like this:
> 
> TransportError: 553-Can't open that file: No such file or directory
> 553 Rename/move failure: No such file or directory
> 
> When I look into .bzr.log I see that this error occurs when bzr try to
> push revision-store:

I think the bug is that FTPTransport is not properly raising a
NoSuchFile exception when a file doesn't exist. (as you can see, you are
getting a generic TransportError.

The reason is this bit of code in the TextStore.put()

def _try_put(self, fn, f):
    try:
        self._transport.put(fn, f, mode=self._file_mode)
    except NoSuchFile:
        if not self._prefixed:
            raise
        try:
            self._transport.mkdir(os.path.dirname(fn),
                                  mode=self._dir_mode)
        except FileExists:
            pass
        self._transport.put(fn, f, mode=self._file_mode)


Basically, we only create the directory if we fail to put a file there.
That way we don't have to attempt to create the directory *every* time
we put a file, only if it fails.

The big problem is that the FTP transport is not properly tested,
because we don't have an FTP server we can easily test with.

John
=:->

> 
> add store entry 'bialix at ukr.net-20060115005924-d6144061a9fa662b'
> FTP has not:
> /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b
> 
> FTP has not:
> /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b.gz
> 
> FTP put:
> /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b
> 
> [ 5244] Sun 04:02:27.217 ERROR: 553-Can't open that file: No such file
> or directory
> 553 Rename/move failure: No such file or directory
> Traceback (most recent call last):
> ...
> 
> I think the bug caused by the fact that bzr try to put file to server in
> non-existent directory. Because branch format 6 use prefixed stores I
> think this is root of problem. Error log attached.
> 
> In log you can see that before storing weaves needed prefixed directory
> was created. But before storing revision-store prefixed directory was
> not created.
> 
> -- 
> Alexander
> 
> 
> ------------------------------------------------------------------------
> 
> bzr 0.7rc1 invoked on python 2.4.2.final.0 (win32)
>   arguments: ['c:\\utils\\bzr.py', 'push', 'ftp://myhost/public_html/bzr/bzr.exe/']
>   working dir: u'D:\\push\\bzr.exe'
> looking for plugins in E:\work\Python\bzr\bzr.dev-rus\bzrlib\plugins
> Plugin name __init__ already loaded
> Plugin name __init__ already loaded
> looking for plugins in E:\work\python\bzr\plugins.work
> add plugin name bzrtools-0.6.1
> add plugin name version_info
> add plugin name ztransport
> load plugin (None, 'E:\\work\\python\\bzr\\plugins.work\\bzrtools-0.6.1', ('', '', 5))
> registered plugin command shelve
> registered plugin command unshelve
> registered plugin command clean-tree
> registered plugin command graph-ancestry
> registered plugin command fetch-ghosts
> registered plugin command patch
> registered plugin command shell
> registered plugin command baz-import
> loaded succesfully
> load plugin (None, 'E:\\work\\python\\bzr\\plugins.work\\version_info', ('', '', 5))
> registered plugin command version-info
> loaded succesfully
> load plugin (None, 'E:\\work\\python\\bzr\\plugins.work\\ztransport', ('', '', 5))
> loaded succesfully
> trying to open u'D:/push/bzr.exe' with transport <bzrlib.transport.local.LocalTransport object at 0x009E6810>
> got branch format u'Bazaar-NG branch, format 6\n'
> trying to open u'ftp://myhost/public_html/bzr/bzr.exe/' with transport <bzrlib.transport.ftp.FtpTransport object at 0x00D51230>
> FTP get: /public_html/bzr/bzr.exe/.bzr/branch-format
> Constructing FTP instance
> FTP clone
> FTP mkd: /public_html/bzr/bzr.exe
> Constructing FTP instance
> FTP stat: /public_html/bzr/bzr.exe
> Constructing FTP instance
> FTP mkd: /public_html/bzr/bzr.exe/.bzr
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/revision-store
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves
> FTP put: /public_html/bzr/bzr.exe/.bzr/README
> FTP put: /public_html/bzr/bzr.exe/.bzr/branch-format
> FTP put: /public_html/bzr/bzr.exe/.bzr/revision-history
> FTP put: /public_html/bzr/bzr.exe/.bzr/branch-name
> FTP put: /public_html/bzr/bzr.exe/.bzr/branch-lock
> FTP put: /public_html/bzr/bzr.exe/.bzr/pending-merges
> FTP put: /public_html/bzr/bzr.exe/.bzr/inventory
> FTP put: /public_html/bzr/bzr.exe/.bzr/inventory.weave
> FTP put: /public_html/bzr/bzr.exe/.bzr/ancestry.weave
> created control directory in ftp://myhost/public_html/bzr/bzr.exe/
> FTP get: /public_html/bzr/bzr.exe/.bzr/branch-format
> got branch format u'Bazaar-NG branch, format 6\n'
> FTP stat: /public_html/bzr/bzr.exe/.bzr
> FTP clone
> FTP clone
> FTP clone
> FTP get: /public_html/bzr/bzr.exe/.bzr/revision-history
> [ 5368] Sun 03:57:41.780 WARNING: Unable to update the working tree of: ftp://myhost/public_html/bzr/bzr.exe/
> FTP get: /public_html/bzr/bzr.exe/.bzr/revision-history
> FTP get: /public_html/bzr/bzr.exe/.bzr/revision-history
> fetch up to rev {bialix at ukr.net-20060115015128-191939cf3712f73b}
> FTP has not: /public_html/bzr/bzr.exe/.bzr/revision-store/a3/bialix at ukr.net-20060115015128-191939cf3712f73b
> FTP has not: /public_html/bzr/bzr.exe/.bzr/revision-store/a3/bialix at ukr.net-20060115015128-191939cf3712f73b.gz
> FTP get: /public_html/bzr/bzr.exe/.bzr/revision-history
> need to get revision {None}
> need to get revision {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> need to get revision {bialix at ukr.net-20060115014433-d19de95bbc7dbaff}
> need to get revision {bialix at ukr.net-20060115014529-5628f77e8ed82da1}
> need to get revision {bialix at ukr.net-20060115015128-191939cf3712f73b}
> need to get 5 revisions in total
> FTP has not: /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b
> FTP has not: /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b.gz
> copying revision {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> cache hit in WeaveStore(u'D:/push/bzr.exe/.bzr') for inventory
>   commiter Alexander Belchenko <bialix at ukr.net>, 0 parents
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/55/bzrignore-20060115005844-9191aead508f3b85.weave
> copy file {bzrignore-20060115005844-9191aead508f3b85} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/55
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/55/bzrignore-20060115005844-9191aead508f3b85.weave
> copied file {bzrignore-20060115005844-9191aead508f3b85}
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/f1/README-20060115005823-53032a51eba2896b.weave
> copy file {README-20060115005823-53032a51eba2896b} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/f1
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/f1/README-20060115005823-53032a51eba2896b.weave
> copied file {README-20060115005823-53032a51eba2896b}
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/7e/bzr.c-20060115005823-ae27ad1ddf131434.weave
> copy file {bzr.c-20060115005823-ae27ad1ddf131434} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/7e
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/7e/bzr.c-20060115005823-ae27ad1ddf131434.weave
> copied file {bzr.c-20060115005823-ae27ad1ddf131434}
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/2c/exemaker.c-20060115005823-6b5d52b428c8050e.weave
> copy file {exemaker.c-20060115005823-6b5d52b428c8050e} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/2c
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/2c/exemaker.c-20060115005823-6b5d52b428c8050e.weave
> copied file {exemaker.c-20060115005823-6b5d52b428c8050e}
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/8d/exemaker.exe-20060115005851-0566964968e1c316.weave
> copy file {exemaker.exe-20060115005851-0566964968e1c316} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/8d
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/8d/exemaker.exe-20060115005851-0566964968e1c316.weave
> copied file {exemaker.exe-20060115005851-0566964968e1c316}
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/78/exemaker.ico-20060115005823-30628085f2344d28.weave
> copy file {exemaker.ico-20060115005823-30628085f2344d28} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/78
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/78/exemaker.ico-20060115005823-30628085f2344d28.weave
> copied file {exemaker.ico-20060115005823-30628085f2344d28}
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/91/exemaker.py-20060115005823-6b2ec0d07bacbbb3.weave
> copy file {exemaker.py-20060115005823-6b2ec0d07bacbbb3} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/91
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/91/exemaker.py-20060115005823-6b2ec0d07bacbbb3.weave
> copied file {exemaker.py-20060115005823-6b2ec0d07bacbbb3}
> FTP get: /public_html/bzr/bzr.exe/.bzr/weaves/62/makefile.vc-20060115005823-450108735e7ce70e.weave
> copy file {makefile.vc-20060115005823-450108735e7ce70e} modified in {bialix at ukr.net-20060115005924-d6144061a9fa662b}
> FTP mkd: /public_html/bzr/bzr.exe/.bzr/weaves/62
> FTP put: /public_html/bzr/bzr.exe/.bzr/weaves/62/makefile.vc-20060115005823-450108735e7ce70e.weave
> copied file {makefile.vc-20060115005823-450108735e7ce70e}
> FTP get: /public_html/bzr/bzr.exe/.bzr/inventory.weave
> FTP put: /public_html/bzr/bzr.exe/.bzr/inventory.weave
> add store entry 'bialix at ukr.net-20060115005924-d6144061a9fa662b'
> FTP has not: /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b
> FTP has not: /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b.gz
> FTP put: /public_html/bzr/bzr.exe/.bzr/revision-store/c9/bialix at ukr.net-20060115005924-d6144061a9fa662b
> [ 5368] Sun 03:58:19.750 ERROR: 553-Can't open that file: No such file or directory
> 553 Rename/move failure: No such file or directory
> Traceback (most recent call last):
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\commands.py", line 572, in run_bzr_catch_errors
>     return run_bzr(argv)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\commands.py", line 534, in run_bzr
>     ret = cmd_obj.run_argv(argv)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\commands.py", line 233, in run_argv
>     return self.run(**all_cmd_args)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\builtins.py", line 515, in run
>     count = br_to.pull(br_from, overwrite)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\branch.py", line 89, in decorated
>     return unbound(self, *args, **kwargs)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\branch.py", line 1059, in pull
>     self.update_revisions(source)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\branch.py", line 1003, in update_revisions
>     revision=stop_revision)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\fetch.py", line 66, in greedy_fetch
>     f = Fetcher(to_branch, from_branch, revision, pb)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\fetch.py", line 111, in __init__
>     self._fetch_revisions(last_revision)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\fetch.py", line 126, in _fetch_revisions
>     self._copy_revisions(revs_to_fetch)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\fetch.py", line 180, in _copy_revisions
>     self._copy_one_revision(rev_id)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\fetch.py", line 203, in _copy_one_revision
>     self.to_branch.revision_store.add(StringIO(rev_xml), rev_id)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\store\__init__.py", line 162, in add
>     self._add(names[0], f)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\store\text.py", line 64, in _add
>     self._try_put(fn, f)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\store\text.py", line 68, in _try_put
>     self._transport.put(fn, f, mode=self._file_mode)
>   File "E:\work\Python\bzr\bzr.dev-rus\bzrlib\transport\ftp.py", line 197, in put
>     raise TransportError(orig_error=e)
> TransportError: 553-Can't open that file: No such file or directory
> 553 Rename/move failure: No such file or directory
> 
> return code 3
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060115/50dab81a/attachment.pgp 


More information about the bazaar mailing list