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

47923 Коммитов

Автор SHA1 Сообщение Дата
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
sonots ec30bc5930 * string.c (deleted_prefix_length, deleted_suffix_length):
Add doxygen comment.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 10:33:25 +00:00
naruse e2a92c54e6 Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]
The order of resulted array is changed in some cases.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 10:28:34 +00:00
tarui a2d6b37f0c fix comment abount IMEMO_FL_USHIFT
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 10:26:31 +00:00
ko1 62c68b4c93 do not need to clear by NULL because of last commit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 10:23:59 +00:00
ko1 2ab99609e0 imemo_mask (enum) -> IMEMO_MASK (immediate value).
* internal.h: imemo_mask is not a valid imemo type but
  switch statements show warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 10:21:31 +00:00
knu 49ce3ca374 Make ACL::ACLEntry not suppress IPAddr::InvalidPrefixError
This is because it would be a user error because a pattern containing
a slash shouldn't be a host name pattern but an IP address pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 09:53:52 +00:00
svn 0fc3ae4a75 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 09:50:37 +00:00
hsbt 6faa0e12b0 [EXPERIMENTAL] Added test-bundled-gems task.
`test-bundled-gems` invoke test suite of bundled gems with
  build environment.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 09:50:36 +00:00
nobu d5b34b5331 common.mk: preserve rest fields of bundled_gems
* common.mk (update-bundled_gems): preserve rest fields other than
  names and versions, for more extensions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 09:25:05 +00:00
ko1 293b9d66af add RUNRUBY_USE_GDB envvar for runruby.rb.
* tool/runruby.rb: add RUNRUBY_USE_GDB environment variable.
  If RUNRUBY_USE_GDB=true then use 'gdb --args'.
  If there is 'run.gdb' file (made by 'make run.gdb') on current directory,
  run gdb with this file ('gdb -x run.gdb --args').

  This envval is useful when you want to run test-all (and so on) with gdb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 09:24:59 +00:00
nobu 719531dba5 fix up imemo_alloc
* internal.h (rb_imemo_alloc_struct), gc.c (gc_mark_imemo): turned
  next into the pointer to chain.

* parse.y (NEWHEAP): needs a cast.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 09:10:42 +00:00
nobu f5f328d497 vcs.rb: try to extract revision number from tags
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 08:56:58 +00:00
akr 2432796e1b RbConfig::LIMITS is provided by rbconfig/sizeof.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 08:44:56 +00:00
akr 4ad1ac75e4 declare variables once for each line in pathname.c.
This ease adding/deleting variables.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 08:41:59 +00:00
usa 6a832cdb8d Use GetSystemTimePreciseAsFileTime on recent Windows
* win32/win32.c (gettiemeofday, wutime): use GetSystemTimePreciseAsFileTime
  instead of GetSystemTimeAsFileTime if it is available.
  This patch is based on Takehiro Kubo <kubo@jiubao.org> 's one (change only
  the name of wrapper function).  Thanks! and sorry to late
  [ruby-dev:50167] [Feature #13732]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 08:41:22 +00:00
mame ccfe37884a Replace NODE_ALLOCA with T_IMEMO (imemo_alloc)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 08:40:28 +00:00
akr cea5f5aaee Pathname#glob method implemented.
[ruby-core:49373] [Feature #7360] proposed by Alexander E. Fischer.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 08:34:49 +00:00
usa 2caaae0707 File.symlink is not potable
* test/fileutils/test_fileutils.rb: skip tests using File.symlink if it's not
  available.  this problem is reported by ko1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 07:44:11 +00:00
akr 3d9453994c lib/open3.rb: accept IO-like object for :stdin_data argument.
Open3.capture3, Open3.capture2, Open3.capture2e accepts
IO-like object for :stdin_data argument.
[ruby-core:80936] [Feature #13527] proposed by janko.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 07:00:58 +00:00
k0kubun b6d97cc9a8 vm.c, vm_insnhelper.h: export symbols of VM serials
This change is for future JIT compiler introduction.
See r60231 for the purpose.

[close GH-1721]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:57:04 +00:00
naruse 6187b0001b [Feature #13712] String#start_with? supports regexp
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:51:01 +00:00
akr ae2578f6bc [DOC] describe methods used for src and dst argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:45:41 +00:00
akr a2831955b2 lib/open-uri.rb: accept :encoding option as well as encoding in mode string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:22:53 +00:00
k0kubun e6484a1530 vm_core.h: export symbols of shared variables
vm_insnhelper.h: ditto.

All changes are for reducing changes required to introduce JIT compiler.
Unlike functions that can be inlined by header, those variables should
be shared with JIT-ed code. This will help reducing cost of rebase
against upstream.

[close GH-1720]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:22:43 +00:00
glass d358972213 Update NEWS for Hash#slice
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:11:01 +00:00
glass 6c50bdda0b hash.c: Add Hash#slice
* hash.c (rb_hash_slice): add Hash#slice [Feature #8499]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 06:08:33 +00:00
knu d83f9745f5 Replace `to_a[1..-1]` on a MatchData with `captures`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 05:18:40 +00:00
knu da665b0234 Remove redundant calls of String#chr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 05:18:38 +00:00
nobu 08c8f73195 assertion for r60225
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 03:18:46 +00:00
yui-knk 1a0ed8cb42 Do not literal_flush if float is read correctly
* parse.y (parse_numeric): Do not literal_flush if
  float is read correctly. This will fix the first
  column of float.

before:
  ```
  1.2i1.1
         ^
  ```

after:
  ```
  1.2i1.1
      ^~~
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 02:50:38 +00:00
nobu 342e9ae38a moved node generation for dregex_once to parse.y
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 01:06:25 +00:00