On Thu, Feb 07, 2008 at 04:28:03PM -0500, Stephen Smalley wrote: > Hmm..the shifting of arguments was introduced in r2699 from Dan Walsh > (cc'd), diff is below. Also relevant are r2736, r2750 and r2760. > > I'd agree that we don't want to break existing usage, but I'm not sure > what the least intrusive and cleanest fix is. Ok. What about this patch :) The interpreter is changed to /bin/bash. There are bashisms (getopts, PIPESTATUS...), so this can't be interpreted by /bin/sh. Regards -- Zito
Index: fixfiles =================================================================== --- fixfiles (revision 2793) +++ fixfiles (working copy) @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # fixfiles # # Script to restore labels on a SELinux box @@ -201,27 +201,21 @@ case "$i" in f) fullFlag=1 - shift 1 ;; R) RPMFILES=$OPTARG - shift 2 ;; o) OUTFILES=$OPTARG - shift 2 ;; l) LOGFILE=$OPTARG - shift 2 ;; C) PREFC=$OPTARG - shift 2 ;; F) FORCEFLAG="-F" - shift 1 ;; *) usage @@ -229,17 +223,22 @@ esac done +# Move out processed options from arguments +shift $(( OPTIND - 1 )) + # Check for the command command=$1 if [ -z $command ]; then usage fi +# Move out command from arguments +shift + # # check if they specified both DIRS and RPMFILES # -shift 1 if [ ! -z "$RPMFILES" ]; then process $command if [ $# -gt 0 ]; then