8000 Merge branch 'master' into update-call-data · github/ruby@42930fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 42930fc

Browse files
committed
Merge branch 'master' into update-call-data
* master: (47 commits) test/ruby/test_keywords.rb: suppress a warning test/net/http/test_https.rb (test_get_SNI_failure): stop proxy settings Support completion with case-insensitive fashion * 2019-12-10 [ci skip] Add Proc#ruby2_keywords fix typo of 54072e3 Add ipaddr optional parameter to Net::HTTP#start Added workaround for CoreAssertions used by ruby/logger. Merge the upstream changes for test-unit on ruby/logger. [ruby/logger] 1.4.1 [ruby/logger] Fixes #38 [ruby/logger] 1.4.0 [ruby/logger] Avoid creating [] and "" when logging an Exception that has no backtrace [ruby/logger] frozen_string_literal: true [ruby/logger] Fix typo Add badge of Cygwin Add cache of cygwin packages Remove unused branch name Split cygwin-chocolatey cache Remove debug print ...
2 parents 470be8d + c50d9dc commit 42930fc

38 files changed

+482
-74
lines changed

.github/workflows/cygwin.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Cygwin
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- '*'
9+
jobs:
10+
make:
11+
strategy:
12+
matrix:
13+
test_task: [test]
14+
os: [windows-2019]
15+
vs: [2019]
16+
fail-fast: false
17+
runs-on: ${{ matrix.os }}
18+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
19+
steps:
20+
- uses: actions/cache@v1
21+
with:
22+
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
23+
key: ${{ runner.os }}-cygwin-chocolatey-${{ matrix.os }}-${{ github.sha }}
24+
restore-keys: |
25+
${{ runner.os }}-cygwin-chocolatey-${{ matrix.os }}-
26+
${{ runner.os }}-cygwin-chocolatey-
27+
- name: Install cygwin base packages with chocolatey
28+
run: |
29+
choco install --no-progress cygwin
30+
- uses: actions/cache@v1
31+
with:
32+
path: C:\tools\cygwin\package
33+
key: ${{ runner.os }}-cygwin-package-${{ matrix.os }}-${{ github.sha }}
34+
restore-keys: |
35+
${{ runner.os }}-cygwin-package-${{ matrix.os }}-
36+
${{ runner.os }}-cygwin-package-
37+
- name: Install cygwin additional packages
38+
run: |
39+
C:\tools\cygwin\cygwinsetup.exe -qgnNdO -R C:/tools/cygwin -l C:/tools/cygwin/package -s http://mirrors.kernel.org/sourceware/cygwin/ -P autoconf,bison,gcc-core,git,libcrypt-devel,libedit-devel,libffi-devel,libgdbm-devel,libgmp-devel,libintl-devel,libncurses-devel,libreadline-devel,libssl-devel,libuuid-devel,make,patch,ruby,tcl-tk-devel,zlib-devel
40+
shell: cmd
41+
- name: Set ENV
42+
run: |
43+
echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
44+
# Not using official actions/checkout because it's unstable and sometimes doesn't work for a fork.
45+
- name: Checkout ruby/ruby
46+
run: |
47+
git clone --single-branch --shallow-since=yesterday https://github.com/ruby/ruby src
48+
git -C src reset --hard ${{ github.sha }}
49+
if: github.event_name == 'push'
50+
shell: cmd
51+
- name: Checkout a pull request
52+
run: |
53+
git clone --single-branch --shallow-since=yesterday --branch=${{ github.event.pull_request.head.ref }} https://github.com/${{ github.event.pull_request.head.repo.full_name }} src
54+
git -C src reset --hard ${{ github.event.pull_request.head.sha }}
55+
if: github.event_name == 'pull_request'
56+
shell: cmd
57+
- name: Actions-commit-info.sh
58+
run: |
59+
bash.exe -c "./src/tool/actions-commit-info.sh"
60+
shell: cmd
61+
- name: Autoconf
62+
run: |
63+
cd src
64+
bash.exe -c autoconf
65+
shell: cmd
66+
- name: Configure
67+
run: |
68+
md build
69+
cd build
70+
bash -c ../src/configure
71+
shell: cmd
72+
- name: make
73+
run: |
74+
make -C build
75+
shell: cmd
76+
- name: make btest
77+
run: |
78+
make -C build btest
79+
shell: cmd

.github/workflows/windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
${{ runner.os }}-chocolatey-
3737
- name: Install libraries with chocolatey
3838
run: |
39-
choco config get cacheLocation
4039
choco install --no-progress openssl winflexbison3
4140
# Not using official actions/checkout because it's unstable and sometimes doesn't work for a fork.
4241
- name: Checkout ruby/ruby

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ env:
128128
arch: arm64
129129
<<: *gcc-8
130130

131+
- &s390x-linux
132+
name: s390x-linux
133+
arch: s390x
134+
<<: *gcc-8
135+
131136
- &jemalloc
132137
name: --with-jemalloc
133138
<<: *gcc-8
@@ -413,6 +418,7 @@ matrix:
413418
- <<: *arm64-linux
414419
- <<: *i686-linux
415420
- <<: *arm32-linux
421+
- <<: *s390x-linux
416422
- <<: *pedanticism
417423
- <<: *assertions
418424
- <<: *baseruby

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,11 @@ Net::FTP::
508508
* Add Net::FTP#features to check available features, and Net::FTP#option to
509509
enable/disable each of them. [Feature #15964]
510510

511+
Net::HTTP::
512+
513+
* Add ipaddr optional parameter to Net::HTTP#start to replace the address for
514+
TCP/IP connection [Feature #5180]
515+
511516
Net::IMAP::
512517

513518
* Add Server Name Indication (SNI) support. [Feature #15594]

README.ja.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Build Status](https://travis-ci.org/ruby/ruby.svg?branch=master)](https://travis-ci.org/ruby/ruby)
22
[![Build status](https://ci.appveyor.com/api/projects/status/0sy8rrxut4o0k960/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/ruby/branch/master)
3+
![](https://github.com/ruby/ruby/workflows/Cygwin/badge.svg)
34
![](https://github.com/ruby/ruby/workflows/macOS/badge.svg)
45
![](https://github.com/ruby/ruby/workflows/MJIT/badge.svg)
56
![](https://github.com/ruby/ruby/workflows/Ubuntu/badge.svg)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Build Status](https://travis-ci.org/ruby/ruby.svg?branch=master)](https://travis-ci.org/ruby/ruby)
22
[![Build status](https://ci.appveyor.com/api/projects/status/0sy8rrxut4o0k960/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/ruby/branch/master)
3+
![](https://github.com/ruby/ruby/workflows/Cygwin/badge.svg)
34
![](https://github.com/ruby/ruby/workflows/macOS/badge.svg)
45
![](https://github.com/ruby/ruby/workflows/MJIT/badge.svg)
56
![](https://github.com/ruby/ruby/workflows/Ubuntu/badge.svg)

compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10494,7 +10494,7 @@ ibf_load_location_str(const struct ibf_load *load, VALUE str_index)
1049410494
static void
1049510495
ibf_load_iseq_each(struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t offset)
1049610496
{
10497-
struct rb_iseq_constant_body *load_body = iseq->body = ZALLOC(struct rb_iseq_constant_body);
10497+
struct rb_iseq_constant_body *load_body = iseq->body = rb_iseq_constant_body_alloc();
1049810498

1049910499
ibf_offset_t reading_pos = offset;
1050010500

iseq.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,22 @@ rb_iseq_memsize(const rb_iseq_t *iseq)
431431
return size;
432432
}
433433

434+
static unsigned long fresh_iseq_unique_id = 0; /* -- Remove In 3.0 -- */
435+
436+
struct rb_iseq_constant_body *
437+
rb_iseq_constant_body_alloc(void)
438+
{
439+
struct rb_iseq_constant_body *iseq_body;
440+
iseq_body = ZALLOC(struct rb_iseq_constant_body);
441+
iseq_body->iseq_unique_id = fresh_iseq_unique_id++; /* -- Remove In 3.0 -- */
442+
return iseq_body;
443+
}
444+
434445
static rb_iseq_t *
435446
iseq_alloc(void)
436447
{
437448
rb_iseq_t *iseq = iseq_imemo_alloc();
438-
iseq->body = ZALLOC(struct rb_iseq_constant_body);
449+
iseq->body = rb_iseq_constant_body_alloc();
439450
return iseq;
440451
}
441452

iseq.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events);
186186
void rb_iseq_trace_set_all(rb_event_flag_t turnon_events);
187187
void rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq);
188188

189+
struct rb_iseq_constant_body *rb_iseq_constant_body_alloc(void);
189190
VALUE rb_iseqw_new(const rb_iseq_t *iseq);
190191
const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw);
191192

lib/irb/irb.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Gem::Specification.new do |spec|
7575
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
7676
spec.require_paths = ["lib"]
7777

78-
spec.required_ruby_version = Gem::Requirement.new(">= 2.4")
78+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5")
7979

8080
spec.add_dependency "reline", ">= 0.0.1"
8181
spec.add_development_dependency "bundler"

lib/irb/version.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212

1313
module IRB # :nodoc:
14-
VERSION = "1.1.0"
14+
VERSION = "1.2.0"
1515
@RELEASE_VERSION = VERSION
16-
@LAST_UPDATE_DATE = "2019-11-21"
16+
@LAST_UPDATE_DATE = "2019-12-07"
1717
end

lib/logger.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class Logger
237237
name = File.basename(__FILE__)
238238
end
239239
rev ||= "v#{VERSION}"
240-
ProgName = "#{name}/#{rev}".freeze
240+
ProgName = "#{name}/#{rev}"
241241

242242
include Severity
243243

@@ -366,7 +366,7 @@ def fatal!; self.level = FATAL; end
366366
# +datetime_format+::
367367
# Date and time format. Default value is '%Y-%m-%d %H:%M:%S'.
368368
# +binmode+::
369-
# Use binany mode on the log device. Defaul value is false.
369+
# Use binary mode on the log device. Default value is false.
370370
# +shift_period_suffix+::
371371
# The log file suffix format for +daily+, +weekly+ or +monthly+ rotation.
372372
# Default is '%Y%m%d'.
@@ -574,7 +574,7 @@ def close
574574
private
575575

576576
# Severity label for logging (max 5 chars).
577-
SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY).each(&:freeze).freeze
577+
SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY).freeze
578578

579579
def format_severity(severity)
580580
SEV_LABEL[severity] || 'ANY'

lib/logger/errors.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# not used after 1.2.7. just for compat.
24
class Logger
35
class Error < RuntimeError # :nodoc:

lib/logger/formatter.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
# frozen_string_literal: true
2+
13
class Logger
24
# Default formatter for log messages.
35
class Formatter
4-
Format = "%s, [%s#%d] %5s -- %s: %s\n".freeze
6+
Format = "%s, [%s#%d] %5s -- %s: %s\n"
57

68
attr_accessor :datetime_format
79

@@ -17,16 +19,15 @@ def call(severity, time, progname, msg)
1719
private
1820

1921
def format_datetime(time)
20-
time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ".freeze)
22+
time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ")
2123
end
2224

2325
def msg2str(msg)
2426
case msg
2527
when ::String
2628
msg
2729
when ::Exception
28-
"#{ msg.message } (#{ msg.class })\n" <<
29-
(msg.backtrace || []).join("\n")
30+
"#{ msg.message } (#{ msg.class })\n#{ msg.backtrace.join("\n") if msg.backtrace }"
3031
else
3132
msg.inspect
3233
end

lib/logger/log_device.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require_relative 'period'
24

35
class Logger

lib/logger/logger.gemspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ end
77
Gem::Specification.new do |spec|
88
spec.name = "logger"
99
spec.version = Logger::VERSION
10-
spec.authors = ["SHIBATA Hiroshi"]
11-
spec.email = ["hsbt@ruby-lang.org"]
10+
spec.authors = ["Naotoshi Seo", "SHIBATA Hiroshi"]
11+
spec.email = ["sonots@gmail.com", "hsbt@ruby-lang.org"]
1212

1313
spec.summary = %q{Provides a simple logging utility for outputting messages.}
1414
spec.description = %q{Provides a simple logging utility for outputting messages.}
1515
spec.homepage = "https://github.com/ruby/logger"
1616
spec.license = "BSD-2-Clause"
1717

18-
spec.files = ["Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/logger.rb", "logger.gemspec"]
18+
spec.files = Dir.glob("lib/**/*.rb") + ["logger.gemspec"]
1919
spec.bindir = "exe"
2020
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2121
spec.require_paths = ["lib"]
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
2424

2525
spec.add_development_dependency "bundler", ">= 0"
2626
spec.add_development_dependency "rake", "~> 10.0"
27-
spec.add_development_dependency "minitest", "~> 5.0"
27+
spec.add_development_dependency "test-unit"
28+
spec.add_development_dependency "rdoc"
2829
end

lib/logger/period.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class Logger
24
module Period
35
module_function

lib/logger/severity.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class Logger
24
# Logging severity.
35
module Severity

lib/logger/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
class Logger
4-
VERSION = "1.3.0"
4+
VERSION = "1.4.1"
55
end

lib/net/http.rb

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def HTTP.socket_type #:nodoc: obsolete
571571
# _opt_ :: optional hash
572572
#
573573
# _opt_ sets following values by its accessor.
574-
# The keys are ca_file, ca_path, cert, cert_store, ciphers,
574+
# The keys are ipaddr, ca_file, ca_path, cert, cert_store, ciphers,
575575
# close_on_empty_response, key, open_timeout, read_timeout, write_timeout, ssl_timeout,
576576
# ssl_version, use_ssl, verify_callback, verify_depth and verify_mode.
577577
# If you set :use_ssl as true, you can use https and default value of
@@ -590,6 +590,7 @@ def HTTP.start(address, *arg, &block) # :yield: +http+
590590
p_addr = :ENV if arg.size < 2
591591
port = https_default_port if !port && opt && opt[:use_ssl]
592592
http = new(address, port, p_addr, p_port, p_user, p_pass)
593+
http.ipaddr = opt[:ipaddr] if opt && opt[:ipaddr]
593594

594595
if opt
595596
if opt[:use_ssl]
@@ -660,6 +661,7 @@ def HTTP.new(address, port = nil, p_addr = :ENV, p_port = nil, p_user = nil, p_p
660661
def initialize(address, port = nil)
661662
@address = address
662663
@port = (port || HTTP.default_port)
664+
@ipaddr = nil
663665
@local_host = nil
664666
@local_port = nil
665667
@curr_http_version = HTTPVersion
@@ -727,6 +729,17 @@ def set_debug_output(output)
727729
attr_writer :proxy_user
728730
attr_writer :proxy_pass
729731

732+
# The IP address to connect to/used to connect to
733+
def ipaddr
734+
started? ? @socket.io.peeraddr[3] : @ipaddr
735+
end
736+
737+
# Set the IP address to connect to
738+
def ipaddr=(addr)
739+
raise IOError, "ipaddr value changed, but session already started" if started?
740+
@ipaddr = addr
741+
end
742+
730743
# Number of seconds to wait for the connection to open. Any number
731744
# may be used, including Floats for fractional seconds. If the HTTP
732745
# object cannot open a connection in this many seconds, it raises a
@@ -934,20 +947,20 @@ def do_start
934947

935948
def connect
936949
if proxy? then
937-
conn_address = proxy_address
950+
conn_addr = proxy_address
938951
conn_port = proxy_port
939952
else
940-
conn_address = address
953+
conn_addr = conn_address
941954
conn_port = port
942955
end
943956

944-
D "opening connection to #{conn_address}:#{conn_port}..."
957+
D "opening connection to #{conn_addr}:#{conn_port}..."
945958
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
946959
begin
947-
TCPSocket.open(conn_address, conn_port, @local_host, @local_port)
960+
TCPSocket.open(conn_addr, conn_port, @local_host, @local_port)
948961
rescue => e
949962
raise e, "Failed to open TCP connection to " +
950-
"#{conn_address}:#{conn_port} (#{e.message})"
963+
"#{conn_addr}:#{conn_port} (#{e.message})"
951964
end
952965
}
953966
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
@@ -984,7 +997,7 @@ def connect
984997
OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT |
985998
OpenSSL::SSL::SSLContext::SESSION_CACHE_NO_INTERNAL_STORE
986999
@ssl_context.session_new_cb = proc {|sock, sess| @ssl_session = sess }
987-
D "starting SSL for #{conn_address}:#{conn_port}..."
1000+
D "starting SSL for #{conn_addr}:#{conn_port}..."
9881001
s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)
9891002
s.sync_close = true
9901003
# Server Name Indication (SNI) RFC 3546
@@ -1161,7 +1174,7 @@ def proxy_pass
11611174
# without proxy, obsolete
11621175

11631176
def conn_address # :nodoc:
1164-
address()
1177+
@ipaddr || address()
11651178
end
11661179

11671180
def conn_port # :nodoc:

0 commit comments

Comments
 (0)
0