Compare commits

...
Sign in to create a new pull request.

13 commits

Author SHA1 Message Date
Pavel Valena
d85283a96f Upgrade to Ruby 2.6.9. 2021-12-05 16:34:27 +01:00
Pavel Valena
a96f9182a8 Upgrade Ruby to 2.6.8. 2021-11-15 10:31:36 +01:00
Pavel Valena
7996ee7339 Sync with ruby:2.6 EL8 Appstream. 2021-11-04 21:32:33 +01:00
Jun Aruga
77d7664ed7 Fix rpmlint issue.
Fix the following rpmlint issue.

```
ruby.spec:609: W: macro-in-comment %{ruby_version}
```
2021-07-08 12:45:04 +02:00
Vít Ondruch
052fac6e36 Properly support DWARF5 debug information.
Resolves: rhbz#1920533
2021-07-08 12:13:02 +02:00
Jun Aruga
d7f560cf43 Fix FTBFS due to an incompatible load.
The FTBFS has started to happen with rpm-4.16.90-0.git15395.2.fc35.

root.log

```
DEBUG util.py:444:  error: line 116: Unknown tag: /chroot_tmpdir/srpm_unpacked/SOURCES/macros.ruby
```

As the `%{?load:...}` is undocumented, it is gone.

https://github.com/rpm-software-management/rpm/issues/1669
2021-07-07 17:58:04 +02:00
Jun Aruga
fd1c2abaf1 Give an option to increase the timeout in tests.
Because setting the option makes some tests stable that are currently randomly
failing with error on especially s390x and aarch64.

We observed the failing tests are calling `assert_in_out_err` method
calling `invoke_ruby` calling method.

Then when the `th_stdout.join(timeout)` or `th_stderr.join(timeout)` returns
`nil` as thread timeout in `invoke_ruby` method, it causes the error. [1][2]

The `test_timeout_scale` macro is to set the environment variable
`RUBY_TEST_TIMEOUT_SCALE` to increase the timeout in `apply_timeout_scale`
method as <new timeout> = <timeout> * <timeout scale>.

As an example, `TestBugReporter#test_bug_reporter_add` test's
maximum thread timeout was 56+ seconds for the default timeout 10 seconds. [3]
In this case setting `RUBY_TEST_TIMEOUT_SCALE=6` (6 * 10 = 60) is good enough
for 56+ seconds.

[1] https://github.com/ruby/ruby/blob/v2_7_1/tool/lib/envutil.rb#L149
[2] https://bugs.ruby-lang.org/issues/16492#note-8
[3] https://bugs.ruby-lang.org/issues/16492#note-4
2020-08-07 19:49:22 +02:00
Vít Ondruch
a4dab688e7 Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2). 2020-08-07 17:40:29 +02:00
Jun Aruga
7b6c9c5f13 Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. 2020-08-07 17:40:29 +02:00
Jun Aruga
da7e649e79 Disable LTO, which appear to cause issues with SIGSEV handler. 2020-08-07 17:40:29 +02:00
Jun Aruga
6bd343401a Fix FTBFS due to libyaml 0.2.5.
Resolves: rhbz#1845530
2020-08-07 17:40:21 +02:00
Pavel Valena
4851ffaf10 Disable "File.utime allows Time instances in the far future to set
mtime and atime".

https://bugs.ruby-lang.org/issues/16410
2020-05-12 03:23:02 +02:00
Pavel Valena
c7a78d5441 Upgrade to Ruby 2.6.6.
Resolves: rhbz#1833293
Resolves: rhbz#1827505
2020-05-12 02:27:20 +02:00
16 changed files with 878 additions and 32 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
@ -64,18 +64,18 @@ index 79c003e..34f2382 100644
% R = {}
% R["ruby_version"] = '"RUBY_LIB_VERSION"'
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index b47b6e1..0b99408 100755
index d8987af..1efbd33 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -334,6 +334,7 @@ def CONFIG.[](name, mandatory = false)
sitearchlibdir = CONFIG["sitearchdir"]
@@ -338,6 +338,7 @@ if CONFIG["vendordir"]
vendorlibdir = CONFIG["vendorlibdir"]
vendorarchlibdir = CONFIG["vendorarchdir"]
end
+rubygemsdir = CONFIG["rubygemsdir"]
mandir = CONFIG["mandir", true]
docdir = CONFIG["docdir", true]
enable_shared = CONFIG["ENABLE_SHARED"] == 'yes'
@@ -560,7 +561,16 @@ def stub
@@ -564,7 +565,16 @@ end
install?(:local, :comm, :lib) do
prepare "library scripts", rubylibdir
noinst = %w[*.txt *.rdoc *.gemspec]

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
@ -171,7 +171,7 @@ diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index d4c110e..d39c9a6 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -424,7 +424,7 @@ def CONFIG.[](name, mandatory = false)
@@ -428,7 +428,7 @@ def CONFIG.[](name, mandatory = false)
install?(:doc, :rdoc) do
if $rdocdir

View file

@ -0,0 +1,58 @@
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,22 +13,11 @@ typedef struct {
ffi_type **argv;
} fiddle_closure;
-#if defined(USE_FFI_CLOSURE_ALLOC)
-#elif !defined(HAVE_FFI_CLOSURE_ALLOC)
-# 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);
}
@@ -202,12 +188,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;
}
@@ -254,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,34 @@
From 9b42fce32bff25e0569581f76f532b9d57865aef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Mon, 27 Jul 2020 14:56:05 +0200
Subject: [PATCH] Timeout the test_bug_reporter_add witout raising error.
While timeouting the threads might be still good idea, it does not seems
the timeout impacts the TestBugReporter#test_bug_reporter_add result,
because the output of the child process has been already collected
earlier.
It seems that when the system is under heavy load, the thread might not
be sheduled to finish its processing. Even finishing the child process
might take tens of seconds and therefore the test case finish might take
a while.
---
test/-ext-/bug_reporter/test_bug_reporter.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb
index 628fcd0340..2c677cc8a7 100644
--- a/test/-ext-/bug_reporter/test_bug_reporter.rb
+++ b/test/-ext-/bug_reporter/test_bug_reporter.rb
@@ -19,7 +19,7 @@ def test_bug_reporter_add
args = ["--disable-gems", "-r-test-/bug_reporter",
"-C", tmpdir]
stdin = "register_sample_bug_reporter(12345); Process.kill :SEGV, $$"
- assert_in_out_err(args, stdin, [], expected_stderr, encoding: "ASCII-8BIT")
+ assert_in_out_err(args, stdin, [], expected_stderr, encoding: "ASCII-8BIT", timeout_error: nil)
ensure
FileUtils.rm_rf(tmpdir) if tmpdir
end
--
2.27.0

View file

@ -0,0 +1,134 @@
From 5400fc3c67446e2f7f35ea317c596e71f0cb1ca4 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Fri, 28 Feb 2020 21:15:37 +0900
Subject: [PATCH 2/2] Moved not-implemented method tests [Bug #16662]
Test not-implemented method with the dedicated methods, instead of
platform dependent features.
---
test/-ext-/test_notimplement.rb | 7 +++
test/ruby/test_notimp.rb | 90 ---------------------------------
2 files changed, 7 insertions(+), 90 deletions(-)
delete mode 100644 test/ruby/test_notimp.rb
diff --git a/test/-ext-/test_notimplement.rb b/test/-ext-/test_notimplement.rb
index 92a2fd22b8..038b507b73 100644
--- a/test/-ext-/test_notimplement.rb
+++ b/test/-ext-/test_notimplement.rb
@@ -13,10 +13,17 @@ def test_funcall_notimplement
end
def test_respond_to
+ assert_include(Bug.methods(false), :notimplement)
+ assert_include(Bug::NotImplement.instance_methods(false), :notimplement)
assert_not_respond_to(Bug, :notimplement)
assert_not_respond_to(Bug::NotImplement.new, :notimplement)
end
+ def test_method_inspect_notimplement
+ assert_match(/not-implemented/, Bug.method(:notimplement).inspect)
+ assert_match(/not-implemented/, Bug::NotImplement.instance_method(:notimplement).inspect)
+ end
+
def test_not_method_defined
assert !Bug::NotImplement.method_defined?(:notimplement)
assert !Bug::NotImplement.method_defined?(:notimplement, true)
diff --git a/test/ruby/test_notimp.rb b/test/ruby/test_notimp.rb
deleted file mode 100644
index daa5a82d7b..0000000000
--- a/test/ruby/test_notimp.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-# frozen_string_literal: false
-require 'test/unit'
-require 'timeout'
-require 'tmpdir'
-
-class TestNotImplement < Test::Unit::TestCase
- def test_respond_to_fork
- assert_include(Process.methods, :fork)
- if /linux/ =~ RUBY_PLATFORM
- assert_equal(true, Process.respond_to?(:fork))
- end
- end
-
- def test_respond_to_lchmod
- assert_include(File.methods, :lchmod)
- case RUBY_PLATFORM
- when /freebsd/, /linux-musl/
- assert_equal(true, File.respond_to?(:lchmod))
- when /linux/
- assert_equal(false, File.respond_to?(:lchmod))
- end
- end
-
- def test_call_fork
- GC.start
- pid = nil
- ps =
- case RUBY_PLATFORM
- when /linux/ # assume Linux Distribution uses procps
- proc {`ps -eLf #{pid}`}
- when /freebsd/
- proc {`ps -lH #{pid}`}
- when /darwin/
- proc {`ps -lM #{pid}`}
- else
- proc {`ps -l #{pid}`}
- end
- assert_nothing_raised(Timeout::Error, ps) do
- Timeout.timeout(EnvUtil.apply_timeout_scale(5)) {
- pid = fork {}
- Process.wait pid
- pid = nil
- }
- end
- ensure
- if pid
- Process.kill(:KILL, pid)
- Process.wait pid
- end
- end if Process.respond_to?(:fork)
-
- def test_call_lchmod
- if File.respond_to?(:lchmod)
- Dir.mktmpdir {|d|
- f = "#{d}/f"
- g = "#{d}/g"
- File.open(f, "w") {}
- File.symlink f, g
- newmode = 0444
- begin
- File.lchmod newmode, "#{d}/g"
- rescue Errno::EOPNOTSUPP
- skip $!
- else
- snew = File.lstat(g)
- assert_equal(newmode, snew.mode & 0777)
- end
- }
- end
- end
-
- def test_method_inspect_fork
- m = Process.method(:fork)
- if Process.respond_to?(:fork)
- assert_not_match(/not-implemented/, m.inspect)
- else
- assert_match(/not-implemented/, m.inspect)
- end
- end
-
- def test_method_inspect_lchmod
- m = File.method(:lchmod)
- if File.respond_to?(:lchmod)
- assert_not_match(/not-implemented/, m.inspect)
- else
- assert_match(/not-implemented/, m.inspect)
- end
- end
-
-end
--
2.26.2

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

@ -0,0 +1,217 @@
--- a/addr2line.c
+++ b/addr2line.c
@@ -161,11 +161,12 @@
struct dwarf_section debug_info;
struct dwarf_section debug_line;
struct dwarf_section debug_ranges;
+ struct dwarf_section debug_rnglists;
struct dwarf_section debug_str;
struct obj_info *next;
} obj_info_t;
-#define DWARF_SECTION_COUNT 5
+#define DWARF_SECTION_COUNT 6
static struct dwarf_section *
obj_dwarf_section_at(obj_info_t *obj, int n)
@@ -175,6 +176,7 @@
&obj->debug_info,
&obj->debug_line,
&obj->debug_ranges,
+ &obj->debug_rnglists,
&obj->debug_str
};
if (n < 0 || DWARF_SECTION_COUNT <= n) {
@@ -413,7 +415,7 @@
FILL_LINE();
break;
case DW_LNS_advance_pc:
- a = uleb128((char **)&p);
+ a = uleb128((char **)&p) * header.minimum_instruction_length;
addr += a;
break;
case DW_LNS_advance_line: {
@@ -452,7 +454,7 @@
/* isa = (unsigned int)*/(void)uleb128((char **)&p);
break;
case 0:
- a = *(unsigned char *)p++;
+ a = uleb128((char **)&p);
op = *p++;
switch (op) {
case DW_LNE_end_sequence:
@@ -766,6 +768,18 @@
DW_FORM_addrx4 = 0x2c
};
+/* Range list entry encodings */
+enum {
+ DW_RLE_end_of_list = 0x00,
+ DW_RLE_base_addressx = 0x01,
+ DW_RLE_startx_endx = 0x02,
+ DW_RLE_startx_length = 0x03,
+ DW_RLE_offset_pair = 0x04,
+ DW_RLE_base_address = 0x05,
+ DW_RLE_start_end = 0x06,
+ DW_RLE_start_length = 0x07
+};
+
enum {
VAL_none = 0,
VAL_cstr = 1,
@@ -919,6 +933,23 @@
}
static void
+di_skip_die_attributes(char **p)
+{
+ for (;;) {
+ uint64_t at = uleb128(p);
+ uint64_t form = uleb128(p);
+ if (!at && !form) break;
+ switch (form) {
+ default:
+ break;
+ case DW_FORM_implicit_const:
+ sleb128(p);
+ break;
+ }
+ }
+}
+
+static void
di_read_debug_abbrev_cu(DebugInfoReader *reader)
{
uint64_t prev = 0;
@@ -932,12 +963,7 @@
prev = abbrev_number;
uleb128(&p); /* tag */
p++; /* has_children */
- /* skip content */
- for (;;) {
- uint64_t at = uleb128(&p);
- uint64_t form = uleb128(&p);
- if (!at && !form) break;
- }
+ di_skip_die_attributes(&p);
}
}
@@ -1202,12 +1228,7 @@
/* skip 255th record */
uleb128(&p); /* tag */
p++; /* has_children */
- /* skip content */
- for (;;) {
- uint64_t at = uleb128(&p);
- uint64_t form = uleb128(&p);
- if (!at && !form) break;
- }
+ di_skip_die_attributes(&p);
for (n = uleb128(&p); abbrev_number != n; n = uleb128(&p)) {
if (n == 0) {
fprintf(stderr,"%d: Abbrev Number %"PRId64" not found\n",__LINE__, abbrev_number);
@@ -1215,12 +1236,7 @@
}
uleb128(&p); /* tag */
p++; /* has_children */
- /* skip content */
- for (;;) {
- uint64_t at = uleb128(&p);
- uint64_t form = uleb128(&p);
- if (!at && !form) break;
- }
+ di_skip_die_attributes(&p);
}
return p;
}
@@ -1348,6 +1364,21 @@
}
}
+static uint64_t
+read_dw_form_addr(DebugInfoReader *reader, char **ptr)
+{
+ char *p = *ptr;
+ *ptr = p + reader->format;
+ if (reader->format == 4) {
+ return read_uint32(&p);
+ } else if (reader->format == 8) {
+ return read_uint64(&p);
+ } else {
+ fprintf(stderr,"unknown address_size:%d", reader->address_size);
+ abort();
+ }
+}
+
static uintptr_t
ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr)
{
@@ -1361,8 +1392,50 @@
}
else if (ptr->ranges_set) {
/* TODO: support base address selection entry */
- char *p = reader->obj->debug_ranges.ptr + ptr->ranges;
+ char *p;
uint64_t base = ptr->low_pc_set ? ptr->low_pc : reader->current_low_pc;
+ if (reader->obj->debug_rnglists.ptr) {
+ p = reader->obj->debug_rnglists.ptr + ptr->ranges;
+ for (;;) {
+ uint8_t rle = read_uint8(&p);
+ uintptr_t base_address = 0;
+ uintptr_t from, to;
+ if (rle == DW_RLE_end_of_list) break;
+ switch (rle) {
+ case DW_RLE_base_addressx:
+ uleb128(&p);
+ break;
+ case DW_RLE_startx_endx:
+ uleb128(&p);
+ uleb128(&p);
+ break;
+ case DW_RLE_startx_length:
+ uleb128(&p);
+ uleb128(&p);
+ break;
+ case DW_RLE_offset_pair:
+ from = base_address + uleb128(&p);
+ to = base_address + uleb128(&p);
+ if (base + from <= addr && addr < base + to) {
+ return from;
+ }
+ break;
+ case DW_RLE_base_address:
+ base_address = read_dw_form_addr(reader, &p);
+ break;
+ case DW_RLE_start_end:
+ read_dw_form_addr(reader, &p);
+ read_dw_form_addr(reader, &p);
+ break;
+ case DW_RLE_start_length:
+ read_dw_form_addr(reader, &p);
+ uleb128(&p);
+ break;
+ }
+ }
+ return false;
+ }
+ p = reader->obj->debug_ranges.ptr + ptr->ranges;
for (;;) {
uintptr_t from = read_uintptr(&p);
uintptr_t to = read_uintptr(&p);
@@ -1702,6 +1775,7 @@
".debug_info",
".debug_line",
".debug_ranges",
+ ".debug_rnglists",
".debug_str"
};
@@ -1950,6 +2024,7 @@
"__debug_info",
"__debug_line",
"__debug_ranges",
+ "__debug_rnglists",
"__debug_str"
};
struct LP(segment_command) *scmd = (struct LP(segment_command) *)lcmd;

115
ruby.spec
View file

@ -1,6 +1,6 @@
%global major_version 2
%global minor_version 6
%global teeny_version 5
%global teeny_version 9
%global major_minor_version %{major_version}.%{minor_version}
%global ruby_version %{major_minor_version}.%{teeny_version}
@ -21,7 +21,7 @@
%endif
%global release 124
%global release 130
%{!?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
@ -48,8 +48,8 @@
%global openssl_version 2.1.2
%global power_assert_version 1.1.3
%global psych_version 3.1.0
%global rake_version 12.3.2
%global rdoc_version 6.1.2
%global rake_version 12.3.3
%global rdoc_version 6.1.2.1
%global test_unit_version 3.2.9
%global xmlrpc_version 0.3.0
@ -75,6 +75,10 @@
%bcond_without hardening_test
%endif
# LTO appears to cause some issue to SEGV handler.
# https://bugs.ruby-lang.org/issues/17052
%define _lto_cflags %{nil}
Summary: An interpreter of object-oriented scripting language
Name: ruby
Version: %{ruby_version}
@ -105,8 +109,8 @@ Source14: test_systemtap.rb
# The load directive is supported since RPM 4.12, i.e. F21+. The build process
# fails on older Fedoras.
%{?load:%{SOURCE4}}
%{?load:%{SOURCE5}}
%{load:%{SOURCE4}}
%{load:%{SOURCE5}}
# Fix ruby_version abuse.
# https://bugs.ruby-lang.org/issues/11002
@ -144,10 +148,40 @@ Patch11: rubygems-3.0.3-Restore-gem-build-behavior-and-introdcue-the-C-flag-to-g
# https://github.com/rubygems/rubygems/pull/2604
Patch12: rubygems-3.0.3-Avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.patch
# Fix DWARF5 support.
# https://bugzilla.redhat.com/show_bug.cgi?id=1920533
# https://bugs.ruby-lang.org/issues/17585
Patch15: ruby-dwarf5-avoid_crash-r1.patch
# Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add.
# https://bugs.ruby-lang.org/issues/16492
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/72c02aa4b79731c7f25c9267f74b347f1946c704
Patch42: ruby-2.8.0-Moved-not-implemented-method-tests.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Suggests: rubypick
Recommends: ruby(rubygems) >= %{rubygems_version}
@ -538,7 +572,14 @@ rm -rf ext/fiddle/libffi*
%patch9 -p1
%patch11 -p1
%patch12 -p1
%patch15 -p1
%patch19 -p1
%patch22 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch42 -p1
# Provide an example of usage of the tapset:
cp -a %{SOURCE3} .
@ -583,7 +624,7 @@ make install DESTDIR=%{buildroot}
# Rename ruby/config.h to ruby/config-<arch>.h to avoid file conflicts on
# multilib systems and install config.h wrapper
%multilib_fix_c_header --file %{_includedir}/%{name}/config.h
# TODO: The correct patch should be %%{_includedir}/%%{name}/rb_mjit_min_header-%{ruby_version}.h
# TODO: The correct patch should be %%{_includedir}/%%{name}/rb_mjit_min_header-%%{ruby_version}.h
# https://bugs.ruby-lang.org/issues/15425
%multilib_fix_c_header --file %{_includedir}/rb_mjit_min_header-%{ruby_version}.h
@ -595,16 +636,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)" \
@ -829,7 +876,23 @@ DISABLE_TESTS="$DISABLE_TESTS -n !/test_segv_\(setproctitle\|test\|loaded_featur
# which fails on Koji.
# https://bugs.ruby-lang.org/issues/14175
sed -i '/def test_mdns_each_address$/,/^ end$/ s/^/#/' test/resolv/test_mdns.rb
# Disable Timeouting test_queue_with_trap
# https://github.com/ruby/ruby/pull/3101/
sed -i '/^ def test_queue_with_trap$/,/^ end$/ s/^/#/g' \
test/ruby/test_thread_queue.rb
# Disable "File.utime allows Time instances in the far future to set
# mtime and atime".
# https://bugs.ruby-lang.org/issues/16410
MSPECOPTS="$MSPECOPTS -P 'File.utime allows Time instances in the far future to set mtime and atime'"
# Disable File.lchmod specs, which fails when building against glibc 2.31.9000.
# https://bugs.ruby-lang.org/issues/16749
MSPECOPTS="$MSPECOPTS -P 'File.lchmod returns false from \#respond_to?'"
MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'"
# Give an option to increase the timeout in tests.
# https://bugs.ruby-lang.org/issues/16921
%{?test_timeout_scale:RUBY_TEST_TIMEOUT_SCALE="%{test_timeout_scale}"} \
make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS"
%files
@ -1032,7 +1095,7 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS"
# TODO: Gemify these libraries
%{gem_dir}/specifications/default/cmath-1.0.0.gemspec
%{gem_dir}/specifications/default/csv-3.0.9.gemspec
%{gem_dir}/specifications/default/date-2.0.0.gemspec
%{gem_dir}/specifications/default/date-2.0.2.gemspec
%{gem_dir}/specifications/default/dbm-1.0.0.gemspec
%{gem_dir}/specifications/default/e2mmap-0.1.0.gemspec
%{gem_dir}/specifications/default/etc-1.0.1.gemspec
@ -1047,7 +1110,7 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS"
%{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
@ -1057,7 +1120,7 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS"
%{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
@ -1175,6 +1238,32 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS"
%{_mandir}/man5/gemfile.5*
%changelog
* Sun Dec 05 2021 Pavel Valena <pvalena@redhat.com> - 2.6.9-130
- Upgrade to Ruby 2.6.9.
* Fri Nov 12 2021 Pavel Valena <pvalena@redhat.com> - 2.6.8-129
- Upgrade Ruby to 2.6.8.
- 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.
Resolves: rhbz#1920533
* Thu Aug 06 2020 Jun Aruga <jaruga@redhat.com> - 2.6.6-126
- Fix FTBFS due to libyaml 0.2.5.
- Disable LTO, which appear to cause issues with SIGSEV handler.
- Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add.
- Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2).
* Thu May 07 2020 Pavel Valena <pvalena@redhat.com> - 2.6.6-125
- Upgrade to Ruby 2.6.6.
Resolves: rhbz#1833293
Resolves: rhbz#1827505
* Tue Oct 08 2019 Slava Kardakov <ojab@ojab.ru> - 2.6.5-124
- Update to Ruby 2.6.5.

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
@@ -233,16 +233,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
@@ -255,16 +252,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
@@ -283,31 +277,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.5.tar.xz) = e8ae3b5d4d23a93d0ef6057235ad0e573665a8b4b6544e1c70b4cce9c4d2fb9094e5c8fe8a9ab7b9996efe3ada603f9b4ef1fd08fb5a83253c1ae2b5e3f202db
SHA512 (ruby-2.6.9.tar.xz) = f60aa89e685cea324185eb0d13e6b44caef4e4f761cbf9ea1386ae70e39faf3866ac01e4bb5354574f2583e74290b8c80eaf63d126040d52368be6c771476451