summaryrefslogtreecommitdiff
path: root/Tools/scripts
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/scripts
parentlang/rust*: Bring back the llvm-config-wrapper patches after r543251 (diff)
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/scripts')
-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