LFTP backend crashes on empty remote path

Bug #1413792 reported by Adam Reichold on 2015-01-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Medium
Unassigned

Bug Description

I use Duplicity 0.7.01 running on Python 2.7.9 on a current Arch Linux. My target file system is an FTP server which I access using the LFTP backend. When accessing my backup target using an URL like "ftp://<email address hidden>/", the LFTP backend immediately crashes with the following error:

LFTP version is 4.6.1
Benutze temporäres Verzeichnis /tmp/duplicity-XNJ6L_-tempdir
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1500, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1494, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1327, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/duplicity/commandline.py", line 1047, in ProcessCommandLine
    globals.backend = backend.get_backend(args[0])
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 221, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 207, in get_backend_object
    return factory(pu)
  File "/usr/lib/python2.7/site-packages/duplicity/backends/lftpbackend.py", line 73, in __init__
    if self.remote_path[-1] != '/':
IndexError: string index out of range

due to "self.remote_path" being empty. The attached patch seems to resolve the issue.

Download full text (3.6 KiB)

The patch does not do what you want:

>>> re.sub('^/.+', '', '/')
'/'
>>> re.sub('^/.+', '', '/foo')
''

On Thu, Jan 22, 2015 at 5:14 PM, Adam Reichold <email address hidden>
wrote:

> Public bug reported:
>
> I use Duplicity 0.7.01 running on Python 2.7.9 on a current Arch Linux.
> My target file system is an FTP server which I access using the LFTP
> backend. When accessing my backup target using an URL like
> "ftp://<email address hidden>/", the LFTP backend immediately crashes with the
> following error:
>
> LFTP version is 4.6.1
> Benutze temporäres Verzeichnis /tmp/duplicity-XNJ6L_-tempdir
> Traceback (most recent call last):
> File "/usr/bin/duplicity", line 1500, in <module>
> with_tempdir(main)
> File "/usr/bin/duplicity", line 1494, in with_tempdir
> fn()
> File "/usr/bin/duplicity", line 1327, in main
> action = commandline.ProcessCommandLine(sys.argv[1:])
> File "/usr/lib/python2.7/site-packages/duplicity/commandline.py", line
> 1047, in ProcessCommandLine
> globals.backend = backend.get_backend(args[0])
> File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 221,
> in get_backend
> obj = get_backend_object(url_string)
> File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line 207,
> in get_backend_object
> return factory(pu)
> File
> "/usr/lib/python2.7/site-packages/duplicity/backends/lftpbackend.py", line
> 73, in __init__
> if self.remote_path[-1] != '/':
> IndexError: string index out of range
>
> due to "self.remote_path" being empty. The attached patch seems to
> resolve the issue.
>
> ** Affects: duplicity
> Importance: Undecided
> Status: New
>
> ** Patch added: "Patch to only remove leading slash if it is not also
> trailing"
>
> https://bugs.launchpad.net/bugs/1413792/+attachment/4303869/+files/empty-remote-path.diff
>
> --
> You received this bug notification because you are subscribed to
> Duplicity.
> https://bugs.launchpad.net/bugs/1413792
>
> Title:
> LFTP backend crashes on empty remote path
>
> Status in Duplicity - Bandwidth Efficient Encrypted Backup:
> New
>
> Bug description:
> I use Duplicity 0.7.01 running on Python 2.7.9 on a current Arch
> Linux. My target file system is an FTP server which I access using the
> LFTP backend. When accessing my backup target using an URL like
> "ftp://<email address hidden>/", the LFTP backend immediately crashes with
> the following error:
>
> LFTP version is 4.6.1
> Benutze temporäres Verzeichnis /tmp/duplicity-XNJ6L_-tempdir
> Traceback (most recent call last):
> File "/usr/bin/duplicity", line 1500, in <module>
> with_tempdir(main)
> File "/usr/bin/duplicity", line 1494, in with_tempdir
> fn()
> File "/usr/bin/duplicity", line 1327, in main
> action = commandline.ProcessCommandLine(sys.argv[1:])
> File "/usr/lib/python2.7/site-packages/duplicity/commandline.py", line
> 1047, in ProcessCommandLine
> globals.backend = backend.get_backend(args[0])
> File "/usr/lib/python2.7/site-packages/duplicity/backend.py", line
> 221, in get_backend
> obj = get_backend_object(url_string)
> File "/usr/lib/python2.7/site-packages/duplicity/backe...

Read more...

Adam Reichold (adamreichold) wrote :

Hello again,

sorry about the botched patch. It is probably simpler to fix up emtpy remote path without touching anything else...

Best regards, Adam.

Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.7.02
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