Rev 3437: (jam) Fix bug #215522, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue May 20 03:25:26 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3437
revision-id:pqm at pqm.ubuntu.com-20080520022514-gncomeyihrd1vywq
parent: pqm at pqm.ubuntu.com-20080519235311-iagwfnx1xargmkc5
parent: john at arbash-meinel.com-20080421190603-t9ev9pts4tmbg9wf
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-05-20 03:25:14 +0100
message:
  (jam) Fix bug #215522,
  	workaround xs4all returning an error for ls on an empty dir
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
    ------------------------------------------------------------
    revno: 3376.3.2
    revision-id:john at arbash-meinel.com-20080421190603-t9ev9pts4tmbg9wf
    parent: john at arbash-meinel.com-20080421190100-3ktkhqu1f6adayok
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: ftp_215522
    timestamp: Mon 2008-04-21 20:06:03 +0100
    message:
      Add a mutter() to help ensure the error is being properly trapped
    modified:
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
    ------------------------------------------------------------
    revno: 3376.3.1
    revision-id:john at arbash-meinel.com-20080421190100-3ktkhqu1f6adayok
    parent: pqm at pqm.ubuntu.com-20080421181503-z5opy8fb01ksjc5w
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: ftp_215522
    timestamp: Mon 2008-04-21 20:01:00 +0100
    message:
      Fix bug #215522, xs4all's ftp server returns a temp error when listing an empty directory.
      Trap the error, and return an empty list instead.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
=== modified file 'NEWS'
--- a/NEWS	2008-05-19 21:27:35 +0000
+++ b/NEWS	2008-05-20 02:25:14 +0000
@@ -183,6 +183,11 @@
     * When logging the changes to a particular file, there was a bug if there
       were ghosts in the revision ancestry. (John Arbash Meinel, #209948)
 
+    * xs4all's ftp server returns a temporary error when trying to list an
+      empty directory, rather than returning an empty list. Adding a
+      workaround so that we don't get spurious failures.
+      (John Arbash Meinel, #215522)
+
   DOCUMENTATION:
 
     * Expanded the User Guide to include new chapters on popular plugins and

=== modified file 'bzrlib/transport/ftp.py'
--- a/bzrlib/transport/ftp.py	2008-05-08 04:33:38 +0000
+++ b/bzrlib/transport/ftp.py	2008-05-20 02:25:14 +0000
@@ -516,6 +516,16 @@
             paths = f.nlst(basepath)
         except ftplib.error_perm, e:
             self._translate_perm_error(e, relpath, extra='error with list_dir')
+        except ftplib.error_temp, e:
+            # xs4all's ftp server raises a 450 temp error when listing an empty
+            # directory. Check for that and just return an empty list in that
+            # case. See bug #215522
+            if str(e).lower().startswith('450 no files found'):
+                mutter('FTP Server returned "%s" for nlst.'
+                       ' Assuming it means empty directory',
+                       str(e))
+                return []
+            raise
         # If FTP.nlst returns paths prefixed by relpath, strip 'em
         if paths and paths[0].startswith(basepath):
             entries = [path[len(basepath)+1:] for path in paths]




More information about the bazaar-commits mailing list