Ok. I've made a new patch in the subscription-file.c to fix my problem. Attached...
thank you 2008/11/4 Timo Sirainen <[EMAIL PROTECTED]> > It's not a good idea to change the code that way. For example > dovecot-uidlist reading relies on i_stream_next_line() not returning a > partially written. That's why the API description also says: > > /* Gets the next line from stream and returns it, or NULL if more data is > needed to make a full line. Note that if the stream ends with LF not > being > the last character, this function doesn't return the last line. */ > char *i_stream_next_line(struct istream *stream); > > I'd think the easiest way would be for you to just add the missing LFs to > the subscription files. Or alternatively change the subscription file > reading code to also include the last line (with i_stream_get_data() after > i_stream_next_line() has returned NULL). > > > On Nov 4, 2008, at 10:36 PM, Giorgenes Gelatti wrote: > > I did the patch below and it worked for me. >> >> diff --git a/dovecot/src/lib/istream.c b/dovecot/src/lib/istream.c >> index 4b218b9..b195b4f 100644 >> --- a/dovecot/src/lib/istream.c >> +++ b/dovecot/src/lib/istream.c >> @@ -245,6 +245,10 @@ char *i_stream_next_line(struct istream *stream) >> } >> } >> >> + if(ret_buf == NULL && i == _stream->pos) { >> + ret_buf = i_stream_next_line_finish(_stream, i); >> + } >> + >> return ret_buf; >> >> >> 2008/11/4 Giorgenes Gelatti <[EMAIL PROTECTED]> >> >> Hello there, >>> >>> I have a "subscriptions" file that is *not* ended with a line break >>> (created by another system). >>> When I do a "lsub "" "*"" the last mailbox name is not listed. >>> Debugging a little showed that it looks like i_stream_next_line() is not >>> returning the last line if it doesn't end with a line break. >>> >>> Is this a bug? >>> >>> btw, i'm using version 1.1.6. >>> >>> []'s >>> >>> >>> >
diff --git a/dovecot/src/lib-storage/list/subscription-file.c b/dovecot/src/lib-storage/list/subscription-file.c index dc03a29..912bd23 100644 --- a/dovecot/src/lib-storage/list/subscription-file.c +++ b/dovecot/src/lib-storage/list/subscription-file.c @@ -57,14 +57,22 @@ static const char *next_line(struct mailbox_list *list, const char *path, bool ignore_estale) { const char *line; + ssize_t ret; *failed_r = FALSE; if (input == NULL) return NULL; while ((line = i_stream_next_line(input)) == NULL) { - switch (i_stream_read(input)) { + ret = i_stream_read(input); + switch (ret) { case -1: + if(i_stream_have_bytes_left(input)) { + size_t size; + line = i_stream_get_data(input, &size); + i_stream_skip(input, size); + if(line && size > 0) break; + } if (input->stream_errno != 0 && (input->stream_errno != ESTALE || !ignore_estale)) { subswrite_set_syscall_error(list, @@ -81,6 +89,7 @@ static const char *next_line(struct mailbox_list *list, const char *path, *failed_r = TRUE; return NULL; } + if(line) break; } return line;