Discussion:
[bug-mailutils] movemail: looses messages if connection broken
Jean Louis
2017-01-01 18:07:28 UTC
Permalink
Hello,

I have experienced following before some time:

movemail: number of messages in source mailbox: 5
movemail: number of processed messages: 5
movemail: number of errors: 0 / 0

;;; At this point I have lost Internet connection. The movemail was
waiting for long time, and when I came back to computer, I have
seen this below. However, none of messages was in the local
mailbox. The messages in the remote mailbox were deleted according
to the notices. The local mailbox is empty.

0 kept, 5 deleted.
movemail: mailbox `imaps://username:***@server:993/INBOX.box': cannot open: Operation failed
movemail: mailbox `imaps://username:***@server:993/INBOX.box': cannot open: Network is unreachable


The operation of movemail shall be changed so that unless all messages
are in local inbox, the remote shall not be deleted. I am not sure if
this assumption of mine is really so in the source code. That is based
on analyzis that I could not see any new messages in the inbox.

Jean Louis
Sergey Poznyakoff
2017-01-02 08:58:18 UTC
Permalink
Hi Jean,
Post by Jean Louis
movemail: number of messages in source mailbox: 5
movemail: number of processed messages: 5
movemail: number of errors: 0 / 0
[...]
Post by Jean Louis
0 kept, 5 deleted.
What's this? None of mailutils code produces such message.
Post by Jean Louis
The operation of movemail shall be changed so that unless all messages
are in local inbox, the remote shall not be deleted.
That's the way it operates now. Quoting the source (with additional
annotations for clarity):

// Synchronize destination mailbox with the disk and close it
968 mu_mailbox_sync (dest);
969 rc = mu_mailbox_close (dest);
970 mu_mailbox_destroy (&dest);
971 if (rc)
972 mu_error (_("cannot close destination mailbox: %s"), mu_strerror (rc));
973 else if (!preserve_mail)
// Delete messages from the source mailbox
974 mu_mailbox_expunge (source);
// Close the source mailbox
975 mu_mailbox_close (source);
976 mu_mailbox_destroy (&source);


Regards,
Sergey
Jean Louis
2017-01-02 15:17:25 UTC
Permalink
Post by Sergey Poznyakoff
Hi Jean,
Post by Jean Louis
movemail: number of messages in source mailbox: 5
movemail: number of processed messages: 5
movemail: number of errors: 0 / 0
[...]
Post by Jean Louis
0 kept, 5 deleted.
What's this? None of mailutils code produces such message.
That message above? It is movmail.
Post by Sergey Poznyakoff
Post by Jean Louis
The operation of movemail shall be changed so that unless all messages
are in local inbox, the remote shall not be deleted.
That's the way it operates now. Quoting the source (with additional
// Synchronize destination mailbox with the disk and close it
968 mu_mailbox_sync (dest);
969 rc = mu_mailbox_close (dest);
970 mu_mailbox_destroy (&dest);
971 if (rc)
972 mu_error (_("cannot close destination mailbox: %s"), mu_strerror (rc));
973 else if (!preserve_mail)
// Delete messages from the source mailbox
974 mu_mailbox_expunge (source);
// Close the source mailbox
975 mu_mailbox_close (source);
976 mu_mailbox_destroy (&source);
Regards,
Sergey
Well thank you. I still lost 5 messages, cannot know the reason.

Jean Louis
Sergey Poznyakoff
2017-01-02 15:39:49 UTC
Permalink
Post by Jean Louis
Post by Sergey Poznyakoff
What's this? None of mailutils code produces such message.
That message above? It is movmail.
Jean, the message '0 kept, 5 deleted.' is definitely *Not* produced
by GNU movemail (nor, for what it's worth, by any code in GNU
mailutils, unless you modified it somehow). The simple search for the
word "kept" in the Mailutils codebase gives empty list. Try this:

git ls-files | grep '\.[clyh]' | xargs grep -i 'kept'

and see the result

Regards,
Sergey
Jean Louis
2017-01-02 17:11:52 UTC
Permalink
Hello,

my apologies. It must be something on my side. I have a routine to
movemail and then to invoke mutt, which is the one giving those
messages kept/deleted. Then mutt reported deleted, and I have mistaken
it for movemail. I cannot know why, as it passed. So it it solved.

Jean
Post by Sergey Poznyakoff
Post by Jean Louis
Post by Sergey Poznyakoff
What's this? None of mailutils code produces such message.
That message above? It is movmail.
Jean, the message '0 kept, 5 deleted.' is definitely *Not* produced
by GNU movemail (nor, for what it's worth, by any code in GNU
mailutils, unless you modified it somehow). The simple search for the
git ls-files | grep '\.[clyh]' | xargs grep -i 'kept'
and see the result
Regards,
Sergey
Jean Louis
2017-01-04 10:54:57 UTC
Permalink
Dear Sergey,

Today, I have done git pull, and I failed in following below.

Jean

./bootstrap

./configure --prefix=/package/mail/mailutils --enable-experimental
--disable-pam --enable-ipv6 --disable-imap --disable-pop
--disable-nntp --disable-mh --disable-radius --disable-python
MU_DEFAULT_SCHEME=maildir

In file included from ../include/mailutils/cpp/message.h:23:0,
from message.cc:20:
../include/mailutils/message.h:137:12: note: declared here
extern int mu_message_get_stream (mu_message_t, mu_stream_t *) MU_DEPRECATED;
^
message.cc:122:16: warning: ‘int mu_message_get_stream(mu_message_t, _mu_stream**)’ is deprecated [-Wdeprecated-declarations]
int status = mu_message_get_stream (msg, &c_stream);
^
In file included from ../include/mailutils/cpp/message.h:23:0,
from message.cc:20:
../include/mailutils/message.h:137:12: note: declared here
extern int mu_message_get_stream (mu_message_t, mu_stream_t *) MU_DEPRECATED;
^
message.cc:122:53: warning: ‘int mu_message_get_stream(mu_message_t, _mu_stream**)’ is deprecated [-Wdeprecated-declarations]
int status = mu_message_get_stream (msg, &c_stream);
^
In file included from ../include/mailutils/cpp/message.h:23:0,
from message.cc:20:
../include/mailutils/message.h:137:12: note: declared here
extern int mu_message_get_stream (mu_message_t, mu_stream_t *) MU_DEPRECATED;
^
CXX mime.lo
CXX mutil.lo
CXX pop3.lo
pop3.cc: In member function ‘void mailutils::Pop3::stat(unsigned int*, mu_off_t*)’:
pop3.cc:210:49: error: cannot convert ‘unsigned int*’ to ‘size_t* {aka long unsigned int*}’ for argument ‘2’ to ‘int mu_pop3_stat(mu_pop3_t, size_t*, mu_off_t*)’
int status = mu_pop3_stat (pop3, count, octets);
^
make[2]: *** [Makefile:1089: pop3.lo] Error 1
make[2]: Leaving directory '/sources/gnu/mailutils/libmu_cpp'
make[1]: *** [Makefile:1165: all-recursive] Error 1
make[1]: Leaving directory '/sources/gnu/mailutils'
make: *** [Makefile:1050: all] Error 2
Sergey Poznyakoff
2017-01-04 12:50:48 UTC
Permalink
Hi Jean,
Post by Jean Louis
./configure --prefix=/package/mail/mailutils --enable-experimental
I'd suggest you not enabling experimental features. They are, well ...
experimental, and as such not guaranteed to work :)

That being said, the following simple patch should help:

diff --git a/libmu_cpp/pop3.cc b/libmu_cpp/pop3.cc
index 25dee7c..49fe7dc 100644
--- a/libmu_cpp/pop3.cc
+++ b/libmu_cpp/pop3.cc
@@ -205,7 +205,7 @@ Pop3 :: rset ()
}

void
-Pop3 :: stat (unsigned int* count, mu_off_t* octets)
+Pop3 :: stat (size_t* count, mu_off_t* octets)
{
int status = mu_pop3_stat (pop3, count, octets);
if (status)

Regards,
Sergey
Jean Louis
2017-01-04 17:29:52 UTC
Permalink
Thank you, sure I see what is experimental. I have just hoped that you
included some new utilities, which are useful.

I will skip the patch, and simply git pull from time to time.

Jean
Post by Sergey Poznyakoff
Hi Jean,
Post by Jean Louis
./configure --prefix=/package/mail/mailutils --enable-experimental
I'd suggest you not enabling experimental features. They are, well ...
experimental, and as such not guaranteed to work :)
diff --git a/libmu_cpp/pop3.cc b/libmu_cpp/pop3.cc
index 25dee7c..49fe7dc 100644
--- a/libmu_cpp/pop3.cc
+++ b/libmu_cpp/pop3.cc
@@ -205,7 +205,7 @@ Pop3 :: rset ()
}
void
-Pop3 :: stat (unsigned int* count, mu_off_t* octets)
+Pop3 :: stat (size_t* count, mu_off_t* octets)
{
int status = mu_pop3_stat (pop3, count, octets);
if (status)
Regards,
Sergey
Loading...