<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-legacy-support.
</pre>
<p><a href="https://github.com/macports/macports-legacy-support/commit/e0a0fafdf81f12959a29cdd834a449c1827f96c9">https://github.com/macports/macports-legacy-support/commit/e0a0fafdf81f12959a29cdd834a449c1827f96c9</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit e0a0fafdf81f12959a29cdd834a449c1827f96c9
</span>Author: Fred Wright <fw@fwright.net>
AuthorDate: Fri Jun 7 13:28:40 2024 -0700
<span style='display:block; white-space:pre;color:#404040;'> Add secure/_common.h to avoid security wrappers on 10.4.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Security wrappers are unsupported on 10.4. They're never enabled when
</span><span style='display:block; white-space:pre;color:#404040;'> using the 10.4 SDK, but builds with later SDKs and the enable on
</span><span style='display:block; white-space:pre;color:#404040;'> (default in 10.6+, allowable in 10.5) result in build failures. This
</span><span style='display:block; white-space:pre;color:#404040;'> is not limited to legacy-support's stpncpy(), but affects native
</span><span style='display:block; white-space:pre;color:#404040;'> functions (e.g. strncpy()) as well. We avoid this by #undefing
</span><span style='display:block; white-space:pre;color:#404040;'> _FORTIFY_SOURCE in any 10.4 build.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Re: https://trac.macports.org/ticket/69867
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> TESTED:
</span><span style='display:block; white-space:pre;color:#404040;'> Tested on 10.4-10.5 ppc, 10.5-10.6 ppc (i386 Rosetta), 10.4-10.6 i386,
</span><span style='display:block; white-space:pre;color:#404040;'> 10.5-12.x x86_64, and 11.x-14.x arm64. Tested against all 10.4-14.x
</span><span style='display:block; white-space:pre;color:#404040;'> SDKs, using the headerinfo manual test (from a subsequent commit).
</span><span style='display:block; white-space:pre;color:#404040;'> All target/SDK combinations where the SDK supports the CPU
</span><span style='display:block; white-space:pre;color:#404040;'> architecture work correctly, including all SDKs on Intel
</span><span style='display:block; white-space:pre;color:#404040;'> architectures. Only 10.4-10.6 SDKs support ppc, and only 11.x+ SDKs
</span><span style='display:block; white-space:pre;color:#404040;'> support arm64.
</span>---
include/secure/_common.h | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/include/secure/_common.h b/include/secure/_common.h
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..69a124e
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/include/secure/_common.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,37 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2024 Frederick H. G. Wright II <fw@fwright.net>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Permission to use, copy, modify, and distribute this software for any
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * purpose with or without fee is hereby granted, provided that the above
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * copyright notice and this permission notice appear in all copies.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Support for security wrappers is absent in 10.4. It's also not enabled
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * in the 10.4 SDK, but building for 10.4 with a later SDK and explicit
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * enabling results in build failures. So we undefine the enable on 10.4.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Note that this is more aggressive than the setup in _types.h in the 10.6+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * SDK, which only *defaults* it off on 10.4. But that results in build
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * failures when _FORTIFY_SOURCE is set nonzero explicitly.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#if !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#undef _FORTIFY_SOURCE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+/*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Include the primary system secure/_common.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * That header is nonexistent in the 10.4 SDK, but so are refernces to it,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * so if we're building with a 10.4 SDK we won't be here.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#include_next <secure/_common.h>
</span></pre><pre style='margin:0'>
</pre>