This patch fixes the following issue while using "grep -w"
to do exact match:
$ echo /mnt/nbp0-2 | grep -w /mnt/nbp0
/mnt/nbp0-2
Per the description of "-w" option:
-w, --word-regexp
Select only those lines containing matches that form whole words.
The test is that the matching substring must either be at the
beginning of the line, or preceded by a non-word constituent
character. Similarly, it must be either at the end of the line
or followed by a non-word constituent character. Word-constituent
characters are letters, digits, and the underscore.
So, the hyphen "-" character is a non-word constituent character
and "grep -w" does not do exact match on strings which contain it.
Signed-off-by: Yu Jian <yujian@whamcloud.com>
Change-Id: I53d306d38b05408c351db10dc545120f2f9dabce
Reviewed-on: http://review.whamcloud.com/2529
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
nfs_client_mode && return
local MOUNTED=$(mounted_lustre_filesystems)
nfs_client_mode && return
local MOUNTED=$(mounted_lustre_filesystems)
- if $(echo $MOUNTED | grep -w -q $MOUNT); then
+ if $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
check_config_clients $MOUNT
init_facets_vars
init_param_vars
check_config_clients $MOUNT
init_facets_vars
init_param_vars
$SETUP
MOUNTED=$(mounted_lustre_filesystems)
$SETUP
MOUNTED=$(mounted_lustre_filesystems)
- if ! $(echo $MOUNTED | grep -w -q $MOUNT); then
+ if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
echo "Lustre is not mounted after setup! SETUP=$SETUP"
exit 1
fi
echo "Lustre is not mounted after setup! SETUP=$SETUP"
exit 1
fi
auster_cleanup=false
local MOUNTED=$(mounted_lustre_filesystems)
auster_cleanup=false
local MOUNTED=$(mounted_lustre_filesystems)
- if $(echo $MOUNTED | grep -w -q $MOUNT); then
+ if $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
check_config_clients $MOUNT
# init_facets_vars
# init_param_vars
check_config_clients $MOUNT
# init_facets_vars
# init_param_vars
setupall
MOUNTED=$(mounted_lustre_filesystems)
setupall
MOUNTED=$(mounted_lustre_filesystems)
- if ! $(echo $MOUNTED | grep -w -q $MOUNT); then
+ if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT' '); then
echo "Lustre is not mounted after setup! "
exit 1
fi
echo "Lustre is not mounted after setup! "
exit 1
fi
check_and_setup_lustre
MOUNTED=$(mounted_lustre_filesystems)
check_and_setup_lustre
MOUNTED=$(mounted_lustre_filesystems)
-if ! $(echo $MOUNTED | grep -w -q $MOUNT2); then
+if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT2' '); then
zconf_mount $HOSTNAME $MOUNT2
MOUNTED2=yes
fi
zconf_mount $HOSTNAME $MOUNT2
MOUNTED2=yes
fi
local rc=0
for mnt in $mnts ; do
do_nodes $nodes "running=\\\$(grep -c $mnt' ' /proc/mounts);
local rc=0
for mnt in $mnts ; do
do_nodes $nodes "running=\\\$(grep -c $mnt' ' /proc/mounts);
-mpts=\\\$(mount | grep -w -c $mnt);
+mpts=\\\$(mount | grep -c $mnt' ');
if [ \\\$running -ne \\\$mpts ]; then
echo \\\$(hostname) env are INSANE!;
exit 1;
if [ \\\$running -ne \\\$mpts ]; then
echo \\\$(hostname) env are INSANE!;
exit 1;
exit \\\$rc" || return ${PIPESTATUS[0]}
echo "Started clients $clients: "
exit \\\$rc" || return ${PIPESTATUS[0]}
echo "Started clients $clients: "
- do_nodes $clients "mount | grep -w $mnt"
+ do_nodes $clients "mount | grep $mnt' '"
set_default_debug_nodes $clients
set_default_debug_nodes $clients