[ofa-general] Re: [PATCH] infiniband-diags/scripts: Fix Bug 239 Error Reporting

Sasha Khapyorsky sashak at voltaire.com
Sun Aug 5 12:25:08 PDT 2007


Hi David,

On 19:09 Tue 31 Jul     , davem at systemfabricworks.com wrote:
> 
> 
>    Fix Bug 239 OpenIB diag scripts don't return error when lacking umad
>    permissions.  Returning the error from the head of a shell pipeline is a
>    problem, so this fix causes the awk scripts to pass error messages through.
>    This will pass all standard error messages.
> 
>    This patch needs [ofa-general] [PATCH] infiniband-diags: Add common flags
>    -P, -C, and -t (posted Tue Jul 31 13:39:27 PDT 2007) applied first.
> 
> Signed-off-by: David A. McMillen <davem at systemfabricworks.com>
> ---
>  infiniband-diags/scripts/ibcheckerrors.in    |   11 +++++++++--
>  infiniband-diags/scripts/ibcheckerrs.in      |   13 ++++++++++---
>  infiniband-diags/scripts/ibchecknet.in       |   16 ++++++++++++++--
>  infiniband-diags/scripts/ibcheckport.in      |   11 +++++++++--
>  infiniband-diags/scripts/ibcheckportstate.in |   11 +++++++++--
>  infiniband-diags/scripts/ibcheckportwidth.in |   11 +++++++++--
>  infiniband-diags/scripts/ibcheckstate.in     |   10 +++++++++-
>  infiniband-diags/scripts/ibcheckwidth.in     |   10 +++++++++-
>  infiniband-diags/scripts/ibclearcounters.in  |   10 +++++++++-
>  infiniband-diags/scripts/ibclearerrors.in    |   10 +++++++++-
>  infiniband-diags/scripts/ibdatacounters.in   |   11 +++++++++--
>  infiniband-diags/scripts/ibdatacounts.in     |   11 +++++++++--
>  infiniband-diags/scripts/ibhosts.in          |    9 ++++++++-
>  infiniband-diags/scripts/ibrouters.in        |    9 ++++++++-
>  infiniband-diags/scripts/ibswitches.in       |    9 ++++++++-
>  15 files changed, 138 insertions(+), 24 deletions(-)
> 
> diff --git a/infiniband-diags/scripts/ibcheckerrors.in b/infiniband-diags/scripts/ibcheckerrors.in
> index 01c7a99..ebf44ec 100644
> --- a/infiniband-diags/scripts/ibcheckerrors.in
> +++ b/infiniband-diags/scripts/ibcheckerrors.in
> @@ -73,7 +73,9 @@ else
>  	netcmd="$IBPATH/ibnetdiscover $ca_info"
>  fi
>  
> -eval $netcmd | awk '
> +text="`eval $netcmd`"
> +rv=$?
> +echo "$text" | awk '
>  BEGIN {
>  	ne=0
>  }

Wouldn't it be simpler just exit instead of running awk over already
broken output?

Like:

	if [ $rv -ne 0 ] ; then
		echo $test
		exit $rv
	fi

	echo $text | awk ...

Sasha



More information about the general mailing list