From: <ssm...@us...> - 2008-02-08 16:14:58
|
Revision: 2798 http://selinux.svn.sourceforge.net/selinux/?rev=2798&view=rev Author: ssmalley Date: 2008-02-08 08:14:55 -0800 (Fri, 08 Feb 2008) Log Message: ----------- Author: V?\195?\161clav Ovs?\195?\173k Email: vaclav.ovsik@i.cz Subject: fixfiles: broken option processing? Date: Fri, 8 Feb 2008 09:29:22 +0100 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. Acked-by: Stephen Smalley <sd...@ty...> Modified Paths: -------------- trunk/policycoreutils/scripts/fixfiles Modified: trunk/policycoreutils/scripts/fixfiles =================================================================== --- trunk/policycoreutils/scripts/fixfiles 2008-02-08 16:13:33 UTC (rev 2797) +++ trunk/policycoreutils/scripts/fixfiles 2008-02-08 16:14:55 UTC (rev 2798) @@ -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |