Skip to content

Commit

Permalink
fix issue where expr fails on freebsd.
Browse files Browse the repository at this point in the history
These scripts produce errors when run on FreeBSD (in the context of logstash). Adding the double dash prevents interpretation of the left operand as an option to expr itself. See also https://discuss.elastic.co/t/cannot-install-multiline-filter-on-freebsd-11/106929?source_topic_id=117201.
arjanvandervelde authored and enebo committed Jan 29, 2018
1 parent d26cad1 commit 07950ec
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/jruby.bash
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ do
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
-X*)
val=${1:2}
if expr "$val" : '.*[.]' > /dev/null; then
if expr -- "$val" : '.*[.]' > /dev/null; then
java_args=("${java_args[@]}" "-Djruby.${val}")
else
ruby_args=("${ruby_args[@]}" "-X${val}")
8 changes: 4 additions & 4 deletions bin/jruby.sh
Original file line number Diff line number Diff line change
@@ -26,9 +26,9 @@ progname=`basename "$0"`

while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
if expr "$link" : '/' > /dev/null; then
link=`expr -- "$ls" : '.*-> \(.*\)$'`
if expr -- "$link" : '.*/.*' > /dev/null; then
if expr -- "$link" : '/' > /dev/null; then
PRG="$link"
else
PRG="`dirname ${PRG}`/${link}"
@@ -202,7 +202,7 @@ do
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
-X*)
val=${1:2}
if expr "$val" : '.*[.]' > /dev/null; then
if expr -- "$val" : '.*[.]' > /dev/null; then
java_args="${java_args} -Djruby.${val}"
else
ruby_args="${ruby_args} -X${val}"

0 comments on commit 07950ec

Please sign in to comment.