Browse Source

ruby: Some more /tmp -> $PREFIX/tmp patches

android-5
Fredrik Fornwall 8 years ago
parent
commit
8c31b955c3
  1. 12
      packages/ruby/ext-etc-etc.c.patch
  2. 30
      packages/ruby/lib-tmpdir.rb.patch

12
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

30
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
Loading…
Cancel
Save