basho / node_package

RPM/Debian/FreeBSD/SmartOS/Solaris/OSX packaging templates for Erlang Nodes
Apache License 2.0
89 stars 63 forks source link

$RANDOM is bash specific and should be avoided [JIRA: TOOLS-475] #215

Open larshesel opened 7 years ago

larshesel commented 7 years ago

The runner shell script is using a bashism, namely $RANDOM:

https://github.com/basho/node_package/blob/develop/priv/base/runner#L309

but the runner script is using /bin/sh which on many systems is not bash and thus $RANDOM is undefined:

https://github.com/basho/node_package/blob/develop/priv/base/runner#L1

Something portable would need to be used in place of $RANDOM.

larshesel commented 7 years ago

A possible solution may be something like:

tr -cd 0-9 </dev/urandom | head -c 3

But I have no idea if one can really count on tr, head and /dev/urandom to be present on all systems (OSX, Solaris...)