From e6b04d9ffd8bef2482ab61957c138ae92527206d Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 13 Mar 2019 17:15:03 -0400 Subject: Protect [ commands from strings beginning with "-" --- (limited to 'lib/metadata.sh') diff --git a/lib/metadata.sh b/lib/metadata.sh index e22a6e7..c8201ae 100644 --- a/lib/metadata.sh +++ b/lib/metadata.sh @@ -170,8 +170,8 @@ ob_match_arch() for field_arch in ${arch_field}; do # "all" == "all" - if [ "${match_arch}" = 'all' ]; then - if [ "${field_arch}" = 'all' ]; then + if [ x"${match_arch}" = x'all' ]; then + if [ x"${field_arch}" = x'all' ]; then return 0 else continue @@ -179,7 +179,7 @@ ob_match_arch() fi # "foo-bar-baz" == "any" - if [ "${field_arch}" = 'any' ]; then + if [ x"${field_arch}" = x'any' ]; then return 0 fi @@ -215,17 +215,17 @@ ob_match_plat() local p= for p in ${plat_field}; do - if [ "${plat}" = 'all' ]; then - if [ "${p}" = 'all' ]; then + if [ x"${plat}" = x'all' ]; then + if [ x"${p}" = x'all' ]; then return 0 else continue fi fi - if [ "${p}" = 'any' ]; then + if [ x"${p}" = x'any' ]; then return 0 fi - if [ "${p}" = "${plat}" ]; then + if [ x"${p}" = x"${plat}" ]; then return 0 fi done @@ -242,10 +242,10 @@ ob_arch_is_concerned() local not_arch= local seen_arch= - if [ "x${arches}" = 'x' ]; then + if [ x"${arches}" = x'' ]; then return 0 - elif [ "x${host_arch}" = 'xall' ]; then - if [ "x${arches}" = 'xall' ]; then + elif [ x"${host_arch}" = x'all' ]; then + if [ x"${arches}" = x'all' ]; then return 0 else return 1 @@ -254,7 +254,7 @@ ob_arch_is_concerned() seen_arch=1 for arch in ${arches}; do not_arch="${arch#!}" - if [ "${not_arch}" != "${arch}" ]; then + if [ x"${not_arch}" != x"${arch}" ]; then if ob_match_arch "${host_arch}" "${not_arch}" then seen_arch=1 @@ -280,10 +280,10 @@ ob_plat_is_concerned() local not_plat= local seen_plat= - if [ "x${plats}" = 'x' ]; then + if [ x"${plats}" = x'' ]; then return 0 - elif [ "x${host_plat}" = 'xall' ]; then - if [ "x${plats}" = 'xall' ]; then + elif [ x"${host_plat}" = x'all' ]; then + if [ x"${plats}" = x'all' ]; then return 0 else return 1 @@ -292,7 +292,7 @@ ob_plat_is_concerned() seen_plat=1 for plat in ${plats}; do not_plat="${plat#!}" - if [ "${not_plat}" != "${plat}" ]; then + if [ x"${not_plat}" != x"${plat}" ]; then if ob_match_plat "${host_plat}" "${not_plat}" then seen_plat=1 -- cgit v0.9.1