Skip to content

Commit 07950ec

Browse files
arjanvanderveldeenebo
authored andcommittedJan 29, 2018
fix issue where expr fails on freebsd.
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.
1 parent d26cad1 commit 07950ec

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎bin/jruby.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ do
244244
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
245245
-X*)
246246
val=${1:2}
247-
if expr "$val" : '.*[.]' > /dev/null; then
247+
if expr -- "$val" : '.*[.]' > /dev/null; then
248248
java_args=("${java_args[@]}" "-Djruby.${val}")
249249
else
250250
ruby_args=("${ruby_args[@]}" "-X${val}")

‎bin/jruby.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ progname=`basename "$0"`
2626

2727
while [ -h "$PRG" ] ; do
2828
ls=`ls -ld "$PRG"`
29-
link=`expr "$ls" : '.*-> \(.*\)$'`
30-
if expr "$link" : '.*/.*' > /dev/null; then
31-
if expr "$link" : '/' > /dev/null; then
29+
link=`expr -- "$ls" : '.*-> \(.*\)$'`
30+
if expr -- "$link" : '.*/.*' > /dev/null; then
31+
if expr -- "$link" : '/' > /dev/null; then
3232
PRG="$link"
3333
else
3434
PRG="`dirname ${PRG}`/${link}"
@@ -202,7 +202,7 @@ do
202202
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
203203
-X*)
204204
val=${1:2}
205-
if expr "$val" : '.*[.]' > /dev/null; then
205+
if expr -- "$val" : '.*[.]' > /dev/null; then
206206
java_args="${java_args} -Djruby.${val}"
207207
else
208208
ruby_args="${ruby_args} -X${val}"

0 commit comments

Comments
 (0)
Please sign in to comment.