prevent displaying 'which' error message #133

Merged
merged 1 commit into from Mar 2, 2013

Conversation

Projects
None yet
4 participants
Contributor

thomasbittermann commented Feb 14, 2013

redirect which stderr to /dev/null to prevent "/usr/bin/which: no gvm-init.sh in (...)"

Owner

marc0der commented Feb 16, 2013

Could you please tell me under what circumstances you are seeing this happening. This seem to be happening intermittently and I'd rather like to figure out what is actually going on before merging any requests to fix something that we don't really know.

Could you let me know what platform your're on, and exact steps to replicate this happening. Also what version your are on, using gvm version.

Contributor

thomasbittermann commented Feb 26, 2013

on Fedora 17/18 (x86_64) with bash 4.2.x and gvm version 0.9.5:

  1. open gnome-terminalgvm
  2. export JAVA_HOME=/etc/alternatives/java_sdk
  3. curl -s get.gvmtool.net | bash
  4. open new tab / terminal / shell
  5. see message: "/usr/bin/which: no gvm-init.sh in (...)"

Cheers,
Thomas

longwa commented Feb 27, 2013

This also happened for me on Cygwin using 0.9.5. Applying the patch fixed the problem and GVM seems to be working fine despite the message.

Owner

marc0der commented Feb 28, 2013

Do both of you still have the original broken snippet in your bash profile? It would help lots if you could provide that. This was a known issue that was fixed in 0.9.5, but because the snippet doesn't get upgraded along with gvm, you would still be seeing this side effect. It would also be great if the two of you could confirm that your initial installation was 0.9.4.

Simply swallowing the error message here is not good, because we should actually be addressing the cause, not the effect. The snippet ensures that gvm-init.sh only ever gets sourced once, preventing duplicate entries from appearing on the path. This was fixed in 0.9.5.

I just installed gvm 0.9.5 in cygwin (with no previous gvm installation) and the issue still exists directly after installation. The problem is that "which gvm-init.sh" doesn't find anything because $HOME/.gvm is not on the path until it's been sourced.

$ [[ -s "/home/Tom/.gvm/bin/gvm-init.sh" && -z $(which gvm-init.sh  | grep '/gvm-init.sh') ]]
which: no gvm-init.sh in (/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/SenchaSDKTools-2.0.0-beta3:/cygdrive/c/Perl64/site/bin:/cygdrive/c/Perl64/bin:/cygdrive/c/Oracle/product/11.2.0/client/bin:/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/SlikSvn/bin:/cygdrive/c/Program Files (x86)/Windows Live/Shared:/cygdrive/c/Program Files (x86)/Graphviz 2.28/bin:/cygdrive/c/Program Files/TortoiseSVN/bin:/cygdrive/c/grails/bin:/cygdrive/c/Program Files (x86)/SenchaSDKTools-2.0.0-beta3:/cygdrive/c/Perl64/site/bin:/cygdrive/c/Perl64/bin:/cygdrive/c/Oracle/product/11.2.0/client/bin:/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/SlikSvn/bin:/cygdrive/c/Program Files (x86)/Windows Live/Shared:/cygdrive/c/Program Files (x86)/Graphviz 2.28/bin:/cygdrive/c/Program Files/TortoiseSVN/bin:/cygdrive/c/Program Files/nant-0.91/bin:/cygdrive/c/Ruby193/bin)

As a solution, I don't see any issue with swallowing the stderr output as proposed.

marc0der added a commit that referenced this pull request Mar 2, 2013

Merge pull request #133 from thomasbittermann/master
prevent displaying 'which' error message

@marc0der marc0der merged commit 4fd6a84 into sdkman:master Mar 2, 2013

Owner

marc0der commented Mar 2, 2013

Okay, managed to replicate it on cygwin, and doesn't seem to break anything. Thanks for the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment