[arch-projects] [devtools][patch][makechrootpkg] Actually pass extra arguments to makepkg

Joel Teichroeb joel at teichroeb.net
Sun Mar 16 00:36:27 EDT 2014


Currently, if a user has extra arguments on the end of their makechrootpkg
command it prints an error and does not add those arguments to the makepkg
command line as expected. As far as I can tell it would have never worked
this way because according to the specifications for getopts[1] if there is
no ":" at the start of the argument list $OPTARG will not be set and $arg
will be set to "?", but if there is a ":" $OPTARG will be set to the
unknown argument. Unfortunately this means we can not easily get the
argument to an unknown option.


[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/getopts.html
---
 makechrootpkg.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/makechrootpkg.in b/makechrootpkg.in
index d03b703..7e5f8e8 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -66,7 +66,7 @@ usage() {
  exit 1
 }

-while getopts 'hcur:I:l:nTD:d:' arg; do
+while getopts ':hcur:I:l:nTD:d:' arg; do
  case "$arg" in
  h) usage ;;
  c) clean_first=true ;;
@@ -78,7 +78,7 @@ while getopts 'hcur:I:l:nTD:d:' arg; do
  l) copy="$OPTARG" ;;
  n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
  T) temp_chroot=true; copy+="-$" ;;
- *) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
+ *) makepkg_args="$makepkg_args -$OPTARG" ;;
  esac
 done

-- 
1.9.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.archlinux.org/pipermail/arch-projects/attachments/20140315/a5cb4809/attachment.html>


More information about the arch-projects mailing list