From 89eb562616a1c17dec22a29868a010e9021b67ea Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Tue, 30 Jul 2024 15:25:53 -0500 Subject: [PATCH] Clear LC_ALL for tr call This resolves additional issues when tr is called in a shell that has set LC_ALL to a specific encoding. In that case, the tr may fail to ignore binary files, expecting that they are in some encoding. See https://github.com/rbenv/ruby-build/issues/2279 --- bin/ruby-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ruby-build b/bin/ruby-build index abb22f12..df1b2312 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -876,7 +876,7 @@ install_jruby_launcher() { fix_jruby_shebangs() { for file in "${PREFIX_PATH}/bin"/*; do - if [ "$(head -c 20 "$file" | LC_CTYPE=C tr -d '\0')" = "#!/usr/bin/env jruby" ]; then + if [ "$(head -c 20 "$file" | LC_CTYPE=C LC_ALL='' tr -d '\0')" = "#!/usr/bin/env jruby" ]; then sed -i.bak "1 s:.*:#\!${PREFIX_PATH}\/bin\/jruby:" "$file" rm "$file".bak fi