{"thread":{"id":"65138","subject":"[PATCH 0/3] gitlab-ci: update to macOS 15 images","startedAt":"2026-03-05T11:20:28Z","lastAt":"2026-03-09T16:04:08Z","messageCount":7,"participants":["Patrick Steinhardt","Justin Tobler"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"537919","messageId":"20260305-pks-gitlab-ci-macos-16-v1-0-ce8da0ff29c2@pks.im","threadId":"65138","inReplyTo":null,"subject":"[PATCH 0/3] gitlab-ci: update to macOS 15 images","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-05T11:20:20Z","receivedAt":"2026-03-05T11:20:28Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi,\n\nthis isn't anything urgent, I'm simply trying to stay ahead of the\nupcoming deprecation.\n\nThe update uncovers the issue with broken iconv that we have already\nfixed in d0cec08d70 (utf8.c: prepare workaround for iconv under macOS\n14/15, 2026-01-12). But for now we had only wired up this workaround for\nour Makefile, not yet for Meson. So the first two patches wire up this\nfix for Meson, too.\n\nThanks!\n\nPatrick\n\n---\nPatrick Steinhardt (3):\n      meson: simplify iconv-emits-BOM check\n      meson: detect broken iconv that requires ICONV_RESTART_RESET\n      gitlab-ci: update to macOS 15 images\n\n .gitlab-ci.yml |  6 ++---\n meson.build    | 80 +++++++++++++++++++++++++++++++++-------------------------\n 2 files changed, 48 insertions(+), 38 deletions(-)\n\n\n---\nbase-commit: c1485ce6c89b3d33d32bd5e940432d30885afdcc\nchange-id: 20260304-pks-gitlab-ci-macos-16-e9862bfee206\n\n"},{"id":"537920","messageId":"20260305-pks-gitlab-ci-macos-16-v1-1-ce8da0ff29c2@pks.im","threadId":"65138","inReplyTo":"20260305-pks-gitlab-ci-macos-16-v1-0-ce8da0ff29c2@pks.im","subject":"[PATCH 1/3] meson: simplify iconv-emits-BOM check","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-05T11:20:21Z","receivedAt":"2026-03-05T11:20:29Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Simplify the iconv-emits-BOM check that we have in Meson a bit by:\n\n  - Dropping useless variables.\n\n  - Casting the `inpos` pointer to `void *` instead of using a typedef\n    that depends on whether or not we use an old iconv library.\n\nThis overall condenses the code signficantly and makes it easier to\nfollow.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 56 ++++++++++++++++++++------------------------------------\n 1 file changed, 20 insertions(+), 36 deletions(-)\n\ndiff --git a/meson.build b/meson.build\nindex 4b536e0124..ee3d9ced92 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1040,42 +1040,26 @@ if iconv.found()\n     have_old_iconv = true\n   endif\n \n-  iconv_omits_bom_source = '''#\n-    #include <iconv.h>\n-\n-    int main(int argc, const char **argv)\n-    {\n-  '''\n-  if have_old_iconv\n-    iconv_omits_bom_source += '''\n-      typedef const char *iconv_ibp;\n-    '''\n-  else\n-    iconv_omits_bom_source += '''\n-      typedef char *iconv_ibp;\n-    '''\n-  endif\n-  iconv_omits_bom_source += '''\n-      int v;\n-      iconv_t conv;\n-      char in[] = \"a\"; iconv_ibp pin = in;\n-      char out[20] = \"\"; char *pout = out;\n-      size_t isz = sizeof in;\n-      size_t osz = sizeof out;\n-\n-      conv = iconv_open(\"UTF-16\", \"UTF-8\");\n-      iconv(conv, &pin, &isz, &pout, &osz);\n-      iconv_close(conv);\n-      v = (unsigned char)(out[0]) + (unsigned char)(out[1]);\n-      return v != 0xfe + 0xff;\n-    }\n-  '''\n-\n-  if meson.can_run_host_binaries() and compiler.run(iconv_omits_bom_source,\n-    dependencies: iconv,\n-    name: 'iconv omits BOM',\n-  ).returncode() != 0\n-    libgit_c_args += '-DICONV_OMITS_BOM'\n+  if meson.can_run_host_binaries()\n+    if compiler.run('''\n+      #include <iconv.h>\n+\n+      int main(int argc, const char **argv)\n+      {\n+        char in[] = \"a\", *inpos = in;\n+        char out[20] = \"\", *outpos = out;\n+        size_t insz = sizeof(in), outsz = sizeof(out);\n+        iconv_t conv = iconv_open(\"UTF-16\", \"UTF-8\");\n+        iconv(conv, (void *) &inpos, &insz, &outpos, &outsz);\n+        iconv_close(conv);\n+        return (unsigned char)(out[0]) + (unsigned char)(out[1]) != 0xfe + 0xff;\n+      }\n+    ''',\n+      dependencies: iconv,\n+      name: 'iconv omits BOM',\n+    ).returncode() != 0\n+      libgit_c_args += '-DICONV_OMITS_BOM'\n+    endif\n   endif\n else\n   libgit_c_args += '-DNO_ICONV'\n\n-- \n2.53.0.797.g7842e34a66.dirty\n\n"},{"id":"537921","messageId":"20260305-pks-gitlab-ci-macos-16-v1-2-ce8da0ff29c2@pks.im","threadId":"65138","inReplyTo":"20260305-pks-gitlab-ci-macos-16-v1-0-ce8da0ff29c2@pks.im","subject":"[PATCH 2/3] meson: detect broken iconv that requires ICONV_RESTART_RESET","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-05T11:20:22Z","receivedAt":"2026-03-05T11:20:32Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"In d0cec08d70 (utf8.c: prepare workaround for iconv under macOS 14/15,\n2026-01-12) we have introduced a new workaround for a broken version of\nlibiconv on macOS. This workaround has for now only been wired up for\nour Makefile, so using Meson with such a broken version will fail.\n\nWe can rather easily detect the broken behaviour. Some encodings have\ndifferent modes that can be switched to via an escape sequence. In the\ncase of ISO-2022-JP this can be done via \"<Esc>$B\" and \"<Esc>(J\" to\nswitch between ASCII and JIS modes. The bug now triggers when one does\nmultiple calls to iconv(3p) to convert a string piece by piece, where\nthe first call enters JIS mode. The second call forgets about the fact\nthat it is still in JIS mode, and consequently it will incorrectly treat\nthe input as ASCII, and thus the produced output is of course garbage.\n\nWire up a test that exercises this in Meson and, if it fails, set the\n`ICONV_RESTART_RESET` define.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n meson.build | 26 ++++++++++++++++++++++++++\n 1 file changed, 26 insertions(+)\n\ndiff --git a/meson.build b/meson.build\nindex ee3d9ced92..1b9be3d36c 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1060,6 +1060,32 @@ if iconv.found()\n     ).returncode() != 0\n       libgit_c_args += '-DICONV_OMITS_BOM'\n     endif\n+\n+    if compiler.run('''\n+      #include <iconv.h>\n+      #include <string.h>\n+\n+      int main(int argc, const char *argv[])\n+      {\n+          char in[] = \"\\x1b\\x24\\x42\\x24\\x22\\x24\\x22\\x1b\\x28\\x42\", *inpos = in;\n+          char out[7] = { 0 }, *outpos = out;\n+          size_t insz = sizeof(in) - 1, outsz = 4;\n+          iconv_t conv = iconv_open(\"UTF-8\", \"ISO-2022-JP\");\n+          if (!conv)\n+              return 1;\n+          if (iconv(conv, (void *) &inpos, &insz, &outpos, &outsz) != (size_t) -1)\n+              return 2;\n+          outsz = sizeof(out) - (outpos - out);\n+          if (iconv(conv, (void *) &inpos, &insz, &outpos, &outsz) == (size_t) -1)\n+              return 3;\n+          return strcmp(\"\\343\\201\\202\\343\\201\\202\", out) ? 4 : 0;\n+      }\n+    ''',\n+      dependencies: iconv,\n+      name: 'iconv handles restarts properly',\n+    ).returncode() != 0\n+      libgit_c_args += '-DICONV_RESTART_RESET'\n+    endif\n   endif\n else\n   libgit_c_args += '-DNO_ICONV'\n\n-- \n2.53.0.797.g7842e34a66.dirty\n\n"},{"id":"537922","messageId":"20260305-pks-gitlab-ci-macos-16-v1-3-ce8da0ff29c2@pks.im","threadId":"65138","inReplyTo":"20260305-pks-gitlab-ci-macos-16-v1-0-ce8da0ff29c2@pks.im","subject":"[PATCH 3/3] gitlab-ci: update to macOS 15 images","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-03-05T11:20:23Z","receivedAt":"2026-03-05T11:20:34Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The macos-14-xcode-15 images for GitLab's macOS runners have been\ndeprecated. Update to macOS 15, which is our current stable version.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\n .gitlab-ci.yml | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/.gitlab-ci.yml b/.gitlab-ci.yml\nindex 71b8a6e642..83ec786c5a 100644\n--- a/.gitlab-ci.yml\n+++ b/.gitlab-ci.yml\n@@ -101,13 +101,13 @@ test:osx:\n   parallel:\n     matrix:\n       - jobname: osx-clang\n-        image: macos-14-xcode-15\n+        image: macos-15-xcode-16\n         CC: clang\n       - jobname: osx-reftable\n-        image: macos-14-xcode-15\n+        image: macos-15-xcode-16\n         CC: clang\n       - jobname: osx-meson\n-        image: macos-14-xcode-15\n+        image: macos-15-xcode-16\n         CC: clang\n   artifacts:\n     paths:\n\n-- \n2.53.0.797.g7842e34a66.dirty\n\n"},{"id":"538291","messageId":"aa7nk37z9VkaiEyt@denethor","threadId":"65138","inReplyTo":"20260305-pks-gitlab-ci-macos-16-v1-1-ce8da0ff29c2@pks.im","subject":"Re: [PATCH 1/3] meson: simplify iconv-emits-BOM check","fromName":"Justin Tobler","fromEmail":"jltobler@gmail.com","sentAt":"2026-03-09T15:33:42Z","receivedAt":"2026-03-09T15:33:47Z","isPatch":true,"sender":{"key":"jltobler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53454972?v=4"},"body":"On 26/03/05 12:20PM, Patrick Steinhardt wrote:\n> Simplify the iconv-emits-BOM check that we have in Meson a bit by:\n> \n>   - Dropping useless variables.\n> \n>   - Casting the `inpos` pointer to `void *` instead of using a typedef\n>     that depends on whether or not we use an old iconv library.\n> \n> This overall condenses the code signficantly and makes it easier to\n> follow.\n> \n> Signed-off-by: Patrick Steinhardt <ps@pks.im>\n> ---\n>  meson.build | 56 ++++++++++++++++++++------------------------------------\n>  1 file changed, 20 insertions(+), 36 deletions(-)\n> \n> diff --git a/meson.build b/meson.build\n> index 4b536e0124..ee3d9ced92 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -1040,42 +1040,26 @@ if iconv.found()\n>      have_old_iconv = true\n>    endif\n>  \n> -  iconv_omits_bom_source = '''#\n> -    #include <iconv.h>\n> -\n> -    int main(int argc, const char **argv)\n> -    {\n> -  '''\n> -  if have_old_iconv\n> -    iconv_omits_bom_source += '''\n> -      typedef const char *iconv_ibp;\n> -    '''\n> -  else\n> -    iconv_omits_bom_source += '''\n> -      typedef char *iconv_ibp;\n> -    '''\n> -  endif\n> -  iconv_omits_bom_source += '''\n> -      int v;\n> -      iconv_t conv;\n> -      char in[] = \"a\"; iconv_ibp pin = in;\n> -      char out[20] = \"\"; char *pout = out;\n> -      size_t isz = sizeof in;\n> -      size_t osz = sizeof out;\n> -\n> -      conv = iconv_open(\"UTF-16\", \"UTF-8\");\n> -      iconv(conv, &pin, &isz, &pout, &osz);\n> -      iconv_close(conv);\n> -      v = (unsigned char)(out[0]) + (unsigned char)(out[1]);\n> -      return v != 0xfe + 0xff;\n> -    }\n> -  '''\n> -\n> -  if meson.can_run_host_binaries() and compiler.run(iconv_omits_bom_source,\n> -    dependencies: iconv,\n> -    name: 'iconv omits BOM',\n> -  ).returncode() != 0\n> -    libgit_c_args += '-DICONV_OMITS_BOM'\n> +  if meson.can_run_host_binaries()\n> +    if compiler.run('''\n> +      #include <iconv.h>\n> +\n> +      int main(int argc, const char **argv)\n> +      {\n> +        char in[] = \"a\", *inpos = in;\n> +        char out[20] = \"\", *outpos = out;\n> +        size_t insz = sizeof(in), outsz = sizeof(out);\n> +        iconv_t conv = iconv_open(\"UTF-16\", \"UTF-8\");\n> +        iconv(conv, (void *) &inpos, &insz, &outpos, &outsz);\n\nOk, we are able to avoid the typedefs used for pin/inpos by simply\ncasting to void *. This does indeed simplify how the program is\nconstructed while remaining functionally the same. Looks good.\n\n-Justin\n"},{"id":"538294","messageId":"aa7pwTbyv8TT9WBB@denethor","threadId":"65138","inReplyTo":"20260305-pks-gitlab-ci-macos-16-v1-2-ce8da0ff29c2@pks.im","subject":"Re: [PATCH 2/3] meson: detect broken iconv that requires ICONV_RESTART_RESET","fromName":"Justin Tobler","fromEmail":"jltobler@gmail.com","sentAt":"2026-03-09T16:02:24Z","receivedAt":"2026-03-09T16:02:29Z","isPatch":true,"sender":{"key":"jltobler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53454972?v=4"},"body":"On 26/03/05 12:20PM, Patrick Steinhardt wrote:\n> In d0cec08d70 (utf8.c: prepare workaround for iconv under macOS 14/15,\n> 2026-01-12) we have introduced a new workaround for a broken version of\n> libiconv on macOS. This workaround has for now only been wired up for\n> our Makefile, so using Meson with such a broken version will fail.\n> \n> We can rather easily detect the broken behaviour. Some encodings have\n> different modes that can be switched to via an escape sequence. In the\n> case of ISO-2022-JP this can be done via \"<Esc>$B\" and \"<Esc>(J\" to\n> switch between ASCII and JIS modes. The bug now triggers when one does\n> multiple calls to iconv(3p) to convert a string piece by piece, where\n> the first call enters JIS mode. The second call forgets about the fact\n> that it is still in JIS mode, and consequently it will incorrectly treat\n> the input as ASCII, and thus the produced output is of course garbage.\n> \n> Wire up a test that exercises this in Meson and, if it fails, set the\n> `ICONV_RESTART_RESET` define.\n\nMakes sense.\n\n> Signed-off-by: Patrick Steinhardt <ps@pks.im>\n> ---\n>  meson.build | 26 ++++++++++++++++++++++++++\n>  1 file changed, 26 insertions(+)\n> \n> diff --git a/meson.build b/meson.build\n> index ee3d9ced92..1b9be3d36c 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -1060,6 +1060,32 @@ if iconv.found()\n>      ).returncode() != 0\n>        libgit_c_args += '-DICONV_OMITS_BOM'\n>      endif\n> +\n> +    if compiler.run('''\n> +      #include <iconv.h>\n> +      #include <string.h>\n> +\n> +      int main(int argc, const char *argv[])\n> +      {\n> +          char in[] = \"\\x1b\\x24\\x42\\x24\\x22\\x24\\x22\\x1b\\x28\\x42\", *inpos = in;\n\nThis appears to be the ISO-2022-JP encoded sequence that switches\nbetween ASCII and JIS modes. Might we worth mentioning this in a\ncomment. :)\n\n> +          char out[7] = { 0 }, *outpos = out;\n> +          size_t insz = sizeof(in) - 1, outsz = 4;\n> +          iconv_t conv = iconv_open(\"UTF-8\", \"ISO-2022-JP\");\n> +          if (!conv)\n> +              return 1;\n> +          if (iconv(conv, (void *) &inpos, &insz, &outpos, &outsz) != (size_t) -1)\n> +              return 2;\n> +          outsz = sizeof(out) - (outpos - out);\n> +          if (iconv(conv, (void *) &inpos, &insz, &outpos, &outsz) == (size_t) -1)\n> +              return 3;\n\nHere we call iconv twice. If we have a bugged version of iconv, In the\nsecond call we expect that it forgets the mode and returns garbage.\n\n> +          return strcmp(\"\\343\\201\\202\\343\\201\\202\", out) ? 4 : 0;\n\nThis appears to be the expected UTF-8 string. If the output doesn't\nmatch, it indicates we are encountering this bug.\n\n> +      }\n> +    ''',\n> +      dependencies: iconv,\n> +      name: 'iconv handles restarts properly',\n> +    ).returncode() != 0\n\nShould we be more specific and expect the return code to be 4? It is my\nunderstanding that these other scenarios would not be indicative of the\nbug.\n\n> +      libgit_c_args += '-DICONV_RESTART_RESET'\n> +    endif\n>    endif\n>  else\n>    libgit_c_args += '-DNO_ICONV'\n\nThe check here looks good, but without the surrounding context, it is\nnot immediately obvious to me what we are trying to do. It would\nprobably be nice to leave some breadcrumbs for future readers.\n\n-Justin\n"},{"id":"538295","messageId":"aa7vS85brBpd9R1X@denethor","threadId":"65138","inReplyTo":"20260305-pks-gitlab-ci-macos-16-v1-3-ce8da0ff29c2@pks.im","subject":"Re: [PATCH 3/3] gitlab-ci: update to macOS 15 images","fromName":"Justin Tobler","fromEmail":"jltobler@gmail.com","sentAt":"2026-03-09T16:04:06Z","receivedAt":"2026-03-09T16:04:08Z","isPatch":true,"sender":{"key":"jltobler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53454972?v=4"},"body":"On 26/03/05 12:20PM, Patrick Steinhardt wrote:\n> The macos-14-xcode-15 images for GitLab's macOS runners have been\n> deprecated. Update to macOS 15, which is our current stable version.\n> \n> Signed-off-by: Patrick Steinhardt <ps@pks.im>\n> ---\n>  .gitlab-ci.yml | 6 +++---\n>  1 file changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml\n> index 71b8a6e642..83ec786c5a 100644\n> --- a/.gitlab-ci.yml\n> +++ b/.gitlab-ci.yml\n> @@ -101,13 +101,13 @@ test:osx:\n>    parallel:\n>      matrix:\n>        - jobname: osx-clang\n> -        image: macos-14-xcode-15\n> +        image: macos-15-xcode-16\n>          CC: clang\n>        - jobname: osx-reftable\n> -        image: macos-14-xcode-15\n> +        image: macos-15-xcode-16\n>          CC: clang\n>        - jobname: osx-meson\n> -        image: macos-14-xcode-15\n> +        image: macos-15-xcode-16\n>          CC: clang\n>    artifacts:\n>      paths:\n\nThis patch looks good.\n\n-Justin\n"}]}