69518 Commits

Author SHA1 Message Date
Koichi Sasada
8a49c7e481 Revert "introduce check code for mysterious EBADF"
This reverts commit 7864efa105921eb3900c843126f2e0db02b9c6ae.
2021-10-26 17:06:57 +09:00
Koichi Sasada
d1424f7f7e Revert "check other IO#close calls"
This reverts commit a1c4cab11d613d7df037a81a770ee44a23a2e9be.
2021-10-26 17:06:57 +09:00
Nobuyoshi Nakada
049e1f8560
Fix typo 2021-10-26 14:43:12 +09:00
Koichi Sasada
5c2b644166 fix random EBADF problem
```ruby
      r, w = IO.pipe
      r.close

      IO.for_fd(w.fileno).close
```

This code closes a file descriptor `w.fileno`, but `w` doesn't know
the closing. Another code can open same file descriptor with opening
file (`f`). After that, the `w` will GCed and `w.fileno` is closed
again, and `f.fileno` is closed too, so IO operations for `f` (`f.close`)
will cause EBADF.

To fix this issue, do this test in another process.
2021-10-26 11:39:52 +09:00
卜部昌平
7d4c59203f improve doc coverage [ci skip]
Just split the comment for struct's one and array's one.
2021-10-26 09:30:42 +09:00
卜部昌平
a0029ae2b6 just another evidence that @shyouhei is an idiot [ci skip]
(gdb) ptype/o struct RString
/* offset    |  size */  type = struct RString {
/*    0      |    16 */    struct RBasic {
/*    0      |     8 */        VALUE flags;
/*    8      |     8 */        const VALUE klass;

                               /* total size (bytes):   16 */
                           } basic;
/*   16      |    24 */    union {
/*                24 */        struct {
/*   16      |     8 */            long len;
/*   24      |     8 */            char *ptr;
/*   32      |     8 */            union {
/*                 8 */                long capa;
/*                 8 */                VALUE shared;

                                       /* total size (bytes):    8 */
                                   } aux;

                                   /* total size (bytes):   24 */
                               } heap;
/*                24 */        struct {
/*   16      |    24 */            char ary[24];

                                   /* total size (bytes):   24 */
                               } embed;
/* XXX  8-byte padding  */

                               /* total size (bytes):   24 */
                           } as;

                           /* total size (bytes):   40 */
                         }
(gdb)
2021-10-26 09:30:12 +09:00
卜部昌平
b49ec78fd0 more on eliminating $make 2021-10-26 09:05:46 +09:00
卜部昌平
b682f76339 GNUMAKEFLAGS is too new for mac
It is relatively well known that mac does not update its command line
tools, and make is no exception.  They ship GNU make 3.x, which didn't
yet implemented GNUMAKEFLAGS.

Resort to MAKEFLAGS there.
2021-10-26 09:05:46 +09:00
卜部昌平
748688a63d .github: use GNUMAKEFLAGS instead of JOBS
A bit readable to me.
See also https://github.com/ruby/ruby/pull/4880
2021-10-26 09:05:46 +09:00
Jenny Shen
92ec010595
[rubygems/rubygems] Add support to build and sign certificates with multiple key algorithms
https://github.com/rubygems/rubygems/commit/967876f15d

Co-Authored-By: Frederik Dudzik <frederik.dudzik@shopify.com>
2021-10-26 08:01:55 +09:00
Maxime Chevalier-Boisvert
10fe8495cd Update YJIT code owners. Revert accidental commit. 2021-10-25 14:53:22 -04:00
Maxime Chevalier-Boisvert
722d43ad5e
Test PR 2021-10-25 14:29:36 -04:00
Maxime Chevalier-Boisvert
cf52a2c9ba
Add code owners for YJIT sources
Code owners are automatically tagged as reviewers on pull requests
2021-10-25 14:28:39 -04:00
Peter Zhu
a5b6598192 [Feature #18239] Implement VWA for strings
This commit adds support for embedded strings with variable capacity and
uses Variable Width Allocation to allocate strings.
2021-10-25 13:26:23 -04:00
Peter Zhu
6374be5a81 [Feature #18239] Refactor RVARGC alloc functions
The allocation functions no longer assume that one RVALUE needs to be
allocated.
2021-10-25 13:26:23 -04:00
Peter Zhu
46b66eb9e8 [Feature #18239] Add struct for embedded strings 2021-10-25 13:26:23 -04:00
Yusuke Endoh
09fa773e04
ast.c: Use kept script_lines data instead of re-opening the source file (#5019)
ast.c: Use kept script_lines data instead of re-open the source file
2021-10-26 01:58:01 +09:00
git
33113c6b64 * 2021-10-26 [ci skip] 2021-10-26 01:51:20 +09:00
Jean Boussier
557fa38915 [rubygems/rubygems] Fix Bundler::Digest#sha1 on big-endian systems
As noticed by @nobu https://github.com/rubygems/rubygems/pull/4989#discussion_r735674633

From wikipedia: https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode

> append ml, the original message length in bits, as a 64-bit big-endian integer.

`Q` is native endian, so little-endian on most modern hardware.
The original code from RubyDigest reverses the bytes:
d15f906caf/lib/ruby_digest.rb (L521)

But that makes the code non-portable, the correct way is to directly ask
for a big-endian representation.

https://github.com/rubygems/rubygems/commit/ba2be01ea4
2021-10-26 01:51:05 +09:00
Alan Wu
244c98e635
Strip out YJIT at build time when unsupported or disabled (#5003)
In an effort to minimize build issues on non x64 platforms, we can
decide at build time to not build the bulk of YJIT. This should fix
obscure build errors like this one on riscv64:

    yjit_asm.c:137:(.text+0x3fa): relocation truncated to fit: R_RISCV_PCREL_HI20 against `alloc_exec_mem'

We also don't need to bulid YJIT on `--disable-jit-support` builds.

One wrinkle to this is that the YJIT Ruby module will not be defined
when YJIT is stripped from the build. I think that's a fair change as
it's only meant to be used for YJIT development.
2021-10-25 10:45:22 -04:00
Ian C. Anderson
e943511455
YJIT: Implement duphash (#5009)
`duphash` showed up in the top-20 most frequent exit ops for @jhawthorn's benchmark that renders github.com/about

The implementation was almost exactly the same as `duparray`

Co-authored-by: John Hawthorn <john@hawthorn.email>

Co-authored-by: John Hawthorn <john@hawthorn.email>
2021-10-25 10:40:33 -04:00
Yusuke Endoh
1c0c8d5da2 test/ruby/test_jit.rb: Add a test for checkmatch insn 2021-10-25 21:30:16 +09:00
Yusuke Endoh
5bcef26d24 test/ruby/test_jit.rb: Print a hint at exit of the original process
Otherwise, the hint is printed whenever fork is called.

http://rubyci.s3.amazonaws.com/debian9/ruby-master/log/20211025T093004Z.log.html.gz
```
[20244/21156] TestThread#test_fork_while_lockedyou may want to add tests for following insns, when you have a chance: checkmatch
you may want to add tests for following insns, when you have a chance: checkmatch
you may want to add tests for following insns, when you have a chance: checkmatch
 = 0.19 s
```
2021-10-25 21:28:44 +09:00
David Rodriguez
9d28618091
[rubygems/rubygems] Avoid loading the digest gem unnecessarily
OpenSSL includes what we need.

https://github.com/rubygems/rubygems/commit/955f3b72ca
2021-10-25 20:48:52 +09:00
David Rodriguez
a959342abf
[rubygems/rubygems] Remove comment that seems no longer accurate
We require things inline or autoload them for efficiency and to avoid as
much as possible conflicting with user's choice of gems.

But I removed the require and observed no deadlocks when activating
gems.

https://github.com/rubygems/rubygems/commit/7d6333e842
2021-10-25 20:48:52 +09:00
David Rodriguez
9fbf3a1f6f
Unify issue template and ISSUES.md document
Some crucial information to ease maintainers work, like the advice of
upgrading rubygems and bundler, was one step away from the issue
template, making it easier for some users to miss.

Now all relevant information is written directly in the bug report
template.
2021-10-25 20:48:51 +09:00
David Rodriguez
b4a43e4f57
[rubygems/rubygems] Show proper error when previous installation of gem can't be deleted
Instead of showing the bug report template with an error at a random
place.

https://github.com/rubygems/rubygems/commit/882ad3ab57
2021-10-25 20:48:51 +09:00
David Rodriguez
00412be204
[rubygems/rubygems] Show a proper error if gem path is not writable
Instead of showing the bug report place with an error at a randome
place.

https://github.com/rubygems/rubygems/commit/241854ce73
2021-10-25 20:48:51 +09:00
David Rodriguez
f6d1909500
[rubygems/rubygems] Catch up with recent error message modification
https://github.com/rubygems/rubygems/commit/ae374c1f31
2021-10-25 20:48:51 +09:00
David Rodriguez
7073870dfa
[rubygems/rubygems] Improve readability by splitting updating the cache and searching it
https://github.com/rubygems/rubygems/commit/d0df25bb0f
2021-10-25 20:48:51 +09:00
David Rodriguez
f7f85c1feb
[rubygems/rubygems] Manage global gem cache directly
Previously, it was maintained in sync with the standard cache. That was
less efficient, and it caused some error messages to point to non
existent files.

https://github.com/rubygems/rubygems/commit/931f8cb8a9
2021-10-25 20:48:51 +09:00
David Rodriguez
4fc29d17b3
[rubygems/rubygems] Cached gem path resolution should consider default gems
https://github.com/rubygems/rubygems/commit/83b2b845b3
2021-10-25 20:48:51 +09:00
David Rodriguez
4edcda67b3
[rubygems/rubygems] Simplify gem downloading inside bundler
We can skip most stuff in `Gem::RemoteFetcher#download`, and use
`Gem::RemoteFetcher#update_cache_path` directly.

This has the benefit of allowing us to remove some workarounds to
support several rubygems versions, but also allows us to pass the target
folder where the gem should be downloaded directly and skip the logic
inside `Gem::RemoteFetcher#download` to infer the cache path. This will
be useful later to fix some issues with the `global_gem_cache` feature
flag.

https://github.com/rubygems/rubygems/commit/8fe74a77e4
2021-10-25 20:48:51 +09:00
David Rodriguez
03a563b47e
[rubygems/rubygems] Remove unused let
https://github.com/rubygems/rubygems/commit/7e1316e454
2021-10-25 20:48:51 +09:00
David Rodriguez
57d990ddab
[rubygems/rubygems] Raise original exception
https://github.com/rubygems/rubygems/commit/3c93b9fd21
2021-10-25 20:48:51 +09:00
David Rodriguez
7b821bc9b5
[rubygems/rubygems] Add missing requires
These methods rescue a constant defined by `rubygems/remote_fetcher`,
so they should technically require it.

The require is provided by `gem_remote_fetcher` anyways but I was
running a unit spec that stubs that method, so I was getting an
undefined constant error hiding another error.

https://github.com/rubygems/rubygems/commit/8bedae4034
2021-10-25 20:48:50 +09:00
David Rodriguez
9b1b171866
[rubygems/rubygems] Use Gem::Specification#file_name consistently
https://github.com/rubygems/rubygems/commit/13b933f49a
2021-10-25 20:48:50 +09:00
David Rodriguez
38542cfffc
[rubygems/rubygems] Extract a default_cache_path helper
https://github.com/rubygems/rubygems/commit/8319305d58
2021-10-25 20:48:50 +09:00
David Rodriguez
edc1813190
[rubygems/rubygems] Small refactor
Extract final cache path to a variable and pass that to `download_gem`.
It actually fits better the parameters documentation since it's the
final directory where the downloaded gem will be placed.

https://github.com/rubygems/rubygems/commit/1429db6a04
2021-10-25 20:48:50 +09:00
Yusuke Endoh
13068ebe32
process.c: Add Process._fork (#5017)
* process.c: Add Process._fork

This API is supposed for application monitoring libraries to hook fork
event.

[Feature #17795]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-10-25 20:47:19 +09:00
Yusuke Endoh
1eac38c609 test/ruby/test_rubyvm.rb: prevent "assigned but unused variable" warnings
http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20211025T093004Z.log.html.gz
```
[ 4896/21159] TestRubyVM#test_keep_script_lines(none):3: warning: assigned but unused variable - b
(none):6: warning: assigned but unused variable - c
(none):1: warning: assigned but unused variable - a
<compiled>:3: warning: assigned but unused variable - b
(none):3: warning: assigned but unused variable - b
(none):6: warning: assigned but unused variable - c
(none):1: warning: assigned but unused variable - a
<compiled>:3: warning: assigned but unused variable - b
```
2021-10-25 20:45:05 +09:00
Yusuke Endoh
7da9c25aa4 test/ruby/test_refinement.rb: Prevent deprecation warnings during test
http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20211025T093004Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_refinement.rb:777: warning: Refinement#include is deprecated and will be removed in Ruby 3.2
/home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_refinement.rb:840: warning: Refinement#prepend is deprecated and will be removed in Ruby 3.2
/home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_refinement.rb:2620: warning: Refinement#include is deprecated and will be removed in Ruby 3.2
```
2021-10-25 20:44:29 +09:00
Yusuke Endoh
00c7b91f91 test/ruby/test_marshal.rb: Prevent "assigned but unused variable" warning
http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20211025T093004Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_marshal.rb:925: warning: assigned but unused variable - objects
```
2021-10-25 20:43:42 +09:00
Jean Boussier
5af3f7f357
[rubygems/rubygems] Vendor a pure ruby implementation of SHA1
This allows `Source::Git` to no longer load the `digest` gem as it is causing
issues on Ruby 3.1.

https://github.com/rubygems/rubygems/pull/4989/commits/c19a9f2ff7
2021-10-25 20:24:32 +09:00
Yusuke Endoh
86e3d77abb
Make Coverage suspendable (#4856)
* Make Coverage suspendable

Add `Coverage.suspend`, `Coverage.resume` and some methods.

[Feature #18176] [ruby-core:105321]
2021-10-25 20:00:51 +09:00
Yusuke Endoh
54379e3d7d Update TypeProf to 0.20.1 2021-10-25 19:42:42 +09:00
Daniel Colson
7394514bde [rubygems/rubygems] Simplify and remove some unused code
When `install_with_build_args` was added in
be96283985,
there were two versions of the method: the default version in the base class that still
used the locking `with_build_args`, and an override in the `Future`
class (for Rubygems 2.0 and up) that yielded without calling
`with_build_args`.

The `with_build_args` version of the method was removed in
8a5b71e3e8
while removing a bunch of the old Rubygems compatibility code.

This commit removes `with_build_args`, since it no longer appears to be
used (the build args are passed as a keyword argument to
`spec.source.install` instead, since
be96283985).

The commit also removes `install_with_build_args` and the conditional
around it, since the method wasn't doing anything different than
`install`, and it had a comment that was no longer accurate.

https://github.com/rubygems/rubygems/commit/ba543a60eb
2021-10-25 19:02:50 +09:00
Koichi Sasada
a1c4cab11d check other IO#close calls
http://ci.rvm.jp/results/trunk@ruby-iga/3690333
> tool/lib/test/unit/parallel.rb:68:in `close': Bad file descriptor (Errno::EBADF)
2021-10-25 17:38:23 +09:00
Koichi Sasada
7864efa105 introduce check code for mysterious EBADF
parallel test randomly failed with EBADF.
This patch checks wich suite causes this error.

ex) http://ci.rvm.jp/results/trunk@ruby-iga/3690219

```
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:88:in `close': Bad file descriptor (Errno::EBADF)
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:88:in `ensure in _run_suite'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:89:in `_run_suite'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:30:in `block in _run_suites'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:29:in `map'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:29:in `_run_suites'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:128:in `run'
	/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:211:in `<main>'
```
2021-10-25 15:47:09 +09:00
Tanaka Akira
b74f9d656a add example for buffer: argument of pack. 2021-10-25 12:25:13 +09:00