{"thread":{"id":"63559","subject":"[PATCH] compat: fixes for header handling with OpenBSD / NetBSD","startedAt":"2025-06-02T07:29:06Z","lastAt":"2025-06-03T14:37:55Z","messageCount":6,"participants":["Brad Smith","Collin Funk","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"519398","messageId":"aD1SvlRypkhczxRS@humpty.home.comstyle.com","threadId":"63559","inReplyTo":null,"subject":"[PATCH] compat: fixes for header handling with OpenBSD / NetBSD","fromName":"Brad Smith","fromEmail":"brad@comstyle.com","sentAt":"2025-06-02T07:29:02Z","receivedAt":"2025-06-02T07:29:06Z","isPatch":true,"sender":{"key":"brad@comstyle.com","avatar":"https://avatars.githubusercontent.com/u/1129902?v=4"},"body":"Handle OpenBSD and NetBSD as FreeBSD / DragonFly are. OpenBSD would\nneed _XOPEN_SOURCE to be set to 700. Its simpler to just not set\n_XOPEN_SOURCE.\n\n    CC strbuf.o\nstrbuf.c:645:6: warning: call to undeclared function 'getdelim'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]\n        r = getdelim(&sb->buf, &sb->alloc, term, fp);\n            ^\n1 warning generated.\n\nSigned-off-by: Brad Smith <brad@comstyle.com>\n---\n compat/posix.h | 11 +++++------\n 1 file changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/compat/posix.h b/compat/posix.h\nindex f4c71f9427..61fb08b64c 100644\n--- a/compat/posix.h\n+++ b/compat/posix.h\n@@ -60,18 +60,17 @@\n # else\n # define _XOPEN_SOURCE 500\n # endif\n-#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \\\n-      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \\\n-      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \\\n-      !defined(__CYGWIN__)\n-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */\n+#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \\\n+      !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__MirBSD__) && \\\n+      !defined(__USLC__) && !defined(_M_UNIX) && !defined(__sgi) && \\\n+      !defined(__TANDEM) && !defined(__QNX__) && !defined(__CYGWIN__)\n+#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500 */\n #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n #endif\n #define _ALL_SOURCE 1\n #define _GNU_SOURCE 1\n #define _BSD_SOURCE 1\n #define _DEFAULT_SOURCE 1\n-#define _NETBSD_SOURCE 1\n #define _SGI_SOURCE 1\n \n #if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */\n-- \n2.49.0\n\n"},{"id":"519489","messageId":"87wm9ut3uo.fsf@gmail.com","threadId":"63559","inReplyTo":"aD1SvlRypkhczxRS@humpty.home.comstyle.com","subject":"Re: [PATCH] compat: fixes for header handling with OpenBSD / NetBSD","fromName":"Collin Funk","fromEmail":"collin.funk1@gmail.com","sentAt":"2025-06-02T18:06:55Z","receivedAt":"2025-06-02T18:06:57Z","isPatch":true,"sender":{"key":"collin.funk1@gmail.com","avatar":"https://avatars.githubusercontent.com/u/65689063?v=4"},"body":"Hi Brad,\n\nYou wrote:\n\n> Handle OpenBSD and NetBSD as FreeBSD / DragonFly are. OpenBSD would\n> need _XOPEN_SOURCE to be set to 700. Its simpler to just not set\n> _XOPEN_SOURCE.\n> \n>     CC strbuf.o\n> strbuf.c:645:6: warning: call to undeclared function 'getdelim'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]\n>         r = getdelim(&sb->buf, &sb->alloc, term, fp);\n>             ^\n> 1 warning generated.\n> \n> Signed-off-by: Brad Smith <brad@comstyle.com>\n> ---\n>  compat/posix.h | 11 +++++------\n>  1 file changed, 5 insertions(+), 6 deletions(-)\n\nI noticed this as well when testing your other fixes.\n\nJust one question about this chunk:\n\n>  #define _DEFAULT_SOURCE 1\n> -#define _NETBSD_SOURCE 1\n\nWhy remove this definition? I think it might be useful on some older\nsystems and seems harmless otherwise.\n\nOther than that, I tested on OpenBSD 7.6 and NetBSD 10.0 and this patch\nfixes the missing declarations. So:\n\nReviewed-by: Collin Funk <collin.funk1@gmail.com>\n\nCollin\n"},{"id":"519519","messageId":"xmqqfrghslu0.fsf@gitster.g","threadId":"63559","inReplyTo":"87wm9ut3uo.fsf@gmail.com","subject":"Re: [PATCH] compat: fixes for header handling with OpenBSD / NetBSD","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-06-03T00:36:07Z","receivedAt":"2025-06-03T00:36:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Collin Funk <collin.funk1@gmail.com> writes:\n\n> Just one question about this chunk:\n>\n>>  #define _DEFAULT_SOURCE 1\n>> -#define _NETBSD_SOURCE 1\n>\n> Why remove this definition? I think it might be useful on some older\n> systems and seems harmless otherwise.\n\nYes, it is curious.\n\n>\n> Other than that, I tested on OpenBSD 7.6 and NetBSD 10.0 and this patch\n> fixes the missing declarations. So:\n>\n> Reviewed-by: Collin Funk <collin.funk1@gmail.com>\n>\n> Collin\n"},{"id":"519529","messageId":"47c58a78-d38b-4170-87fc-c9332618d0da@comstyle.com","threadId":"63559","inReplyTo":"87wm9ut3uo.fsf@gmail.com","subject":"Re: [PATCH] compat: fixes for header handling with OpenBSD / NetBSD","fromName":"Brad Smith","fromEmail":"brad@comstyle.com","sentAt":"2025-06-03T03:56:28Z","receivedAt":"2025-06-03T03:56:38Z","isPatch":true,"sender":{"key":"brad@comstyle.com","avatar":"https://avatars.githubusercontent.com/u/1129902?v=4"},"body":"On 2025-06-02 2:06 p.m., Collin Funk wrote:\n> Hi Brad,\n>\n> You wrote:\n>\n>> Handle OpenBSD and NetBSD as FreeBSD / DragonFly are. OpenBSD would\n>> need _XOPEN_SOURCE to be set to 700. Its simpler to just not set\n>> _XOPEN_SOURCE.\n>>\n>>      CC strbuf.o\n>> strbuf.c:645:6: warning: call to undeclared function 'getdelim'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]\n>>          r = getdelim(&sb->buf, &sb->alloc, term, fp);\n>>              ^\n>> 1 warning generated.\n>>\n>> Signed-off-by: Brad Smith <brad@comstyle.com>\n>> ---\n>>   compat/posix.h | 11 +++++------\n>>   1 file changed, 5 insertions(+), 6 deletions(-)\n> I noticed this as well when testing your other fixes.\n>\n> Just one question about this chunk:\n>\n>>   #define _DEFAULT_SOURCE 1\n>> -#define _NETBSD_SOURCE 1\n> Why remove this definition? I think it might be useful on some older\n> systems and seems harmless otherwise.\n\n_XOPEN_SOURCE restricts the build environment. _NETBSD_SOURCE is added \nto counteract\n_XOPEN_SOURCE. Not setting it in the first place provides everything by \ndefault.\n\nI was removing it as it should no longer be necessary.\n\nBut as said, it is harmless. I can leave it in if desired.\n\n> Other than that, I tested on OpenBSD 7.6 and NetBSD 10.0 and this patch\n> fixes the missing declarations. So:\n>\n> Reviewed-by: Collin Funk <collin.funk1@gmail.com>\n>\n> Collin\n>\n"},{"id":"519530","messageId":"87y0u9qxk8.fsf@gmail.com","threadId":"63559","inReplyTo":"47c58a78-d38b-4170-87fc-c9332618d0da@comstyle.com","subject":"Re: [PATCH] compat: fixes for header handling with OpenBSD / NetBSD","fromName":"Collin Funk","fromEmail":"collin.funk1@gmail.com","sentAt":"2025-06-03T04:05:43Z","receivedAt":"2025-06-03T04:05:45Z","isPatch":true,"sender":{"key":"collin.funk1@gmail.com","avatar":"https://avatars.githubusercontent.com/u/65689063?v=4"},"body":"Brad Smith <brad@comstyle.com> writes:\n\n>> Why remove this definition? I think it might be useful on some older\n>> systems and seems harmless otherwise.\n>\n> _XOPEN_SOURCE restricts the build environment. _NETBSD_SOURCE is added\n> to counteract\n> _XOPEN_SOURCE. Not setting it in the first place provides everything\n> by default.\n>\n> I was removing it as it should no longer be necessary.\n>\n> But as said, it is harmless. I can leave it in if desired.\n\nIn Autoconf's AC_USE_SYSTEM_EXTENSIONS it is defined with the comment:\n\n    /* Enable general extensions on NetBSD.\n       Enable NetBSD compatibility extensions on Minix.  */\n\nI would prefer just leaving it for any old system that may need it. Or\nin case git uses features from a recent standard that might still be\nhidden as a NetBSD extension.\n\nFor example, POSIX.1-2024 has been released, but most functions added\nthere are still under _GNU_SOURCE in current glibc.\n\nCollin\n"},{"id":"519572","messageId":"xmqqwm9sriv3.fsf@gitster.g","threadId":"63559","inReplyTo":"87y0u9qxk8.fsf@gmail.com","subject":"Re: [PATCH] compat: fixes for header handling with OpenBSD / NetBSD","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-06-03T14:37:52Z","receivedAt":"2025-06-03T14:37:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Collin Funk <collin.funk1@gmail.com> writes:\n\n> Brad Smith <brad@comstyle.com> writes:\n> ...\n>> But as said, it is harmless. I can leave it in if desired.\n> ...\n> I would prefer just leaving it for any old system that may need it.\n\nOK, here is what I will queue.\n\n-------- >8 --------\nFrom: Brad Smith <brad@comstyle.com>\nDate: Mon, 2 Jun 2025 03:29:02 -0400\nSubject: [PATCH] compat: fixes for header handling with OpenBSD / NetBSD\n\nHandle OpenBSD and NetBSD as FreeBSD / DragonFly are. OpenBSD would\nneed _XOPEN_SOURCE to be set to 700. Its simpler to just not set\n_XOPEN_SOURCE.\n\n    CC strbuf.o\nstrbuf.c:645:6: warning: call to undeclared function 'getdelim'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]\n        r = getdelim(&sb->buf, &sb->alloc, term, fp);\n            ^\n1 warning generated.\n\nSigned-off-by: Brad Smith <brad@comstyle.com>\nReviewed-by: Collin Funk <collin.funk1@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n compat/posix.h | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/compat/posix.h b/compat/posix.h\nindex f4c71f9427..067a00f33b 100644\n--- a/compat/posix.h\n+++ b/compat/posix.h\n@@ -60,11 +60,11 @@\n # else\n # define _XOPEN_SOURCE 500\n # endif\n-#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \\\n-      !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \\\n-      !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \\\n-      !defined(__CYGWIN__)\n-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */\n+#elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && \\\n+      !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__MirBSD__) && \\\n+      !defined(__USLC__) && !defined(_M_UNIX) && !defined(__sgi) && \\\n+      !defined(__TANDEM) && !defined(__QNX__) && !defined(__CYGWIN__)\n+#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500 */\n #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */\n #endif\n #define _ALL_SOURCE 1\n-- \n2.50.0-rc0-176-g427db30fd9\n\n"}]}