On Wednesday 22 July 2009 17:20:19 Mimi Zohar wrote:
> testcases/kernel/security/integrity/ima/tests/ima_policy.sh
>
> -             if [ "${line:0:1}" != "#" ] ; then
> +             firstch=`expr substr "${line}" 1 1`
> +             if [ "${firstch}" != "#" ] ; then

the `expr` util, while pretty flexible, tends to not get used.  so it'll 
probably be easier for people to grok:
        if [ "${line#\#}" = "${line}" ] ; then

> -     RC=$((`expr $RC1 + $RC2`))
> -     if [ $RC -eq 1 ]; then
> +     if [ $RC1 -eq 0 ] && [ $RC2 -eq 0 ]; then

i dont see what was wrong with the original here, but if you really want to 
rewrite this, then just change the one line to:
        RC=$((RC1 + RC2))

> testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
>
> +     zero="0000000000000000000000000000000000000000"
>
> +     ima_aggr=`expr substr "${line}" 49 40`
>
> -             [ "${line:49:40}" -eq 0 ] || RC=$?
> +             [ "${ima_aggr}" = "${zero}" ] || RC=$?

these changes arent exactly equivalent.  if the subst of line only returned 
say 5 zeros, then your check wouldnt work.  do you even need this ?  simply 
changing the line to ima_aggr via substr looks good enough to me.  this should 
work fine in POSIX shells:
        [ "00000" -eq 0 ]

> testcases/kernel/security/integrity/ima/tests/ima_violations.sh
>
> +                     tst_res TINFO $LTPTMP/imalog.$$\
> +                      "$TCID: (message ratelimiting?)"

this shows up a few times in the patch ... if you're going to line wrap 
things, there needs to be a space before the continuation marker for style.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to