From: Joshua E. <je...@gm...> - 2011-03-12 00:04:05
|
Will's patch works perfectly on the box I'm on. Thank you for simplifying the case statement. Joshua On Fri, Mar 11, 2011 at 10:31 AM, Maynard Johnson <may...@us...> wrote: > William Cohen wrote: >> On 03/11/2011 12:42 PM, Maynard Johnson wrote: >>> William Cohen wrote: >>>> On 03/09/2011 12:11 PM, Joshua Emele wrote: >>>>> Hello, >>>>> >>>>> There was a brief discussion in December 2009 (http://old.nabble.com/-PATCH--Fix-incompatibility-between-opcontrol---busybox-td26683323.html) about fixing incompatibilities between opcontrol and busybox. It does not appear the patch was ever accepted. >>>>> >>>>> Attached is a patch that uses `wc -c` instead of `wc -m` which is not available with the busybox implementation of wc. The patch also changes the implementation of is_non_cell_ppc64_variant to remove the use of variable substitution, another feature which is not available with the busybox implementation of /bin/sh. >>>>> >>>>> Signed-off-by: Joshua Emele <je...@ac... <mailto:je...@ac...>> >>>> >>>> Are the nested cases in is_non_cell_ppc64_variant() needed? Could that be simplified? >>> Yes, definitely. See updated patch attached below, which I've tested. I'll commit this patch. >> >> Is the patch's case correct? Original code did the following >> >> return 0 for ppc64/*cell* >> return 1 for ppc64/* (every ppc64 not cell) >> return 0 for everything other than ppc64 > Whoops! You're absolutely right. Good catch. Joshua, can you please test Will's patch. I'll test it on Power AND on Intel (which I neglected to do the first go-round). > > -Maynard >> >> Shouldn't the case statement be like the attached? >> >> -Will >> >> diff --git a/utils/opcontrol b/utils/opcontrol >> index 8c64af9..3a8a814 100644 >> --- a/utils/opcontrol >> +++ b/utils/opcontrol >> @@ -1149,18 +1149,15 @@ set_ctr_param() >> is_non_cell_ppc64_variant() >> { >> case "$1" in >> - ppc64/*) >> - tmp="${1/cell/CELL}" >> - if test "$1" = "$tmp"; then >> - #No substituion occurred, so cputype is not cell >> - return 1 >> - else >> - return 0 >> - fi >> - ;; >> - *) >> - return 0; >> - ;; >> + ppc64/*cell*) >> + return 0 >> + ;; >> + ppc64/*) >> + return 1 >> + ;; >> + *) >> + return 0 >> + ;; >> esac >> } >> >> @@ -1278,7 +1275,7 @@ check_event_mapping_data() >> fi >> fi >> fi >> - len=`echo -n $event_num | wc -m` >> + len=`echo -n $event_num | wc -c` >> num_chars_in_grpid=`expr $len - 2` >> GRP_NUM_VAL=`echo | awk '{print substr("'"${event_num}"'",1,"'"${num_chars_in_grpid}"'")}'` >> if [ "$GRP_NUM_CK_VAL" = "" ] ; then > > |