From 8c31b955c38d75945e4ab6d2b0ef1881a064cf81 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Wed, 18 Jan 2017 10:33:41 +0100 Subject: [PATCH] ruby: Some more /tmp -> $PREFIX/tmp patches --- packages/ruby/ext-etc-etc.c.patch | 12 ++++++++++++ packages/ruby/lib-tmpdir.rb.patch | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 packages/ruby/ext-etc-etc.c.patch create mode 100644 packages/ruby/lib-tmpdir.rb.patch diff --git a/packages/ruby/ext-etc-etc.c.patch b/packages/ruby/ext-etc-etc.c.patch new file mode 100644 index 000000000..94e5eca61 --- /dev/null +++ b/packages/ruby/ext-etc-etc.c.patch @@ -0,0 +1,12 @@ +diff -u -r ../ruby-2.4.0/ext/etc/etc.c ./ext/etc/etc.c +--- ../ruby-2.4.0/ext/etc/etc.c 2016-06-02 14:21:42.000000000 +0200 ++++ ./ext/etc/etc.c 2017-01-18 04:18:25.912737382 +0100 +@@ -651,7 +651,7 @@ + if (!len) return Qnil; + tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding()); + #else +- const char default_tmp[] = "/tmp"; ++ const char default_tmp[] = "@TERMUX_PREFIX@/tmp"; + const char *tmpstr = default_tmp; + size_t tmplen = strlen(default_tmp); + # if defined _CS_DARWIN_USER_TEMP_DIR diff --git a/packages/ruby/lib-tmpdir.rb.patch b/packages/ruby/lib-tmpdir.rb.patch new file mode 100644 index 000000000..8934a7646 --- /dev/null +++ b/packages/ruby/lib-tmpdir.rb.patch @@ -0,0 +1,30 @@ +diff -u -r ../ruby-2.4.0/lib/tmpdir.rb ./lib/tmpdir.rb +--- ../ruby-2.4.0/lib/tmpdir.rb 2016-02-26 03:11:14.000000000 +0100 ++++ ./lib/tmpdir.rb 2017-01-18 04:13:47.675833299 +0100 +@@ -13,7 +13,7 @@ + + class Dir + +- @@systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '/tmp' ++ @@systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '@TERMUX_PREFIX@/tmp' + + ## + # Returns the operating system's temporary file path. +@@ -23,7 +23,7 @@ + @@systmpdir.dup + else + tmp = nil +- [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', '.'].each do |dir| ++ [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '@TERMUX_PREFIX@/tmp', '.'].each do |dir| + next if !dir + dir = File.expand_path(dir) + if stat = File.stat(dir) and stat.directory? and stat.writable? and +@@ -120,7 +120,7 @@ + + def create(basename, tmpdir=nil, max_try: nil, **opts) + if $SAFE > 0 and tmpdir.tainted? +- tmpdir = '/tmp' ++ tmpdir = '@TERMUX_PREFIX@/tmp' + else + tmpdir ||= tmpdir() + end