sftp errors after rev 740 change

Bug #823556 reported by Olivier Berger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned
Debian
Fix Released
Unknown

Bug Description

I'm currently experiencing problems in the form of :

# duplicity -v 9 cleanup --force --allow-source-mismatch --no-print-statistics --scp-command 'scp ' --sftp-command 'sftp ' --full-if-older-than 30D --extra-clean --archive-dir /var/cache/backupninja/duplicity scp://backup@sheeva//mnt/testbackups/asustour_slash
...
Running 'sftp -oServerAliveInterval=15 -oServerAliveCountMax=2 backup@sheeva' (attempt #1)
State = sftp, Before = 'Connected to sheeva.'
sftp command: 'mkdir ""'
State = sftp, Before = 'mkdir ""
Couldn't create directory: Failure'
sftp command: 'cd ""'
State = sftp, Before = 'cd ""'
sftp command: 'mkdir "mnt"'
State = sftp, Before = 'mkdir "mnt"
Couldn't create directory:'
Invalid SSH password
Running 'sftp -oServerAliveInterval=15 -oServerAliveCountMax=2 backup@sheeva' failed (attempt #1)

It seems that the change introduced in rev 740 introduces the following variables to be defined :
remote_dir: /mnt/testbackups/asustour_slash
dirs: ['', 'mnt', 'testbackups', 'asustour_slash']

When connecting manually with sftp (passphrase less ssh key + scponly on target), I get logged in in /var/backup, so obviously, mkdir "" and mkdir "mnt" there aren't the desired behaviour.

I suggest to change the code to something like :
    def list(self):
        """
        List files available for scp

        Note that this command can get confused when dealing with
        files with newlines in them, as the embedded newlines cannot
        be distinguished from the file boundaries.
        """
        print 'remote_dir:', self.remote_dir
        dirs = self.remote_dir.split(os.sep)
        print 'dirs:', dirs
        if len(dirs) > 0:
            if not dirs[0] :
                dirs = dirs[1:]
                dirs[0]= '/' + dirs[0]
        print 'dirs:', dirs
        mkdir_commands = [];
        for d in dirs:
            mkdir_commands += ["mkdir \"%s\"" % (d)] + ["cd \"%s\"" % (d)]

        commands = mkdir_commands + ["ls -1"]
        commandline = ("%s %s %s" % (globals.sftp_command,
                                     globals.ssh_options,
                                     self.host_string))

        l = self.run_sftp_command(commandline, commands).split('\n')[1:]

        return filter(lambda x: x, map(string.strip, l))

Revision history for this message
Olivier Berger (oberger) wrote :

Here's a proposed patch

Changed in debian:
status: Unknown → Confirmed
Changed in duplicity:
milestone: none → 0.6.15
importance: Undecided → Medium
status: New → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
Changed in debian:
status: Confirmed → Fix Released
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.