Sync with ruby:2.6 EL8 Appstream.

This commit is contained in:
Pavel Valena 2021-11-04 20:53:54 +01:00
commit 7996ee7339
13 changed files with 431 additions and 18 deletions

View file

@ -39,7 +39,7 @@ diff --git a/configure.ac b/configure.ac
index 028ef7ca3e..cdeff87871 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3855,6 +3855,13 @@ AC_SUBST(rubyarchhdrdir)dnl
@@ -3872,6 +3872,13 @@ AC_SUBST(rubyarchhdrdir)dnl
AC_SUBST(sitearchhdrdir)dnl
AC_SUBST(vendorarchhdrdir)dnl

View file

@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac
index 11fc237552..b77e88fc37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3085,6 +3085,11 @@ AS_IF([test ${multiarch+set}], [
@@ -3102,6 +3102,11 @@ AS_IF([test ${multiarch+set}], [
])
archlibdir='${libdir}/${arch}'

View file

@ -14,7 +14,7 @@ diff --git a/configure.ac b/configure.ac
index 999e2d6d5d..11fc237552 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3710,7 +3710,8 @@ AS_CASE(["$ruby_version_dir_name"],
@@ -3727,7 +3727,8 @@ AS_CASE(["$ruby_version_dir_name"],
ruby_version_dir=/'${ruby_version_dir_name}'
if test -z "${ruby_version_dir_name}"; then

View file

@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac
index b77e88fc37..6bba453e3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3774,6 +3774,8 @@ AC_SUBST(vendorarchdir)dnl
@@ -3791,6 +3791,8 @@ AC_SUBST(vendorarchdir)dnl
AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl
AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl

View file

@ -15,7 +15,7 @@ diff --git a/configure.ac b/configure.ac
index 6bba453e3c..028ef7ca3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3746,6 +3746,10 @@ AC_ARG_WITH(vendorarchdir,
@@ -3763,6 +3763,10 @@ AC_ARG_WITH(vendorarchdir,
[vendorarchdir=$withval],
[vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}])
@ -26,7 +26,7 @@ index 6bba453e3c..028ef7ca3e 100644
AS_IF([test "${LOAD_RELATIVE+set}"], [
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
RUBY_EXEC_PREFIX=''
@@ -3770,6 +3774,7 @@ AC_SUBST(sitearchdir)dnl
@@ -3787,6 +3787,7 @@ AC_SUBST(sitearchdir)dnl
AC_SUBST(vendordir)dnl
AC_SUBST(vendorlibdir)dnl
AC_SUBST(vendorarchdir)dnl

View file

@ -11,7 +11,7 @@ diff --git a/common.mk b/common.mk
index 168dc52..20c218a 100644
--- a/common.mk
+++ b/common.mk
@@ -1052,9 +1052,9 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE)
@@ -1053,9 +1053,9 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE)
$(srcdir)/template/prelude.c.tmpl
$(PRELUDE_C): $(COMPILE_PRELUDE) \

View file

@ -20,7 +20,7 @@ diff --git a/configure.ac b/configure.ac
index 8ea969412f..a00f2b6776 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3661,9 +3661,6 @@ AS_CASE(["$target_os"],
@@ -3678,9 +3678,6 @@ AS_CASE(["$target_os"],
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
])
@ -30,7 +30,7 @@ index 8ea969412f..a00f2b6776 100644
rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'}
AC_ARG_WITH(rubyarchprefix,
AS_HELP_STRING([--with-rubyarchprefix=DIR],
@@ -3686,56 +3683,62 @@ AC_ARG_WITH(ridir,
@@ -3703,56 +3703,62 @@ AC_ARG_WITH(ridir,
AC_SUBST(ridir)
AC_SUBST(RI_BASE_NAME)
@ -120,7 +120,7 @@ index 8ea969412f..a00f2b6776 100644
AS_IF([test "${LOAD_RELATIVE+set}"], [
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
@@ -3752,6 +3755,7 @@ AC_SUBST(sitearchincludedir)dnl
@@ -3769,6 +3769,7 @@ AC_SUBST(sitearchincludedir)dnl
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
AC_SUBST(ruby_version)dnl

View file

@ -0,0 +1,61 @@
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c
index 1a80b2b..b997e23 100644
--- a/ext/fiddle/closure.c
+++ b/ext/fiddle/closure.c
@@ -13,25 +13,11 @@ typedef struct {
ffi_type **argv;
} fiddle_closure;
-#if defined(USE_FFI_CLOSURE_ALLOC)
-#elif defined(__OpenBSD__) || defined(__APPLE__) || defined(__linux__)
-# define USE_FFI_CLOSURE_ALLOC 0
-#elif defined(RUBY_LIBFFI_MODVERSION) && RUBY_LIBFFI_MODVERSION < 3000005 && \
- (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64))
-# define USE_FFI_CLOSURE_ALLOC 0
-#else
-# define USE_FFI_CLOSURE_ALLOC 1
-#endif
-
static void
dealloc(void * ptr)
{
fiddle_closure * cls = (fiddle_closure *)ptr;
-#if USE_FFI_CLOSURE_ALLOC
ffi_closure_free(cls->pcl);
-#else
- munmap(cls->pcl, sizeof(*cls->pcl));
-#endif
if (cls->argv) xfree(cls->argv);
xfree(cls);
}
@@ -205,12 +191,7 @@ allocate(VALUE klass)
VALUE i = TypedData_Make_Struct(klass, fiddle_closure,
&closure_data_type, closure);
-#if USE_FFI_CLOSURE_ALLOC
closure->pcl = ffi_closure_alloc(sizeof(ffi_closure), &closure->code);
-#else
- closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
-#endif
return i;
}
@@ -257,17 +238,8 @@ initialize(int rbargc, VALUE argv[], VALUE self)
if (FFI_OK != result)
rb_raise(rb_eRuntimeError, "error prepping CIF %d", result);
-#if USE_FFI_CLOSURE_ALLOC
result = ffi_prep_closure_loc(pcl, cif, callback,
(void *)self, cl->code);
-#else
- result = ffi_prep_closure(pcl, cif, callback, (void *)self);
- cl->code = (void *)pcl;
- i = mprotect(pcl, sizeof(*pcl), PROT_READ | PROT_EXEC);
- if (i) {
- rb_sys_fail("mprotect");
- }
-#endif
if (FFI_OK != result)
rb_raise(rb_eRuntimeError, "error prepping closure %d", result);

View file

@ -0,0 +1,131 @@
From 920b924e5652884064a9529ffbd80d458a46fbc6 Mon Sep 17 00:00:00 2001
From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Tue, 5 Feb 2019 09:58:50 +0000
Subject: [PATCH] Make sure to wait with IO.select before using
Socket#recvfrom_nonblock
* On all platforms, as this is the recommended code pattern.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
index c1239ae637e0..74fd286c42ad 100644
--- a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb
@@ -36,12 +36,11 @@
describe 'with data available' do
before do
@client.write('hello')
-
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
end
platform_is_not :windows do
it 'returns an Array containing the data and an Addrinfo' do
+ IO.select([@server])
ret = @server.recvfrom_nonblock(1)
ret.should be_an_instance_of(Array)
@@ -54,8 +53,7 @@
5.times do
@client.write('hello')
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
-
+ IO.select([@server])
msg, _ = @server.recvfrom_nonblock(5)
msg.should == 'hello'
@@ -66,6 +64,7 @@
platform_is_not :windows do
describe 'the returned Array' do
before do
+ IO.select([@server])
@array = @server.recvfrom_nonblock(1)
end
@@ -80,6 +79,7 @@
describe 'the returned Addrinfo' do
before do
+ IO.select([@server])
@addr = @server.recvfrom_nonblock(1)[1]
end
From c1f0daeb6ac5c5414c9a4a58bb778a118006ae1f Mon Sep 17 00:00:00 2001
From: eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Tue, 5 Feb 2019 10:19:29 +0000
Subject: [PATCH] Make sure to wait with IO.select before using
Socket#accept_nonblock and recvfrom_nonblock
* On all platforms, as this is the recommended code pattern.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
spec/ruby/library/socket/socket/accept_nonblock_spec.rb | 4 ++--
spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
index 3ef219ed05a9..cde9e6a4b669 100644
--- a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
+++ b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb
@@ -86,8 +86,6 @@
@client = Socket.new(family, :STREAM, 0)
@client.connect(addr)
-
- platform_is(:darwin, :freebsd, :solaris) { IO.select([@server]) }
end
after do
@@ -96,6 +94,7 @@
end
it 'returns an Array containing a Socket and an Addrinfo' do
+ IO.select([@server])
@socket, addrinfo = @server.accept_nonblock
@socket.should be_an_instance_of(Socket)
@@ -104,6 +103,7 @@
describe 'the returned Addrinfo' do
before do
+ IO.select([@server])
@socket, @addr = @server.accept_nonblock
end
diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
index 015109a05200..62bbaf0dc93a 100644
--- a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb
@@ -40,16 +40,16 @@
describe 'with data available' do
before do
@client.write('hello')
-
- platform_is(:darwin, :freebsd) { IO.select([@server]) }
end
it 'returns an Array containing the data and an Array' do
+ IO.select([@server])
@server.recvfrom_nonblock(1).should be_an_instance_of(Array)
end
describe 'the returned Array' do
before do
+ IO.select([@server])
@array = @server.recvfrom_nonblock(1)
end
@@ -64,6 +64,7 @@
describe 'the returned address Array' do
before do
+ IO.select([@server])
@addr = @server.recvfrom_nonblock(1)[1]
end

View file

@ -0,0 +1,26 @@
From 2becb920e431110c4afc4fa069b051c5940c2096 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@jeremyevans.net>
Date: Fri, 29 May 2020 14:13:30 -0700
Subject: [PATCH] Convert ip addresses to canonical form in
Resolv::DNS::Requester::UnconnectedUDP#sender
Otherwise, if the IP address given is not in canonical form, it
won't match, and Resolv will ignore it.
Fixes [Bug #16439]
---
lib/resolv.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/resolv.rb b/lib/resolv.rb
index e7b45e785a85..d78531e174fd 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -762,6 +762,7 @@ def recv_reply(readable_socks)
end
def sender(msg, data, host, port=Port)
+ host = Addrinfo.ip(host).ip_address
lazy_initialize
sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"]
return nil if !sock

View file

@ -1,6 +1,6 @@
%global major_version 2
%global minor_version 6
%global teeny_version 6
%global teeny_version 7
%global major_minor_version %{major_version}.%{minor_version}
%global ruby_version %{major_minor_version}.%{teeny_version}
@ -21,7 +21,7 @@
%endif
%global release 127
%global release 128
%{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}
# The RubyGems library has to stay out of Ruby directory tree, since the
@ -29,7 +29,7 @@
%global rubygems_dir %{_datadir}/rubygems
# Bundled libraries versions
%global rubygems_version 3.0.3
%global rubygems_version 3.0.3.1
%global rubygems_molinillo_version 0.5.7
%global bundler_version 1.17.2
@ -147,6 +147,7 @@ Patch11: rubygems-3.0.3-Restore-gem-build-behavior-and-introdcue-the-C-flag-to-g
# This allows to loosen the RDoc dependency again.
# https://github.com/rubygems/rubygems/pull/2604
Patch12: rubygems-3.0.3-Avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.patch
# Fix compatibility with libyaml 0.2.5
# https://bugs.ruby-lang.org/issues/16949
Patch14: ruby-2.7.2-psych-fix-yaml-tests.patch
@ -160,6 +161,26 @@ Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch
# Add support for .include directive used by OpenSSL config files.
# https://github.com/ruby/openssl/pull/216
Patch22: ruby-2.6.0-config-support-include-directive.patch
# IO.select on all platforms to wait for input with recvfrom_nonblock
# and accept_nonblock
# https://bugzilla.redhat.com/show_bug.cgi?id=1719743
# https://github.com/ruby/ruby/commit/920b924e5652884064a9529ffbd80d458a46fbc6
# https://github.com/ruby/ruby/commit/c1f0daeb6ac5c5414c9a4a58bb778a118006ae1f
Patch24: ruby-2.7.0-preview1-IO.select-on-all-platforms-to-wait-for-input-with-recvfr.patch
# Use ffi_closure_alloc to avoid segmentation fault by libffi on aarch64.
# https://bugzilla.redhat.com/show_bug.cgi?id=1727832
# https://bugzilla.redhat.com/show_bug.cgi?id=1721569
# https://github.com/ruby/fiddle/pull/20
Patch25: ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch
# Resolv::DNS: timeouts if multiple IPv6 name servers are given and address
# contains leading zero
# https://bugzilla.redhat.com/show_bug.cgi?id=1944227
Patch26: ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch
# rubygem-bundler: Insecure permissions on directory in /tmp/ allows for execution of malicious code
# https://bugzilla.redhat.com/show_bug.cgi?id=1651826
# https://github.com/rubygems/bundler/pull/7416
Patch27: rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch
# Fix lchmod test failures.
# https://github.com/ruby/ruby/commit/a19228f878d955eaf2cce086bcf53f46fdf894b9
Patch41: ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch
@ -560,6 +581,10 @@ rm -rf ext/fiddle/libffi*
%patch15 -p1
%patch19 -p1
%patch22 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch41 -p1
%patch42 -p1
@ -618,16 +643,22 @@ make install DESTDIR=%{buildroot}
sed -i 's/Version: \${ruby_version}/Version: %{ruby_version}/' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
# Kill bundled certificates, as they should be part of ca-certificates.
# bundler
for cert in \
rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem \
rubygems.org/AddTrustExternalCARoot.pem \
index.rubygems.org/GlobalSignRootCA.pem
do
rm %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert
rm -r $(dirname %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert)
rm %{buildroot}%{ruby_libdir}/bundler/ssl_certs/$cert
rm -r $(dirname %{buildroot}%{ruby_libdir}/bundler/ssl_certs/$cert)
done
for cert in \
rubygems.org/GlobalSignRootCA.pem
do
rm %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert
rm -r $(dirname %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert)
done
# Ensure there is not forgotten any certificate.
test ! "$(ls -A %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/ 2>/dev/null)"
test "$(ls -A %{buildroot}%{ruby_libdir}/bundler/ssl_certs/ 2>/dev/null)" \
@ -1086,7 +1117,7 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'"
%{gem_dir}/specifications/default/mutex_m-0.1.0.gemspec
%{gem_dir}/specifications/default/ostruct-0.1.0.gemspec
%{gem_dir}/specifications/default/prime-0.1.0.gemspec
%{gem_dir}/specifications/default/rexml-3.1.9.gemspec
%{gem_dir}/specifications/default/rexml-3.1.9.1.gemspec
%{gem_dir}/specifications/default/rss-0.2.7.gemspec
%{gem_dir}/specifications/default/scanf-1.0.0.gemspec
%{gem_dir}/specifications/default/sdbm-1.0.0.gemspec
@ -1096,7 +1127,7 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'"
%{gem_dir}/specifications/default/sync-0.5.0.gemspec
%{gem_dir}/specifications/default/thwait-0.1.0.gemspec
%{gem_dir}/specifications/default/tracer-0.1.0.gemspec
%{gem_dir}/specifications/default/webrick-1.4.2.gemspec
%{gem_dir}/specifications/default/webrick-1.4.4.gemspec
%{gem_dir}/specifications/default/zlib-1.0.0.gemspec
%files -n rubygems-devel
@ -1214,6 +1245,13 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'"
%{_mandir}/man5/gemfile.5*
%changelog
* Wed Apr 14 2021 Jarek Prokop <jprokop@redhat.com> - 2.6.7-128
- Upgrade to Ruby 2.6.7.
- Resolv::DNS: timeouts if multiple IPv6 name servers are given an address
containing leading zero
- Fix: Rubygem-bundler: Don't use insecure tmp directory as home
allows for execution of malicious code.
* Wed Jul 07 2021 Jun Aruga <jaruga@redhat.com> - 2.6.6-127
- Fix FTBFS due to incompatible load directive.
- Properly support DWARF5 debug information.

View file

@ -0,0 +1,157 @@
From 65cfebb041c454c246aaf32a177b0243915a9998 Mon Sep 17 00:00:00 2001
From: fatkodima <fatkodima123@gmail.com>
Date: Fri, 1 Nov 2019 23:06:10 +0200
Subject: [PATCH] Don't use insecure temporary directory as home directory
---
lib/bundler.rb | 29 +++++++++++---------------
spec/bundler/bundler_spec.rb | 38 +++++++++--------------------------
spec/bundler/settings_spec.rb | 2 +-
3 files changed, 22 insertions(+), 47 deletions(-)
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 2ada6fe7891..b184f7e69c6 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -170,8 +170,7 @@ def user_home
end
if warning
- Kernel.send(:require, "etc")
- user_home = tmp_home_path(Etc.getlogin, warning)
+ user_home = tmp_home_path(warning)
Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n"
user_home
else
@@ -180,21 +180,6 @@ def user_home
end
end
- def tmp_home_path(login, warning)
- login ||= "unknown"
- Kernel.send(:require, "tmpdir")
- path = Pathname.new(Dir.tmpdir).join("bundler", "home")
- SharedHelpers.filesystem_access(path) do |tmp_home_path|
- unless tmp_home_path.exist?
- tmp_home_path.mkpath
- tmp_home_path.chmod(0o777)
- end
- tmp_home_path.join(login).tap(&:mkpath)
- end
- rescue RuntimeError => e
- raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
- end
-
def user_bundle_path(dir = "home")
env_var, fallback = case dir
when "home"
@@ -555,6 +555,17 @@ def configure_gem_home
Bundler.rubygems.clear_paths
end
+ def tmp_home_path(warning)
+ Kernel.send(:require, "tmpdir")
+ SharedHelpers.filesystem_access(Dir.tmpdir) do
+ path = Bundler.tmp
+ at_exit { Bundler.rm_rf(path) }
+ path
+ end
+ rescue RuntimeError => e
+ raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}")
+ end
+
# @param env [Hash]
def with_env(env)
backup = ENV.to_hash
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb
index 74cf7ae05d3..247838600bf 100644
--- a/spec/bundler/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler/bundler_spec.rb
@@ -232,16 +232,13 @@
path = "/home/oggy"
allow(Bundler.rubygems).to receive(:user_home).and_return(path)
allow(File).to receive(:directory?).with(path).and_return false
- allow(Etc).to receive(:getlogin).and_return("USER")
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
message = <<EOF
`/home/oggy` is not a directory.
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
EOF
expect(Bundler.ui).to receive(:warn).with(message)
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
end
end
@@ -254,16 +251,13 @@
allow(File).to receive(:directory?).with(path).and_return true
allow(File).to receive(:writable?).with(path).and_return false
allow(File).to receive(:directory?).with(dotbundle).and_return false
- allow(Etc).to receive(:getlogin).and_return("USER")
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
message = <<EOF
`/home/oggy` is not writable.
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
EOF
expect(Bundler.ui).to receive(:warn).with(message)
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
end
context ".bundle exists and have correct permissions" do
@@ -282,31 +276,17 @@
context "home directory is not set" do
it "should issue warning and return a temporary user home" do
allow(Bundler.rubygems).to receive(:user_home).and_return(nil)
- allow(Etc).to receive(:getlogin).and_return("USER")
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true)
- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER")
+ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom"))
message = <<EOF
Your home directory is not set.
-Bundler will use `/TMP/bundler/home/USER' as your home directory temporarily.
+Bundler will use `/tmp/trulyrandom' as your home directory temporarily.
EOF
expect(Bundler.ui).to receive(:warn).with(message)
- expect(Bundler.user_home).to eq(Pathname("/TMP/bundler/home/USER"))
+ expect(Bundler.user_home).to eq(Pathname("/tmp/trulyrandom"))
end
end
end
- describe "#tmp_home_path" do
- it "should create temporary user home" do
- allow(Dir).to receive(:tmpdir).and_return("/TMP")
- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(false)
- expect(FileUtils).to receive(:mkpath).once.ordered.with("/TMP/bundler/home")
- expect(FileUtils).to receive(:mkpath).once.ordered.with("/TMP/bundler/home/USER")
- expect(File).to receive(:chmod).with(0o777, "/TMP/bundler/home")
- expect(Bundler.tmp_home_path("USER", "")).to eq(Pathname("/TMP/bundler/home/USER"))
- end
- end
-
describe "#requires_sudo?" do
let!(:tmpdir) { Dir.mktmpdir }
let(:bundle_path) { Pathname("#{tmpdir}/bundle") }
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb
index 7e1dadded76..2a285fdcf37 100644
--- a/spec/bundler/bundler/settings_spec.rb
+++ b/spec/bundler/bundler/settings_spec.rb
@@ -67,7 +67,7 @@
context "when $TMPDIR is not writable" do
it "does not raise" do
expect(Bundler.rubygems).to receive(:user_home).twice.and_return(nil)
- expect(FileUtils).to receive(:mkpath).twice.with(File.join(Dir.tmpdir, "bundler", "home")).and_raise(Errno::EROFS, "Read-only file system @ dir_s_mkdir - /tmp/bundler")
+ expect(Bundler).to receive(:tmp).twice.and_raise(Errno::EROFS, "Read-only file system @ dir_s_mkdir - /tmp/bundler")
expect(subject.send(:global_config_file)).to be_nil
end

View file

@ -1 +1 @@
SHA512 (ruby-2.6.6.tar.xz) = 86caf93dbf61d03781767ab5375a7edf4761f13ba08ccfefe16c0a7550499237e7390c2f72a95d42670d4fe76b2401b4218936187c62ec1572799e9e04c50d62
SHA512 (ruby-2.6.7.tar.xz) = ba6fc0a36af2a08cf1b008851e805f59ea1047724fc7b61d4bc674533b8f123cb12fa0969e9a3f57290477c0d75f974ca7e304836e4905bd96a737211df9bd21