Backup fails with ReadError("raise ReadError("unexpected end of data") (lp:#1725829)

[Original report](https://bugs.launchpad.net/bugs/1725829) created by **Bharat Mediratta (bharat-menalto)**
```
Hey team. I've been using duplicity and duply for about a year now with few
problems. I recently upgraded my Debian system (I can probably find out the
exact upgrade details if you need to know) and duplicity started crashing.
You can see the full trace below.

As far as I can tell, it's attempting to convert an incomplete tarfile into
a GPG version. I've paused the code at that point and verified that if I do
a "tar tzvf" on the input tar file, it returns an EOF error.

Note that I modified /usr/lib/python2.7/tarfile.py to add slightly more
detail to the exception for debugging, but otherwise the code is unchanged.

I'm going to continue to debug independently, but if you can point me at
some things to try that would help me. Happy to run whatever diagnostics
will help narrow this down.

OS INFO
-------
Linux fidelity 4.9.0-1-686-pae #1 SMP Debian 4.9.6-3 (2017-01-28) i686
GNU/Linux

PACKAGE INFO
------------
ii  duplicity                   0.7.12-1           i386
encrypted bandwidth-efficient backup
ii  duply                       1.11.3-1           all                easy
to use frontend to the duplicity backup system

OUTPUT FROM A RUN
-----------------
# TMPDIR='/tmp' PASSPHRASE='[ELIDED]' FTP_PASSWORD='[ELIDED]' trickle -s -u
1500 -d 5120 duplicity --archive-dir '/var/cache/duply' --name
duply_backups --verbosity '9' --volsize 1024 --full-if-older-than 3M
--asynchronous-upload --tempdir /var/cache/duply --exclude-filelist
'/etc/duply/backups/exclude' '/' 's3://[ELIDED]'
gpg: WARNING: unsafe ownership on homedir '/home/bharat/.gnupg'
Using archive dir: /var/cache/duply/duply_backups
Using backup name: duply_backups
GPG binary is gpg, version 2.1.18
Import of duplicity.backends.acdclibackend Succeeded
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Succeeded
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 Succeeded
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Succeeded
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
Reading globbing filelist /etc/duply/backups/exclude
Main action: inc
================================================================================
duplicity 0.7.12 (March 21, 2017)
Args: /usr/bin/duplicity --archive-dir /var/cache/duply --name
duply_backups --verbosity 9 --volsize 1024 --full-if-older-than 3M
--asynchronous-upload --tempdir /var/cache/duply --exclude-filelist
/etc/duply/backups/exclude / s3://AKIAIFBSC2GRGO7KR5DQ@s3-eu-
central-1.amazonaws.com/menalto.backups/fidelity
Linux fidelity 4.9.0-1-686-pae #1 SMP Debian 4.9.6-3 (2017-01-28) i686
/usr/bin/python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118]
================================================================================
Using temporary directory /var/cache/duply/duplicity-A4Cxl1-tempdir
Registering (mkstemp) temporary file
/var/cache/duply/duplicity-A4Cxl1-tempdir/mkstemp-tQT0KF-1
Temp has 172445667328 available, backup will use approx 2469606195.

....

Comparing usr/lib/i386-linux-gnu/samba/libcliauth.so.0 and
usr/lib/i386-linux-gnu/samba/libcliauth.so.0
Selection: examining path /usr/lib/i386-linux-gnu/samba/libcluster.so.0
Selection:     result: None from function: Command-line exclude glob: /dev
Selection:     result: None from function: Command-line exclude glob: /tmp
Selection:     result: None from function: Command-line exclude glob: /proc
Selection:     result: None from function: Command-line exclude glob: /sys
Selection:     result: None from function: Command-line exclude glob:
/var/lib/apt-xapian-index
Selection:     result: None from function: Command-line exclude glob:
/var/lib/clamav/daily.cld
Selection:     result: None from function: Command-line exclude glob:
/var/lib/mlocate
Selection:     result: None from function: Command-line exclude glob:
/var/cache/apt
Selection:     result: None from function: Command-line exclude glob:
/home/duply
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/unifi.vdi
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/VMs/unifi/Snapshots
Selection:     + including file
Selecting /usr/lib/i386-linux-gnu/samba/libcluster.so.0
<TarInfo 'signature/usr/lib/i386-linux-gnu/samba/libcluster.so.0' at
0xa6075dac>
Comparing usr/lib/i386-linux-gnu/samba/libcluster.so.0 and
usr/lib/i386-linux-gnu/samba/libcluster.so.0
Selection: examining path /usr/lib/i386-linux-gnu/samba/libcmdline-
credentials.so.0
Selection:     result: None from function: Command-line exclude glob: /dev
Selection:     result: None from function: Command-line exclude glob: /tmp
Selection:     result: None from function: Command-line exclude glob: /proc
Selection:     result: None from function: Command-line exclude glob: /sys
Selection:     result: None from function: Command-line exclude glob:
/var/lib/apt-xapian-index
Selection:     result: None from function: Command-line exclude glob:
/var/lib/clamav/daily.cld
Selection:     result: None from function: Command-line exclude glob:
/var/lib/mlocate
Selection:     result: None from function: Command-line exclude glob:
/var/cache/apt
Selection:     result: None from function: Command-line exclude glob:
/home/duply
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/unifi.vdi
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/VMs/unifi/Snapshots
Selection:     + including file
Selecting /usr/lib/i386-linux-gnu/samba/libcmdline-credentials.so.0
<TarInfo 'signature/usr/lib/i386-linux-gnu/samba/libcmdline-
credentials.so.0' at 0xa607598c>
Comparing usr/lib/i386-linux-gnu/samba/libcmdline-credentials.so.0 and
usr/lib/i386-linux-gnu/samba/libcmdline-credentials.so.0
Selection: examining path /usr/lib/i386-linux-gnu/samba/libcom_err-
samba4.so.0
Selection:     result: None from function: Command-line exclude glob: /dev
Selection:     result: None from function: Command-line exclude glob: /tmp
Selection:     result: None from function: Command-line exclude glob: /proc
Selection:     result: None from function: Command-line exclude glob: /sys
Selection:     result: None from function: Command-line exclude glob:
/var/lib/apt-xapian-index
Selection:     result: None from function: Command-line exclude glob:
/var/lib/clamav/daily.cld
Selection:     result: None from function: Command-line exclude glob:
/var/lib/mlocate
Selection:     result: None from function: Command-line exclude glob:
/var/cache/apt
Selection:     result: None from function: Command-line exclude glob:
/home/duply
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/unifi.vdi
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/VMs/unifi/Snapshots
Selection:     + including file
Selecting /usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0
<TarInfo 'snapshot/usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0' at
0xa607570c>
Comparing usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0 and
usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0
Selection: examining path /usr/lib/i386-linux-gnu/samba/libcom_err-
samba4.so.0.25
Selection:     result: None from function: Command-line exclude glob: /dev
Selection:     result: None from function: Command-line exclude glob: /tmp
Selection:     result: None from function: Command-line exclude glob: /proc
Selection:     result: None from function: Command-line exclude glob: /sys
Selection:     result: None from function: Command-line exclude glob:
/var/lib/apt-xapian-index
Selection:     result: None from function: Command-line exclude glob:
/var/lib/clamav/daily.cld
Selection:     result: None from function: Command-line exclude glob:
/var/lib/mlocate
Selection:     result: None from function: Command-line exclude glob:
/var/cache/apt
Selection:     result: None from function: Command-line exclude glob:
/home/duply
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/unifi.vdi
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/VMs/unifi/Snapshots
Selection:     + including file
Selecting /usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0.25
<TarInfo 'signature/usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0.25'
at 0xa607540c>
Comparing usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0.25 and
usr/lib/i386-linux-gnu/samba/libcom_err-samba4.so.0.25
Selection: examining path /usr/lib/i386-linux-gnu/samba/libdbwrap.so.0
Selection:     result: None from function: Command-line exclude glob: /dev
Selection:     result: None from function: Command-line exclude glob: /tmp
Selection:     result: None from function: Command-line exclude glob: /proc
Selection:     result: None from function: Command-line exclude glob: /sys
Selection:     result: None from function: Command-line exclude glob:
/var/lib/apt-xapian-index
Selection:     result: None from function: Command-line exclude glob:
/var/lib/clamav/daily.cld
Selection:     result: None from function: Command-line exclude glob:
/var/lib/mlocate
Selection:     result: None from function: Command-line exclude glob:
/var/cache/apt
Selection:     result: None from function: Command-line exclude glob:
/home/duply
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/unifi.vdi
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/VMs/unifi/Snapshots
Selection:     + including file
Selecting /usr/lib/i386-linux-gnu/samba/libdbwrap.so.0
<TarInfo 'signature/usr/lib/i386-linux-gnu/samba/libdbwrap.so.0' at
0xa6075a6c>
Comparing usr/lib/i386-linux-gnu/samba/libdbwrap.so.0 and
usr/lib/i386-linux-gnu/samba/libdbwrap.so.0
Selection: examining path /usr/lib/i386-linux-gnu/samba/libdcerpc-
samba.so.0
Selection:     result: None from function: Command-line exclude glob: /dev
Selection:     result: None from function: Command-line exclude glob: /tmp
Selection:     result: None from function: Command-line exclude glob: /proc
Selection:     result: None from function: Command-line exclude glob: /sys
Selection:     result: None from function: Command-line exclude glob:
/var/lib/apt-xapian-index
Selection:     result: None from function: Command-line exclude glob:
/var/lib/clamav/daily.cld
Selection:     result: None from function: Command-line exclude glob:
/var/lib/mlocate
Selection:     result: None from function: Command-line exclude glob:
/var/cache/apt
Selection:     result: None from function: Command-line exclude glob:
/home/duply
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/unifi.vdi
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/VMs/unifi/Snapshots
Selection:     + including file
Selecting /usr/lib/i386-linux-gnu/samba/libdcerpc-samba.so.0
<TarInfo 'signature/usr/lib/i386-linux-gnu/samba/libdcerpc-samba.so.0' at
0xa6075b6c>
Comparing usr/lib/i386-linux-gnu/samba/libdcerpc-samba.so.0 and
usr/lib/i386-linux-gnu/samba/libdcerpc-samba.so.0
Selection: examining path /usr/lib/i386-linux-gnu/samba/libdcerpc-
samba4.so.0
Selection:     result: None from function: Command-line exclude glob: /dev
Selection:     result: None from function: Command-line exclude glob: /tmp
Selection:     result: None from function: Command-line exclude glob: /proc
Selection:     result: None from function: Command-line exclude glob: /sys
Selection:     result: None from function: Command-line exclude glob:
/var/lib/apt-xapian-index
Selection:     result: None from function: Command-line exclude glob:
/var/lib/clamav/daily.cld
Selection:     result: None from function: Command-line exclude glob:
/var/lib/mlocate
Selection:     result: None from function: Command-line exclude glob:
/var/cache/apt
Selection:     result: None from function: Command-line exclude glob:
/home/duply
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/unifi.vdi
Selection:     result: None from function: Command-line exclude glob:
/home/virtualbox/VMs/unifi/Snapshots
Selection:     + including file
Selecting /usr/lib/i386-linux-gnu/samba/libdcerpc-samba4.so.0
Releasing lockfile /var/cache/duply/duply_backups/lockfile.lock
Removing still remembered temporary file
/var/cache/duply/duplicity-A4Cxl1-tempdir/mktemp-_tMnye-4
Removing still remembered temporary file
/var/cache/duply/duplicity-A4Cxl1-tempdir/mkstemp-tQT0KF-1
Removing still remembered temporary file
/var/cache/duply/duplicity-A4Cxl1-tempdir/mktemp-t8lgqC-3
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1553, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1547, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1398, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1529, in do_backup
    incremental_backup(sig_chain)
  File "/usr/bin/duplicity", line 678, in incremental_backup
    globals.backend)
  File "/usr/bin/duplicity", line 439, in write_multivol
    globals.volsize)
  File "/usr/lib/python2.7/dist-packages/duplicity/gpg.py", line 360, in
GPGWriteFile
    data = block_iter.next().data
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 523,
in next
    result = self.process(self.input_iter.next())
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 195,
in get_delta_iter
    for new_path, sig_path in collated:
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 286,
in collate2iters
    relem2 = riter2.next()
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 354,
in combine_path_iters
    refresh_triple_list(triple_list)
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 341,
in refresh_triple_list
    new_triple = get_triple(old_triple[1])
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 327,
in get_triple
    path = path_iter_list[iter_index].next()
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 239,
in sigtar2path_iter
    for tarinfo in tf:
  File "/usr/lib/python2.7/tarfile.py", line 2511, in next
    tarinfo = self.tarfile.next()
  File "/usr/lib/python2.7/tarfile.py", line 2352, in next
    raise ReadError("unexpected end of data in %s at offset %d" %
(self.name, self.offset - 1))
ReadError: unexpected end of data in /usr/lib/python2.7/dist-
packages/duplicity/arbitrary at offset 2388667391
```

Story points: 18.0