From 5e174900b3b1adcdf38e3b5e713136772f77b967 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Mon, 9 Jan 2017 17:04:46 -0500 Subject: [PATCH] coreutils: Fix 32-bit issue with ST_BLKSIZE macro Fixes https://github.com/termux/termux-app/issues/233 --- packages/coreutils/build.sh | 2 +- packages/coreutils/lib-stat-size.h.patch | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/coreutils/lib-stat-size.h.patch diff --git a/packages/coreutils/build.sh b/packages/coreutils/build.sh index 1977e902..8694d77d 100755 --- a/packages/coreutils/build.sh +++ b/packages/coreutils/build.sh @@ -1,7 +1,7 @@ TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/coreutils/ TERMUX_PKG_DESCRIPTION="Basic file, shell and text manipulation utilities from the GNU project" TERMUX_PKG_VERSION=8.26 -TERMUX_PKG_BUILD_REVISION=1 +TERMUX_PKG_BUILD_REVISION=2 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=155e94d748f8e2bc327c66e0cbebdb8d6ab265d2f37c3c928f7bf6c3beba9a8e TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_func_mkfifo=yes gl_cv_host_operating_system=Android --without-gmp --enable-single-binary=symlinks ac_cv_func_endpwent=no" diff --git a/packages/coreutils/lib-stat-size.h.patch b/packages/coreutils/lib-stat-size.h.patch new file mode 100644 index 00000000..c1c8cdb9 --- /dev/null +++ b/packages/coreutils/lib-stat-size.h.patch @@ -0,0 +1,19 @@ +diff -u -r ../coreutils-8.26/lib/stat-size.h ./lib/stat-size.h +--- ../coreutils-8.26/lib/stat-size.h 2016-07-15 15:47:39.000000000 -0400 ++++ ./lib/stat-size.h 2017-01-09 16:49:31.758957157 -0500 +@@ -71,9 +71,13 @@ + suffice, since "cat" sometimes multiplies the result by 4.) If + anyone knows of a system for which this limit is too small, please + report it as a bug in this code. */ +-# define ST_BLKSIZE(statbuf) ((0 < (statbuf).st_blksize \ ++/* Termux patch: Cast to long since on 32-bit Android this otherwise ++ results in an unsigned long, which breaks comparison with e.g. ++ signed off_t in tail.c, see: ++ https://github.com/termux/termux-app/issues/233 */ ++# define ST_BLKSIZE(statbuf) ((long) ((0 < (statbuf).st_blksize \ + && (statbuf).st_blksize <= ((size_t)-1) / 8 + 1) \ +- ? (statbuf).st_blksize : DEV_BSIZE) ++ ? (statbuf).st_blksize : DEV_BSIZE)) + # if defined hpux || defined __hpux__ || defined __hpux + /* HP-UX counts st_blocks in 1024-byte units. + This loses when mixing HP-UX and BSD file systems with NFS. */ -- 2.11.0