svn commit: r544225 - head/Tools/scripts

Mateusz Piotrowski 0mp at FreeBSD.org
Wed Aug 5 15:03:02 UTC 2020


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


More information about the svn-ports-head mailing list