File tree Expand file tree Collapse file tree 4 files changed +8
-2
lines changed
src/main/ruby/truffleruby/core/truffle Expand file tree Collapse file tree 4 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Bug fixes:
9
9
* Fix error message when the method name is not a Symbol or String for ` Kernel#respond_to? ` (#2132 , @ssnickolay )
10
10
* Fixed setting of special variables in enumerators and enumerables (#1484 ).
11
11
* Fixed return value of ` Enumerable#count ` and ` Enumerable#uniq ` with multiple yielded arguments (#2145 , @LillianZ ).
12
+ * Fixed issue with `` Kernel#` `` when invalid UTF-8 given (#2118 ).
12
13
13
14
Compatibility:
14
15
Original file line number Diff line number Diff line change 35
35
-> { `nonexistent_command` } . should raise_error ( Errno ::ENOENT )
36
36
end
37
37
38
+ it "handles invalid UTF-8 bytes in command" do
39
+ `echo "testing\xC2 a non UTF-8 string"` . should == "testing\xC2 a non UTF-8 string\n "
40
+ end
41
+
38
42
platform_is_not :windows do
39
43
it "sets $? to the exit status of the executed sub-process" do
40
44
ip = 'world'
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ slow:Kernel#` produces a String in the default external encoding
4
4
slow:Kernel#` raises an Errno::ENOENT if the command is not executable
5
5
slow:Kernel#` sets $? to the exit status of the executed sub-process
6
6
slow:Kernel.` tries to convert the given argument to String using #to_str
7
+ slow:Kernel#` handles invalid UTF-8 bytes in command
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ module ProcessOperations
89
89
]
90
90
# A simplified version of Regexp.new("[#{SHELL_META_CHARS.map { |c| Regexp.escape(c) }.join}]")
91
91
# to avoid running too much code during initialization
92
- SHELL_META_CHAR_PATTERN = /[*?{}\[ \] <>()~&|\\ $;'`"\n #=%]/
92
+ SHELL_META_CHAR_PATTERN = /[*?{}\[ \] <>()~&|\\ $;'`"\n #=%]/n
93
93
94
94
def self . exec ( *args )
95
95
exe = Execute . new
@@ -543,7 +543,7 @@ def exec
543
543
end
544
544
545
545
def should_use_shell? ( command )
546
- command . match? ( SHELL_META_CHAR_PATTERN )
546
+ command . b . match? ( SHELL_META_CHAR_PATTERN )
547
547
end
548
548
549
549
def should_search_path? ( command )
You can’t perform that action at this time.
0 commit comments