From d4e19e86b2e77118497e104bd5bf3beba5ca7282 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Thu, 28 Apr 2016 08:27:01 -0400 Subject: [PATCH] git: Patch away some /tmp usage --- packages/git/build.sh | 2 +- packages/git/tempfile.c.patch | 12 ++++++++++++ packages/git/wrapper.c.patch | 21 +++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 packages/git/tempfile.c.patch create mode 100644 packages/git/wrapper.c.patch diff --git a/packages/git/build.sh b/packages/git/build.sh index 47dd68b36..c66d64ea2 100755 --- a/packages/git/build.sh +++ b/packages/git/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Distributed version control system designed to handle ev # less is required as a pager for git log, and the busybox less does not handle used escape sequences. TERMUX_PKG_DEPENDS="libcurl, less" TERMUX_PKG_VERSION=2.8.1 -TERMUX_PKG_BUILD_REVISION=2 +TERMUX_PKG_BUILD_REVISION=3 TERMUX_PKG_SRCURL=https://www.kernel.org/pub/software/scm/git/git-${TERMUX_PKG_VERSION}.tar.xz ## This requires a working $TERMUX_PREFIX/bin/sh on the host building: TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--without-tcltk --with-curl --with-shell=$TERMUX_PREFIX/bin/sh ac_cv_header_libintl_h=no ac_cv_fread_reads_directories=yes ac_cv_snprintf_returns_bogus=yes" diff --git a/packages/git/tempfile.c.patch b/packages/git/tempfile.c.patch new file mode 100644 index 000000000..384468830 --- /dev/null +++ b/packages/git/tempfile.c.patch @@ -0,0 +1,12 @@ +diff -u -r ../git-2.8.1/tempfile.c ./tempfile.c +--- ../git-2.8.1/tempfile.c 2016-04-03 15:07:18.000000000 -0400 ++++ ./tempfile.c 2016-04-28 07:22:47.339509915 -0400 +@@ -170,7 +170,7 @@ + + tmpdir = getenv("TMPDIR"); + if (!tmpdir) +- tmpdir = "/tmp"; ++ tmpdir = "@TERMUX_PREFIX@/tmp"; + + strbuf_addf(&tempfile->filename, "%s/%s", tmpdir, template); + tempfile->fd = git_mkstemps_mode(tempfile->filename.buf, suffixlen, mode); diff --git a/packages/git/wrapper.c.patch b/packages/git/wrapper.c.patch new file mode 100644 index 000000000..41db01119 --- /dev/null +++ b/packages/git/wrapper.c.patch @@ -0,0 +1,21 @@ +diff -u -r ../git-2.8.1/wrapper.c ./wrapper.c +--- ../git-2.8.1/wrapper.c 2016-04-03 15:07:18.000000000 -0400 ++++ ./wrapper.c 2016-04-28 07:24:14.514073661 -0400 +@@ -437,7 +437,7 @@ + + tmp = getenv("TMPDIR"); + if (!tmp) +- tmp = "/tmp"; ++ tmp = "@TERMUX_PREFIX@/tmp"; + n = snprintf(path, len, "%s/%s", tmp, template); + if (len <= n) { + errno = ENAMETOOLONG; +@@ -454,7 +454,7 @@ + + tmp = getenv("TMPDIR"); + if (!tmp) +- tmp = "/tmp"; ++ tmp = "@TERMUX_PREFIX@/tmp"; + n = snprintf(path, len, "%s/%s", tmp, template); + if (len <= n) { + errno = ENAMETOOLONG;