SSH-Backend: Creating dirs separately causes a permissons-problems

Bug #909031 reported by Thomas K. on 2011-12-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Medium
Unassigned

Bug Description

The mkdir-behaviour of the ssh-backend has changed from duplicity 0.6.08 to duplicity 0.6.17.

The old behaviour was to create all directories at once (e.g. 'mkdir /users/foo/backup';).

The new behavious is to create all directories separately (e.g. 'mkdir /users'; 'cd users'; 'mkdir foo'; 'cd foo'; mkdir backup'; 'cd backup';)

The problem is, that the directory 'users' may exists (as it is in my case) and is owned by root, so trying to create it by the user who is connecting via sftp/scp, causes in the error-message:

  > sftp command: 'mkdir "users"'
  > Invalid SSH password

(The error-message is very misleading, but this is a secondary problem.)

The relevant code is: duplicity/backends/sshbackend.py: SSHBackend.list() (line 273 in duplicity 0.6.17)

Possible solutions from my point of view are:
* Change duplicity's mkdir-behavior for the ssh-backend back to the old version (may be by a command-line-option)
* Supress mkdir at all (by a command-line-option)

My workaround is to comment the mkdir-command in the 'source', because all directories exists in my case.

Thanks in advance for your support.
Thomas

---
System-Info: I am using duplicity 0.6.08 under Debian Linux 'squeeze' with python 2.6 which works fine, and duplicity 0.6.17 under Debian Linux 'wheezy' with python 2.7 which does not work in cause of the above mentioned problem. The target-system is SSH/SFTP/SCP running some Linux.

Related branches

az (az-debian) wrote :

The root cause is that the sftp code doesn't handle errors cleanly: if the sftp server side happens to prefix its error message with 'mkdir:' and includes 'permission denied', then the current code ignores the error and continues.

personally i believe the pipe+pexpect setup is beyond salvaging (sorry, but parsing error outputs is way too brittle - what about locales, for example?), so i've rewritten the ssh backend from scratch, to use python-paramiko and no local scp/sftp client programs at all.
the rewritten version does both sftp and scp, uses only one persistent ssh connection and should be a lot more
robust.

i'll provide a patch to update/cleanup the cmdline options and manpage later.

az (az-debian) wrote :

as promised, here is the patch that inserts the new backend, updates manpage and the command line handler.

Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.6.18
status: New → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers