Commit graph

16449 commits

Author SHA1 Message Date
aycabta
b1c73f239f [ruby/rdoc] Use File.open to fix the OS Command Injection vulnerability in CVE-2021-31799
a7f5d6ab88
2021-05-21 13:42:24 +09:00
Nobuyoshi Nakada
c711093559 Get rid of sporadic WSAEACCES on Windows [ruby-dev:42661] 2021-05-20 21:56:58 +09:00
Yusuke Endoh
5026f9a5d5 compile.c: stop the jump-jump optimization if the second has any event
Fixes [Bug #17868]
2021-05-20 19:13:39 +09:00
Hiroshi SHIBATA
adcbae8d49
Removed minitest/mock 2021-05-19 14:24:01 +09:00
Yusuke Endoh
ceea1ea8af test/rubygems/test_gem_commands_open_command.rb: prevent a warning
20210518T093002Z.log.html.gz
```
[ 9396/21186] TestGemCommandsOpenCommand#test_execute-e:1: warning: possibly useless use of a literal in void context
 = 0.06 s
```
2021-05-18 19:06:48 +09:00
Yusuke Endoh
837cbea64b test/psych/test_coder.rb: Suppress non-parenthesis warnings
20210518T093002Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20210518T093002Z/ruby/test/psych/test_coder.rb:277: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator
```
2021-05-18 19:01:27 +09:00
Nobuyoshi Nakada
34bc8210ed
test/irb/test_raise_no_backtrace_exception.rb: fix test file path
Create a file for test under the temporary directory.
2021-05-18 16:04:37 +09:00
Jeremy Evans
2579593a56 [ruby/fiddle] Do not use a libdir for glibc, it breaks Linux PPC64 (#70)
Fixes [Bug #12666]

a267a40be7
2021-05-18 12:48:40 +09:00
Sutou Kouhei
ab5212b3c9 [ruby/fiddle] Add support for "const" in type
GitHub: fix #68

Reported by kojix2. Thanks!!!

d7322c234a
2021-05-18 12:48:40 +09:00
Sutou Kouhei
881b2dc898 [ruby/fiddle] closure: add support for const char *
GitHub: fix GH-62

Reported by Cody Krieger. Thanks!!!

284b820f2d
2021-05-18 12:48:40 +09:00
Sutou Kouhei
b2de5999d8 [ruby/fiddle] closure: accept symbol as type
dc2da6633e
2021-05-18 12:48:40 +09:00
Hiroshi SHIBATA
e36da7ba18
Revert an accidentally commits at df86a13cc1 2021-05-17 15:28:47 +09:00
Yusuke Endoh
31a757a442 Make the test pass with the old libyaml
I have no idea what result is right, but it fails with libyaml 0.1.7
(bundled with Ubuntu 18.04) anyway.
2021-05-17 14:31:34 +09:00
Yusuke Endoh
f367b4ffe7 assert_equal accepts an expected value as the first argument 2021-05-17 14:31:34 +09:00
Yusuke Endoh
ffdf0232ef lib/rdoc/rdoc.rb: Allow only RDoc::Options in .rdoc_options
Follow-up of d8fd92f620. Instead of using
unsafe_load blindly, RDoc::Options is only supposed to be allowed.
2021-05-17 12:53:42 +09:00
Hiroshi SHIBATA
d8fd92f620
Workaround with fbb4e3f96c in rdoc 2021-05-17 12:04:40 +09:00
Hiroshi SHIBATA
8e91b969df
Workaround with fbb4e3f96c 2021-05-17 12:00:05 +09:00
Yusuke Endoh
da5b283963 test/ostruct/test_ostruct.rb: Use YAML.unsafe_load instead of YAML.load
Follow-up of fbb4e3f96c
2021-05-17 11:36:16 +09:00
Aaron Patterson
42b20bdbfe
[ruby/psych] remove deprecated interface
0767227051
2021-05-17 11:20:46 +09:00
Aaron Patterson
c7c2ad5749
[ruby/psych] Introduce Psych.unsafe_load
In future versions of Psych, the `load` method will be mostly the same
as the `safe_load` method.  In other words, the `load` method won't
allow arbitrary object deserialization (which can be used to escalate to
an RCE).  People that need to load *trusted* documents can use the
`unsafe_load` method.

This commit introduces the `unsafe_load` method so that people can
incrementally upgrade.  For example, if they try to upgrade to 4.0.0 and
something breaks, they can downgrade, audit callsites, change to
`safe_load` or `unsafe_load` as required, and then upgrade to 4.0.0
smoothly.

cb50aa8d3f
2021-05-17 11:20:45 +09:00
Hiroshi SHIBATA
bcaa6aecea
[ruby/psych] Removed needless platform detection
57d704fd63
2021-05-17 11:20:45 +09:00
Hiroshi SHIBATA
df86a13cc1
[ruby/psych] Import test assertions from ruby/ruby
01dda86681
2021-05-17 11:20:45 +09:00
Jean Boussier
a3ceed50b8
[ruby/psych] Fix symabolize_name with non-string keys
1c5c29e81f
2021-05-17 11:20:45 +09:00
Jeremy Ebler
830778db95
[ruby/psych] feat: allow scalars and sequences to be styled when dumped
546154ddb7
2021-05-17 11:20:45 +09:00
Gabriel Nagy
229cb0fcdb
[Win32] long path name support [Bug #12551]
Implement long path support on Windows by applying Microsoft's
recommended application manifest.

To make this work on both Visual C++ and MinGW, include the manifest as
a resource when generating the resource files. This way it will be
embedded into the executables generated by both compilers.

It's important for the manifest resource to have ID 1, otherwise GCC
will embed a default manifest.

Note that in addition to this, the user needs to have [long paths enabled]
either by modifying the registry or by enabling a group policy.

[long paths enabled]: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-05-17 08:33:08 +09:00
Yusuke Endoh
f210d456a8 test/objspace/test_objspace.rb: check stderr before stdout
When `require "objspace/trace"` fails, previously the failure says:
```
  1) Failure:
TestObjSpace#test_objspace_trace [/tmp/ruby/v3/src/trunk-mjit/test/objspace/test_objspace.rb:621]:
<3> expected but was
<0>.
```
but this is hard to debug.
2021-05-14 18:07:58 +09:00
Yusuke Endoh
702961a88b test/ruby/test_refinement.rb: prevent "assigned but unused variable" 2021-05-14 15:44:13 +09:00
Yusuke Endoh
cf1e1879f1 ext/objspace/lib/objspace/trace.rb: Added
This file, when require'ed, starts tracing the object allocations, and
redefines `Kernel#p` to show the allocation site.

This commit is experimental; the library name and APIs may change.

[Feature #17762]
2021-05-14 13:40:32 +09:00
Nobuyoshi Nakada
110f242ef9
Also \U after control/meta is invalid [Bug #17861]
As well as `\u`, `\U` should be invalid there too.
And highlight including `u`/`U` not only the backslash before it.
2021-05-13 12:54:56 +09:00
Jeremy Evans
9ce29c94d8 Avoid improper optimization of case statements mixed integer/rational/complex
Fixes [Bug #17857]
2021-05-12 19:30:05 -07:00
Jeremy Evans
11ae581a4a Fix handling of control/meta escapes in literal regexps
Ruby uses a recursive algorithm for handling control/meta escapes
in strings (read_escape).  However, the equivalent code for regexps
(tokadd_escape) in did not use a recursive algorithm.  Due to this,
Handling of control/meta escapes in regexp did not have the same
behavior as in strings, leading to behavior such as the following
returning nil:

```ruby
/\c\xFF/ =~ "\c\xFF"
```

Switch the code for handling \c, \C and \M in literal regexps to
use the same code as for strings (read_escape), to keep behavior
consistent between the two.

Fixes [Bug #14367]
2021-05-12 18:55:43 -07:00
Yusuke Endoh
9484f9ebdf [rubygems/rubygems] Use Time.stub :now to avoid a random failure
Essentially this reverts 45464bfcbdf9f9cfb440950bc57a27d237627a17.
The commit removed a mock of Time.now, which caused a random failure.

20210512T123004Z.fail.html.gz
```
  1) Failure:
TestGemPackageTarWriter#test_add_file_signer [/home/chkbuild/chkbuild/tmp/build/20210512T123004Z/ruby/test/rubygems/test_gem_package_tar_writer.rb:117]:
Field mtime of the tar header differs..
<"14046746312\u0000"> expected but was
<"14046746311\x00">.
```

Object#stub is defined at f1af59fe02ef2cc58f13e2742e4cc6cf8c2a1a20, so
now `Time.stub :now` works.

85f60a9ed0
2021-05-13 09:26:13 +09:00
Yusuke Endoh
31794d2e73 parse.y: Allow "command" syntax in endless method definition
This change allows `def hello = puts "Hello"` without parentheses.

Note that `private def hello = puts "Hello"` does not parse for
technical reason.

[Feature #17398]
2021-05-13 00:14:50 +09:00
git
81513c9dab * remove trailing spaces. [ci skip] 2021-05-12 17:40:52 +09:00
Koichi Sasada
523a6998dd Use another class for the comparison.
`memsize_of(Object.new)` can be changed with past ivar creation
history for Object instances (another Object instance has 4 or
more ivars, next created Object instance has the area for the
ivars). So use antoher class for the comparison.
2021-05-12 17:40:31 +09:00
Hiroshi SHIBATA
81720b947a Use assert_raise instead of assert_raises 2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
cdcfe1082c Revert 924ce2c5ba4d1c1dc781a6a06682204d358421bb
Because test-unit didn't provide the benchmark test. And This test
  is fragile with the several environments.
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
bef49e6e8d [rubygems/rubygems] Added begin-end block for java platform
Because pend of test-unit raises exception.

b5e2d0855a
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
d33888bf96 [rubygems/rubygems] Replace skip to pend
0b145135c7
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
129bc04ab7 [rubygems/rubygems] util/rubocop -a
a10ff97830
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
00f5b4b546 [rubygems/rubygems] Don't use Minitest::Mock
d3fa893597
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
3456335a9c [rubygems/rubygems] Removed minitest/mock from test/rubygems/test_gem_remote_fetcher.rb
f1af59fe02
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
ff3f990499 [rubygems/rubygems] Removed minitest/mock from test_gem_package_tar_writer.rb
45464bfcbd
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
7b3b48549b [rubygems/rubygems] capture_output will return empty string, not nil
3fa93f6144
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
9b5e4ce611 [rubygems/rubygems] Fixed variable scope at test_silent_system
bfcdf79657
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
cd375e455e [rubygems/rubygems] Rewrite with capture_output
a091004ded
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
5ed9d3f16f [rubygems/rubygems] Use capture_output instead of capture_io
c46185abe3
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
c30594bb0c [rubygems/rubygems] Use assert_raise instead of assert_raises
769e87f011
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
2c0072dec5 [rubygems/rubygems] Use dummy assertion for assert_https
64d843fe17
2021-05-12 17:24:43 +09:00
Hiroshi SHIBATA
a1c416460b [rubygems/rubygems] Use capture_output instead of assert_silent
3225aab7f8
2021-05-12 17:24:43 +09:00