Comments (7)
@mislav Thank you for the super quick fix!
I'd like to keep this open to track the 2 leftover items:
Also, more problematic is that even though it says BUILD FAILED the exit code seems 0 and so GitHub Actions continues (I checked and I don't have continue-on-error at all in that workflow).
I suppose this is due to the position of the tr
in if [ "$(head -c 20 "$file" | LC_CTYPE=C tr -d '\0')" = "#!/usr/bin/env jruby" ]; then
? Maybe we can somehow fail in that case if tr
fails?
Given we do see BUILD FAILED
I guess that error is somehow half-propagated, but not the exit status.
Or maybe the problem is in
Line 779 in c3bae8b
fix_jruby_shebangs || return 1
and the same for function calls above?
Finally I think there is no point to install ri/rdoc for jruby-launcher, so it would be best to
gem install --no-document jruby-launcher
.
from ruby-build.
I suspect that BUILD FAILED happened due to the bash ERR trap function propagating into sub-shells (that includes command-capturing expressions) and one of those subshells failing due to tr
exiting with nonzero. The code in question didn't have a guard against tr
failing because it was never meant to fail. The fact it did was a bug, which is now fixed, and so I do not think we need a || return 1
construct.
In the "main thread" of ruby-build execution, the ERR trap will mostly ensure that the ruby-build process exits with a nonzero status. However, if the BUILD FAILED accidentally happens in a non-fatal sub shell, ruby-build will exit with 0 status because it didn't technically fail. I think that your JRuby build succeeded even if it printed "BUILD FAILED". Of course, that is a bug which I now hope is fixed.
Bash error handling (either through the ERR trap or through set -e
) is arcane and difficult to get right. However, I do not think that the solution should be to append || return 1
to every line of code. Instead, command-capturing expressions that anticipate that the last command in a pipe could potentially exit with nonzero should append || true
to avoid having them inherit the ERR behavior.
from ruby-build.
OK, thanks for the explanation, let's close this then.
from ruby-build.
I still had this issue after this patch, it turns out that I set LC_ALL in my profile (I shouldn't have done that). LC_ALL overrides LC_CTYPE so tr was still assuming UTF-8 input.
I'm adding this comment just in case anyone else is confused about still seeing the issue, double check whether LC_ALL is set to something, and see if the issue still persists after unsetting LC_ALL (and stop setting LC_ALL In your profile if you did so)
from ruby-build.
@joerixaop Thanks for reporting. That's a new bug and you're welcome to report it as such! Even better, you could open a PR that blanks out LC_ALL when invoking tr
.
from ruby-build.
Looking at https://github.com/rbenv/ruby-build/pull/2280/files, why do we use tr
at all there?
There shouldn't be any \0
byte in a shebang line, isn't it? So why trying to remove them?
locale env vars are notorious for being brittle unfortunately (if we need to set anything we should set LC_ALL around the tr
).
from ruby-build.
There shouldn't be any
\0
byte in a shebang line, isn't it? So why trying to remove them?
We don't know for sure if an executable is a plain-text shim (or script) or an actually binary file. So this acts as a guard against binary files, because it appears that the [
builtin doesn't deal well when testing strings that have a null byte in them.
if we need to set anything we should set LC_ALL around the
tr
Agreed!
from ruby-build.
Related Issues (20)
- OpenSSL version check fails HOT 1
- `print_command()` prints odd output v20231107 HOT 4
- Old Ruby, mismatched OpenSSL HOT 4
- Build fails on Alpine as BusyBox wget does not support --show-progress HOT 3
- Using CRuby snapshot archives instead of building from git HOT 8
- Ruby compilation broken for Ruby < 2.5
- Add option to not link against Homebrew openssl HOT 5
- ruby-build -l yields different output from rbenv install --list HOT 5
- Can we skip installing readline when Ruby version is greater than 3.3.0? HOT 3
- Giving multiple optflags raises unrecognized option error. HOT 3
- Cannot install Ruby versions 2.6 using asdf
- can't install 3.2.3 ruby version from rbenv
- ruby-build: definition not found: 3.3.0.rc1 HOT 3
- Wiki open to edits HOT 2
- Ruby 2.2.10 install fails due to OpenSSL issue HOT 3
- RUBY_BUILD_MIRROR_URL ignored HOT 7
- Can't upgrade above 20211019 via brew on macos HOT 3
- 3.3.1 fails to build YJIT with Homebrew LLVM 18 HOT 7
- install command prompts in non-interactive shell HOT 1
- Failure to detect bz2 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-build.