mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 61639: [Backport #14323]
net/ftp: fix FrozenError in BufferedSocket I noticed this bug while working on something else with RUBYOPT=-d on, existing test cases all passed with it. Note: I use String.new because it is the local style, here, I prefer +'' (or ''.b, for a future commit) * lib/net/ftp.rb (BufferedSocket#read): use String.new * test/net/ftp/test_buffered_socket.rb (test_read_nil): new test [Bug #14323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f444a7ab98
commit
08987d3105
4 changed files with 22 additions and 2 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Sun Mar 28 14:40:25 2018 Eric Wong <normalperson@yhbt.net>
|
||||
|
||||
net/ftp: fix FrozenError in BufferedSocket
|
||||
|
||||
I noticed this bug while working on something else with
|
||||
RUBYOPT=-d on, existing test cases all passed with it.
|
||||
|
||||
Note: I use String.new because it is the local style, here,
|
||||
I prefer +'' (or ''.b, for a future commit)
|
||||
|
||||
* lib/net/ftp.rb (BufferedSocket#read): use String.new
|
||||
* test/net/ftp/test_buffered_socket.rb (test_read_nil): new test
|
||||
[Bug #14323]
|
||||
|
||||
Thu Mar 28 14:29:26 2018 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
clean autogenerated files
|
||||
|
|
|
@ -1297,7 +1297,7 @@ module Net
|
|||
s = super(len, String.new, true)
|
||||
return s.empty? ? nil : s
|
||||
else
|
||||
result = ""
|
||||
result = String.new
|
||||
while s = super(DEFAULT_BLOCKSIZE, String.new, true)
|
||||
break if s.empty?
|
||||
result << s
|
||||
|
|
|
@ -33,6 +33,12 @@ class BufferedSocketTest < Test::Unit::TestCase
|
|||
assert_equal("bar", sock.gets)
|
||||
end
|
||||
|
||||
def test_read_nil
|
||||
sock = create_buffered_socket("foo\nbar")
|
||||
assert_equal("foo\nbar", sock.read)
|
||||
assert_equal("", sock.read)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_buffered_socket(s)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.3.7"
|
||||
#define RUBY_RELEASE_DATE "2018-03-28"
|
||||
#define RUBY_PATCHLEVEL 439
|
||||
#define RUBY_PATCHLEVEL 440
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2018
|
||||
#define RUBY_RELEASE_MONTH 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue