Skip to content

Commit e113526

Browse files
committed
tools/semver-compare.sh: with fixed-width strings instead of numbers, we can forgo the "sort -n", it is confusing on some systems [networkupstools#3055]
NetBSD, looking at you: ( echo '0001 0030' ; echo '0001 0003' ) | sort inverses order with sort -n Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 69c124a commit e113526

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/semver-compare.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ EOF
221221
printf '%s\t%s\n' "`echo \"$1\" | filter_add_extra_width`" "$1"
222222
shift
223223
done \
224-
| sort -n $SORT_OPTS \
224+
| sort $SORT_OPTS \
225225
| awk '{print $2}'
226226
exit
227227
;;
@@ -232,7 +232,7 @@ EOF
232232
fi
233233
SEMVER1="`echo "$2" | filter_add_extra_width`"
234234
SEMVER2="`echo "$4" | filter_add_extra_width`"
235-
SEMVER_MIN="`(echo \"$SEMVER1\" ; echo \"$SEMVER2\") | sort -n | head -1`"
235+
SEMVER_MIN="`(echo \"$SEMVER1\" ; echo \"$SEMVER2\") | sort | head -1`"
236236
case "$3" in
237237
'-eq'|'='|'==')
238238
if [ x"${SEMVER1}" = x"${SEMVER2}" ] ; then

0 commit comments

Comments
 (0)