86825 Commits

Author SHA1 Message Date
David Rodríguez
bb9a9f31ca [rubygems/rubygems] Remove unnecessary artifice parameter
It's automatically detected from Gemfile.

https://github.com/rubygems/rubygems/commit/72301a2e3b
2024-07-18 18:07:08 +00:00
David Rodríguez
ba6ffaf2e0 [rubygems/rubygems] Use latest shellwords for standalone test
https://github.com/rubygems/rubygems/commit/fcd04daf68
2024-07-18 18:07:08 +00:00
David Rodríguez
99bf4021fb [rubygems/rubygems] Ext is generally not in require_paths
https://github.com/rubygems/rubygems/commit/83b417a166
2024-07-18 18:07:07 +00:00
Peter Zhu
d6ef74407b Use rb_obj_hide instead of setting klass to 0 2024-07-18 13:47:00 -04:00
Kevin Newton
b1608fc6bc [PRISM] Do not respect xflag when eflag is set 2024-07-18 13:03:33 -04:00
Kevin Newton
8e5ac5a87d [PRISM] Ensure not opening directories 2024-07-18 13:03:25 -04:00
Kevin Newton
76ea5cde2a Refactor RUBY_DESCRIPTION assertions in test_rubyoptions 2024-07-18 13:03:17 -04:00
eileencodes
aa3030ac24 Fix empty hash instruction
When we have an empty hash the iseq should have a `newhash` but instead
had a `duphash`. To fix, check if the node's elements are equal to `0`.
If so we want a `newhash`, otherwise use the original `duphash`
instructions.

Before:

```
== disasm: #<ISeq:<main>@test2.rb:1 (1,0)-(1,2)>
0000 duphash                                {}                        (   1)[Li]
0002 leave
```

After:

```
== disasm: #<ISeq:<main>@test2.rb:1 (1,0)-(1,2)>
0000 newhash                                0                         (   1)[Li]
0002 leave
```

Fixes the test `TestYJIT#test_compile_newhash`. Related to ruby/prism#2935
2024-07-18 10:12:20 -04:00
tomoya ishida
c304bf13b5 [ruby/irb] Clear ENV["XDG_CONFIG_HOME"] to avoid loading
user-defined irbrc in TestIRB::ConfigValidationTest
(https://github.com/ruby/irb/pull/982)

https://github.com/ruby/irb/commit/632da0ff29
2024-07-18 10:56:19 +00:00
Nobuyoshi Nakada
b61e3a6218 Write rbinc files at once
Unexpected error can make empty files which result in unclear
compilation errors.
2024-07-18 19:34:10 +09:00
yui-knk
231a9acc15 Free data of struct rb_parser_ary in rb_parser_ary_free
For example:

    10.times do
      100_000.times do
        RubyVM::AbstractSyntaxTree.parse("x = 1 + 2 +", keep_tokens: true)
      rescue SyntaxError
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    28944
    44816
    60720
    76496
    92336
   108160
   123968
   139808
   155648
   171408

After:

    11984
    12704
    12816
    12832
    13072
    13088
    13088
    13136
    13136
    13152
2024-07-18 19:19:27 +09:00
David Rodríguez
86c99a8d14 [rubygems/rubygems] Fix gemspec require_paths type validation
It was not properly being detected as an Array attribute, and thus not
properly validated.

Fixing this allows us to remove a strange `rescue` clause in Bundler.

https://github.com/rubygems/rubygems/commit/4121a32408
2024-07-18 09:25:17 +00:00
David Rodríguez
95728a8b42 [rubygems/rubygems] Warn non flattened require paths in old RubyGems versions too
https://github.com/rubygems/rubygems/commit/b3cdccc6fb
2024-07-18 09:25:16 +00:00
David Rodríguez
f78a8761c4 [rubygems/rubygems] Remove unnecessary Windows test skip
https://github.com/rubygems/rubygems/commit/946180f5c1
2024-07-18 09:25:16 +00:00
Nobuyoshi Nakada
c032e2c225 [rubygems/rubygems] Use caller_locations instead of splitting caller
Also limit caller ranges

https://github.com/rubygems/rubygems/commit/a274b1af78
2024-07-18 04:20:07 +00:00
David Rodríguez
c639bacd45 [rubygems/rubygems] Fix detection of gem_repo1 being updated
https://github.com/rubygems/rubygems/commit/9f9493c77c
2024-07-18 04:20:06 +00:00
Hiroshi SHIBATA
e0f40dc9b0
Split URI::Parser examples with RFC2396 and RFC3986
Prepare for https://github.com/ruby/uri/pull/107
2024-07-18 12:42:36 +09:00
Naoto Ono
509f1b50c2 Lanunchable: Add missing condition statement
Addresses https://github.com/ruby/ruby/pull/11183/files#r1680617485.
2024-07-18 12:22:47 +09:00
Nobuyoshi Nakada
d11d615ba6
Fix utimesat availability condition
As `__has_attribute` macro is always defined in internal/compilers.h,
gcc warns `-Wunguarded-availability-new` as unknown option.  Check if
the warning option is usable instead.
2024-07-18 11:20:17 +09:00
Hartley McGuire
d0c17cbd09
Require space between hash/content in ATX heading (#1140)
While writing some Markdown documentation for Rails, I came across an
interesting case where trying to link to an instance method at the start
of a line would instead parse as an H1 heading:

```markdown
#response_body=
```

Expected:

```html
<a href=""><code>#response_body=</code></a>
```

Actual:

```html
<h1>response_body=</h1>
```

According to the CommonMark spec:

> At least one space or tab is required between the # characters and the
> heading’s contents, unless the heading is empty. Note that many
> implementations currently do not require the space. However, the space
> was required by the original ATX implementation, and it helps prevent
> things like the following from being parsed as headings:
>
> Example 64

So while some implementations do not follow this requirement, I believe
RDoc should because it makes it easy to write text similar to Example 64
(which was used in the new test) and it also enables automatically
linking to instance methods at the start of a line.
2024-07-18 09:40:01 +09:00
Stan Lo
239d54dfbc [ruby/rdoc] Improve rubocop setup
(https://github.com/ruby/rdoc/pull/1139)

* Rename rake rubocop to rake format_generated_files

* Add rubocop rules to ensure spaces are applied consistently

* Improve rubocop related CI workflows

https://github.com/ruby/rdoc/commit/27932d001c
2024-07-17 20:43:08 +00:00
Peter Zhu
573c2893dc Don't disable GC in rb_gc_impl_object_id
Disabling GC when creating the object ID was introduced in commit
67b2c21, but we shouldn't need to disable the GC.
2024-07-17 15:46:41 -04:00
Kevin Newton
2cc20c06e0
[PRISM] Use RSTRING_PTR for Ruby parsing with fgets 2024-07-17 15:45:07 -04:00
Kevin Newton
e77e4aa608 [ruby/prism] Have parse_stream handle NUL bytes
https://github.com/ruby/prism/commit/4a41d298c8
2024-07-17 19:44:32 +00:00
Koichi ITO
0fe816f380 [ruby/prism] [Doc] Tweak example of Prism::Dispatcher
This PR tweaked the documentation to correct an error encountered
when running the example code of `Prism::Dispatcher`.
This aims to make understanding the example smoother.

https://github.com/ruby/prism/commit/165a1a0e78
2024-07-17 18:17:59 +00:00
Kevin Newton
7de2c06352
[PRISM] Use RSTRING_LEN for Prism stream parsing 2024-07-17 14:13:16 -04:00
Nobuyoshi Nakada
278bbd7b45 Revert pending EVENT_RETURN tests
* "Allow ambiguosity of `return` line"
  65b991bc8571b7b718fc22bd33a43c4d269bf52d
* "Move to test/.excludes-prism"
  3b4ff810d2fefdf0194bd774bc04f6f17e2ccae7
* "Pending `EVENT_RETURN` settracefunc tests with Prism"
  a7f33c99c69e3cc62b7a24ce35f51f76cc5bfaa2
2024-07-17 14:06:11 -04:00
Nobuyoshi Nakada
644424941a [Bug #20457] [Prism] Remove redundant return flag 2024-07-17 14:06:11 -04:00
Kevin Newton
7993b88eee [PRISM] Use StringValuePtr for fgets for Prism stream parsing 2024-07-17 13:58:58 -04:00
Alan Wu
99825a539f [DOC] Note that rb_obj_freeze_inline() can raise NoMemoryError
And move it back to a public header because Doxygen might not be
scanning the .c files.

[Feature #18776]
2024-07-17 10:25:20 -04:00
Alan Wu
cd428b490d [DOC] No more is rb_ary_freeze() an alias of rb_obj_freeze()
[Feature #20589]
2024-07-17 10:25:20 -04:00
Peter Zhu
403f44ec2c Make OBJ_ID_INCREMENT == RUBY_IMMEDIATE_MASK + 1
All the non-GC objects (i.e. immediates) have addresses such that
`obj % RUBY_IMMEDIATE_MASK != 0` (except for `Qfalse`, which is 0). We
can define `OBJ_ID_INCREMENT` as `RUBY_IMMEDIATE_MASK + 1` which should
guarantee that GC objects never have conflicting object IDs with
immediates.
2024-07-17 09:01:42 -04:00
Matt Valentine-House
690ea013ca Remove unused variable from GC compaction path 2024-07-17 12:47:27 +01:00
David Rodríguez
3c3cce13c6 [rubygems/rubygems] Fix another case of bundle lock --add-platform doing nothing
https://github.com/rubygems/rubygems/commit/0629e27dda
2024-07-17 11:14:53 +00:00
Hiroshi SHIBATA
58aebcbce1 [rubygems/rubygems] Applied rubocop
https://github.com/rubygems/rubygems/commit/c26054e7e9
2024-07-17 10:17:57 +00:00
Yusuke Endoh
3f65df48bd Report a TracePoint log when the TracePoint tests fail 2024-07-17 18:41:39 +09:00
Hiroshi SHIBATA
af60317861 Removed needless block arguments 2024-07-17 17:37:57 +09:00
Hiroshi SHIBATA
2a12e4ffec To avoid fd leak with fetch request for SSL server 2024-07-17 17:37:57 +09:00
Hiroshi SHIBATA
e55bae4a67 Close leaked TCPServer socket 2024-07-17 17:37:57 +09:00
Hiroshi SHIBATA
76386ba1c0 Close leaked SSLServer socket 2024-07-17 17:37:57 +09:00
Hiroshi SHIBATA
f4c642edb1 Fixed fd leak from TCPServer
```
Leaked file descriptor: HTTPSProxyTest#test_https_proxy_ssl_connection: 8 : #<TCPServer:fd 8, AF_INET, 127.0.0.1, 63104>
```
2024-07-17 17:37:57 +09:00
Naoto Ono
2b3bfbc4c7 Launchable: Fix Python package path 2024-07-17 16:53:58 +09:00
Nobuyoshi Nakada
03a0ade90d
Fix double free when getcwd does not allocate buffer
Do not free the result at normal return from `ruby_getcwd`.
2024-07-17 15:16:21 +09:00
Nobuyoshi Nakada
05502c1dda
Add a macro to initialize struct getattrlist_args 2024-07-17 12:00:27 +09:00
Iskren
371790165f
[DOC] Fix and improve array slicing example in range.c
* [DOC] Fix typo in range.c

  In the example of the beginless range used for array slicing,
  '..' range literal was used while the '...' literal was expected

* [DOC] Add example for array slicing in range.c

  Add an example for the array slice with the beginless range
  using the '..' range literal

* [DOC] Add comments for array slicing in range.c

  Add comments to make crystal clear what the '..' and '...'
  range literals do when used for array slicing as beginless range
2024-07-17 11:42:29 +09:00
Jeremy Evans
dabb6c49aa
Release GVL around {,f}getattrlist calls in dir.c
Fixes [Bug #20587]
2024-07-16 19:20:17 -07:00
Peter Zhu
c083a3ffcd Fix memory leak reported in main ractor when RUBY_FREE_AT_EXIT
STACK OF 1 INSTANCE OF 'ROOT LEAK: <calloc in rb_ractor_main_alloc>':
6   dyld                                  0x1840e20e0 start + 2360
5   miniruby                              0x1006796c8 main + 88  main.c:62
4   miniruby                              0x10072f4a4 ruby_init + 16  eval.c:99
3   miniruby                              0x10072f328 ruby_setup + 104  eval.c:81
2   miniruby                              0x1008d08c0 Init_BareVM + 508  vm.c:4276
1   miniruby                              0x1007f8944 rb_ractor_main_alloc + 76  ractor.c:2034
0   libsystem_malloc.dylib                0x1842a4cac _malloc_zone_calloc_instrumented_or_legacy + 128
====
    1 (96 bytes) ROOT LEAK: <calloc in rb_ractor_main_alloc 0x1347075d0> [96]
2024-07-16 15:50:00 -04:00
Kevin Newton
c4a021ef96 [ruby/prism] Move sample files under sample/prism
https://github.com/ruby/prism/commit/9e9b069404
2024-07-16 19:26:28 +00:00
Kevin Newton
e3c5d73e0f
[PRISM] Omit two more ast tests that will not work without RubyVM::Ast 2024-07-16 14:41:42 -04:00
Kevin Newton
b0a99d0da9 [PRISM] Properly compile branch conditions in their own sequence 2024-07-16 14:40:20 -04:00