BUG: maildir flags sync with database relative path results in corrupted filename

Subject: BUG: maildir flags sync with database relative path results in corrupted filename

Date: Sun, 7 Jun 2015 17:12:00 +0200

To: notmuch@notmuchmail.org

Cc:

From: Morgan Veyret


Calling Message.tags_to_maildir_flags() when the database has been opened
with a relative path results in a corrupted filename entry in the database.
The actual filename is changed properly but the filename in the database
gets
the relative path prepended.

As I understand it's expected that the database path should be absolute but
corrupting the database when the path is relative sounds dangerous.

Attached is a python script showing the problem.
Run it as follows:

   python ./retag_bug.py db_path +tag,-tag search_query

Also attached is the output showing the problem.
$ notmuch search thread:00000000000005a2
thread:00000000000005a2     March 07 [1/1] Mathieu de Verdiere; [fablab brest] Echange PC DUINO contre ARDUINO MEGA+ramp? (inbox unread)
$ python2 ./test.py ./maildir/ -unread thread:00000000000005a2 
Using db at ./maildir/
Changing tags: -unread
Search query: thread:00000000000005a2
Adding tags: []
Removing tags: ['unread']
Filename: ./maildir/cur/1425822991_0.10764.minux,U=2618,FMD5=7b0d668e0b18d8601b8bce4eec0ed930:2,
Retagging thread:00000000000005a2
Adding []
Removing ['unread']
Sync maildir: True
Found 1 messages to retag
Retag done
Filename: ./maildir/./maildir/cur/1425822991_0.10764.minux,U=2618,FMD5=7b0d668e0b18d8601b8bce4eec0ed930:2,S


Thread: