Skip to content

Commit c2ed36a

Browse files
eregonfniephaus
authored andcommitted
[GR-18163] Fix locale docs for Oracle Linux and fix test when run in Docker
PullRequest: truffleruby/4564
2 parents 47b0c3c + b0cae77 commit c2ed36a

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# https://github.com/google/jsonnet/releases and compiled.
1111

1212
# CONFIGURATION
13-
local overlay = "86462312c58551adf8993c7fbced4963751230d3";
13+
local overlay = "6f30aacf41a0c15262f890770972e3f74af187e7";
1414

1515
# For debugging: generated builds will be restricted to those listed in
1616
# the array. No restriction is applied when it is empty.

doc/user/utf8-locale.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Instead, all values should be `"en_US.UTF-8"` or other regions but still `.UTF-8
2121
### Fedora-based: RHEL, Oracle Linux, etc
2222

2323
```bash
24+
sudo dnf install glibc-langpack-en
2425
export LANG=en_US.UTF-8
2526
```
2627

spec/truffle/include_all_c_header_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
describe 'lib/cext/include/internal_all.h' do
1212
it 'includes each *.h file from lib/cext/include/internal/' do
13-
filenames = Dir.glob('internal/**/*.h', base: 'lib/cext/include', sort: true)
14-
content = File.read('lib/cext/include/internal_all.h')
13+
ruby_home = RbConfig::CONFIG['prefix']
14+
filenames = Dir.glob('internal/**/*.h', base: "#{ruby_home}/lib/cext/include", sort: true)
15+
content = File.read("#{ruby_home}/lib/cext/include/internal_all.h")
1516

1617
filenames.should_not be_empty
1718

@@ -20,8 +21,9 @@
2021
end
2122

2223
it 'includes each *.h file from lib/cext/include/stubs/internal/' do
23-
filenames = Dir.glob('internal/**/*.h', base: 'lib/cext/include/stubs', sort: true)
24-
content = File.read('lib/cext/include/internal_all.h')
24+
ruby_home = RbConfig::CONFIG['prefix']
25+
filenames = Dir.glob('internal/**/*.h', base: "#{ruby_home}/lib/cext/include/stubs", sort: true)
26+
content = File.read("#{ruby_home}/lib/cext/include/internal_all.h")
2527

2628
filenames.should_not be_empty
2729

src/main/ruby/truffleruby/core/dir.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def glob(pattern, flags = 0, base: nil, sort: true, &block)
303303

304304
total = matches.size
305305
while index < total
306-
matches[index] = matches[index].encode(enc) unless matches[index].encoding == enc
306+
matches[index] = matches[index].force_encoding(enc) unless matches[index].encoding == enc
307307
index += 1
308308
end
309309
end

src/main/ruby/truffleruby/core/env.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,11 @@ def set_encoding(value)
366366
if Encoding.default_internal && value.ascii_only?
367367
value = value.encode Encoding.default_internal, Encoding::LOCALE
368368
elsif value.encoding != Encoding::LOCALE
369-
value = value.dup.force_encoding(Encoding::LOCALE)
369+
if Encoding::LOCALE == Encoding::US_ASCII && !value.ascii_only?
370+
value = value.b
371+
else
372+
value = value.dup.force_encoding(Encoding::LOCALE)
373+
end
370374
end
371375
value.freeze
372376
end

0 commit comments

Comments
 (0)