[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 2/6] test/depriv: Add a tool to check process-level depriv



On Fri, Sep 21, 2018 at 06:04:24PM +0100, George Dunlap wrote:
> diff --git a/tools/tests/depriv/depriv-process-checker.sh 
> b/tools/tests/depriv/depriv-process-checker.sh
> --- /dev/null
> +++ b/tools/tests/depriv/depriv-process-checker.sh
[...]
> +# Example input:
> +# Uid:       1193    1193    1193    1193
> +input=$(grep Uid /proc/$dmpid/status)
> +if [[ "$input" =~ 
> ^Uid:[[:space:]]*([0-9]+)[[:space:]]*([0-9]+)[[:space:]]*([0-9]+)[[:space:]]*([0-9]+)$
>  ]] ; then

You should replace all the * by +. Surely you want at least one space
between two numbers.

> +    result="PASSED"
> +    for i in {1..4}; do
> +     if [[ "${BASH_REMATCH[$i]}" != "$tgt_uid" ]] ; then
> +         result="FAILED"
> +         failed="true"
> +         break
> +     fi
> +    done
> +else
> +    result="FAILED"
> +    failed="true"
> +fi
> +echo $result
> +
> +# Example input:
> +# Gid:       10020   10020   10020   10020
> +echo -n "Process GID: "
> +input=$(grep Uid /proc/$dmpid/status)

Here grep for "Uid" but ...

> +if [[ "$input" =~ 
> ^Gid:[[:space:]]*([0-9]+)[[:space:]]*([0-9]+)[[:space:]]*([0-9]+)[[:space:]]*([0-9]+)$
>  ]] ; then

here is "Gid".

> +    result="PASSED"
> +    for i in {1..4}; do
> +     if [[ "${BASH_REMATCH[$i]}" != "$65534" ]] ; then

Is "$65534" supposed to be a variable? Or is "$" a extra character?


-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.