-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Exec format error" #229
Comments
@jjb Thanks for reporting this problem, sorry for not responding sooner. Can you post the contents of From the path to your home directory, it looks like you're on OS X, so a possible work around would be to install Ruby from homebrew, which will give you a non-rbenv Ruby with GNU Readline. |
#!/Users/john/.rbenv/shims/ruby --disable-gems
$LOAD_PATH.unshift('/usr/local/share/gitsh/ruby')
require '/usr/local/share/gitsh/gems/setup.rb'
require 'gitsh/cli'
begin
Gitsh::CLI.new.run
rescue => e
$stderr.puts "gitsh: Error: #{e.message}"
end |
@jjb Thanks. That looks correct, and after doing more research into the error message you're seeing, it's probably an issue with the C wrapper around gitsh being compiled for the wrong architecture. If can run Do you have |
➔ env | grep FLAGS
XPC_FLAGS=0x0
➔ |
i don't have time right now to rebuild and test the ruby script directly, sorry |
No problem. Sorry I haven't been able to investigate this sooner. |
I found the cause of the problem. If I change the top line of /usr/local/share/gitsh/ruby/gitsh.rb, it works. # does not work
#!/Users/john/.rbenv/shims/ruby --disable-gems
# this works
#!/usr/bin/env ruby --disable-gems This is the same for both bash and zsh. (or maybe it's sh running it anyway in both cases? i can't remember.). I don't know why it has a problem with the original line. env is picking the same ruby executable as what was previously hardcoded: ➔ /usr/bin/env which ruby
/Users/john/.rbenv/shims/ruby I thought maybe periods aren't allowed in shebang lines, so I tried: ln -s /Users/john/.rbenv/shims/ruby /tmp/ruby-link and #!/tmp/ruby-link --disable-gems And I got the same error message. |
still seeing this in 0.10 under macOS 10.11.5, rbenv 1.0.0-21-g9fdce5d, ruby 2.3.1 |
I've finally managed to reproduce this (entirely by accident) and work out what's going on. I was wrong about the C wrapper causing problems, it's actually an incompatibility between the gitsh Ruby program and the way the rbenv shim works. On some operating systems, including macOS, it's not possible to use a program as a sh-bang line if it has a sh-bang line itself (see discussion on #7). Unfortunately, the Ruby binary rbenv provides is a shell script with a sh-bang line. The error message results from the C program reporting that it failed to execute the Ruby program, but the root cause is that the Ruby program's sh-bang line is invalid. I've confirmed this by writing a simple shell script that passes its arguments on to system Ruby, and that produces the exact same behaviour. You mentioned that your motivation for using an rbenv Ruby was to get a version of Ruby linked against GNU Readline instead of libedit. Since v0.11, gitsh has ignored Ruby's Readline integration and provides its own (and maybe, after the discussion we had on #281, that's working better!). Since this is a rbenv-specific issue, and we recommend using system Ruby, I'm going to close this. For anyone reading this in the future who really wants to use an rbenv Ruby with gitsh, you can probably work around it by running something like |
Sorry to bump a closed issue, but I am getting this issue now when I try to install gitsh using asdf with
If I make updates, as suggested in this gist, to update the
I've tried with Ruby 2.7.7, 3.06, and 3.2.2 via asdf and they all get the same result. I am on arm64 arch with macos. The homebrew install is also failing with the error in #388. The system level ruby is:
When I try to configure with system Ruby, I get:
|
If I use my rbenv-provided ruby (with gnu readline)...
Here is the full build log
The text was updated successfully, but these errors were encountered: