2024/06/20(木)FreeBSD 13.3R で dovecot 2.3.21 はそのまま構築できない
2024/06/21 16:36
FreeBSD 13.3 では、clang が Ver 17 になった影響か、dovecot 2.3.21 ではこんな感じで、コンパイルエラーになる:
test-mail-index-transaction-update.c:633:14: warning: comparison of function 'timezone' equal to a null pointer is always false [-Wtautological-pointer-compare] 633 | test_assert(timezone == 0); | ^~~~~~~~ ~ ../../src/lib-test/test-common.h:20:8: note: expanded from macro 'test_assert' 20 | if (!(code)) test_assert_failed(#code, __FILE__, __LINE__); \ | ^~~~ test-mail-index-transaction-update.c:633:14: note: prefix with the address-of operator to silence this warning 633 | test_assert(timezone == 0); | ^ | & ../../src/lib-test/test-common.h:20:8: note: expanded from macro 'test_assert' 20 | if (!(code)) test_assert_failed(#code, __FILE__, __LINE__); \ | ^ test-mail-index-transaction-update.c:648:42: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith] 648 | hdr.day_stamp = tests[i].old_day_stamp + timezone; | ^ ~~~~~~~~ test-mail-index-transaction-update.c:648:17: error: incompatible pointer to integer conversion assigning to 'uint32_t' (aka 'unsigned int') from 'char *(*)(int, int)' [-Wint-conversion] 648 | hdr.day_stamp = tests[i].old_day_stamp + timezone; | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test-mail-index-transaction-update.c:650:49: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith] 650 | mail_index_update_day_headers(t, tests[i].now + timezone); | ^ ~~~~~~~~ test-mail-index-transaction-update.c:650:36: error: incompatible pointer to integer conversion passing 'char *(*)(int, int)' to parameter of type 'time_t' (aka 'long') [-Wint-conversion] 650 | mail_index_update_day_headers(t, tests[i].now + timezone); | ^~~~~~~~~~~~~~~~~~~~~~~ ./mail-index-transaction-private.h:127:77: note: passing argument to parameter 'day_stamp' here 127 | void mail_index_update_day_headers(struct mail_index_transaction *t, time_t day_stamp); | ^ test-mail-index-transaction-update.c:654:63: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith] 654 | test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp + timezone, i); | ^ ~~~~~~~~ ../../src/lib-test/test-common.h:26:9: note: expanded from macro 'test_assert_idx' 26 | if (!(code)) test_assert_failed_idx(#code, __FILE__, __LINE__, i); \ | ^~~~ test-mail-index-transaction-update.c:654:37: warning: comparison between pointer and integer ('uint32_t' (aka 'unsigned int') and 'char *(*)(int, int)') [-Wpointer-integer-compare] 654 | test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp + timezone, i); | ~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/lib-test/test-common.h:26:9: note: expanded from macro 'test_assert_idx' 26 | if (!(code)) test_assert_failed_idx(#code, __FILE__, __LINE__, i); \ | ^~~~ 5 warnings and 2 errors generated. gmake[3]: *** [Makefile:916: test-mail-index-transaction-update.o] エラー 1 gmake[3]: ディレクトリ '/usr/local/src/dovecot-2.3.21/src/lib-index' から出ます gmake[2]: *** [Makefile:573: all-recursive] エラー 1 gmake[2]: ディレクトリ '/usr/local/src/dovecot-2.3.21/src' から出ます gmake[1]: *** [Makefile:704: all-recursive] エラー 1 gmake[1]: ディレクトリ '/usr/local/src/dovecot-2.3.21' から出ます gmake: *** [Makefile:548: all] エラー 2軒並み、timezone 絡みのようで、この件に関するパッチが3つ公開されています:
その1 https://github.com/dovecot/core/commit/e983ead775671186b3c8567d59973d2e52b678c7
その2 https://github.com/dovecot/core/commit/1a7b1f66fe4b86cb642dbcfe5a0192c1b77d0e17
その3 https://github.com/dovecot/core/commit/867a37fa7b74f798a931fb582214b5377f57610e
〔その1 src/lib/ioloop-notify-kqueue.c を修正〕
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | 12 | #include "ioloop-private.h" | |
13 | 13 | #include "llist.h" | |
14 | + | #include "time-util.h" | |
14 | 15 | #include <unistd.h> | |
15 | 16 | #include <fcntl.h> | |
16 | 17 | #include <sys/types.h> |
〔その2 src/lib-index/test-mail-index-transaction-update.c を修正〕
@@ -6,6 +6,7 @@ | ||||
6 | 6 | #include "test-common.h" | ||
7 | 7 | #include "mail-index-private.h" | ||
8 | 8 | #include "mail-index-transaction-private.h" | ||
9 | + | #include "utc-offset.h" | ||
9 | 10 | |||
10 | 11 | #include <time.h> | ||
11 | 12 | |||
@@ -630,7 +631,9 @@ | ||||
630 | 631 | |||
631 | 632 | /* daylight savings times were confusing these tests, so we'll now | ||
632 | 633 | just assume that TZ=UTC */ | ||
633 | - | test_assert(timezone == 0); | ||
634 | + | time_t now = time(NULL); | ||
635 | + | struct tm *local_time = localtime(&now); | ||
636 | + | test_assert(utc_offset(local_time, now) == 0); | ||
634 | 637 | |||
635 | 638 | hdr.messages_count = 10; | ||
636 | 639 | t = mail_index_transaction_new(); |
〔その3 src/lib-index/test-mail-index-transaction-update.c を修正〕
@@ -648,13 +648,13 @@ | ||||
648 | 648 | i_zero(&hdr); | ||
649 | 649 | for (j = 0; j < N_ELEMENTS(hdr.day_first_uid); j++) | ||
650 | 650 | hdr.day_first_uid[j] = 8-j; | ||
651 | - | hdr.day_stamp = tests[i].old_day_stamp + timezone; | ||
651 | + | hdr.day_stamp = tests[i].old_day_stamp; | ||
652 | 652 | memcpy(t->post_hdr_change, &hdr, sizeof(hdr)); | ||
653 | - | mail_index_update_day_headers(t, tests[i].now + timezone); | ||
653 | + | mail_index_update_day_headers(t, tests[i].now); | ||
654 | 654 | |||
655 | 655 | struct mail_index_header new_hdr; | ||
656 | 656 | memcpy(&new_hdr, t->post_hdr_change, sizeof(new_hdr)); | ||
657 | - | test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp + timezone, i); | ||
657 | + | test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp, i); | ||
658 | 658 | test_assert_idx(memcmp(new_hdr.day_first_uid, | ||
659 | 659 | tests[i].new_day_first_uid, | ||
660 | 660 | sizeof(uint32_t) * 8) == 0, i); |
これらのパッチを手動で当て、いつもの手順でコンパイルすることで、いくつか Warning が出るものの、通常通りの使用可能となるようです。
バージョンアップで、この不具合が解消されることを期待したいところ。