1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Fix memory fault on ARM-based Macs (#354)

Ksh segfaults on M1 Macs, apparently because Apple's compiler
optimizer can't cope with overriding bzero(3) with libast's
implementation (though it's nothing more than "memset(b, 0, n);").

Apple has disabled libast's bzero function since 2018-12-04:
https://opensource.apple.com/source/ksh/ksh-27/patches/src__lib__libast__comp__omitted.c.diff.auto.html

src/lib/libast/comp/omitted.c:
- Only fall back to the libast bzero function if the OS lacks an
  implementation of bzero.
- Remove the bzero undef since this fallback is only reached if the
  OS doesn't have bzero.

NEWS:
- Add compat info for macOS on ARM64. This notes that macOS
  Monterey can now compile and run ksh, although there is one
  regression test failure:
        builtins.sh[345]: printf %H: invalid UTF-8 characters
        (expected %3F%C2%86%3F%3F%3F; got %3F%C2%86%3F%3Fv%3F%3F)

Thanks to @DesantBucie for the report and the testing.

Resolves: https://github.com/ksh93/ksh/issues/329
This commit is contained in:
Johnothan King 2021-11-29 04:38:17 -08:00 committed by Martijn Dekker
parent a0eeb14787
commit bfad44e56d
3 changed files with 4 additions and 3 deletions

2
NEWS
View file

@ -5,6 +5,8 @@ Any uppercase BUG_* names are modernish shell bug IDs.
2021-11-29:
- Fixed a memory fault that prevented ksh from functioning on ARM-based Macs.
- A bug that caused the time keyword to override the errexit shell option has
been fixed.

View file

@ -262,6 +262,7 @@ failures (crashes, and/or important functionality does not work).
* illumos: OmniOS 2020-08-19 (gcc) on x86_64
macOS 10.13.6 (High Sierra) on x86_64
macOS 10.14.6 (Mojave) on x86_64
* macOS 12.0.1 (Monterey) on ARM64
* NetBSD 8.1 on x86_64
* NetBSD 9.2 on x86_64
* OpenBSD 6.8 on x86_64

View file

@ -1092,9 +1092,7 @@ utime(const char* path, const struct utimbuf* ut)
* own bsd-like macros
*/
#if !_lib_bzero || defined(bzero)
#undef bzero
#if !_lib_bzero
void
bzero(void* b, size_t n)