From a47d342818c92b22b68707d191a5cfbb4912079d Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Fri, 30 Jul 2021 18:09:15 +0300 Subject: [PATCH] coreutils: date: don't fail with 'Bad system call' on settime Notify user that only root can modify system time. --- packages/coreutils/build.sh | 2 +- packages/coreutils/date.c.patch | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 packages/coreutils/date.c.patch diff --git a/packages/coreutils/build.sh b/packages/coreutils/build.sh index 310eb1cf59..cbcd81854d 100644 --- a/packages/coreutils/build.sh +++ b/packages/coreutils/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Basic file, shell and text manipulation utilities from t TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=8.32 -TERMUX_PKG_REVISION=7 +TERMUX_PKG_REVISION=8 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa TERMUX_PKG_DEPENDS="libandroid-support, libgmp, libiconv" diff --git a/packages/coreutils/date.c.patch b/packages/coreutils/date.c.patch new file mode 100644 index 0000000000..19251a8906 --- /dev/null +++ b/packages/coreutils/date.c.patch @@ -0,0 +1,14 @@ +diff -uNr coreutils-8.32/src/date.c coreutils-8.32.mod/src/date.c +--- coreutils-8.32/src/date.c 2020-01-01 16:13:12.000000000 +0200 ++++ coreutils-8.32.mod/src/date.c 2021-07-30 17:57:00.571867917 +0300 +@@ -559,6 +559,10 @@ + + if (set_date) + { ++ if (getuid() != 0) ++ { ++ die (EXIT_FAILURE, 0, "only root user can change date/time"); ++ } + /* Set the system clock to the specified date, then regardless of + the success of that operation, format and print that date. */ + if (settime (&when) != 0)