[PATCH] IMAP Backend Error in delete()

Bug #422477 reported by Matthew Gadd
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned

Bug Description

When duplicity goes to delete files using the delete() method of the IMAP backend, an error occurs. This seems to be due to a badly formed IMAP search command. Traceback below:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1241, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1234, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1207, in main
    full_backup(col_stats)
  File "/usr/bin/duplicity", line 429, in full_backup
    col_stats.set_values(sig_chain_warning=None).cleanup_signatures()
  File "/usr/lib/python2.6/dist-packages/duplicity/collections.py", line 971, in cleanup_signatures
    map(SignatureChain.delete, self.other_sig_chains)
  File "/usr/lib/python2.6/dist-packages/duplicity/collections.py", line 527, in delete
    self.backend.delete(inclist_copy)
  File "/usr/lib/python2.6/dist-packages/duplicity/backends/imapbackend.py", line 251, in delete
    list = self._imapf(self._conn.search,None,"(HEADER, Subject %s)"%filename)
  File "/usr/lib/python2.6/dist-packages/duplicity/backends/imapbackend.py", line 237, in _imapf
    (ret,list)=fun(*args)
  File "/usr/lib/python2.6/imaplib.py", line 621, in search
    typ, dat = self._simple_command(name, *criteria)
  File "/usr/lib/python2.6/imaplib.py", line 1059, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/usr/lib/python2.6/imaplib.py", line 896, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
error: SEARCH command error: BAD ['Could not parse command']

This is using duplicity from the PPA on ubuntu Jaunty:
Duplicity ver 0.6.05

The imap server I'm using is imap.gmail.com (a Gmail account of course).

Revision history for this message
Matthew Gadd (darkotter) wrote :

I did a bzr branch lp:duplicity and edited the imapbackend.py file to try and fix the problem. It works for me now, I just changed the search command.

Could somebody please check the attached merge directive? I have no experience of contributing to software on launchpad or anyone else, and I'd hate to cause problems. The merge directive was made using bazaar, so it should apply nicely using bzr merge.

summary: - IMAP Backend Error in delete()
+ [PATCH] IMAP Backend Error in delete()
Revision history for this message
Matthew Gadd (darkotter) wrote :

Thought I may as well add another bit - I noticed that the FTP backend searches an environment variable (FTP_PASSWORD) for the password as well as requesting it from the user. I added code (based on that for the FTP backend) so that the IMAP backend should check the environment variables IMAP_USERNAME and IMAP_PASSWORD for the username and password respectively.

The newer merge directive (with both changes) is attached, if you don't want to add support for the environment variables, just use the previous merge directive.

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Thanks for the patches!

Changed in duplicity:
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Matthew Gadd (darkotter) wrote :

I'm terribly sorry, I just realised I've made a formatting error in the second patch, which will cause an error in the IMAPBackend.py file (I mixed up my indents). Here is an updated version which should actually work.

Revision history for this message
Matthew Gadd (darkotter) wrote :

Terribly sorry again, I made a typo AGAIN (I'm very new at this whole thing as you can probably tell :P).

Changed in duplicity:
assignee: nobody → Kenneth Loafman (kenneth-loafman)
milestone: none → 0.6.06
Changed in duplicity:
assignee: Kenneth Loafman (kenneth-loafman) → nobody
status: In Progress → Fix Committed
Revision history for this message
Matthew Gadd (darkotter) wrote :

Thanks, I look forward to testing the fix when I get home.

Changed in duplicity:
status: Fix Committed → Fix Released
Revision history for this message
David Anderson (q-launchpad-net-dw-perspective-org-uk) wrote :

I came to file a new bug for an IMAP_PASSWORD environment variable, because I found no mention of it in the man page or recent changelogs.

Then this bug here alerted me where to look, and indeed it is there in 6.06 (found by grep-ing)...

Can I suggest that the man page have this information added? It's not in the 6.06 version or the latest online version.

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.