test-kitchen / busser

Kitchen Busser - Runs tests for projects in test-kitchen
Other
45 stars 17 forks source link

/usr/bin/env sh shouldn't assume bourne shell #3

Closed jtimberman closed 10 years ago

jtimberman commented 10 years ago

While /usr/bin/env sh may resolve to Bourne shell or a Bourne-like shell on many platforms, it doesn't on Solaris/illumos systems, such as OmniOS.

$ ls -l /usr/bin/sh
lrwxrwxrwx   1 root     root           9 May 16  2013 /usr/bin/sh -> i86/ksh93

This causes the following error:

-----> Setting up Busser
       Creating BUSSER_ROOT in /tmp/busser
       Creating busser binstub
       /tmp/busser/bin/busser: line 15: : cannot execute [Is a directory]
       Usage: dirname [-frx] string
       /tmp/busser/bin/busser[15]: /opt/chef/embedded/bin/ruby` && pwd: not found [No such file or directory]
       /tmp/busser/bin/busser[33]: exec: /ruby: not found
>>>>>> Setup failed on instance <client-omnios-r151006c>.
>>>>>> Please see .kitchen/logs/client-omnios-r151006c.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (127) for command: [sh -c 'BUSSER_ROOT="/tmp/busser" GEM_HOME="/tmp/busser/gems" GEM_PATH="/tmp/busser/gems" GEM_CACHE="/tmp/busser/gems/cache" ; export BUSSER_ROOT GEM_HOME GEM_PATH GEM_CACHE; if ! sudo -E /opt/chef/embedded/bin/gem list busser -i >/dev/null; then sudo -E /opt/chef/embedded/bin/gem install busser --no-rdoc --no-ri; fi; gem_bindir=`/opt/chef/embedded/bin/ruby -rrubygems -e "puts Gem.bindir"`; sudo -E ${gem_bindir}/busser setup; sudo -E /tmp/busser/bin/busser plugin install busser-bats']
>>>>>> ----------------------
jtimberman commented 10 years ago

Removing the surrounding quotes from the embedded backticks:

DIR="`cd -P "\`dirname "$SOURCE"\`" && pwd`"

Seems to work with ksh, dash, bash, and zsh.

DIR=`cd -P \`dirname $SOURCE\` && pwd`

The problem which I think the quotes were there to solve is when the resolved path contains special characters like spaces. None of the default methods for installing Chef's Ruby (at least) will end up with a space in the name.

fnichol commented 10 years ago

@jtimberman I'll see about a release of busser tonight

fnichol commented 10 years ago

Released in 0.6.1, engage the non-Linux support!

jtimberman commented 10 years ago

:heart: