You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by "Brandon DeVries (JIRA)" <ji...@apache.org> on 2016/04/19 21:26:25 UTC

[jira] [Commented] (NIFI-1786) Use "Unofficial Bash Strict Mode" in nifi,sh

    [ https://issues.apache.org/jira/browse/NIFI-1786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15248456#comment-15248456 ] 

Brandon DeVries commented on NIFI-1786:
---------------------------------------

So, realizing that what happened there was that strict mode was causing the check in the script for the existence of $MAX_FD to fail.  However, it does not appear to be being done in the best way.  Some guy named Greg on the internet says the way it is being done now is "Only needed for ancient Bourne shells and not so ancient pdksh or ash versions. Don't use this in modern scripts." \[1\].  Consulting StackOverflow \[2\] \[3\] gives us another option that is compatible with set -u:

{code}
if [ -n "${foobar+1}" ]; then
  echo "foobar is defined"
else
  echo "foobar is not defined"
fi
{code}

\[1\] http://mywiki.wooledge.org/BashFAQ/083
\[2\] http://unix.stackexchange.com/questions/56837/how-to-test-if-a-variable-is-defined-at-all-in-bash-prior-to-version-4-2-with-th
\[3\] http://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash


> Use "Unofficial Bash Strict Mode" in nifi,sh
> --------------------------------------------
>
>                 Key: NIFI-1786
>                 URL: https://issues.apache.org/jira/browse/NIFI-1786
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Brandon DeVries
>            Priority: Minor
>
> We just had a user trying to do "nifi.sh start" on a new install get the cryptic error message
> {code}
>  does not exist.  Exiting.
> {code}
> enabling "Unofficial Bash Strict Mode"\[1\] by adding 
> {code}
> set -euo pipefail
> {code}
> to the top of the script revealed that the problem was that $MAX_FD was unset.  While we're still working through why that would be, its at least a bit more to go on.
> \[1\] http://redsymbol.net/articles/unofficial-bash-strict-mode/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)