From 265267ebcc83e985060675b102310660f2795dff Mon Sep 17 00:00:00 2001 From: Minh Diep Date: Mon, 6 Feb 2012 15:37:10 -0800 Subject: [PATCH] LU-1049 script: lc_net doesn't parse output correctly Port the second fix from bz=23234 The output of ping contains two ip addresses. The regex matching picks up both addresses. The fix is to add -m 1 to stop at the first match Signed-off-by: Minh Diep Change-Id: Iaefe42918b4587f88a8a0cb39cf9afb2a82021ba Reviewed-on: http://review.whamcloud.com/2105 Tested-by: Hudson Tested-by: Maloo Reviewed-by: hongchao.zhang Reviewed-by: Andreas Dilger --- lustre/scripts/lc_net.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lustre/scripts/lc_net.in b/lustre/scripts/lc_net.in index fef2637..d65830c 100644 --- a/lustre/scripts/lc_net.in +++ b/lustre/scripts/lc_net.in @@ -169,9 +169,8 @@ remote_check() { fi # Get the IP address of ${HOST_NAMES[i]} from its own ping - ip_pattern="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" - ip_addr=`echo "${ret_str}" | egrep -o "${ip_pattern}"` - ip_addr=`echo "${ip_addr}" | sed -e 's/^(//' -e 's/)$//'` + ip_pattern="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" + ip_addr=`echo "${ret_str}" | egrep -m 1 -o "${ip_pattern}"` # Compare IP addresses # Check whether ${HOST_NAMES[i]} agrees with the local host -- 1.8.3.1