aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorMateusz Piotrowski <0mp@FreeBSD.org>2020-08-05 15:03:01 +0000
committerMateusz Piotrowski <0mp@FreeBSD.org>2020-08-05 15:03:01 +0000
commit4bd3723c02c1ea22d88a9c68a9d231abd5892f35 (patch)
treee212918c20b6674063d83da50f9adb2917afc2b7 /Tools
parent1c843dbb6a63e19f890026cc17d2af752e7cfd00 (diff)
downloadports-4bd3723c02c1ea22d88a9c68a9d231abd5892f35.tar.gz
ports-4bd3723c02c1ea22d88a9c68a9d231abd5892f35.zip
Make argument parsing a bit more robust
Currently, when running mfh with a flag like --help the user gets a confusing error message from expr(1) like the following: > expr: illegal option -- - > expr: usage: expr [-e] expression > > revision "--help" should be a number This is not helpful. Instead, make sure that any arguments specified by the user are handled properly by expr(1). This results in a much cleaner error message: > revision "--help" should be a number Reviewed by: mat Approved by: portmgr (mat) Differential Revision: https://reviews.freebsd.org/D25958
Notes
Notes: svn path=/head/; revision=544225
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/mfh2
1 files changed, 1 insertions, 1 deletions
diff --git a/Tools/scripts/mfh b/Tools/scripts/mfh
index cf332ca43983..14e362687aac 100755
--- a/Tools/scripts/mfh
+++ b/Tools/scripts/mfh
@@ -85,7 +85,7 @@ else cdiffcmd=cat
fi
# I sure hope by 2030 we'll be doing something else. Yes, famous last words.
-if expr "${branch}" : '20[12][0-9]Q[1-4]' > /dev/null; then
+if expr -- "${branch}" : '20[12][0-9]Q[1-4]' > /dev/null; then
shift
if [ "${latest_branch}" != "${branch}" ]; then
ask "/!\\ The latest branch is ${latest_branch}, do you really want to commit to ${branch}?" || exit 1