Merge branch '1.2'

Conflicts:
	configure.ac
	src/mbsync.1
This commit is contained in:
Oswald Buddenhagen 2017-08-05 21:20:34 +02:00
commit 118fdc4f18
2 changed files with 45 additions and 12 deletions

View File

@ -248,6 +248,7 @@ Define the Maildir Store \fIname\fR, opening a section for its parameters.
Use the \fBalternative\fR UID storage scheme for mailboxes in this Store. Use the \fBalternative\fR UID storage scheme for mailboxes in this Store.
This does not affect mailboxes that do already have a UID storage scheme; This does not affect mailboxes that do already have a UID storage scheme;
use \fBmdconvert\fR to change it. use \fBmdconvert\fR to change it.
See \fBRECOMMENDATIONS\fR below.
(Default: \fBno\fR) (Default: \fBno\fR)
.. ..
.TP .TP
@ -711,6 +712,14 @@ you should not use \fBmbsync\fR's \fBTrash\fR option at all.
.P .P
Use of the \fBTrash\fR option with M$ Exchange 2013 requires the use of Use of the \fBTrash\fR option with M$ Exchange 2013 requires the use of
\fBDisableExtension MOVE\fR due to a server bug. \fBDisableExtension MOVE\fR due to a server bug.
.P
When using the more efficient default UID mapping scheme, it is important
that the MUA renames files when moving them between Maildir folders.
Mutt always does that, while mu4e needs to be configured to do it:
.br
.in +4
(setq mu4e-change-filenames-when-moving t)
.in -4
.. ..
.SH INHERENT PROBLEMS .SH INHERENT PROBLEMS
Changes done after \fBmbsync\fR has retrieved the message list will not be Changes done after \fBmbsync\fR has retrieved the message list will not be

View File

@ -305,6 +305,14 @@ static void start_tls_p3( conn_t *conn, int ok )
static void z_fake_cb( void * ); static void z_fake_cb( void * );
static const char *
z_err_msg( int code, z_streamp strm )
{
/* zlib's consistency in populating z_stream->msg is somewhat
* less than stellar. zError() is undocumented. */
return strm->msg ? strm->msg : zError( code );
}
void void
socket_start_deflate( conn_t *conn ) socket_start_deflate( conn_t *conn )
{ {
@ -316,7 +324,7 @@ socket_start_deflate( conn_t *conn )
-15 /* Use raw deflate */ -15 /* Use raw deflate */
); );
if (result != Z_OK) { if (result != Z_OK) {
error( "Fatal: Cannot initialize decompression: %s\n", conn->in_z->msg ); error( "Fatal: Cannot initialize decompression: %s\n", z_err_msg( result, conn->in_z ) );
abort(); abort();
} }
@ -330,7 +338,7 @@ socket_start_deflate( conn_t *conn )
Z_DEFAULT_STRATEGY /* Don't try to do anything fancy */ Z_DEFAULT_STRATEGY /* Don't try to do anything fancy */
); );
if (result != Z_OK) { if (result != Z_OK) {
error( "Fatal: Cannot initialize compression: %s\n", conn->out_z->msg ); error( "Fatal: Cannot initialize compression: %s\n", z_err_msg( result, conn->out_z ) );
abort(); abort();
} }
@ -343,6 +351,7 @@ static void socket_fake_cb( void * );
static void socket_timeout_cb( void * ); static void socket_timeout_cb( void * );
static void socket_connect_one( conn_t * ); static void socket_connect_one( conn_t * );
static void socket_connect_next( conn_t * );
static void socket_connect_failed( conn_t * ); static void socket_connect_failed( conn_t * );
static void socket_connected( conn_t * ); static void socket_connected( conn_t * );
static void socket_connect_bail( conn_t * ); static void socket_connect_bail( conn_t * );
@ -485,8 +494,8 @@ socket_connect_one( conn_t *sock )
s = socket( PF_INET, SOCK_STREAM, 0 ); s = socket( PF_INET, SOCK_STREAM, 0 );
#endif #endif
if (s < 0) { if (s < 0) {
perror( "socket" ); socket_connect_next( sock );
exit( 1 ); return;
} }
socket_open_internal( sock, s ); socket_open_internal( sock, s );
@ -511,10 +520,9 @@ socket_connect_one( conn_t *sock )
} }
static void static void
socket_connect_failed( conn_t *conn ) socket_connect_next( conn_t *conn )
{ {
sys_error( "Cannot connect to %s", conn->name ); sys_error( "Cannot connect to %s", conn->name );
socket_close_internal( conn );
free( conn->name ); free( conn->name );
conn->name = 0; conn->name = 0;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
@ -525,6 +533,13 @@ socket_connect_failed( conn_t *conn )
socket_connect_one( conn ); socket_connect_one( conn );
} }
static void
socket_connect_failed( conn_t *conn )
{
socket_close_internal( conn );
socket_connect_next( conn );
}
static void static void
socket_connected( conn_t *conn ) socket_connected( conn_t *conn )
{ {
@ -648,8 +663,10 @@ socket_fill_z( conn_t *sock )
sock->in_z->next_out = (unsigned char *)buf; sock->in_z->next_out = (unsigned char *)buf;
ret = inflate( sock->in_z, Z_SYNC_FLUSH ); ret = inflate( sock->in_z, Z_SYNC_FLUSH );
if (ret != Z_OK && ret != Z_STREAM_END) { /* Z_BUF_ERROR happens here when the previous call both consumed
error( "Error decompressing data from %s: %s\n", sock->name, sock->in_z->msg ); * all input and exactly filled up the output buffer. */
if (ret != Z_OK && ret != Z_BUF_ERROR && ret != Z_STREAM_END) {
error( "Error decompressing data from %s: %s\n", sock->name, z_err_msg( ret, sock->in_z ) );
socket_fail( sock ); socket_fail( sock );
return; return;
} }
@ -832,6 +849,7 @@ do_flush( conn_t *conn )
if (!conn->z_written) if (!conn->z_written)
return; return;
do { do {
int ret;
if (!bc) { if (!bc) {
buf_avail = WRITE_CHUNK_SIZE; buf_avail = WRITE_CHUNK_SIZE;
bc = nfmalloc( offsetof(buff_chunk_t, data) + buf_avail ); bc = nfmalloc( offsetof(buff_chunk_t, data) + buf_avail );
@ -841,8 +859,11 @@ do_flush( conn_t *conn )
conn->out_z->avail_in = 0; conn->out_z->avail_in = 0;
conn->out_z->next_out = (uchar *)bc->data + bc->len; conn->out_z->next_out = (uchar *)bc->data + bc->len;
conn->out_z->avail_out = buf_avail; conn->out_z->avail_out = buf_avail;
if (deflate( conn->out_z, Z_PARTIAL_FLUSH ) != Z_OK) { /* Z_BUF_ERROR cannot happen here, as zlib suppresses the error
error( "Fatal: Compression error: %s\n", conn->out_z->msg ); * both upon increasing the flush level (1st iteration) and upon
* a no-op after the output buffer was full (later iterations). */
if ((ret = deflate( conn->out_z, Z_PARTIAL_FLUSH )) != Z_OK) {
error( "Fatal: Compression error: %s\n", z_err_msg( ret, conn->out_z ) );
abort(); abort();
} }
bc->len = (char *)conn->out_z->next_out - bc->data; bc->len = (char *)conn->out_z->next_out - bc->data;
@ -904,12 +925,15 @@ socket_write( conn_t *conn, conn_iovec_t *iov, int iovcnt )
len = iov->len - offset; len = iov->len - offset;
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
if (conn->out_z) { if (conn->out_z) {
int ret;
conn->out_z->next_in = (uchar *)iov->buf + offset; conn->out_z->next_in = (uchar *)iov->buf + offset;
conn->out_z->avail_in = len; conn->out_z->avail_in = len;
conn->out_z->next_out = (uchar *)bc->data + bc->len; conn->out_z->next_out = (uchar *)bc->data + bc->len;
conn->out_z->avail_out = buf_avail; conn->out_z->avail_out = buf_avail;
if (deflate( conn->out_z, Z_NO_FLUSH ) != Z_OK) { /* Z_BUF_ERROR is impossible here, as the input buffer always has data,
error( "Fatal: Compression error: %s\n", conn->out_z->msg ); * and the output buffer always has space. */
if ((ret = deflate( conn->out_z, Z_NO_FLUSH )) != Z_OK) {
error( "Fatal: Compression error: %s\n", z_err_msg( ret, conn->out_z ) );
abort(); abort();
} }
bc->len = (char *)conn->out_z->next_out - bc->data; bc->len = (char *)conn->out_z->next_out - bc->data;