* ruby.c (process_options): convert the real path of the script to locale
encoding if its encoding is not locale (maybe UTF-8) on Windows/OS X.
this change makes the encoding of __dir__ to the same encoding of __FILE__
when the script name is passed from commandline.
* test/ruby/test_options.rb (test___dir__encoding): test for this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-core:68098] [Feature #10849] proposed by Andrew Butterfield.
SecureRandom.choose and SecureRandom.graph is not included.
(The implementation has SecureRandom.choose but it is private.)
I feel the method name, SecureRandom.choose, doesn't represent
the behavior well.
The actual use cases of SecureRandom.graph is not obvious.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for compilation performance.
$ ruby ./benchmark/driver.rb -e "trunk::/Users/k0kubun/.rbenv/versions/trunk/bin/ruby;modified::/Users/k0kubun/.rbenv/versions/modified/bin/ruby" -d ./benchmark -p app_erb
-----------------------------------------------------------
benchmark results:
Execution time (sec)
name trunk modified
app_erb 1.911 1.885
Speedup ratio: compare with the result of `trunk' (greater is better)
name modified
app_erb 1.014
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove space on double spaces.
* Capitalization of "Ruby".
* Use macOS instead of OS X.
https://github.com/ruby/ruby/pull/1610
Patch by @bunkrich [fix GH-1610]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (new_op_assign_gen): new_op_assign_gen for
ripper does not need column information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (new_op_assign): Define the macro separately
for ruby parser and for ripper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Addrinfo.getaddrinfo is recommended instead of
Socket.gethostbyname.
Addrinfo#getnameinfo is recommended instead of
Socket.gethostbyaddr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/etc/etc.c (etc_sysconfdir): mentioned special case on
Windows. [ruby-core:43110] [Bug #6121]
* win32/Makefile.sub (config.status): sysconfdir is not used on
Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tool/vcs.rb (VCS::GIT.get_revisions): use last revision also as
changed revision when the head does not have svn ID.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Kill following warning.
../../../ext/psych/yaml/emitter.c: In function ‘yaml_emitter_write_block_scalar_hints’:
../../../ext/psych/yaml/emitter.c:2196:20: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
chomp_hint = "-";
^
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Kill following warning.
../../../ext/psych/yaml/emitter.c: In function ‘yaml_emitter_write_folded_scalar’:
../../../ext/psych/yaml/emitter.c:2283:5: warning: passing argument 2 of ‘yaml_emitter_write_indicator’ discards ‘const’ qualifier from pointer target type [enabled by default]
if (!yaml_emitter_write_indicator(emitter, ">", 1, 0, 0))
^
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Feature #13097]
I confirmed current ruby (Ruby 2.4 and trunk) uses
gethostbyname() and gethostbyaddr().
Socket.gethostbyname uses getaddrinfo() and gethostbyname().
Socket.gethostbyaddr uses gethostbyaddr().
Socket.gethostbyname uses gethostbyname() to obtain alias hostnames.
RFC 3493 defines getaddrinfo()/getnameinfo() and
describes the problems of gethostbyname()/gethostbyaddr().
The problems are difficult protocol handling and thread-unsafety.
Since Ruby has GVL, the thread-unsafety doesn't cause wrong result.
But it may block other threads until finishing DNS query.
Socket.gethostbyname has the protocol handling problem.
It returns only one address family:
```
% ruby -rpp -rsocket -e 'pp Socket.gethostbyname("www.wide.ad.jp")'
["www.wide.ad.jp",
[],
10,
" \x01\x02\x00\r\xFF\xFF\xF1\x02\x16>\xFF\xFEKe\x1C",
"\xCB\xB2\x89:"]
```
www.wide.ad.jp has one IPv6 address and one IPv4 address.
But Socket.gethostbyname returns only one address family, 10 (AF_INET6),
which is the address family of the first address.
Also, Socket.gethostbyname and Socket.gethostbyaddr uses
4-bytes binary IPv4 address and 16-bytes binary IPv6 address.
This is not usual in other socket API in Ruby.
(Most socket API uses binary sockaddr string or Addrinfo object)
I think Socket.gethostbyname and Socket.gethostbyaddr are too far
from recommendable API.
So, I added deprecation description for documents for them.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* node.h (rb_node_newnode_longlife): The definition
of this function was deleted r24490.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Currently, gcc claims your coding style is not good. Shut it up.
../../../ext/psych/yaml/emitter.c: In function ‘yaml_emitter_write_plain_scalar’:
../../../ext/psych/yaml/emitter.c:28:6: warning: value computed is not used [-Wunused-value]
&& ((emitter->line_break == YAML_CR_BREAK ? \
^
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Currently, dummy_mark variable makes following warnings. Let's fix it.
../../../ext/psych/yaml/parser.c: In function ‘yaml_parser_parse_block_sequence_entry’:
../../../ext/psych/yaml/parser.c:762:21: warning: variable ‘dummy_mark’ set but not used [-Wunused-but-set-variable]
yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
^
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Currently, scanner.c makes following warning. Fix it.
../../../ext/psych/yaml/scanner.c: In function ‘yaml_parser_decrease_flow_level’:
../../../ext/psych/yaml/scanner.c:1189:23: warning: variable ‘dummy_key’ set but not used [-Wunused-but-set-variable]
yaml_simple_key_t dummy_key; /* Used to eliminate a compiler warning. */
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/win32/lib/win32/registry.rb (read, write): treat REG_NONE just like
REG_BINARY when reading and writing.
cf. [Bug #7526]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This reverts commit r60253 because it causes on error on Linux.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e