Previously, the script was caching any file already present in the
destination directory, regardless of its origin. This caused issues
when the directory contained files copied from external sources like
`autoreconf --install`.
For example:
1. `./autogen.sh --install` copies `config.guess` and `config.sub`
from the system to `./tool`.
2. `ruby tool/downloader.rb -d tool -e gnu config.guess config.sub`
treats those files as if they were downloaded and caches them.
3. Removing the files: `rm tool/config.guess tool/config.sub`.
4. Running the downloader again, it mistakenly restores the cached
files instead of downloading fresh versions.
[ruby/prism] Fix infinite loop in error recovery
When recovering from a depth error that occurs at the end of the
file, we need to break out of parsing statements.
Fixes [Bug #21114]
a32e268787
Do not save ResolutionError if resolution succeeds for any address family (#12678)
* Do not save ResolutionError if resolution succeeds for any address family
Socket with Happy Eyeballs Version 2 performs connection attempts and name resolution in parallel.
In the existing implementation, if a connection attempt failed for one address family while name resolution was still in progress for the other, and that name resolution later failed, the method would terminate with a name resolution error.
This behavior was intended to ensure that the final error reflected the most recent failure, potentially overriding an earlier error.
However, [Bug #21088](https://bugs.ruby-lang.org/issues/21088) made me realize that terminating with a name resolution error is unnatural when name resolution succeeded for at least one address family.
This PR modifies the behavior so that if name resolution succeeds for one address family, any name resolution error from the other is not saved.
This PR includes the following changes:
* Do not display select(2) as the system call that caused the raised error, as it is for internal processing
* Fix bug: Get errno with Socket::SO_ERROR in Windows environment with a workaround for tests not passing
[Bug #21103] Fix local variable index calculation with forwarding
Forwarding argument is optimized not to packed when no other arguments
and an internal object refers values before it. This size is decided
at called time, calculate the local variable index from the fixed end
point.
[Bug #21092] Fallback variables after execonf has done
When reading from a dummy makefile, the global variables initialized
in `init_mkmf` may not be overridden.
rb_feature_p: skip `get_expanded_load_path` for absolute paths
Ref: https://github.com/fxn/zeitwerk/pull/308
```ruby
require 'benchmark'
$LOAD_PATH << 'relative-path'
autoload :FOO, '/tmp/foo.rb'
puts Benchmark.realtime {
500_000.times do
Object.autoload?(:FOO)
end
}
```
The above script takes 2.5 seconds on `master`, and only
50ms on this branch.
When we're looking for a feature with an absolute path, we don't
need to call the expensive `get_expanded_load_path`.
Avoid opt_aset_with optimization inside multiple assignment
Previously, since the opt_aset_with optimization was introduced,
use of the opt_aset_with optimization inside multiple assignment
would result in a segfault or incorrect instructions.
Fixes [Bug #21012]
Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
[ruby/prism] Increase value of PRISM_DEPTH_MAXIMUM to 10000
The previous value of 1_000 was added with a reference to the Bison
parser[^1], but the value of YYMAXDEPTH in the Bison docs is 10_000,
not 1_000.
[^1]: https://www.gnu.org/software/bison/manual/html_node/Memory-Management.html
Fixes [Bug #21044]
e098533ab4
Co-authored-by: Nony Dutton <nonydutton@gmail.com>
Correctly set node_id on iseq location
The iseq location object has a slot for node ids. parse.y was correctly
populating that field but Prism was not. This commit populates the field
with the ast node id for that iseq
[Bug #21014]
[Bug #20992] Test for local variable name encodings
Do not intern invalid symbols in eval parse
When the inner code cannot represent the name of the locals in the
outer code, do not bother putting them into the constant pool as
they will not be referenced.
Fixes [Bug #20992]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
[Bug #20989] Ripper: Pass `compile_error`
For the universal parser, `rb_parser_reg_fragment_check` function is
shared between the parser and ripper. However `parser_params` struct
is partially different, and `compile_error` function depends on that
part indirectly.
Evident with the crash reported in [Bug #20997], the C replacement
codegen functions aren't authored to handle block arguments (nor
should they because the extra code from the complexity defeats
optimization). Filter sites with VM_CALL_ARGS_BLOCKARG.
Backport of GH-12660:
Previously, callers of forwardable ISeqs moved the stack pointer up
without writing to the stack. If there happens to be a stale value in
the area skipped over, it could crash due to "try to mark T_NONE". Also,
the uninitialized local variables were observable through `binding`.
Initialize the locals to nil.
[Bug #21021]
Previously, the code for dropping surplus arguments when yielding
into blocks erroneously attempted to drop keyword arguments when there
is in fact no surplus arguments. Fix the condition and test that
supplying the exact number of keyword arguments as require compiles
without fallback.
Code like the following is crashing for us on 3.4.1:
```ruby
def a(&) = yield(x: 0)
1000.times { a { |x:| x } }
```
Crash:
```
ruby: YJIT has panicked. More info to follow...
thread '<unnamed>' panicked at ./yjit/src/codegen.rs:8018:13:
assertion `left == right` failed
left: 0
right: 1
```
Co-authored-by: Dani Acherkan <dtl.117@gmail.com>