Date: Wed, 5 Aug 2020 15:03:02 +0000 (UTC) From: Mateusz Piotrowski <0mp@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r544225 - head/Tools/scripts Message-ID: <202008051503.075F32kY020089@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: 0mp Date: Wed Aug 5 15:03:01 2020 New Revision: 544225 URL: https://svnweb.freebsd.org/changeset/ports/544225 Log: 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 Modified: head/Tools/scripts/mfh Modified: head/Tools/scripts/mfh ============================================================================== --- head/Tools/scripts/mfh Wed Aug 5 14:46:18 2020 (r544224) +++ head/Tools/scripts/mfh Wed Aug 5 15:03:01 2020 (r544225) @@ -85,7 +85,7 @@ else cdiffcmd= 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008051503.075F32kY020089>