From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67890: 28.2; nnmaildir silently deletes messages upon expiration Date: Sat, 23 Dec 2023 11:54:06 +0200 Message-ID: <83cyuxdz29.fsf@gnu.org> References: <87edfjgl9o.fsf%stlman@poczta.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12503"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67890@debbugs.gnu.org To: =?UTF-8?Q?=C5=81ukasz?= Stelmach , Eric Abrahamsen , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 23 10:55:08 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rGyip-00033G-Qk for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Dec 2023 10:55:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGyig-00022D-DF; Sat, 23 Dec 2023 04:54:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGyif-00021l-A0 for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 04:54:57 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGyif-0000v3-2O for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 04:54:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGyik-00066E-5N for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 04:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Dec 2023 09:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67890 X-GNU-PR-Package: emacs Original-Received: via spool by 67890-submit@debbugs.gnu.org id=B67890.170332526923392 (code B ref 67890); Sat, 23 Dec 2023 09:55:02 +0000 Original-Received: (at 67890) by debbugs.gnu.org; 23 Dec 2023 09:54:29 +0000 Original-Received: from localhost ([127.0.0.1]:48619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGyiD-00065D-4R for submit@debbugs.gnu.org; Sat, 23 Dec 2023 04:54:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGyiC-000650-3S for 67890@debbugs.gnu.org; Sat, 23 Dec 2023 04:54:28 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGyi0-0000rv-NH; Sat, 23 Dec 2023 04:54:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=M+KZFcMC9ezmXf07VEYSujkP+69+LBmUOW/KOn3W0xg=; b=JNFl1DmjKUvU3q3vEUhb dQdhzwSjvorD6SuK5Fn7CPCxQ7U83EI3R7D1TKAFoFqS2Et2R8yDx4BEF+ACt1VryQJXx7e/OYpcY qLSMn47iACC9sU9rPnjdRsEZyKh4+0Msapf1BxEo/+/JdDdhAQfsHbTt04tAUb11XLYaXYyk0fYrW sktuCTF7nDRNcCSaZRKNQ6/wGt0y6tAnMUmEefEiTWkPXlVH7dUfXFTfU/7Lg1Ww2qq0VPgZEXEQV yw0WNOtqA9E9OSkWCKRAdv6CRMC3matm6MSl0EGOMsl0LGGh9TxZ1hdcYOYtvlQqXmQA66Y8RFHsh P+e1fyF7Mw/Law==; In-Reply-To: <87edfjgl9o.fsf%stlman@poczta.fm> (message from =?UTF-8?Q?=C5=81ukasz?= Stelmach on Tue, 19 Dec 2023 00:10:11 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276724 Archived-At: > From: Ɓukasz Stelmach > Date: Tue, 19 Dec 2023 00:10:11 +0100 > > I believe I've found a bug leading to a data loss situation. > > Steps to reproduce. > > 1. Setup a maildir virtual server > > 2. Create two or more groups in it. > > 3. Set expire-age and expire-group parameters (G p) for one so that > messages would be moved to the other. > > 4. Exit Gnus and Emacs > > 5. Deliver a message to that group (let's call it source group) with a > date older than expire-age (for example using the script below) > > 6. Run Gnus > > 7. (Optional) M-x describe-function nnmaildir--pgname. Go to the > function and C-u M-x eval-defun. > > 8. Enter the source group. > > 9. (Optional) The debugger will stop in nnmaildir--pgname. Go step by > step and notice the prefix (inside the let) will become an empty > string. This string will be also set as the prefix of the server > passed to the function. > > 10. (Optional though recommended) Enable debugging for > nnmaildir-request-expire-articles. > > 11. Mark the message delivered in point 5 as expirable (E) > > 12. Exit the group. > > 13. (Optional depending on point 10) The debugger will stop in > nnmaildir-request-expire-articles. Skip to the point where the pgname > variable is set. With debugging enabled for nnmaildir--pgname you > can follow the entire process and notice that pgname won't have > appropriate prefix and will be (most probably) equal to gname. Go on > to the point where the target variable is set > > --8<---------------cut here---------------start------------->8--- > target (if force nil > (save-excursion > (save-restriction > (nnmaildir--param pgname 'expire-group))))) > --8<---------------cut here---------------end--------------->8--- > > At this point when nnmaildir--param is set with a group name without > a prefix it will return nil which will prevent the message from being > moved in the next few lines > > --8<---------------cut here---------------start------------->8--- > (when (and (stringp target) > (not (string-equal target pgname))) ;; Move it. > --8<---------------cut here---------------end--------------->8--- > > but not from being unlinked near the end of the > nnmaildir-request-expire-articls function. > > 14. The message gets totally removed. > > The major problem seems to araise from gnus-group-prefixed-name not > finding proper group prefix, which happens because the method field of > nnmaildir--srv doesn't seem to be properly set in nnmaildir--prepare. > > I am digging deeper and deeper but I can't find anything obvious, so I > think this is the moment I will share me findings anyway. > > As far as I can tell this scenario takes place only when I mark as > expirable messages that are alredy older than expire-age. Those which > get marked early after receiving and wait as expirable, apparently make > it nicely to the archive. > > BTW. Judging by diff between emacs-28.2 and master there were very > little changes in nnmaildir, so I guess the bug (if it's a bug, but hey > my misconfiguration should be handled better anyway) still exists. > > --8<---------------cut here---------------start------------->8--- > #!/bin/sh > > DIR=$1 > if [ ! -d "$DIR" ]; then > echo $DIR does not exist > exit 1; > fi > > FILE=$(date +%s.M%6N)P$$.$(hostname) > > cat >$DIR/tmp/$FILE < From: <42@example.com> > To: <2137@example.com> > Subject: test test test > Date: $(date -d '1 year ago' -R) > Message-ID: <$(date | sha256sum | cut -f1 -d\ )@example.com> > > EOF > fortune >>$DIR/tmp/$FILE > mv $DIR/tmp/$FILE $DIR/new/$FILE > --8<---------------cut here---------------end--------------->8--- Adding Eric and Lars to the discussion.