ruby-changes:49263
From: sonots <ko1@a...>
Date: Thu, 21 Dec 2017 14:07:48 +0900 (JST)
Subject: [ruby-changes:49263] sonots:r61378 (trunk): * lib/logger.rb (Logger::LogDevice#open_logfile, #create_logfile):
sonots 2017-12-21 14:07:43 +0900 (Thu, 21 Dec 2017) New Revision: 61378 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61378 Log: * lib/logger.rb (Logger::LogDevice#open_logfile, #create_logfile): Logger should be able to open only files [Bug #14212] Modified files: trunk/NEWS trunk/lib/logger.rb Index: NEWS =================================================================== --- NEWS (revision 61377) +++ NEWS (revision 61378) @@ -416,6 +416,13 @@ with all sufficient information, see the https://github.com/ruby/ruby/blob/trunk/NEWS#L416 === Stdlib compatibility issues (excluding feature bug fixes) +* Logger + + * Logger.new("| command") had been working to open a command + unintentionally. It was prohibitted, and now Logger#initialize + treats a String argument only as a filename, as its specification. + [Bug #14212] + * Net::HTTP * Net::HTTP#start now passes :ENV to p_addr by default. [Bug #13351] Index: lib/logger.rb =================================================================== --- lib/logger.rb (revision 61377) +++ lib/logger.rb (revision 61378) @@ -743,7 +743,7 @@ private https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L743 def open_logfile(filename) begin - open(filename, (File::WRONLY | File::APPEND)) + File.open(filename, (File::WRONLY | File::APPEND)) rescue Errno::ENOENT create_logfile(filename) end @@ -751,7 +751,7 @@ private https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L751 def create_logfile(filename) begin - logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL)) + logdev = File.open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL)) logdev.flock(File::LOCK_EX) logdev.sync = true add_log_header(logdev) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/