dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.28k stars 9.96k forks source link

kvm.sh does not run on Fish shell / OSX #130

Closed kensykora closed 9 years ago

kensykora commented 10 years ago

I use the Fish Shell as my primary shell on OSX. I ran through the steps detailed out in the readme for OSX, however I ran into a snag when I tried to source kvm.sh

kensykora@dhcp-09-101 /u/l/C/k/1/bin> pwd
/usr/local/Cellar/kvm/1.0.0-alpha3-2/bin
kensykora@dhcp-09-101 /u/l/C/k/1/bin> ./kvm.sh
Failed to execute process './kvm.sh'. Reason:
exec: Exec format error
The file './kvm.sh' is marked as an executable but could not be run by the operating system.

However when i switch over to bash, the script seems to run fine:

kensykora@dhcp-09-101 /u/l/C/k/1/bin> bash
bash-3.2$ kvm
bash: kvm: command not found
bash-3.2$ kvm.sh
bash-3.2$ source kvm.sh
bash-3.2$ kvm

K Runtime Environment Version Manager - Build {{BUILD_NUMBER}}

USAGE: kvm <command> [options]

kvm upgrade
install latest KRE from feed
add KRE bin to path of current command line
set installed version as default

kvm install <semver>|<alias>|<nupkg>|latest [-a|-alias <alias>] [-p -persistent]
<semver>|<alias>  install requested KRE from feed
<nupkg>           install requested KRE from local package on filesystem
latest            install latest version of KRE from feed
-a|-alias <alias> set alias <alias> for requested KRE on install
-p -persistent    set installed version as default
add KRE bin to path of current command line

kvm use <semver>|<alias>|none [-p -persistent]
<semver>|<alias>  add KRE bin to path of current command line   
none              remove KRE bin from path of current command line
-p -persistent    set selected version as default

kvm list
list KRE versions installed 

kvm alias
list KRE aliases which have been defined

kvm alias <alias>
display value of the specified alias

kvm alias <alias> <semver>
<alias>            The name of the alias to set
<semver>|<alias>   The KRE version to set the alias to. Alternatively use the version of the specified alias

kvm unalias <alias>
remove the specified alias

bash-3.2$ 

Any chance this script can be adjusted to support the Fish shell?

kensykora commented 10 years ago

Here is the output of running source kvm.sh from the Fish shell:

https://gist.github.com/kensykora/d9138a09d0fe7127591d

megamaddu commented 9 years ago

Not sure if this is related -- when I run in zsh 5.0.6 (x86_64-apple-darwin14.0.0) it crashes the process. If I put it in my .zshrc no terminal windows will open. If I run it in an existing terminal it crashes, and if I run it in a nested zsh process the inner one crashes with [1] 4167 segmentation fault zsh.

~ » mono --version
Mono JIT compiler version 3.8.0 (tarball Wed Oct 15 17:00:48 MDT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen
robertmircea commented 9 years ago

Just adding a new report of the the same crash behaviour in zsh for me as well. ITerm2 shell window on a Mac is finishing with crash when running source kvm.sh. When ran in bash, everything is ok.

megamaddu commented 9 years ago

This was fixed by https://github.com/aspnet/Home/commit/7d874e39a49d9aabc0832e872bc8be7e13e5681b, but isn't in a full release yet. You can download the fixed version from master and replace your local kvm.source with it: https://github.com/aspnet/Home/blob/master/kvm.sh

robertmircea commented 9 years ago

I confirm that for me the fix works. Thanks for followup.

ammachado commented 9 years ago

Had the same problem here, fixed using @spicydonuts instructions.

alexsukhodolsky commented 9 years ago

Confirming that the solution from @spicydonuts indeed fixed this issue in zsh.

megamaddu commented 9 years ago

Don't thank me, thank @philippkosel : ]

mandreko commented 9 years ago

The instructions @spicydonuts included do not work for me running zsh on osx yosemite. My terminal just closes.

megamaddu commented 9 years ago

Which version of zsh? (zsh --version)

What's brew info kvm return?

mandreko commented 9 years ago
➜  ~  zsh --version
zsh 5.0.5 (x86_64-apple-darwin14.0)
➜  ~  brew info kvm
kvm: stable 1.0.0-beta1
https://www.github.com/aspnet/Home
/usr/local/Cellar/kvm/1.0.0-beta1 (4 files, 44K) *
  Built from source
From: https://github.com/aspnet/homebrew-k/blob/master/kvm.rb
==> Dependencies
Recommended: mono ✔
==> Options
--without-mono
    Build without mono support
==> Caveats
Add the following to the ~/.bash_profile, ~/.bashrc or ~/.zshrc file:

  source kvm.sh

Additionally, the version of kvm.sh located at https://github.com/aspnet/Home/blob/master/kvm.sh is the exact same as the one installed to my /usr/local/Cellar/kvm/1.0.0-beta1/libexec/kvm.sh

If I use bash, it works as expected.

megamaddu commented 9 years ago

Looks like beta1 was released yesterday which includes the fix. I was on alpha4 when I patched it. Updated to beta1 and it still works fine. zsh version 5.0.7 for me. Try updating that just to make sure.

mandreko commented 9 years ago

I just upgraded zsh using brew to 5.0.7, added it to my system shells file, and set it as my shell.

Unfortunately with zsh 5.0.7, I still get the same experience as before. The terminal closes when i do source kvm.sh

➜  ~  zsh --version
zsh 5.0.7 (x86_64-apple-darwin14.0.0)
➜  ~  brew info kvm
kvm: stable 1.0.0-beta1
https://www.github.com/aspnet/Home
/usr/local/Cellar/kvm/1.0.0-beta1 (4 files, 44K) *
  Built from source
From: https://github.com/aspnet/homebrew-k/blob/master/kvm.rb
==> Dependencies
Recommended: mono ✔
==> Options
--without-mono
    Build without mono support
==> Caveats
Add the following to the ~/.bash_profile, ~/.bashrc or ~/.zshrc file:

  source kvm.sh

➜  ~  source kvm.sh

[Process completed]
megamaddu commented 9 years ago

Curious. You'll probably need someone from here who knows more cause this sounds like a different issue. What do you get when you open a terminal, run zsh again, then source kvm.sh? That should at least show you what error zsh exits with.

nizmow commented 9 years ago

I'm getting this as well. zsh exists with signal 11 (segfault), I ran lldb over it but it wasn't very informative.

Same as above, 5.0.7 and KVM beta 1.

krishnabhargav commented 9 years ago

I took the kvm.sh from this https://github.com/zenlambda/ASP.NET.Home/blob/3aedca49dfbd04ac7e367e910d6ca7f1d6013ebc/kvm.sh and that fixed the problem for me.

ejdraper commented 9 years ago

Yep, I can confirm that copying https://github.com/zenlambda/ASP.NET.Home/blob/3aedca49dfbd04ac7e367e910d6ca7f1d6013ebc/kvm.sh over the top worked for me on zsh too. The only difference between that and the latest Homebrew release appears to relate to this commit https://github.com/aspnet/Home/commit/7d874e39a49d9aabc0832e872bc8be7e13e5681b.