Issue #15621 has been reported by kenhys (Kentaro Hayashi). ---------------------------------------- Bug #15621: system({}, ...) breaks nonascii ENV["PATH"] on Windows https://bugs.ruby-lang.org/issues/15621 * Author: kenhys (Kentaro Hayashi) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x64-mingw32] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ### Problem It seems that `system({}, ...)` breaks nonascii `ENV["PATH"]` after execution. `system(...)` isn't affected. Only `system(env, ...)` is affected. OS: Windows 7 Ruby: https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.1-1/rubyinstaller-2.6.1-1-x64.exe chcp: 現在のコード ページ: 932 ### Expected `system({}, ...)` doesn't break nonascii `ENV["PATH"]` environment variable after execution. ### Actual Here is the sample code to reproduce this issue. ``` cat break-env-system.rb # coding: cp932 ENV["PATH"] = [ "インストール", ENV["PATH"], ].join(File::PATH_SEPARATOR) env = {} p ENV["PATH"] system(env, "echo") p ENV["PATH"] ``` It produces the following output: ``` "インストール;%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\CMake\\bin;C:\\GnuWin32\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\patch-2.5.9-7-bin\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Ruby26-x64\\bin" ECHO は <ON> です。 "?C???X?g?[??;%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\CMake\\bin;C:\\GnuWin32\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\patch-2.5.9-7-bin\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Ruby26-x64\\bin" ``` If `system("echo")` is used instead of `system({}, "echo")`, `ENV["PATH"]` is not broken. ---Files-------------------------------- break-env-system.rb (163 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>