Browse Source

gawk: Avoid O_APPEND on terminal

Setting the O_APPEND flag on a terminal file descriptor causes issues
with SELinux preventing (at least) tmux from working. Fixes #2979.
android-5
Fredrik Fornwall 6 years ago
parent
commit
584b1504ed
  1. 1
      packages/gawk/build.sh
  2. 17
      packages/gawk/main.c.patch

1
packages/gawk/build.sh

@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/gawk/
TERMUX_PKG_DESCRIPTION="Programming language designed for text processing" TERMUX_PKG_DESCRIPTION="Programming language designed for text processing"
TERMUX_PKG_DEPENDS="libandroid-support, libmpfr, libgmp, readline" TERMUX_PKG_DEPENDS="libandroid-support, libmpfr, libgmp, readline"
TERMUX_PKG_VERSION=4.2.1 TERMUX_PKG_VERSION=4.2.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=d1119785e746d46a8209d28b2de404a57f983aa48670f4e225531d3bdc175551 TERMUX_PKG_SHA256=d1119785e746d46a8209d28b2de404a57f983aa48670f4e225531d3bdc175551
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/gawk/gawk-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/gawk/gawk-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_RM_AFTER_INSTALL="bin/gawk-* bin/igawk share/man/man1/igawk.1" TERMUX_PKG_RM_AFTER_INSTALL="bin/gawk-* bin/igawk share/man/man1/igawk.1"

17
packages/gawk/main.c.patch

@ -0,0 +1,17 @@
diff -u -r ../gawk-4.2.1/main.c ./main.c
--- ../gawk-4.2.1/main.c 2018-02-23 08:44:11.000000000 +0000
+++ ./main.c 2018-10-28 21:59:28.583118833 +0000
@@ -246,10 +246,12 @@
if ((cp = getenv("GAWK_LOCALE_DIR")) != NULL)
locale_dir = cp;
-#if defined(F_GETFL) && defined(O_APPEND)
+#if defined(F_GETFL) && defined(O_APPEND) && !defined(__ANDROID__)
// 1/2018: This is needed on modern BSD systems so that the
// inplace tests pass. I think it's a bug in those kernels
// but let's just work around it anyway.
+ // Do not do this for Android as it interferes with SELinux,
+ // see https://github.com/termux/termux-packages/issues/2979
int flags = fcntl(fileno(stderr), F_GETFL, NULL);
if (flags >= 0 && (flags & O_APPEND) == 0) {
flags |= O_APPEND;
Loading…
Cancel
Save