Граф коммитов

48104 Коммитов

Автор SHA1 Сообщение Дата
knu 8daa6985dc Use a mutex to make SortedSet.setup thread-safe
This should fix [Bug #13735].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:57:32 +00:00
knu 76e3825376 Remove redundant use of module_eval
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:57:26 +00:00
yui-knk 92746378ab Remove not used node_type NODE_IASGN2
* compile.c (compile_massign_opt, iseq_compile_each0): This
  node_type has not been used since r11813.
* ext/objspace/objspace.c (count_nodes): ditto
* node.c (dump_node, rb_gc_mark_node): ditto
* node.h (node_type, NEW_IASGN2): ditto
* parse.y (node_assign_gen): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:56:03 +00:00
k0kubun dafb230c0b driver.rb: allow executing driver.rb directly
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:45:32 +00:00
usa 3e8c0c577c The encoding of __FILE__ and __dir__ should be same
* 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
2017-10-21 15:43:05 +00:00
k0kubun 8949479e1a driver.rb: add option to specify target with rbenv
[close GH-1724]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:39:35 +00:00
knu 3090169c9b Allow a SortedSet to be frozen and still functional [Bug #12091]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:38:38 +00:00
akr b867882a1c SecureRandom.alphanumeric implemented.
[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
2017-10-21 15:21:26 +00:00
svn cd381d8acc * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:19:46 +00:00
hsbt 86f1d9b705 Clarify return value for assignment methods.
https://github.com/ruby/ruby/pull/1682

  Patch by @sos4nt [fix GH-1682]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:19:45 +00:00
hsbt 2476bf2bb1 Clarify the behavior of IO.write without offset in write mode.
https://github.com/ruby/ruby/pull/1571

  Patch by @takanabe [fix GH-1571]
  [Bug #11638][ruby-core:71277]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:16:54 +00:00
k0kubun 774b42d643 erb.rb: specify frozen_string_literal: true
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
2017-10-21 15:02:46 +00:00
svn 4aed1c7fc9 * 2017-10-22
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:02:26 +00:00
hsbt f4ae225b04 Update some words on README.md.
* 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
2017-10-21 15:02:25 +00:00
hsbt 7d2e5fb979 Added explicitly require to example code.
https://github.com/ruby/ruby/pull/1666

  Patch by @guilherme [fix GH-1666]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:55:22 +00:00
yui-knk 617c53136d Do not pass a not used argument
* 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
2017-10-21 14:51:07 +00:00
kazu dabdec31e4 Use caller with length to reduce unused strings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:40:03 +00:00
ko1 4c6eb271dd fix r60281
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:35:19 +00:00
yui-knk 1ec8694c9e Define the macro separately for ruby parser and for ripper
* 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
2017-10-21 14:32:32 +00:00
sonots 47dd9bf7d8 Add doxygen comments
* include/ruby/ruby.h (enum ruby_value_type): add doxygen comments
* internal.h (enum imemo_type, struct vm_svar): add doxygen comments
* method.h (rb_method_type_t, rb_method_iseq_t): add doxygen comments

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:31:21 +00:00
glass 0686d5f4eb io.c: introduce copy offload to IO.copy_stream
io.c (rb_io_s_copy_stream): add copy offload feature (by using
copy_file_range(2) if available) to IO.copy_stream

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:25:46 +00:00
kosaki 3e5a25210e test_pathname.rb#test_open should care about umask
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:22:12 +00:00
kazu 76897dbabb Fix r60271
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:22:04 +00:00
kosaki 3666ceb729 test_cp_preserve_permissions should care about umask
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:21:56 +00:00
akr d88a0f13c2 Describe recommended-methods.
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
2017-10-21 14:21:52 +00:00
nobu e4ff51b05a sysconfdir on Windows
* 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
2017-10-21 14:19:23 +00:00
hsbt 52a275ee79 Removed obsoleted safe level checks on irb.
https://github.com/ruby/ruby/pull/1713

  Patch by @y-yagi [fix GH-1713]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:11:08 +00:00
nobu fe7f051832 fix up r60243
* 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
2017-10-21 14:06:22 +00:00
svn 9a093e746f * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:58:32 +00:00
hsbt db590b5d59 Fixed unexpected behavior of `Resolv::MDNS#each_address` when given ".local" address.
https://github.com/ruby/ruby/pull/1425

  Patch by @elct9620 [fix GH-1484]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:58:31 +00:00
hsbt 926103a958 Improve docs for `File.delete` exceptions.
https://github.com/ruby/ruby/pull/1505

  Patch by @mrtazz [fix GH-1505]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:49:39 +00:00
hsbt ec4141f183 Added sample code of merge! method in hash.c.
https://github.com/ruby/ruby/pull/1652

  Patch by @selmertsx [fix GH-1652]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:40:12 +00:00
knu 3e95ecd8d1 Fix the issue reference to [Bug #13769], handled in r60270
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:38:03 +00:00
knu e9d9f78483 Add a new test case for ipaddr 1.2.0 + drb/acl
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:34:22 +00:00
knu c2db917b3d Import ipaddr 1.2.0
- Add IPAddr#prefix
- Add IPAddr#loopback?
- Add IPAddr#private? [Feature #11666]
- Add IPAddr#link_local? [Feature #10912]
- Reject invalid address mask [Bug #13399]
- Warn that IPAddr#ipv4_compat and #ipv4_compat? are deprecated [#Bug 13769]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:34:19 +00:00
hsbt 31cc5b1505 Rename spec/rspec to .bundle.
It used without rspec installation for test-* task.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:17:54 +00:00
kosaki 1493972e82 kill "discards ‘const’ qualifier" warning
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
2017-10-21 13:15:23 +00:00
kosaki e3b4cd38df kill "discards ‘const’ qualifier" warning
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
2017-10-21 13:15:11 +00:00
akr b5c6fc8561 Deprecation document for gethostbyname,gethostbyaddr.
[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
2017-10-21 13:13:02 +00:00
yui-knk 7f7d5d0c90 node.h: Remove a not used function prototype
* 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
2017-10-21 13:06:36 +00:00
kosaki af14720f74 kill "value computed is not used" warning
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
2017-10-21 13:02:04 +00:00
kosaki 4911d45648 kill variable set but not used warning
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
2017-10-21 13:01:51 +00:00
kosaki c70f12c288 kill "variable set but not used" warning
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
2017-10-21 12:57:14 +00:00
nobu 4bf6a04f49 Fix bug about String#scanf("%a")
* lib/scanf.rb (extract_float, initialize): allow to omit a sign
  on the binary exponent.  [ruby-core:82435] [Bug #13833]
  [Fix GH-1689]

From: tarotaro0 <tarousann11922960@yahoo.co.jp>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 12:34:13 +00:00
akr 6fba455acb add example for Socket.gethostbyaddr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 12:22:46 +00:00
nobu 6d2dc71acb gc.c (rb_raw_obj_info): suppress a warning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 12:18:38 +00:00
nobu a4664da6fa gc.c (rb_raw_obj_info): adjust indent
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 12:18:35 +00:00
usa f03f4c4216 Treat REG_NONE just like REG_BINARY
* 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
2017-10-21 12:12:52 +00:00
kazu f7c06992fc Sync svn:ignore [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 11:59:08 +00:00
naruse c1db20c3b5 Revert "Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]"
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
2017-10-21 10:44:13 +00:00