BUG: maildir flags sync with database relative path results in corrupted filename
authorMorgan Veyret <morgan.veyret@gmail.com>
Sun, 7 Jun 2015 15:12:00 +0000 (17:12 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:00 +0000 (14:49 -0700)
2e/be2bb9e050888383da9b1a2ac613b6e9b0053d [new file with mode: 0644]

diff --git a/2e/be2bb9e050888383da9b1a2ac613b6e9b0053d b/2e/be2bb9e050888383da9b1a2ac613b6e9b0053d
new file mode 100644 (file)
index 0000000..632529a
--- /dev/null
@@ -0,0 +1,165 @@
+Return-Path: <morgan.veyret@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 9FF4A6DE1502\r
+ for <notmuch@notmuchmail.org>; Sun,  7 Jun 2015 08:12:05 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.819\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.819 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id AEvp9rt8pa50 for <notmuch@notmuchmail.org>;\r
+ Sun,  7 Jun 2015 08:12:03 -0700 (PDT)\r
+Received: from mail-yk0-f169.google.com (mail-yk0-f169.google.com\r
+ [209.85.160.169])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 91DB36DE119C\r
+ for <notmuch@notmuchmail.org>; Sun,  7 Jun 2015 08:12:03 -0700 (PDT)\r
+Received: by yked142 with SMTP id d142so42634253yke.3\r
+ for <notmuch@notmuchmail.org>; Sun, 07 Jun 2015 08:12:00 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=mime-version:date:message-id:subject:from:to:content-type;\r
+ bh=HI0mdyek2BHH5raoTppJ9WxBvRbg4SjQD9MQnrPuFNw=;\r
+ b=RMdOqWz2xGBUTTMNC5oYDRIB2g+Wr5iZWgqSJcOvxrXJlFlKsZ7HX2r42TBTpZU4Gw\r
+ 60YC+PAwSU8wfL9B+qi1M3iQNW/QQwt+BWFgAafBtkOfz+7LFNe/+SKIzZxDUZMGyUE7\r
+ a9wXnNeZ/35piX8cYZ0+lkyPDduhiXAPaQwO5SVb+Z3/Rgv5zlzBtj+913axru4gL4ve\r
+ 7lLUseLy/a5UONo0pq3iAhPb9MO1Ai7Ci8yBO5wu6GW7lSpw6/Cs0+WOXd9Ief2Op3KS\r
+ xUjldqQnLGqwgCuAJLO5qK8PWYT/pgRpkanvmM5of4f9lq5nz3PnKFCvLs9z8RnalhPY\r
+ FQBw==\r
+MIME-Version: 1.0\r
+X-Received: by 10.129.119.7 with SMTP id s7mr11140481ywc.87.1433689920436;\r
+ Sun, 07 Jun 2015 08:12:00 -0700 (PDT)\r
+Received: by 10.129.123.197 with HTTP; Sun, 7 Jun 2015 08:12:00 -0700 (PDT)\r
+Date: Sun, 7 Jun 2015 17:12:00 +0200\r
+Message-ID:\r
+ <CACMMjMLecmXopb8AATjE3UuCnNLOO+5Nmev5X8K-UostDEUdrQ@mail.gmail.com>\r
+Subject: BUG: maildir flags sync with database relative path results in\r
+ corrupted filename\r
+From: Morgan Veyret <morgan.veyret@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Content-Type: multipart/mixed; boundary=001a1149008c6d81e60517eef242\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 07 Jun 2015 15:12:05 -0000\r
+\r
+--001a1149008c6d81e60517eef242\r
+Content-Type: multipart/alternative; boundary=001a1149008c6d81df0517eef240\r
+\r
+--001a1149008c6d81df0517eef240\r
+Content-Type: text/plain; charset=UTF-8\r
+\r
+Calling Message.tags_to_maildir_flags() when the database has been opened\r
+with a relative path results in a corrupted filename entry in the database.\r
+The actual filename is changed properly but the filename in the database\r
+gets\r
+the relative path prepended.\r
+\r
+As I understand it's expected that the database path should be absolute but\r
+corrupting the database when the path is relative sounds dangerous.\r
+\r
+Attached is a python script showing the problem.\r
+Run it as follows:\r
+\r
+   python ./retag_bug.py db_path +tag,-tag search_query\r
+\r
+Also attached is the output showing the problem.\r
+\r
+--001a1149008c6d81df0517eef240\r
+Content-Type: text/html; charset=UTF-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+<div dir=3D"ltr"><br><div class=3D"gmail_quote"><div dir=3D"ltr"><div><div>=\r
+<div><div><div>Calling Message.tags_to_maildir_flags() when the database ha=\r
+s been opened<br></div>with a relative path results in a corrupted filename=\r
+ entry in the database.<br></div><div>The actual filename is changed proper=\r
+ly but the filename in the database gets<br></div><div>the relative path pr=\r
+epended.<br><br></div><div>As I understand it&#39;s expected that the datab=\r
+ase path should be absolute but corrupting the database when the path is re=\r
+lative sounds dangerous.<br></div><div><br></div>Attached is a python scrip=\r
+t showing the problem.<br></div>Run it as follows:<br><br></div>=C2=A0=C2=\r
+=A0 python ./retag_bug.py db_path +tag,-tag search_query<br><br></div>Also =\r
+attached is the output showing the problem.<br></div>\r
+</div><br></div>\r
+\r
+--001a1149008c6d81df0517eef240--\r
+\r
+--001a1149008c6d81e60517eef242\r
+Content-Type: text/plain; charset=US-ASCII; name="retag_bug.txt"\r
+Content-Disposition: attachment; filename="retag_bug.txt"\r
+Content-Transfer-Encoding: base64\r
+X-Attachment-Id: f_iajnwtzj1\r
+\r
+JCBub3RtdWNoIHNlYXJjaCB0aHJlYWQ6MDAwMDAwMDAwMDAwMDVhMgp0aHJlYWQ6MDAwMDAwMDAw\r
+MDAwMDVhMiAgICAgTWFyY2ggMDcgWzEvMV0gTWF0aGlldSBkZSBWZXJkaWVyZTsgW2ZhYmxhYiBi\r
+cmVzdF0gRWNoYW5nZSBQQyBEVUlOTyBjb250cmUgQVJEVUlOTyBNRUdBK3JhbXA/IChpbmJveCB1\r
+bnJlYWQpCiQgcHl0aG9uMiAuL3Rlc3QucHkgLi9tYWlsZGlyLyAtdW5yZWFkIHRocmVhZDowMDAw\r
+MDAwMDAwMDAwNWEyIApVc2luZyBkYiBhdCAuL21haWxkaXIvCkNoYW5naW5nIHRhZ3M6IC11bnJl\r
+YWQKU2VhcmNoIHF1ZXJ5OiB0aHJlYWQ6MDAwMDAwMDAwMDAwMDVhMgpBZGRpbmcgdGFnczogW10K\r
+UmVtb3ZpbmcgdGFnczogWyd1bnJlYWQnXQpGaWxlbmFtZTogLi9tYWlsZGlyL2N1ci8xNDI1ODIy\r
+OTkxXzAuMTA3NjQubWludXgsVT0yNjE4LEZNRDU9N2IwZDY2OGUwYjE4ZDg2MDFiOGJjZTRlZWMw\r
+ZWQ5MzA6MiwKUmV0YWdnaW5nIHRocmVhZDowMDAwMDAwMDAwMDAwNWEyCkFkZGluZyBbXQpSZW1v\r
+dmluZyBbJ3VucmVhZCddClN5bmMgbWFpbGRpcjogVHJ1ZQpGb3VuZCAxIG1lc3NhZ2VzIHRvIHJl\r
+dGFnClJldGFnIGRvbmUKRmlsZW5hbWU6IC4vbWFpbGRpci8uL21haWxkaXIvY3VyLzE0MjU4MjI5\r
+OTFfMC4xMDc2NC5taW51eCxVPTI2MTgsRk1ENT03YjBkNjY4ZTBiMThkODYwMWI4YmNlNGVlYzBl\r
+ZDkzMDoyLFMKCg==\r
+--001a1149008c6d81e60517eef242\r
+Content-Type: text/x-python; charset=US-ASCII; name="retag_bug.py"\r
+Content-Disposition: attachment; filename="retag_bug.py"\r
+Content-Transfer-Encoding: base64\r
+X-Attachment-Id: f_iajnwtyj0\r
+\r
+aW1wb3J0IG5vdG11Y2gKaW1wb3J0IHN5cwoKZGVmIHJldGFnKGRiLHNlYXJjaF9xdWVyeSxhZGRf\r
+bGlzdCxyZW1vdmVfbGlzdCxzeW5jX21haWxkaXIpOgogICAgcXVlcnkgPSBkYi5jcmVhdGVfcXVl\r
+cnkoc2VhcmNoX3F1ZXJ5KQogICAgcHJpbnQgIlJldGFnZ2luZyAlcyIlc2VhcmNoX3F1ZXJ5CiAg\r
+ICBwcmludCAiQWRkaW5nICVzIiVhZGRfbGlzdAogICAgcHJpbnQgIlJlbW92aW5nICVzIiVyZW1v\r
+dmVfbGlzdAogICAgcHJpbnQgIlN5bmMgbWFpbGRpcjogJXMiJXN5bmNfbWFpbGRpcgogICAgdHJ5\r
+OgogICAgICAgIG1zZ19saXN0ID0gbGlzdChxdWVyeS5zZWFyY2hfbWVzc2FnZXMoKSkKICAgICAg\r
+ICBwcmludCAiRm91bmQgJWQgbWVzc2FnZXMgdG8gcmV0YWciJWxlbihtc2dfbGlzdCkKICAgICAg\r
+ICBkYi5iZWdpbl9hdG9taWMoKQogICAgICAgIGZvciBtc2cgaW4gbXNnX2xpc3Q6CiAgICAgICAg\r
+ICAgIG1zZy5mcmVlemUoKQogICAgICAgICAgICBpZiByZW1vdmVfbGlzdCA9PSBUcnVlOgogICAg\r
+ICAgICAgICAgICAgbXNn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