{"thread":{"id":"63074","subject":"[PATCH 0/2] Ensure zlib version is printed by git-version(1)","startedAt":"2025-03-07T14:18:38Z","lastAt":"2025-03-07T20:25:48Z","messageCount":6,"participants":["Toon Claes","Patrick Steinhardt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"513758","messageId":"20250307-toon-zlib-git-version-v1-0-5e8069752bb9@iotcl.com","threadId":"63074","inReplyTo":null,"subject":"[PATCH 0/2] Ensure zlib version is printed by git-version(1)","fromName":"Toon Claes","fromEmail":"toon@iotcl.com","sentAt":"2025-03-07T14:18:06Z","receivedAt":"2025-03-07T14:18:38Z","isPatch":true,"sender":{"key":"toon@iotcl.com","avatar":"https://avatars.githubusercontent.com/u/121621?v=4"},"body":"I was trying to benchmark the difference between using zlib and zlib-ng.\nTo be sure I was testing the correct version, I was interested if\ngit-version(1) would tell which zlib library it uses. After some digging\nI saw it should be printing the zlib version number, but on my machine\nit wasn't.\n\nI discovered a regression caused by 41f1a8435a (git-compat-util: move\ninclude of \"compat/zlib.h\" into \"git-zlib.h\", 2025-01-28). In the first\ncommit I'm addressing that regression.\n\nBut I've noticed building against zlib-ng directly still didn't print\nthe zlib version. This issue is resolved in the second commit.\n\n--\nToon\n\nSigned-off-by: Toon Claes <toon@iotcl.com>\n---\nToon Claes (2):\n      help: include git-zlib.h to print zlib version\n      help: print zlib-ng version number\n\n help.c               | 5 ++++-\n t/t0091-bugreport.sh | 3 ++-\n 2 files changed, 6 insertions(+), 2 deletions(-)\n---\n\n\n\n---\n\nbase-commit: a36e024e989f4d35f35987a60e3af8022cac3420\nchange-id: 20250307-toon-zlib-git-version-a7dcb9caa1ef\n\nThanks\n--\nToon\n\n"},{"id":"513759","messageId":"20250307-toon-zlib-git-version-v1-1-5e8069752bb9@iotcl.com","threadId":"63074","inReplyTo":"20250307-toon-zlib-git-version-v1-0-5e8069752bb9@iotcl.com","subject":"[PATCH 1/2] help: include git-zlib.h to print zlib version","fromName":"Toon Claes","fromEmail":"toon@iotcl.com","sentAt":"2025-03-07T14:18:07Z","receivedAt":"2025-03-07T14:18:41Z","isPatch":true,"sender":{"key":"toon@iotcl.com","avatar":"https://avatars.githubusercontent.com/u/121621?v=4"},"body":"In 41f1a8435a (git-compat-util: move include of \"compat/zlib.h\" into\n\"git-zlib.h\", 2025-01-28) some code was refactored to enable easier\nlinking against zlib-ng.\n\nThis removed `zlib.h` being indirectly included in `help.c`. As this\nfile uses `ZLIB_VERSION` to print the version number of zlib when\nrunning git-version(1) with `--build-options`, this resulted in a\nregression.\n\nInclude `git-zlib.h` directly into `help.c` to print zlib version\ninformation. This brings back the zlib version in the output of\n`git version --build-options`.\n\nSigned-off-by: Toon Claes <toon@iotcl.com>\n---\n help.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/help.c b/help.c\nindex 8d91afe851..707cd59b79 100644\n--- a/help.c\n+++ b/help.c\n@@ -2,6 +2,7 @@\n #define DISABLE_SIGN_COMPARE_WARNINGS\n \n #include \"git-compat-util.h\"\n+#include \"git-zlib.h\"\n #include \"config.h\"\n #include \"builtin.h\"\n #include \"exec-cmd.h\"\n\n-- \n2.49.0.rc1.410.g72b47a15e9\n\n"},{"id":"513760","messageId":"20250307-toon-zlib-git-version-v1-2-5e8069752bb9@iotcl.com","threadId":"63074","inReplyTo":"20250307-toon-zlib-git-version-v1-0-5e8069752bb9@iotcl.com","subject":"[PATCH 2/2] help: print zlib-ng version number","fromName":"Toon Claes","fromEmail":"toon@iotcl.com","sentAt":"2025-03-07T14:18:08Z","receivedAt":"2025-03-07T14:18:45Z","isPatch":true,"sender":{"key":"toon@iotcl.com","avatar":"https://avatars.githubusercontent.com/u/121621?v=4"},"body":"When building against zlib-ng, the header file `zlib.h` is not included,\nbut `zlib-ng.h` is included instead. It's `zlib.h` that defines\n`ZLIB_VERSION` and that macro is used to print out zlib version in\n`git-version(1)` with `--build-options`. But when it's not defined, no\nversion is printed.\n\n`zlib-ng.h` defines another macro: `ZLIBNG_VERSION`. Use that macro to\nprint the zlib-ng version in `git version --build-options` when it's\nset. Otherwise fallback to `ZLIB_VERSION`.\n\nSigned-off-by: Toon Claes <toon@iotcl.com>\nHelped-by: Patrick Steinhardt <ps@pks.im>\n---\n help.c               | 4 +++-\n t/t0091-bugreport.sh | 3 ++-\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/help.c b/help.c\nindex 707cd59b79..c54bd9918a 100644\n--- a/help.c\n+++ b/help.c\n@@ -798,7 +798,9 @@ void get_version_info(struct strbuf *buf, int show_build_options)\n #if defined OPENSSL_VERSION_TEXT\n \t\tstrbuf_addf(buf, \"OpenSSL: %s\\n\", OPENSSL_VERSION_TEXT);\n #endif\n-#if defined ZLIB_VERSION\n+#if defined ZLIBNG_VERSION\n+\t\tstrbuf_addf(buf, \"zlib-ng: %s\\n\", ZLIBNG_VERSION);\n+#elif defined ZLIB_VERSION\n \t\tstrbuf_addf(buf, \"zlib: %s\\n\", ZLIB_VERSION);\n #endif\n \t}\ndiff --git a/t/t0091-bugreport.sh b/t/t0091-bugreport.sh\nindex e11d819b62..e38ca7a901 100755\n--- a/t/t0091-bugreport.sh\n+++ b/t/t0091-bugreport.sh\n@@ -47,7 +47,8 @@ test_expect_success 'sanity check \"System Info\" section' '\n \t# This is bound to differ from environment to environment,\n \t# so we just do some rather high-level checks.\n \tgrep \"uname: .\" system &&\n-\tgrep \"compiler info: .\" system\n+\tgrep \"compiler info: .\" system &&\n+\tgrep \"zlib.\" system\n '\n \n test_expect_success 'dies if file with same name as report already exists' '\n\n-- \n2.49.0.rc1.410.g72b47a15e9\n\n"},{"id":"513774","messageId":"Z8sAwLHff3S4jF1P@pks.im","threadId":"63074","inReplyTo":"20250307-toon-zlib-git-version-v1-0-5e8069752bb9@iotcl.com","subject":"Re: [PATCH 0/2] Ensure zlib version is printed by git-version(1)","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-03-07T14:20:48Z","receivedAt":"2025-03-07T14:20:52Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Fri, Mar 07, 2025 at 03:18:06PM +0100, Toon Claes wrote:\n> I was trying to benchmark the difference between using zlib and zlib-ng.\n> To be sure I was testing the correct version, I was interested if\n> git-version(1) would tell which zlib library it uses. After some digging\n> I saw it should be printing the zlib version number, but on my machine\n> it wasn't.\n> \n> I discovered a regression caused by 41f1a8435a (git-compat-util: move\n> include of \"compat/zlib.h\" into \"git-zlib.h\", 2025-01-28). In the first\n> commit I'm addressing that regression.\n> \n> But I've noticed building against zlib-ng directly still didn't print\n> the zlib version. This issue is resolved in the second commit.\n\nI've already reviewed the change internally and it looked obviously good\nto me. Thanks for finding, fixing and improving this!\n\nPatrick\n"},{"id":"513790","messageId":"xmqqbjucegg9.fsf@gitster.g","threadId":"63074","inReplyTo":"20250307-toon-zlib-git-version-v1-1-5e8069752bb9@iotcl.com","subject":"Re: [PATCH 1/2] help: include git-zlib.h to print zlib version","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-07T20:25:26Z","receivedAt":"2025-03-07T20:25:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Toon Claes <toon@iotcl.com> writes:\n\n> In 41f1a8435a (git-compat-util: move include of \"compat/zlib.h\" into\n> \"git-zlib.h\", 2025-01-28) some code was refactored to enable easier\n> linking against zlib-ng.\n>\n> This removed `zlib.h` being indirectly included in `help.c`. As this\n> file uses `ZLIB_VERSION` to print the version number of zlib when\n> running git-version(1) with `--build-options`, this resulted in a\n> regression.\n>\n> Include `git-zlib.h` directly into `help.c` to print zlib version\n> information. This brings back the zlib version in the output of\n> `git version --build-options`.\n>\n> Signed-off-by: Toon Claes <toon@iotcl.com>\n> ---\n>  help.c | 1 +\n>  1 file changed, 1 insertion(+)\n\nOK, the user was merely \"#ifdef ZLIB_VERSION\", so this new inclusion\nwould not introduce a separate unintended breakage, I would think.\n\nMakes sense.\n\nWill queue.\n\n\n> diff --git a/help.c b/help.c\n> index 8d91afe851..707cd59b79 100644\n> --- a/help.c\n> +++ b/help.c\n> @@ -2,6 +2,7 @@\n>  #define DISABLE_SIGN_COMPARE_WARNINGS\n>  \n>  #include \"git-compat-util.h\"\n> +#include \"git-zlib.h\"\n>  #include \"config.h\"\n>  #include \"builtin.h\"\n>  #include \"exec-cmd.h\"\n"},{"id":"513791","messageId":"xmqq7c50egfq.fsf@gitster.g","threadId":"63074","inReplyTo":"Z8sAwLHff3S4jF1P@pks.im","subject":"Re: [PATCH 0/2] Ensure zlib version is printed by git-version(1)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-03-07T20:25:45Z","receivedAt":"2025-03-07T20:25:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Fri, Mar 07, 2025 at 03:18:06PM +0100, Toon Claes wrote:\n>> I was trying to benchmark the difference between using zlib and zlib-ng.\n>> To be sure I was testing the correct version, I was interested if\n>> git-version(1) would tell which zlib library it uses. After some digging\n>> I saw it should be printing the zlib version number, but on my machine\n>> it wasn't.\n>> \n>> I discovered a regression caused by 41f1a8435a (git-compat-util: move\n>> include of \"compat/zlib.h\" into \"git-zlib.h\", 2025-01-28). In the first\n>> commit I'm addressing that regression.\n>> \n>> But I've noticed building against zlib-ng directly still didn't print\n>> the zlib version. This issue is resolved in the second commit.\n>\n> I've already reviewed the change internally and it looked obviously good\n> to me. Thanks for finding, fixing and improving this!\n\nThanks, both.  The changes look quite sensible.\n"}]}