Re: [Dovecot] maildir-dbox hybrid

2010-11-28 Thread Roland Stuehmer
Am 25.11.2010 17:45, schrieb Timo Sirainen:
> On Thu, 2010-11-25 at 15:33 +, Timo Sirainen wrote:
> 
>> Attached a program to de-maildirify a dbox. You have to run it
>> separately for each directory containing dbox-Mails:
> 
> Minor update: it shouldn't warn about non-existing maildir files.

Hi Timo, list,

I tried the updated version of the program, but I got a number of
"Fatal" errors, see below.

After that I retuned to the previos method of using the patched dovecot
1.2.16, which (after some error I reported here) left me with a running
instance with only the recovered maildir messages. Together with an
instance with just the new dbox mails I used imapsync to merge them and
have all my mail in one place now. :)


$ gcc -g -Wall -I$DOVECOT -I$DOVECOT/src/lib
-I$DOVECOT/src/lib-storage/index/dbox-common -DHAVE_CONFIG_H
dbox-dehybrid.c -o dbox-dehybrid $DOVECOT/src/lib/.libs/liblib.a

$ find /var/spool/dovecot -name dbox-Mails -type d -exec ./dbox-dehybrid
{} \;
Fatal:
stat(/var/spool/dovecot/mail/roland/dbox/mailboxes/INBOX/dbox-Mails/1114431075.R4ed46e60Q8777.atrus,S=4331,W=4418:2,So)
failed: No such file or directory
Fatal:
stat(/var/spool/dovecot/mail/roland/dbox/mailboxes/SPAM/dbox-Mails/1249480272.R72231c08Q2552.atrus,S=3328,W=3394:2,Sc)
failed: No such file or directory

Best,

Roland.


Re: [Dovecot] maildir-dbox hybrid

2010-11-25 Thread Timo Sirainen
On Thu, 2010-11-25 at 15:33 +, Timo Sirainen wrote:

> Attached a program to de-maildirify a dbox. You have to run it
> separately for each directory containing dbox-Mails:

Minor update: it shouldn't warn about non-existing maildir files.
/*
   export DOVECOT=~/cvs/dovecot-2.0
   gcc -g -Wall -I$DOVECOT -I$DOVECOT/src/lib \
 -I$DOVECOT/src/lib-storage/index/dbox-common -DHAVE_CONFIG_H \
 dbox-dehybrid.c -o dbox-dehybrid $DOVECOT/src/lib/.libs/liblib.a
*/

#include "lib.h"
#include "array.h"
#include "str.h"
#include "strnum.h"
#include "hex-dec.h"
#include "istream.h"
#include "istream-crlf.h"
#include "ostream.h"
#include "dbox-file.h"

#include 
#include 
#include 
#include 
#include 

struct mail {
	const char *fname;
	uint32_t uid;
};

static void dbox_header_write(struct ostream *output)
{
	const char *hdr;

	hdr = t_strdup_printf("%u %c%x %c%x\n", DBOX_VERSION,
			  DBOX_HEADER_MSG_HEADER_SIZE,
			  (unsigned int)sizeof(struct dbox_message_header),
			  DBOX_HEADER_CREATE_STAMP,
			  (unsigned int)time(NULL));
	o_stream_send_str(output, hdr);
}

static void dbox_msg_header_write(struct ostream *output, uoff_t message_size)
{
	struct dbox_message_header dbox_msg_hdr;

	memset(&dbox_msg_hdr, ' ', sizeof(dbox_msg_hdr));
	memcpy(dbox_msg_hdr.magic_pre, DBOX_MAGIC_PRE,
	   sizeof(dbox_msg_hdr.magic_pre));
	dbox_msg_hdr.type = DBOX_MESSAGE_TYPE_NORMAL;
	dec2hex(dbox_msg_hdr.message_size_hex, message_size,
		sizeof(dbox_msg_hdr.message_size_hex));
	dbox_msg_hdr.save_lf = '\n';
	o_stream_send(output, &dbox_msg_hdr, sizeof(dbox_msg_hdr));
}

static void dbox_write_metadata(struct ostream *output, time_t received_date,
uoff_t vsize, const char *guid)
{
	struct dbox_metadata_header metadata_hdr;
	string_t *str;

	memset(&metadata_hdr, 0, sizeof(metadata_hdr));
	memcpy(metadata_hdr.magic_post, DBOX_MAGIC_POST,
	   sizeof(metadata_hdr.magic_post));
	o_stream_send(output, &metadata_hdr, sizeof(metadata_hdr));

	str = t_str_new(256);
	str_printfa(str, "%c%lx\n", DBOX_METADATA_RECEIVED_TIME,
		(unsigned long)received_date);
	str_printfa(str, "%c%llx\n", DBOX_METADATA_VIRTUAL_SIZE,
		(unsigned long long)vsize);
	str_printfa(str, "%c%s\n", DBOX_METADATA_GUID, guid);
	str_append_c(str, '\n');
	o_stream_send(output, str_data(str), str_len(str));
}

static int dbox_convert(const struct mail *mail, const char *dir)
{
	const char *srcpath, *destpath;
	struct istream *input, *crlf;
	struct ostream *output;
	size_t size;
	uoff_t vsize;
	struct stat st;
	int fd, ret = -1;

	srcpath = t_strdup_printf("%s/%s", dir, mail->fname);
	destpath = t_strdup_printf("%s/u.%u", dir, mail->uid);
	if (stat(destpath, &st) == 0) {
		if (stat(srcpath, &st) < 0 && errno == ENOENT)
			return 0;
		i_warning("%s exists already, skipping %s", destpath, srcpath);
		return -1;
	}

	if (stat(srcpath, &st) < 0)
		i_fatal("stat(%s) failed: %m", srcpath);

	fd = creat(destpath, st.st_mode);
	if (fd == -1)
		i_fatal("creat(%s) failed: %m", destpath);
	output = o_stream_create_fd_file(fd, 0, TRUE);

	fd = open(srcpath, O_RDONLY);
	if (fd == -1)
		i_fatal("open(%s) failed: %m", srcpath);
	input = i_stream_create_fd(fd, (size_t)-1, TRUE);

	vsize = 0;
	crlf = i_stream_create_crlf(input);
	while (i_stream_read(crlf) > 0) {
		i_stream_get_data(crlf, &size);
		i_stream_skip(crlf, size);
		vsize += size;
	}
	i_stream_destroy(&crlf);
	i_stream_seek(input, 0);

	dbox_header_write(output);
	dbox_msg_header_write(output, st.st_size);
	o_stream_send_istream(output, input);
	i_assert(i_stream_is_eof(input));
	dbox_write_metadata(output, st.st_mtime, vsize,
			t_strcut(mail->fname, ':'));

	if (output->last_failed_errno != 0) {
		errno = output->last_failed_errno;
		i_error("write(%s) failed: %m", destpath);
		unlink(destpath);
	} else {
		struct utimbuf ut;

		ut.actime = time(NULL);
		ut.modtime = st.st_mtime;
		utime(destpath, &ut);
		unlink(srcpath);
		ret = 0;
	}

	i_stream_destroy(&input);
	o_stream_destroy(&output);
	return ret;
}

int main(int argc, char *argv[])
{
	ARRAY_DEFINE(mails, struct mail);
	const struct mail *mail;
	struct mail newmail;
	const char *dir = argv[1], *path, *line;
	struct istream *input;
	int fd, ret = 0;

	lib_init();

	path = t_strconcat(dir, "/dbox.index", NULL);
	t_array_init(&mails, 100);
	fd = open(path, O_RDONLY);
	if (fd == -1)
		i_fatal("open(%s) failed: %m", path);
	input = i_stream_create_fd(fd, (size_t)-1, TRUE);
	(void)i_stream_read_next_line(input);
	while ((line = i_stream_read_next_line(input)) != NULL) {
		const char *const *args = t_strsplit(line, " ");

		i_assert(args[3][0] == ':');
		if (str_to_uint32(args[2], &newmail.uid) < 0)
			i_unreached();
		newmail.fname = t_strdup(args[3] + 1);
		array_append(&mails, &newmail, 1);
	}
	i_stream_destroy(&input);

	array_foreach(&mails, mail) {
		T_BEGIN {
			if (dbox_convert(mail, dir) < 0)
ret = -1;
		} T_END;
	}

	if (ret == 0) {
		unlink(t_strconcat(dir, "/dbox.index", NULL));
		unlink(t_strconcat(dir, "/dovecot-uidli

Re: [Dovecot] maildir-dbox hybrid

2010-11-25 Thread Timo Sirainen
On Tue, 2010-11-09 at 23:57 +0100, Roland Stuehmer wrote:
> are there any opinions on this? :)

Attached a program to de-maildirify a dbox. You have to run it
separately for each directory containing dbox-Mails:

find ~/dbox/ -name dbox-Mails -type d -exec ./dbox-dehybrid {} \;

I tested that it seemed to convert a test maildir ok, but backups would
be a good idea in any case :) The converter deletes all of the
unnecessary files while doing the conversion.
/*
   export DOVECOT=~/cvs/dovecot-2.0
   gcc -g -Wall -I$DOVECOT -I$DOVECOT/src/lib \
 -I$DOVECOT/src/lib-storage/index/dbox-common -DHAVE_CONFIG_H \
 dbox-dehybrid.c -o dbox-dehybrid $DOVECOT/src/lib/.libs/liblib.a
*/

#include "lib.h"
#include "array.h"
#include "str.h"
#include "strnum.h"
#include "hex-dec.h"
#include "istream.h"
#include "istream-crlf.h"
#include "ostream.h"
#include "dbox-file.h"

#include 
#include 
#include 
#include 
#include 

struct mail {
	const char *fname;
	uint32_t uid;
};

static void dbox_header_write(struct ostream *output)
{
	const char *hdr;

	hdr = t_strdup_printf("%u %c%x %c%x\n", DBOX_VERSION,
			  DBOX_HEADER_MSG_HEADER_SIZE,
			  (unsigned int)sizeof(struct dbox_message_header),
			  DBOX_HEADER_CREATE_STAMP,
			  (unsigned int)time(NULL));
	o_stream_send_str(output, hdr);
}

static void dbox_msg_header_write(struct ostream *output, uoff_t message_size)
{
	struct dbox_message_header dbox_msg_hdr;

	memset(&dbox_msg_hdr, ' ', sizeof(dbox_msg_hdr));
	memcpy(dbox_msg_hdr.magic_pre, DBOX_MAGIC_PRE,
	   sizeof(dbox_msg_hdr.magic_pre));
	dbox_msg_hdr.type = DBOX_MESSAGE_TYPE_NORMAL;
	dec2hex(dbox_msg_hdr.message_size_hex, message_size,
		sizeof(dbox_msg_hdr.message_size_hex));
	dbox_msg_hdr.save_lf = '\n';
	o_stream_send(output, &dbox_msg_hdr, sizeof(dbox_msg_hdr));
}

static void dbox_write_metadata(struct ostream *output, time_t received_date,
uoff_t vsize, const char *guid)
{
	struct dbox_metadata_header metadata_hdr;
	string_t *str;

	memset(&metadata_hdr, 0, sizeof(metadata_hdr));
	memcpy(metadata_hdr.magic_post, DBOX_MAGIC_POST,
	   sizeof(metadata_hdr.magic_post));
	o_stream_send(output, &metadata_hdr, sizeof(metadata_hdr));

	str = t_str_new(256);
	str_printfa(str, "%c%lx\n", DBOX_METADATA_RECEIVED_TIME,
		(unsigned long)received_date);
	str_printfa(str, "%c%llx\n", DBOX_METADATA_VIRTUAL_SIZE,
		(unsigned long long)vsize);
	str_printfa(str, "%c%s\n", DBOX_METADATA_GUID, guid);
	str_append_c(str, '\n');
	o_stream_send(output, str_data(str), str_len(str));
}

static int dbox_convert(const struct mail *mail, const char *dir)
{
	const char *srcpath, *destpath;
	struct istream *input, *crlf;
	struct ostream *output;
	size_t size;
	uoff_t vsize;
	struct stat st;
	int fd, ret = -1;

	srcpath = t_strdup_printf("%s/%s", dir, mail->fname);
	destpath = t_strdup_printf("%s/u.%u", dir, mail->uid);
	if (stat(destpath, &st) == 0) {
		i_warning("%s exists already, skipping %s", destpath, srcpath);
		return -1;
	}

	if (stat(srcpath, &st) < 0)
		i_fatal("stat(%s) failed: %m", srcpath);

	fd = creat(destpath, st.st_mode);
	if (fd == -1)
		i_fatal("creat(%s) failed: %m", destpath);
	output = o_stream_create_fd_file(fd, 0, TRUE);

	fd = open(srcpath, O_RDONLY);
	if (fd == -1)
		i_fatal("open(%s) failed: %m", srcpath);
	input = i_stream_create_fd(fd, (size_t)-1, TRUE);

	vsize = 0;
	crlf = i_stream_create_crlf(input);
	while (i_stream_read(crlf) > 0) {
		i_stream_get_data(crlf, &size);
		i_stream_skip(crlf, size);
		vsize += size;
	}
	i_stream_destroy(&crlf);
	i_stream_seek(input, 0);

	dbox_header_write(output);
	dbox_msg_header_write(output, st.st_size);
	o_stream_send_istream(output, input);
	i_assert(i_stream_is_eof(input));
	dbox_write_metadata(output, st.st_mtime, vsize,
			t_strcut(mail->fname, ':'));

	if (output->last_failed_errno != 0) {
		errno = output->last_failed_errno;
		i_error("write(%s) failed: %m", destpath);
		unlink(destpath);
	} else {
		struct utimbuf ut;

		ut.actime = time(NULL);
		ut.modtime = st.st_mtime;
		utime(destpath, &ut);
		unlink(srcpath);
		ret = 0;
	}

	i_stream_destroy(&input);
	o_stream_destroy(&output);
	return ret;
}

int main(int argc, char *argv[])
{
	ARRAY_DEFINE(mails, struct mail);
	const struct mail *mail;
	struct mail newmail;
	const char *dir = argv[1], *path, *line;
	struct istream *input;
	int fd, ret = 0;

	lib_init();

	path = t_strconcat(dir, "/dbox.index", NULL);
	t_array_init(&mails, 100);
	fd = open(path, O_RDONLY);
	if (fd == -1)
		i_fatal("open(%s) failed: %m", path);
	input = i_stream_create_fd(fd, (size_t)-1, TRUE);
	(void)i_stream_read_next_line(input);
	while ((line = i_stream_read_next_line(input)) != NULL) {
		const char *const *args = t_strsplit(line, " ");

		i_assert(args[3][0] == ':');
		if (str_to_uint32(args[2], &newmail.uid) < 0)
			i_unreached();
		newmail.fname = t_strdup(args[3] + 1);
		array_append(&mails, &newmail, 1);
	}
	i_stream_destroy(&input);

	array_foreach(&mails, mail) {
		T_BEGIN {
			if (dbox_conve

Re: [Dovecot] maildir-dbox hybrid

2010-11-09 Thread Roland Stuehmer
Roland Stuehmer wrote:
> I patched Dovecot 1.2.15 with your diff (and with debian patches). I
> then accessed all mailboxes. For some it went OK, but for some I now
> only see old mail and am missing the newest ones starting from some time
> in February (I probably did a dovecot upgrade then).
> 
> What I got is thousands of these:
> 
>> Oct 21 21:29:30 atrus dovecot: IMAP(roland): 
>> /var/spool/dovecot/mail/roland/dbox/mailboxes/INBOX/dbox-Mails/u.8922
>> corrupted: Invalid dbox version
> 

[...]

> 
> Was there a dbox format change?

Hi,

are there any opinions on this? :)

Cheers,

Roland.


Re: [Dovecot] maildir-dbox hybrid

2010-10-21 Thread Roland Stuehmer
Timo Sirainen wrote:
> Yeah. Not very nice either. Here's a 3rd option: Apply the attached 
> patch to v1.2 and then open all users' all mailboxes (write a script
> or something). It should convert all maildir files to dbox files. Try
> with one account first to make sure it works. :)

Hi Timo, list,

your 3rd option sounded best, but I got some problems and had to revert
to my backup:

I patched Dovecot 1.2.15 with your diff (and with debian patches). I
then accessed all mailboxes. For some it went OK, but for some I now
only see old mail and am missing the newest ones starting from some time
in February (I probably did a dovecot upgrade then).

What I got is thousands of these:

> Oct 21 21:29:30 atrus dovecot: IMAP(roland): 
> /var/spool/dovecot/mail/roland/dbox/mailboxes/INBOX/dbox-Mails/u.8922
> corrupted: Invalid dbox version

...and some occasional these:

> Oct 21 21:32:59 atrus dovecot: IMAP(roland): Panic: file
> mail-index-transaction.c: line 1273 (mail_index_update_ext):
> assertion failed: (seq > 0 && (seq <=
> mail_index_view_get_messages_count(t->view) || seq <=
> t->last_new_seq))
> 
> Oct 21 21:32:59 atrus dovecot: IMAP(roland): Raw backtrace: imap
> [0x4a6e32] -> imap [0x4a6eb3] -> imap [0x4a6596] ->
> imap(mail_index_update_ext+0x15d) [0x47d7bd] ->
> imap(dbox_sync_index_rebuild+0x1da) [0x43c87a] ->
> imap(dbox_sync_begin+0x481) [0x43ae01] -> imap(dbox_sync+0x18)
> [0x43b198] -> imap(dbox_storage_sync_init+0x36) [0x43b206] ->
> imap(mailbox_sync+0x30) [0x46d380] -> imap(cmd_select_full+0x37c)
> [0x42129c] -> imap [0x423adc] -> imap [0x423b8d] ->
> imap(client_handle_input+0x45) [0x423d05] -> imap(client_input+0x5f)
> [0x42469f] -> imap(io_loop_handler_run+0xcb) [0x4aefeb] ->
> imap(io_loop_run+0x18) [0x4ae468] -> imap(main+0x537) [0x42c727] ->
> /lib/libc.so.6(__libc_start_main+0xe6) [0x7fe1edc081a6] -> imap
> [0x41c689]
> 
> Oct 21 21:32:59 atrus dovecot: dovecot: child 2920 (imap) killed with
> signal 6 (core dumps disabled)

...where the last one is not always there.

Was there a dbox format change?

Best regards,

Roland.



Re: [Dovecot] maildir-dbox hybrid

2010-10-20 Thread Timo Sirainen
On Wed, 2010-10-20 at 16:34 +0300, Luben Karavelov wrote:
> I have tried the patch with a single dbox and it works. But when I try
> to 
> access it via POP3 I get this error:
> 
> MAIL=dbox:/var/www/210870/mail/156897-dbox /usr/lib/dovecot/pop3
> pop3(areonfresh): Error: Getting size of message UID=2428 failed
> -ERR [IN-USE] Couldn't sync mailbox.
> 
> With IMAP there is no such a problem. This is offline machine, just for
> test, so nobody is accessing
> the mail. I have seen such a messages on other boxes also. How could I
> clean this type of errors?

Does it matter since it works with imap? The idea was to just select all
mailboxes once to get the mails converted, doesn't matter if it's done
with imap or pop3. You shouldn't use that binary for real clients,
because it keeps writing to each dbox file all the time, making the
performance just horrible.




Re: [Dovecot] maildir-dbox hybrid

2010-10-20 Thread Luben Karavelov
I have tried the patch with a single dbox and it works. But when I try
to 
access it via POP3 I get this error:

MAIL=dbox:/var/www/210870/mail/156897-dbox /usr/lib/dovecot/pop3
pop3(areonfresh): Error: Getting size of message UID=2428 failed
-ERR [IN-USE] Couldn't sync mailbox.
pop3(areonfresh): Error: Couldn't init INBOX: Can't sync mailbox:
Messages keep getting expunged
pop3(areonfresh): Info: Mailbox init failed top=0/0, retr=0/0,
del=0/2055, size=286255398

With IMAP there is no such a problem. This is offline machine, just for
test, so nobody is accessing
the mail. I have seen such a messages on other boxes also. How could I
clean this type of errors?

Best regards and thanks for the great work.

-- 
Luben Karavelov
Research and development
Spectrum Net JSC

36, D-r G. M. Dimitrov Blvd.
1797 Sofia
Mobile: +359 884332840
url: www.spnet.net


Re: [Dovecot] maildir-dbox hybrid

2010-10-20 Thread Luben Karavelov
On Tue, 19 Oct 2010 19:11:20 +0100, Timo Sirainen  wrote:
> On Mon, 2010-10-18 at 21:56 +0300, Luben Karavelov wrote:
>> On Sun, 17 Oct 2010 22:23:29 +0100, Timo Sirainen  wrote:
>> > On 17.10.2010, at 17.52, Roland Stuehmer wrote:
>> >
>> >> How can I convert old mailboxes in "maildir-dbox hybrid" to a current 
>> >> dbox?
>> >
>> > Does this help? http://dovecot.org/list/dovecot/2010-September/053012.html
>>
>> If I understand it correctly, dbox/maildir hybrid is when there are
>> some messages
>> stored as maildir msgs and some messages in dbox format, isn't it?
> 
> Right.
> 
>> The conversion, as described in the suggested post seems like a lot of
>> trouble.
> 
> Yeah. 
> 
>> So, I have some questions:
>>
>> In the first scenario, if I redeliver maildir-format messages, does the
>> users that
>> use POP3 and store their mail on the server will re-download all
>> redelivered
>> messages? (if it does matter, my pop3_uidl_format = %08Xu%08Xv).
> 
> Yes, pop3 users will redownload mails.
> 
>> The other option - convert the dbox-es back to maildir, move the old
>> maildir
>> messages in the new maildir, manually add them to the new uid-list and
>> finally
>> convert the new maildir to sdbox - seems quite fragile.
> 
> Yeah. Not very nice either. Here's a 3rd option: Apply the attached
> patch to v1.2 and then open all users' all mailboxes (write a script or
> something). It should convert all maildir files to dbox files. Try with
> one account first to make sure it works. :)

Thanks Timo, I will try the patch and report back.

-- 
Luben Karavelov
Research and development
Spectrum Net JSC

36, D-r G. M. Dimitrov Blvd.
1797 Sofia
Mobile: +359 884332840
url: www.spnet.net


Re: [Dovecot] maildir-dbox hybrid

2010-10-19 Thread Timo Sirainen
On Mon, 2010-10-18 at 21:56 +0300, Luben Karavelov wrote:
> On Sun, 17 Oct 2010 22:23:29 +0100, Timo Sirainen  wrote:
> > On 17.10.2010, at 17.52, Roland Stuehmer wrote:
> > 
> >> How can I convert old mailboxes in "maildir-dbox hybrid" to a current dbox?
> > 
> > Does this help? http://dovecot.org/list/dovecot/2010-September/053012.html
> 
> If I understand it correctly, dbox/maildir hybrid is when there are
> some messages 
> stored as maildir msgs and some messages in dbox format, isn't it?

Right.

> The conversion, as described in the suggested post seems like a lot of
> trouble.

Yeah. 

> So, I have some questions:
> 
> In the first scenario, if I redeliver maildir-format messages, does the
> users that
> use POP3 and store their mail on the server will re-download all
> redelivered 
> messages? (if it does matter, my pop3_uidl_format = %08Xu%08Xv).

Yes, pop3 users will redownload mails.

> The other option - convert the dbox-es back to maildir, move the old
> maildir 
> messages in the new maildir, manually add them to the new uid-list and
> finally 
> convert the new maildir to sdbox - seems quite fragile.

Yeah. Not very nice either. Here's a 3rd option: Apply the attached
patch to v1.2 and then open all users' all mailboxes (write a script or
something). It should convert all maildir files to dbox files. Try with
one account first to make sure it works. :)
diff -r 1ecf1c3f7ecf src/lib-storage/index/dbox/dbox-sync.c
--- a/src/lib-storage/index/dbox/dbox-sync.c	Thu Oct 14 18:20:26 2010 +0100
+++ b/src/lib-storage/index/dbox/dbox-sync.c	Tue Oct 19 19:09:32 2010 +0100
@@ -255,8 +255,8 @@
 	const void *data;
 	size_t data_size;
 
-	if (mbox->last_interactive_change <
-	ioloop_time - DBOX_FLUSH_SECS_INTERACTIVE)
+	/*if (mbox->last_interactive_change <
+	ioloop_time - DBOX_FLUSH_SECS_INTERACTIVE)*/
 		return 1;
 
 	mail_index_get_header_ext(mbox->ibox.view, mbox->dbox_hdr_ext_id,
@@ -295,8 +295,19 @@
 	bool rebuild = FALSE;
 
 	ret = dbox_sync_want_flush_dirty(mbox, close_flush_dirty_flags);
-	if (ret > 0)
+	if (ret > 0) {
+		struct mail_index_transaction *trans;
+		uint32_t seq, count = mail_index_view_get_messages_count(mbox->ibox.view);
+		uoff_t offset;
+
+		trans = mail_index_transaction_begin(mbox->ibox.view, 0);
+		for (seq = 1; seq <= count; seq++) {
+			mail_index_update_flags(trans, seq, MODIFY_ADD,
+(enum mail_flags)MAIL_INDEX_MAIL_FLAG_DIRTY);
+		}
+		mail_index_transaction_commit(&trans, &seq, &offset);
 		sync_flags |= MAIL_INDEX_SYNC_FLAG_FLUSH_DIRTY;
+	}
 	else if (ret < 0)
 		rebuild = TRUE;
 	else {


Re: [Dovecot] maildir-dbox hybrid

2010-10-18 Thread Luben Karavelov
On Sun, 17 Oct 2010 22:23:29 +0100, Timo Sirainen  wrote:
> On 17.10.2010, at 17.52, Roland Stuehmer wrote:
> 
>> How can I convert old mailboxes in "maildir-dbox hybrid" to a current dbox?
> 
> Does this help? http://dovecot.org/list/dovecot/2010-September/053012.html

If I understand it correctly, dbox/maildir hybrid is when there are
some messages 
stored as maildir msgs and some messages in dbox format, isn't it?

The conversion, as described in the suggested post seems like a lot of
trouble.
So, I have some questions:

In the first scenario, if I redeliver maildir-format messages, does the
users that
use POP3 and store their mail on the server will re-download all
redelivered 
messages? (if it does matter, my pop3_uidl_format = %08Xu%08Xv).

The other option - convert the dbox-es back to maildir, move the old
maildir 
messages in the new maildir, manually add them to the new uid-list and
finally 
convert the new maildir to sdbox - seems quite fragile.

Best regards

-- 
Luben Karavelov
Research and development
Spectrum Net JSC

36, D-r G. M. Dimitrov Blvd.
1797 Sofia
Mobile: +359 884332840
url: www.spnet.net


Re: [Dovecot] maildir-dbox hybrid

2010-10-17 Thread Timo Sirainen
On 17.10.2010, at 17.52, Roland Stuehmer wrote:

> How can I convert old mailboxes in "maildir-dbox hybrid" to a current dbox?

Does this help? http://dovecot.org/list/dovecot/2010-September/053012.html



[Dovecot] maildir-dbox hybrid

2010-10-17 Thread Roland Stuehmer
Hi!

How can I convert old mailboxes in "maildir-dbox hybrid" to a current dbox?

I have a Dovecot installation that was upgraded from 1.2.x to 2.0.x.
Having used the old convert plugin during the 1.2-times I am now stuck
with mailboxes which are partially converted (maildir-dbox hybrid state).

On  it just says to contact the
mailinglist. :)

| If you have any Maildir files in your dbox, you need to convert them
| somehow (contact Dovecot mailing list)

Regards,

Roland.

P.S.: I am currently using version: 2.0.5 (b8803a1e2dc2)