fail if :chdir option is invalid

 - this fix also fixes a leak, in cases where :chdir and some additional,
   invalid option are both specified
fail if invalid fd is => :close
reset SIGPIPE handler to default in child

 - without this, OS X will hang on two of the tests
 - without this, Linux will print ugly 'write error' messages on one test
quell a compiler warning
prevent dup'd fds from being closed on exec
protected redirected fds from CLOEXEC in fspawn
remove bash-isms from /bin/sh tests

 - "not found" message is different under bash vs dash
 - "x>&y" redirects are limited to one digit.  It's actually not important
   that we find fds that aren't otherwise in use (I presume that's why all
   these were 100, 101, etc.), because "x>&y" redirection happily dups
   over in-use fds if you ask it to.
 - "exec x>&y || exit 1" redirections return exit code 2, despite the
   "exit 1" at the end.  However, "true x>&y || exit 1" redirections
   return exit code 1, as the tests expect.
Merge pull request #58 from rtomayko/piki/fixing-tests

Fix three real bugs and a pile of broken unit tests