zertrin/duplicity-backup.sh

IndexError: string index out of range

bramanis opened this issue · 12 comments

I suppose that's not a bug, or is it?

# /backup/duplicity-backup/duplicity-backup.sh -c /backup/duplicity-backup/duplicity-backup.conf -b
ssh: Connected (version 2.0, client OpenSSH_5.3)
ssh: Authentication (publickey) successful!
ssh: Secsh channel 1 opened.
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1537, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1531, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1369, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib64/python2.6/site-packages/duplicity/commandline.py", line 1131, in ProcessCommandLine
    set_selection()
  File "/usr/lib64/python2.6/site-packages/duplicity/commandline.py", line 969, in set_selection
    sel.ParseArgs(select_opts, select_files)
  File "/usr/lib64/python2.6/site-packages/duplicity/selection.py", line 247, in ParseArgs
    self.add_selection_func(self.glob_get_sf(arg, 0))
  File "/usr/lib64/python2.6/site-packages/duplicity/selection.py", line 431, in glob_get_sf
    sel_func = self.glob_get_filename_sf(glob_str, include)
  File "/usr/lib64/python2.6/site-packages/duplicity/selection.py", line 475, in glob_get_filename_sf
    if filename != "/" and filename[-1] == "/":
IndexError: string index out of range

I believe this is not a bug with the wrapper script (duplicity-backup.sh) but with duplicity.

Does it work correctly or can you reproduce the bug by using only duplicity? (without using duplicity-backup.sh)

If this works in duplicity but not with the wrapper script, please give more information from your config file, activate the debug mode from the config file (see at the bottom) and give the output and the content of the log files when run in debug mode.

If this doesn't work with duplicity alone, then this is a bug from duplicity, and I can't do anything about that. Maybe you should look for help upstream (see the duplicity mailing-lists https://lists.nongnu.org/mailman/listinfo/duplicity-talk or the duplicity bug-tracker https://launchpad.net/duplicity )

Could this be related?

https://bugs.launchpad.net/duplicity/+bug/1031435

Tõnis

On 3.06.2016 14:22, zertrin wrote:

I believe this is not a bug with the wrapper script
(duplicity-backup.sh) but with duplicity.

Does it work correctly or can you reproduce the bug by using only
duplicity? (without using duplicity-backup.sh)

If this works in duplicity but not with the wrapper script, please
give more information from your config file, activate the debug mode
from the config file (see at the bottom) and give the output and the
content of the log files when run in debug mode.

If this doesn't work with duplicity alone, then this is a bug from
duplicity, and I can't do anything about that. Maybe you should look
for help upstream (see the duplicity mailing-lists
https://lists.nongnu.org/mailman/listinfo/duplicity-talk or the
duplicity bug-tracker https://launchpad.net/duplicity )


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#128 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AIlt5v9DVqXulqbjGwN9gI-JmlvHu51zks5qIA50gaJpZM4ItPao.

Probably. At least this strongly indicates that the bug is known and affects duplicity directly.

I'm gonna close the issue here since I can't do anything if the bug is in duplicity itself.

Feel free to reopen if you can show that the issue is not in duplicity but in our wrapper script 😉

Hum I may have read the link a bit fast, the Python error message is the same but not located in the same part of duplicity's code. So the issue from the link is probably not related to your issue.

However I'm still convinced that the issue has to do with duplicity, unless proven otherwise.

As I precedently said, you should really try to make your backup run directly with duplicity, and not with the script. If this works with duplicity alone and with our script it doesn't, then the issue may be on our side.

Either way, you'll need to provide more information by activating the debug mode of the script in order to at least see how duplicity is called from the script (uncomment the last line of the config file ECHO=$(which echo))

@zertrin

Running the command manually, I get the following:

# /usr/bin/duplicity -v7 --asynchronous-upload --volsize 1024 --tempdir /backup/tmp/ --extra-clean --full-if-older-than 31D --exclude  --include=/home/huggie/ --include=/home/vrie360/ --include=/home/sikorski/ --include=/root/ --exclude=** / scp://root@backup.huggity.com//backup/uk.huggity.com/
Using archive dir: /root/.cache/duplicity/24c2b6e4bfc9ee845284a69eefca0075
Using backup name: 24c2b6e4bfc9ee845284a69eefca0075
Import of duplicity.backends.acdclibackend Succeeded
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Failed: invalid syntax (b2backend.py, line 217)
Import of duplicity.backends.botobackend Succeeded
Import of duplicity.backends.cfbackend Succeeded
Import of duplicity.backends.copycombackend Succeeded
Import of duplicity.backends.dpbxbackend Failed: No module named dropbox
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.giobackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.hubicbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.lftpbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.mediafirebackend Succeeded
Import of duplicity.backends.megabackend Succeeded
Import of duplicity.backends.multibackend Failed: invalid syntax (multibackend.py, line 266)
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Failed: invalid syntax (onedrivebackend.py, line 190)
Import of duplicity.backends.par2backend Succeeded
Import of duplicity.backends.pydrivebackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ssh_paramiko_backend Succeeded
Import of duplicity.backends.ssh_pexpect_backend Succeeded
Import of duplicity.backends.swiftbackend Succeeded
Import of duplicity.backends.sxbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
ssh: Connected (version 2.0, client OpenSSH_5.3)
ssh: Authentication (publickey) successful!
ssh: Secsh channel 1 opened.
Using temporary directory /backup/tmp/duplicity-yUj22t-tempdir
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1537, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1531, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1369, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib64/python2.6/site-packages/duplicity/commandline.py", line 1131, in ProcessCommandLine
    set_selection()
  File "/usr/lib64/python2.6/site-packages/duplicity/commandline.py", line 969, in set_selection
    sel.ParseArgs(select_opts, select_files)
  File "/usr/lib64/python2.6/site-packages/duplicity/selection.py", line 247, in ParseArgs
    self.add_selection_func(self.glob_get_sf(arg, 0))
  File "/usr/lib64/python2.6/site-packages/duplicity/selection.py", line 431, in glob_get_sf
    sel_func = self.glob_get_filename_sf(glob_str, include)
  File "/usr/lib64/python2.6/site-packages/duplicity/selection.py", line 482, in glob_get_filename_sf
    raise FilePrefixError(filename)
FilePrefixError: --include=/home/huggie

Thanks for the infomations!

Somehow this is a different error now compared to the original problem...

It seems that this time the code went a bit further (from line 475, in glob_get_filename_sf to line 482, in glob_get_filename_sf)

I think I can spot the error here: see --exclude --include=/home/huggie/, there is no path given for the --exclude parameter.

So it could be a bug in the script, which leads to a wrong duplicity command.

Could you give the content of your config file concerning the include and exclude parameter?

INCLIST=(  "/home/huggie/" \
           "/home/vrie360/" \
           "/home/sikorski/" \
           "/root/" \
        )

EXCLIST=( "" )

And this I took from my old configuration file directly. There it worked, just before upgrading your script :)

The goal is to ignore everything else, that's not in the INCLIST array.

Ok I think I have isolated the issue.

A quick workaround is to write EXCLIST=( ) instead of EXCLIST=( "" ). The empty element is not a valid path anyway.

I will change the code of the script to handle such situations gracefully (skipping empty elements).

Could you test the branch fix-issue-128-incexc?

Updating dcdc081..7a84fbd
Fast-forward
duplicity-backup.conf.example | 3 +++
duplicity-backup.sh | 14 +++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)

The command stayed the same :( (I haven't changed my configuration file, so I could test your graceful handle of things)

I have merged my changes from fix-issue-128-incexc into dev. But I'm still not sure if I can close this issue. Could you summarize the current situation on your side?

  • example of conf file leading to the issue
  • the duplicity command that you get from setting the debug mode on (ECHO)
  • and the result of running that command

I have improved my setup to test and try to reproduce issues reported on my side (testing in fresh docker containers to avoid messing up with my own backups), but I need a bit more detailed information.

Closing after extended inactivity. Feel free to reopen with the requested information if needed :)