From 7699c97b23bd906e35ba004142217b34eb68306c Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Sat, 10 Apr 2021 17:05:37 +0300 Subject: [PATCH] emacs: disable fdsan https://github.com/termux/termux-packages/issues/6592 --- packages/emacs/build.sh | 1 + packages/emacs/disable-fdsan.patch | 34 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 packages/emacs/disable-fdsan.patch diff --git a/packages/emacs/build.sh b/packages/emacs/build.sh index 829612a82..00d8b603a 100644 --- a/packages/emacs/build.sh +++ b/packages/emacs/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Extensible, customizable text editor-and more" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=27.2 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://ftp.gnu.org/gnu/emacs/emacs-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=b4a7cc4e78e63f378624e0919215b910af5bb2a0afc819fad298272e9f40c1b9 TERMUX_PKG_DEPENDS="ncurses, gnutls, libxml2" diff --git a/packages/emacs/disable-fdsan.patch b/packages/emacs/disable-fdsan.patch new file mode 100644 index 000000000..0a1c1f49b --- /dev/null +++ b/packages/emacs/disable-fdsan.patch @@ -0,0 +1,34 @@ +diff -uNr emacs-27.2/src/emacs.c emacs-27.2.mod/src/emacs.c +--- emacs-27.2/src/emacs.c 2021-01-28 19:52:38.000000000 +0200 ++++ emacs-27.2.mod/src/emacs.c 2021-04-10 17:04:56.744343967 +0300 +@@ -120,6 +120,11 @@ + #include "pdumper.h" + #include "epaths.h" + ++#ifdef __ANDROID__ ++#include ++#include ++#endif ++ + static const char emacs_version[] = PACKAGE_VERSION; + static const char emacs_copyright[] = COPYRIGHT; + static const char emacs_bugreport[] = PACKAGE_BUGREPORT; +@@ -954,6 +959,18 @@ + /* Record (approximately) where the stack begins. */ + stack_bottom = (char *) &stack_bottom_variable; + ++#ifdef __ANDROID__ ++ // For Android 11+. ++ void *lib_handle = dlopen("libc.so", RTLD_LAZY); ++ if (lib_handle) { ++ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level"); ++ if (set_fdsan_error_level) { ++ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED); ++ } ++ dlclose(lib_handle); ++ } ++#endif ++ + const char *dump_mode = NULL; + int skip_args = 0; + char *temacs = NULL;