contrib: Unify quoting in error messages
This fixes error messages to display the contents of variables rather than the variable name by replacing backticks with single quotes (m4 eats backticks). It also removes $"" localization from error messages to eliminate security holes. For instance, `rankmirrors nonexistent_file' will now display: 'nonexistent_file' does not exist. rather than: $1 does not exist. Signed-off-by: Aaron Lindsay <aaron@aclindsay.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
9388808964
commit
3f99cfba1b
3 changed files with 7 additions and 7 deletions
|
@ -124,7 +124,7 @@ fi
|
||||||
|
|
||||||
if [[ ! -d $pkg_dir ]]; then
|
if [[ ! -d $pkg_dir ]]; then
|
||||||
error "package %s is found in pacman database," "${pkg_name}"
|
error "package %s is found in pacman database," "${pkg_name}"
|
||||||
plain " but \`%s' is not a directory" "${pkg_dir}"
|
plain " but '%s' is not a directory" "${pkg_dir}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ while [[ $1 ]]; do
|
||||||
verbose) VERBOSE=1 ; shift ;;
|
verbose) VERBOSE=1 ; shift ;;
|
||||||
url) CHECKURL=1; [[ $2 ]] || err "Must specify url."; URL="$2"; shift 2;;
|
url) CHECKURL=1; [[ $2 ]] || err "Must specify url."; URL="$2"; shift 2;;
|
||||||
repo) [[ $2 ]] || err "Must specify repo name."; TARGETREPO="$2"; shift 2;;
|
repo) [[ $2 ]] || err "Must specify repo name."; TARGETREPO="$2"; shift 2;;
|
||||||
*) err "\`$1' is an invalid argument."
|
*) err "'$1' is an invalid argument."
|
||||||
esac
|
esac
|
||||||
elif [[ ${1:0:1} = - ]]; then
|
elif [[ ${1:0:1} = - ]]; then
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ while [[ $1 ]]; do
|
||||||
u) CHECKURL=1; [[ $2 ]] || err "Must specify url."; URL="$2"; snum=2;;
|
u) CHECKURL=1; [[ $2 ]] || err "Must specify url."; URL="$2"; snum=2;;
|
||||||
r) [[ $2 ]] || err "Must specify repo name."; TARGETREPO="$2"; snum=2;;
|
r) [[ $2 ]] || err "Must specify repo name."; TARGETREPO="$2"; snum=2;;
|
||||||
n) [[ $2 ]] || err "Must specify number." ; NUM="$2" ; snum=2;;
|
n) [[ $2 ]] || err "Must specify number." ; NUM="$2" ; snum=2;;
|
||||||
*) err "\`-$1' is an invald argument." ;;
|
*) err "'$1' is an invalid argument." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $snum
|
shift $snum
|
||||||
|
@ -157,7 +157,7 @@ while [[ $1 ]]; do
|
||||||
[[ $linearray ]] || err "File is empty."
|
[[ $linearray ]] || err "File is empty."
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
err "\`$1' does not exist."
|
err "'$1' does not exist."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ done
|
||||||
# Single url handling
|
# Single url handling
|
||||||
if [[ $CHECKURL ]]; then
|
if [[ $CHECKURL ]]; then
|
||||||
url="$(getfetchurl "$URL")"
|
url="$(getfetchurl "$URL")"
|
||||||
[[ $url = fail ]] && err "url \`$URL' is malformed."
|
[[ $url = fail ]] && err "url '$URL' is malformed."
|
||||||
[[ $VERBOSE ]] && echo "Testing $url..."
|
[[ $VERBOSE ]] && echo "Testing $url..."
|
||||||
time=$(gettime "$url")
|
time=$(gettime "$url")
|
||||||
echo "$URL : $time"
|
echo "$URL : $time"
|
||||||
|
@ -193,7 +193,7 @@ for line in "${linearray[@]}"; do
|
||||||
server="${line#*= }"
|
server="${line#*= }"
|
||||||
server="${server%%#*}"
|
server="${server%%#*}"
|
||||||
url="$(getfetchurl "$server")"
|
url="$(getfetchurl "$server")"
|
||||||
[[ $url = fail ]] && err "url \`$URL' is malformed."
|
[[ $url = fail ]] && err "url '$URL' is malformed."
|
||||||
time=$(gettime "$url")
|
time=$(gettime "$url")
|
||||||
timesarray+=("$time $server")
|
timesarray+=("$time $server")
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ fi
|
||||||
|
|
||||||
# Check $PWD/ for permission to unlink the $buildfile and write a new one
|
# Check $PWD/ for permission to unlink the $buildfile and write a new one
|
||||||
if [[ ! -w . ]]; then
|
if [[ ! -w . ]]; then
|
||||||
printf $'==> ERROR: No write permission in `%s\'\n' "$PWD"
|
printf "==> ERROR: No write permission in '%s'\n" "$PWD"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue