All my rbenv calls comes back as bashr: No such file or directory
See below for more info.
krirou@iHAL ~> rbenv --version
env: bash\r: No such file or directory
krirou@iHAL ~> which rbenv
/Users/krirou/.rbenv/bin/rbenv
krirou@iHAL ~/.rbenv (master) [141]> fish --version
fish, version 2.1.0
krirou@iHAL ~ [127]> cat .config/fish/config.fish
set -x LC_CTYPE sv_SE.UTF-8
# https://github.com/sstephenson/rbenv/issues/459
set PATH $HOME/.rbenv/bin $PATH
status --is-interactive ; and source (rbenv init - | psub)
krirou@iHAL ~> cd .rbenv/
krirou@iHAL ~/.rbenv (master)> git status
# On branch master
nothing to commit, working directory clean
krirou@iHAL ~/.rbenv (master)> git log HEAD
commit 14bc162ca606e0c61da8d82e1b99b0946d7be13f
Merge: 6d0bf9b 1a6bada
Author: Mislav Marohni膰 <[email protected]>
Date: Thu Jan 2 22:44:19 2014 +0100
Merge branch 'openbsd'
Closes #524
You could try to spot the line which raises the error, f.e. opening ~/.rbenv/bin/rbenv and adding echo "[DEBUG] $(readlink -f $0):$LINENO" && exit a bit here a bit there :D in this way, when the error raises the next [DEBUG] line will not printed, helping you finding the faulty point
@kitofr Thanks, that's a great bug report.
The env: bash\r error message points to that there might be something wrong with line endings in the shebangs (the #!/usr/bin/env bash line of rbenv scripts). Line endings should be \n, but yours might be Windows-style \r\n for some reason. Can you tell us your:
git config core.eol
git config core.safecrlf
git config core.autocrlf
In the meantime, you can try fixing rbenv by stripping all the \r characters:
sed -i '' -E 's/^M//g' ~/.rbenv/libexec/*
(The ^M character is typed with Ctrl-V Ctrl-M)
The only one of the git config ones i've set is autocrlf (yes indeed i have parallells and need windows to do certain things).
krirou@iHAL ~> git config core.eol
krirou@iHAL ~ [1]> git config core.safecrlf
krirou@iHAL ~ [1]> git config core.autocrlf
true
krirou@iHAL ~> sed -i '' -E 's/^M//g' ~/.rbenv/libexec/*
krirou@iHAL ~> rbenv
env: bash\r: No such file or directory
Is your problem related to fish at all? What if you start bash and try to run rbenv:
$ bash
$ ~/.rbenv/bin/rbenv --version
Apparently not:
~ 位 ~/.rbenv/bin/rbenv --version
env: bash\r: No such file or directory
Sorry for chasing you down that rabbit hole. :/
I still don't know why this breaks though.
Googling for this error I noticed a lot of similar problems:
env: pythonr: No such file or directory
Error: "env: drushr No such file or directory" when trying to run an install script
They seem to be related to line endings actually
Something somewhere has DOS-style \r\n line endings instead of unix \n. That sed command you used should have fixed all executables within rbenv's libexec/ directory (which your git crlf setting might have broken), but it seems the problem wasn't in there.
You can detect \r with this script:
grep -E '^M' myfile
However, I'm out of ideas where you could be looking.
You could try this: grep -E '^M' bin/rbenv
There should be no output.
I tried it on:
krirou@iHAL ~> grep -E '^M' .rbenv/bin/rbenv
krirou@iHAL ~ [1]> grep -E '^M' .bashrc
krirou@iHAL ~ [1]> grep -E '^M' .gitconfig
krirou@iHAL ~ [1]> grep -E '^M' .git-prompt.sh
But as you said... it should be there somewhere. Now I know what to look for. I'll probably have to backtrack my PATH and see what might hit before that I might have altered.
@kitofr I just realized something. The ^M character is useless if you copy/paste it. So in my sed command that I pasted you, you should have input the character yourself with Ctrl-V Ctrl-M. Otherwise neither sed or the grep command will work as they're supposed to.
krirou@iHAL ~ [255]> git config --global core.autocrlf false
krirou@iHAL ~> git config core.autocrlf
false
krirou@iHAL ~> git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
Cloning into '/Users/krirou/.rbenv'...
remote: Reusing existing pack: 1857, done.
remote: Total 1857 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1857/1857), 290.90 KiB | 354.00 KiB/s, done.
Resolving deltas: 100% (1162/1162), done.
Checking connectivity... done
krirou@iHAL ~> rbenv
rbenv 0.4.0-89-g14bc162
Usage: rbenv <command> [<args>]
Some useful rbenv commands are:
commands List all available rbenv commands
local Set or show the local application-specific Ruby version
global Set or show the global Ruby version
shell Set or show the shell-specific Ruby version
install Install a Ruby version using the ruby-build plugin
uninstall Uninstall a specific Ruby version
rehash Rehash rbenv shims (run this after installing executables)
version Show the current Ruby version and its origin
versions List all Ruby versions available to rbenv
which Display the full path to an executable
whence List all Ruby versions that contain the given executable
See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme
Still think this is a bit odd though. I'm cloning on my mac; so line endings "should" be same right?
Interesting... Thanks!
@mdesantis Thanks, that was a much more solid suggestion to try :)
I'm happy I was helpful :-) @kitofr still no idea why it happens O.O
Me neither. Might be a good idea to add a .gitattributes file to the root and set up
* text eol=lf
or such.
https://help.github.com/articles/dealing-with-line-endings
That might prevent future problems.
Cheers and thx again for all the help!
Most helpful comment
Me neither. Might be a good idea to add a .gitattributes file to the root and set up
or such.
https://help.github.com/articles/dealing-with-line-endings
That might prevent future problems.
Cheers and thx again for all the help!