1047 Commits

Author SHA1 Message Date
Hiroshi SHIBATA
5c6269c459
Support XDG_* (#2174)
* Support XDG_CONFIG_HOME for gemrc.

* Support XDG_DATA_HOME for .gem

* Added test for XDG_DATA_HOME

* Do not reuse environmental variable.

* Unify .rdoc path to RDoc.home.

* Support XDG_DATA_HOME for .rdoc

* Ignore exists?

* Extracted config_home path

* Use XDG_CONFIG_HOME for default credential path

* Fixed inconsistency location.

* Fixed the broken tests.

* Support XDG_CONFIG_HOME for irbrc

* Introduce Gem.cache_home as XDG_CACHE_HOME

* Use Gem.cache_home instead of Gem.config_home for the credential file of RubyGems.

* Initialized the old configurations

* Fixed test failure related the configuration initialization

* restore XDG_DATA_HOME

* Fixed the broken examples of bundler with XDG_*

* Do not modify environmental variable on test file

* Use XDG_DATA_HOME insted of XDG_CACHE_HOME for credential file

* stub out Gem.data_home

* Move dir accessor to defaults.rb file

* Use XDG_DATA_HOME for signed gem features

* Use XDG_DATA_HOME for spec cache

* Do not rely on Gem.user_home

* Gem.user_home is always exists. Don't need to use FileUitls.mkdir_p

* Bump support version to RubyGems 3.2.0+

* Removed the needless fallback configuration

* Fixed the inconsistency methods that are find_config_file and config_file

* Use Gem.configuration.credentials_path instead of hard-coded path

* gem_path is always provided

* Removed the duplicated code of find_home

* Also removed the duplicated code of user_home

* use Gem::UNTAINT instead of untaint for surpressing the warnings

* Use File.directory

* Restore XDG_DATA_HOME

* Use File.write
2020-04-23 19:16:06 +09:00
Yusuke Endoh
2af4c1fc5b Skip Process#clock_getres specs on Android
... just like AIX and OpenBSD.
2020-04-19 23:15:43 +09:00
Nobuyoshi Nakada
62554ca978
Removed NIL/TRUE/FALSE
Deprerecated constants which had been warned since 2.4.
2020-04-17 17:35:17 +09:00
Nobuyoshi Nakada
e8f53692ca
Endless method definition [Feature #16746] 2020-04-10 18:02:15 +09:00
Jeremy Evans
900e83b501 Turn class variable warnings into exceptions
This changes the following warnings:

* warning: class variable access from toplevel
* warning: class variable @foo of D is overtaken by C

into RuntimeErrors.  Handle defined?(@@foo) at toplevel
by returning nil instead of raising an exception (the previous
behavior warned before returning nil when defined? was used).

Refactor the specs to avoid the warnings even in older versions.
The specs were checking for the warnings, but the purpose of
the related specs as evidenced from their description is to
test for behavior, not for warnings.

Fixes [Bug #14541]
2020-04-10 00:29:05 -07:00
Nobuyoshi Nakada
d8720eb7de
Suppress -Wshorten-64-to-32 warnings 2020-04-08 16:28:38 +09:00
卜部昌平
9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada
a58bbd6a51
Use rb_warn_deprecated for File.exists? and Dir.exists? 2020-04-06 21:43:32 +09:00
Nobuyoshi Nakada
146330906f
Fixed the location of the shared library
On platform where searchs shared libraries by `PATH` environment
variable (i.e., Windows), the shared library is installed in
`bindir`.  On other platforms, the library directory is directed
by `libdirname` indirectly.
2020-04-04 11:18:25 +09:00
Nobuyoshi Nakada
4a71645565
rbconfig_spec.rb: removed needless windows guard
This reverts commit 34b0a7be0ed2fd4ca4d1d509a22964b5e61dfe34.
2020-04-04 11:18:23 +09:00
Benoit Daloze
7f82c8cd47 Update to ruby/spec@7289ea3 2020-04-04 01:02:53 +02:00
Benoit Daloze
da5a128991 Update to ruby/mspec@fad32a5 2020-04-04 01:02:50 +02:00
Nobuyoshi Nakada
ca0f68260e
Use platform_is guard 2020-04-03 09:47:19 +09:00
Nobuyoshi Nakada
18f7d3c9a6
Refined "Drop support for ruby 2.4 from ruby/spec"
By using spec/mspec/tool/remove_old_guards.rb.
2020-04-03 09:44:40 +09:00
Nobuyoshi Nakada
f49a24201c
Refined spec/mspec/tool/remove_old_guards.rb
* Allow spaces around `...`
* Matches quotes more precisely
* Matches 0 teeny
2020-04-03 09:44:32 +09:00
Benoit Daloze
da05c1552e Update to ruby/spec@cc7b9e5 2020-04-02 22:39:28 +02:00
Benoit Daloze
4ec32f869f Update to ruby/mspec@b9fe8d6 2020-04-02 22:39:26 +02:00
Nobuyoshi Nakada
242e58db2f
Removed obsolete names 2020-04-03 01:16:57 +09:00
Nobuyoshi Nakada
826f44834f Drop support for ruby 2.4 from ruby/spec 2020-04-01 15:36:20 +09:00
Nobuyoshi Nakada
3a2073e61b Use FrozenError instead of frozen_error_class 2020-04-01 15:36:20 +09:00
Yusuke Endoh
87aebecdc2 spec/ruby/core/time/: Use near time for timezone test
`time_with_zone.zone.should == (time_with_zone - 60*60).zone` fails when
the time is immediately before the change of summer time.

https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-master/log/20200328T232504Z.fail.html.gz

```
1)
Time#+ preserves time zone FAILED
Expected "CET" == "CEST"
to be truthy but was false
```

It is acceptable as it fails at most twice per year, but it would be
good to use near time objects to reduce the possibility.
2020-03-29 10:06:53 +09:00
Yusuke Endoh
6379c6af4d spec/bundler/other/platform_spec.rb: skip an attempt to simulate JRuby 2020-03-29 09:09:46 +09:00
Takashi Kokubun
cf191872fd
Increase the number of Process.times attempts
CI of 5806c54447439f2ba22892e4045e78dd80f96f0c did not succeed
https://travis-ci.org/github/ruby/ruby/jobs/668072714
2020-03-28 15:23:30 -07:00
Benoit Daloze
5806c54447 Improve reliability of the Process.times spec 2020-03-28 14:39:01 +01:00
Benoit Daloze
6413a26b6c Do not check that #stime changes in Process.times spec
* Since the spec might not spend any time in system calls.
2020-03-28 14:32:22 +01:00
Benoit Daloze
11a381940b Remove debugging code 2020-03-28 14:27:13 +01:00
Benoit Daloze
5b48686691 Remove Process.clock_getres "matches the resolution in practice" specs
* Almost all platforms return incorrect values for Process.clock_getres,
  it should be removed: https://bugs.ruby-lang.org/issues/16740
2020-03-28 12:49:28 +01:00
Benoit Daloze
282c9d1bbe Remove spec which is an incorrect usage of rb_rescue2()
* It segfaults on MRI.
2020-03-28 12:34:45 +01:00
Yusuke Endoh
34b0a7be0e spec/ruby/library/rbconfig/rbconfig_spec.rb: restore "not windows" guard
https://github.com/ruby/ruby/runs/541455267
```
1)
RbConfig::CONFIG libdir/LIBRUBY_SO is the path to libruby and it exists if and only if ENABLE_SHARED FAILED
Expected File.exist? "d:/Ruby26-x64/lib/x64-msvcrt-ruby260.dll"
to be truthy but was false
D:/a/ruby/ruby/src/spec/ruby/library/rbconfig/rbconfig_spec.rb:46:in `block (3 levels) in <top (required)>'
D:/a/ruby/ruby/src/spec/ruby/library/rbconfig/rbconfig_spec.rb:4:in `<top (required)>'
```
2020-03-28 19:31:11 +09:00
Nobuyoshi Nakada
8c80922c82
Fixed RbConfig spec for multiarch 2020-03-28 16:27:01 +09:00
Nobuyoshi Nakada
7072e0324e
Guard RbConfig spec unless installed 2020-03-28 14:57:17 +09:00
Yusuke Endoh
6eb3820aad spec/ruby/optional/capi/kernel_spec.rb: stop a spec that causes SEGV
I think the wrong terminating argument cannot work.
To stop the noisy CI failures, the spec is tentatively suspended.
2020-03-28 11:12:30 +09:00
Benoit Daloze
f234d51eab Update to ruby/spec@ec84479 2020-03-28 00:22:51 +01:00
Benoit Daloze
296f68816c Update to ruby/mspec@16b5a0a 2020-03-28 00:22:48 +01:00
Nobuyoshi Nakada
f6b6a7ad34
Show failed times 2020-03-24 14:56:03 +09:00
Takashi Kokubun
eff0c5bf2a
Try to avoid random failures on clock_getres_spec.rb
This spec fails too often
https://github.com/ruby/ruby/runs/529546249
https://github.com/ruby/ruby/runs/524933256
2020-03-23 22:53:54 -07:00
Jeremy Evans
4f7b435c95 Support obj.clone(freeze: true) for freezing clone
This freezes the clone even if the receiver is not frozen.  It
is only for consistency with freeze: false not freezing the clone
even if the receiver is frozen.

Because Object#clone is now partially implemented in Ruby and
not fully implemented in C, freeze: nil must be supported to
provide the default behavior of only freezing the clone if the
receiver is frozen.

This requires modifying delegate and set, to set freeze: nil
instead of freeze: true as the keyword parameter for
initialize_clone.  Those are the two libraries in stdlib that
override initialize_clone.

Implements [Feature #16175]
2020-03-22 09:30:07 -07:00
Nobuyoshi Nakada
5b287481be
Removed non-RUBY_INTEGER_UNIFICATION code 2020-03-21 16:59:55 +09:00
Yusuke Endoh
d514ba8e17 Proc made by Hash#to_proc should be a lambda [Bug #12671]
Like `Symbol#to_proc` (f0b815dc670b61eba1daaa67a8613ac431d32b16)
2020-03-16 23:38:26 +09:00
Yusuke Endoh
47141797be hash.c: Do not use the fast path (rb_yield_values) for lambda blocks
As a semantics, Hash#each yields a 2-element array (pairs of keys and
values).  So, `{ a: 1 }.each(&->(k, v) { })` should raise an exception
due to lambda's arity check.
However, the optimization that avoids Array allocation by using
rb_yield_values for blocks whose arity is more than 1 (introduced at
b9d29603375d17c3d1d609d9662f50beaec61fa1 and some commits), seemed to
overlook the lambda case, and wrongly allowed the code above to work.

This change experimentally attempts to make it strict; now the code
above raises an ArgumentError.  This is an incompatible change; if the
compatibility issue is bigger than our expectation, it may be reverted
(until Ruby 3.0 release).

[Bug #12706]
2020-03-16 23:17:12 +09:00
Nobuyoshi Nakada
f14409c9bb
Enclosed version constant 2020-03-15 22:21:23 +09:00
Nobuyoshi Nakada
1ad9b231ca
Added guard against [Bug #16497] 2020-03-15 22:15:39 +09:00
Jean Boussier
e257c08f2e
[ruby/stringio] StringIO#initialize default to the source string encoding
[Bug #16497]

https://github.com/ruby/stringio/commit/4958a5ccab
2020-03-15 18:43:01 +09:00
Yusuke Endoh
c6633f21a4 Update some syslog tests to absurb the format change of FreeBSD syslog
FreeBSD

```
$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
rubyspec 78462 - - Hello
```

Linux

```
$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
rubyspec: Hello
```

591ef7c807
2020-03-12 15:30:20 +09:00
Nobuyoshi Nakada
2fd779fcd9
Added version guard for OpenSSL::Config 2020-03-10 21:47:18 +09:00
Jeremy Evans
e02bd0e713
Don't display singleton class in Method#inspect unless method defined there
Previously, if an object has a singleton class, and you call
Object#method on the object, the resulting string would include
the object's singleton class, even though the method was not
defined in the singleton class.

Change this so the we only show the singleton class if the method
is defined in the singleton class.

Fixes [Bug #15608]
2020-03-09 07:57:16 -07:00
Jeremy Evans
f4394bbca3 Do not autosplat when calling procs that accept rest and keywords
When providing a single array to a block that takes a splat, pass the
array as one argument of the splat instead of as the splat itself,
even if the block also accepts keyword arguments.  Previously, this
behavior was only used for blocks that did not accept keywords.

Implements [Feature#16166]
2020-03-08 20:49:09 -07:00
Nobuyoshi Nakada
108f7536b3
Removed unnecessary chomp
As `String#split` with the default argument drops trailing newline
as a separator, preceding `String#chomp` is futile.
2020-03-07 17:04:37 +09:00
Kazuhiro NISHIYAMA
fcd605020b
Fix a typo 2020-03-07 13:49:28 +09:00
Yusuke Endoh
17d5efa4fe spec/ruby/core/process/exec_spec.rb: remove a guard for openbsd
openbsd current seems to behave the same as other OSs.

https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20200305T063005Z.fail.html.gz
2020-03-05 18:25:47 +09:00