Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 2010 00:04:33 +0100 (BST)
From:      Jase Thew <freebsd@beardz.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/149923: [PATCH] sysutils/duplicity-devel: fix ftpbackend bug
Message-ID:  <201008232304.o7NN4XLq086691@beardz.net>
Resent-Message-ID: <201008232310.o7NNA13w002998@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         149923
>Category:       ports
>Synopsis:       [PATCH] sysutils/duplicity-devel: fix ftpbackend bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 23 23:10:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Jase Thew
>Release:        FreeBSD 8.1-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD jail-ports.localdomain 8.1-RELEASE FreeBSD 8.1-RELEASE #0 r210200M: Wed Jul 21 14:21:18 CEST
>Description:
- Bring in commit r665 from upstream which fixes a bug (613448) in the ftpbackend which prevents 
  destination directories being created.

Added file(s):
- files/patch-r665-bug613448.diff

Port maintainer (peter.schuller@infidyne.com) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:
>Fix:

--- duplicity-devel-0.6.09_1.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/sysutils/duplicity-devel.orig/Makefile /usr/ports/sysutils/duplicity-devel/Makefile
--- /usr/ports/sysutils/duplicity-devel.orig/Makefile	2010-07-30 12:55:57.000000000 +0100
+++ /usr/ports/sysutils/duplicity-devel/Makefile	2010-08-23 23:53:50.550800378 +0100
@@ -7,6 +7,7 @@
 
 PORTNAME=	duplicity
 PORTVERSION=	0.6.09
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://launchpad.net/duplicity/0.6-series/${PORTVERSION}/+download/
 PKGNAMESUFFIX=	-devel
diff -ruN --exclude=CVS /usr/ports/sysutils/duplicity-devel.orig/files/patch-r665-bug613448.diff /usr/ports/sysutils/duplicity-devel/files/patch-r665-bug613448.diff
--- /usr/ports/sysutils/duplicity-devel.orig/files/patch-r665-bug613448.diff	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/sysutils/duplicity-devel/files/patch-r665-bug613448.diff	2010-08-23 23:51:33.546547324 +0100
@@ -0,0 +1,136 @@
+=== modified file 'duplicity/backend.py'
+--- src/backend.py	2010-05-23 15:52:45 +0000
++++ src/backend.py	2010-08-09 18:56:03 +0000
+@@ -372,78 +372,76 @@
+         else:
+             return commandline
+ 
+-    """
+-    DEPRECATED:
+-    run_command(_persist) - legacy wrappers for subprocess_popen(_persist)
+-    """
+     def run_command(self, commandline):
+-        return self.subprocess_popen(commandline)
++        """
++        Execute the given command line, interpreted as a shell
++        command, with logging and error detection. If execution fails,
++        raise a BackendException.
++        """
++        private = self.munge_password(commandline)
++        log.Info(_("Running '%s'") % private)
++        if os.system(commandline):
++            raise BackendException("Error running '%s'" % private)
++
+     def run_command_persist(self, commandline):
+-        return self.subprocess_popen_persist(commandline)
++        """
++        Like run_command(), but repeat the attempt several times (with
++        a delay in between) if it fails.
++        """
++        private = self.munge_password(commandline)
++        for n in range(1, globals.num_retries+1):
++            if n > 1:
++                # sleep before retry
++                time.sleep(30)
++            log.Info(gettext.ngettext("Running '%s' (attempt #%d)",
++                                      "Running '%s' (attempt #%d)", n) %
++                                      (private, n))
++            if not os.system(commandline):
++                return
++            log.Warn(gettext.ngettext("Running '%s' failed (attempt #%d)",
++                                      "Running '%s' failed (attempt #%d)", n) %
++                                      (private, n), 1)
++        log.Warn(gettext.ngettext("Giving up trying to execute '%s' after %d attempt",
++                                 "Giving up trying to execute '%s' after %d attempts",
++                                 globals.num_retries) % (private, globals.num_retries))
++        raise BackendException("Error running '%s'" % private)
+ 
+-    """
+-    DEPRECATED:
+-    popen(_persist) - legacy wrappers for subprocess_popen(_persist)
+-    """
+     def popen(self, commandline):
+-        result, stdout, stderr = self.subprocess_popen(commandline)
+-        return stdout
++        """
++        Like run_command(), but capture stdout and return it (the
++        contents read from stdout) as a string.
++        """
++        private = self.munge_password(commandline)
++        log.Info(_("Reading results of '%s'") % private)
++        fout = os.popen(commandline)
++        results = fout.read()
++        if fout.close():
++            raise BackendException("Error running '%s'" % private)
++        return results
++
+     def popen_persist(self, commandline):
+-        result, stdout, stderr = self.subprocess_popen_persist(commandline)
+-        return stdout
+-
+-    def _subprocess_popen(self, commandline):
+-        """
+-        For internal use.
+-        Execute the given command line, interpreted as a shell command.
+-        Returns int Exitcode, string StdOut, string StdErr
+-        """
+-        from subprocess import Popen, PIPE
+-        p = Popen(commandline, shell=True, stdout=PIPE, stderr=PIPE)
+-        stdout, stderr = p.communicate()
+-
+-        return p.returncode, stdout, stderr
+-
+-    def subprocess_popen(self, commandline):
+-        """
+-        Execute the given command line with error check.
+-        Returns int Exitcode, string StdOut, string StdErr
+-
+-        Raise a BackendException on failure.
+-        """
+-        private = self.munge_password(commandline)
+-        log.Info(_("Reading results of '%s'") % private)
+-        result, stdout, stderr = self._subprocess_popen(commandline)
+-        if result != 0:
+-            raise BackendException("Error running '%s'" % private)
+-        return result, stdout, stderr
+-
+-    def subprocess_popen_persist(self, commandline):
+-        """
+-        Execute the given command line with error check.
+-        Retries globals.num_retries times with 30s delay.
+-        Returns int Exitcode, string StdOut, string StdErr
+-
+-        Raise a BackendException on failure.
++        """
++        Like run_command_persist(), but capture stdout and return it
++        (the contents read from stdout) as a string.
+         """
+         private = self.munge_password(commandline)
+         for n in range(1, globals.num_retries+1):
+-            # sleep before retry
+             if n > 1:
++                # sleep before retry
+                 time.sleep(30)
+             log.Info(_("Reading results of '%s'") % private)
+-            result, stdout, stderr = self._subprocess_popen(commandline)
+-            if result == 0:
+-                return result, stdout, stderr
+-            elif result == 1280 and self.parsed_url.scheme == 'ftp':
++            fout = os.popen(commandline)
++            results = fout.read()
++            result_status = fout.close()
++            if not result_status:
++                return results
++            elif result_status == 1280 and self.parsed_url.scheme == 'ftp':
+                 # This squelches the "file not found" result fromm ncftpls when
+                 # the ftp backend looks for a collection that does not exist.
+                 return ''
+             log.Warn(gettext.ngettext("Running '%s' failed (attempt #%d)",
+                                      "Running '%s' failed (attempt #%d)", n) %
+                                       (private, n))
+-            if stdout or stderr:
+-                log.Warn(_("Error is:\n%s") % stderr + (stderr and stdout and "\n") + stdout)
+         log.Warn(gettext.ngettext("Giving up trying to execute '%s' after %d attempt",
+                                   "Giving up trying to execute '%s' after %d attempts",
+                                   globals.num_retries) % (private, globals.num_retries))
+
--- duplicity-devel-0.6.09_1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008232304.o7NN4XLq086691>