Rev 6508: Merge 2.5 branch including fix for bug #956027 in http://bazaar.launchpad.net/~vila/bzr/integration/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Mar 15 21:03:11 UTC 2012


At http://bazaar.launchpad.net/~vila/bzr/integration/

------------------------------------------------------------
revno: 6508 [merge]
revision-id: v.ladeuil+lp at free.fr-20120315210310-fk72jp5wzcbfnk17
parent: pqm at pqm.ubuntu.com-20120315153746-mtks01on6sjxn8zu
parent: pqm at pqm.ubuntu.com-20120315184057-1grgcn2ubniptfuv
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Thu 2012-03-15 22:03:10 +0100
message:
  Merge 2.5 branch including fix for bug #956027
modified:
  bzrlib/tests/ftp_server/__init__.py __init__.py-20090227130107-4gcpgvr00l7v3fsw-1
  bzrlib/tests/ftp_server/pyftpdlib_based.py pyftpdlib_based.py-20090227151014-882k9q34m1gwnhvi-1
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
-------------- next part --------------
=== modified file 'bzrlib/tests/ftp_server/__init__.py'
--- a/bzrlib/tests/ftp_server/__init__.py	2011-06-14 01:26:41 +0000
+++ b/bzrlib/tests/ftp_server/__init__.py	2012-03-15 16:06:40 +0000
@@ -41,7 +41,11 @@
 
 try:
     from bzrlib.tests.ftp_server import pyftpdlib_based
-    pyftpdlib_available = True
+    if pyftpdlib_based.pyftplib_version >= (0, 7, 0):
+        pyftpdlib_available = True
+    else:
+        # 0.6.0 breaks SITE CHMOD
+        pyftpdlib_available = False
 except ImportError:
     pyftpdlib_available = False
 

=== modified file 'bzrlib/tests/ftp_server/pyftpdlib_based.py'
--- a/bzrlib/tests/ftp_server/pyftpdlib_based.py	2011-06-07 07:00:23 +0000
+++ b/bzrlib/tests/ftp_server/pyftpdlib_based.py	2012-03-15 16:06:40 +0000
@@ -96,57 +96,18 @@
         else:
             ftpserver.FTPHandler.ftp_NLST(self, path)
 
-    def ftp_SITE_CHMOD(self, line):
-        try:
-            mode, path = line.split(None, 1)
-            mode = int(mode, 8)
-        except ValueError:
-            # We catch both malformed line and malformed mode with the same
-            # ValueError.
-            self.respond("500 'SITE CHMOD %s': command not understood."
-                         % line)
-            self.log('FAIL SITE CHMOD ' % line)
-            return
-        ftp_path = self.fs.fs2ftp(path)
-        try:
-            self.run_as_current_user(self.fs.chmod, self.fs.ftp2fs(path), mode)
-        except OSError, err:
-            why = ftpserver._strerror(err)
-            self.log('FAIL SITE CHMOD 0%03o "%s". %s.' % (mode, ftp_path, why))
-            self.respond('550 %s.' % why)
-        else:
-            self.log('OK SITE CHMOD 0%03o "%s".' % (mode, ftp_path))
-            self.respond('200 SITE CHMOD succesful.')
-
-    if pyftplib_version >= (0, 6, 0):
-        def log_cmd(self, cmd, arg, respcode, respstr):
-            # base class version choke on unicode, the alternative is to just
-            # provide an empty implementation and relies on the client to do
-            # the logging for debugging purposes. Not worth the trouble so far
-            # -- vila 20110607
-            if cmd in ("DELE", "RMD", "RNFR", "RNTO", "MKD"):
-                line = '"%s" %s' % (' '.join([cmd, unicode(arg)]).strip(),
-                                    respcode)
-                self.log(line)
-
-
-if pyftplib_version < (0, 6,0):
-    # pyftpdlib says to define SITE commands by declaring ftp_SITE_<CMD>
-    # methods, but fails to recognize them.
-    ftpserver.proto_cmds['SITE CHMOD'] = ftpserver._CommandProperty(
-        # Best fit choice even if not exactly right (can be d, f or m too)
-        perm='w',
-        auth_needed=True, arg_needed=True, check_path=False,
-        help='Syntax: SITE CHMOD <SP>  octal_mode_bits file-name (chmod file)',
-        )
-    # An empty password is valid, hence the arg is neither mandatory not
-    # forbidden
-    ftpserver.proto_cmds['PASS'].arg_needed = None
-else:
-    # Same rationale as above (the password should be optional), but the hole
-    # in pyftplib-0.6.0 is narrower
-    ftpserver.proto_cmds['PASS']['arg'] = None
-
+    def log_cmd(self, cmd, arg, respcode, respstr):
+        # base class version choke on unicode, the alternative is to just
+        # provide an empty implementation and relies on the client to do
+        # the logging for debugging purposes. Not worth the trouble so far
+        # -- vila 20110607
+        if cmd in ("DELE", "RMD", "RNFR", "RNTO", "MKD"):
+            line = '"%s" %s' % (' '.join([cmd, unicode(arg)]).strip(), respcode)
+            self.log(line)
+
+
+# An empty password is valid, hence the arg is neither mandatory nor forbidden
+ftpserver.proto_cmds['PASS']['arg'] = None
 
 class ftp_server(ftpserver.FTPServer):
 
@@ -191,7 +152,7 @@
 
         address = ('localhost', 0) # bind to a random port
         authorizer = AnonymousWithWriteAccessAuthorizer()
-        authorizer.add_anonymous(self._root, perm='elradfmw')
+        authorizer.add_anonymous(self._root, perm='elradfmwM')
         self._ftp_server = ftp_server(address, BzrConformingFTPHandler,
                                       authorizer)
         # This is hacky as hell, will not work if we need two servers working
@@ -227,7 +188,9 @@
                              % (self._ftpd_thread.ident,))
 
     def _run_server(self):
-        """Run the server until stop_server is called, shut it down properly then.
+        """Run the server until stop_server is called.
+
+        Shut it down properly then.
         """
         self._ftpd_running = True
         self._ftpd_starting.release()
@@ -242,4 +205,4 @@
     def add_user(self, user, password):
         """Add a user with write access."""
         self._ftp_server.authorizer.add_user(user, password, self._root,
-                                             perm='elradfmw')
+                                             perm='elradfmwM')

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-03-14 08:34:10 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-03-15 21:03:10 +0000
@@ -74,6 +74,8 @@
    suite.  This can include new facilities for writing tests, fixes to 
    spurious test failures and changes to the way things should be tested.
 
+* Add support for pyftpdlib >= 0.7.0 and drop support for previous pyftpdlib
+  versions. (Vincent Ladeuil, #956027)
 
 bzr 2.5.0
 #########



More information about the bazaar-commits mailing list