Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux-HA: Users

"grep -zqs" in ocf:heartbeat:exportfs

 

 

Linux-HA users RSS feed   Index | Next | Previous | View Threaded


Ulrich.Windl at rz

Apr 12, 2012, 6:20 AM

Post #1 of 3 (386 views)
Permalink
"grep -zqs" in ocf:heartbeat:exportfs

Hi,

in ocf:heartbeat:exportfs (as found in SLES11 SP1) there is a problem with "grep -zqs":
The "-z" is expected to fix the problem where exportfs splits a lenghty name into two lines. Unfortunately exportfs does not output any binary zeros that "grep -z" is looking for. Thus effectively "-z" makes grep succeed when it shouldn't.

Source:
exportfs_monitor ()
{
# "grep -z" matches across newlines, which is necessary as
# exportfs output wraps lines for long export directory names
exportfs | grep -zqs "${OCF_RESKEY_directory}[[:space:]]*${OCF_RESKEY_clientspec}"
[...]

Example (test):
# exportfs | grep -z h06
/home/windl/src/scripts/OCF/twuc/.git/objects/39
h02
/home/windl/src/scripts/OCF/twuc/.git/objects/39
h06
/mnt h02
/mnt h06
# exportfs | grep h06
h06
/mnt h06

So you see "grep -z" does produce false results. Probably never tested...
BTW: Shouldn't the match be "anchored"? ^$directory ... $host\$

Regards,
Ulrich


_______________________________________________
Linux-HA mailing list
Linux-HA [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems


lars.ellenberg at linbit

Apr 12, 2012, 6:30 AM

Post #2 of 3 (360 views)
Permalink
Re: "grep -zqs" in ocf:heartbeat:exportfs [In reply to]

On Thu, Apr 12, 2012 at 03:20:08PM +0200, Ulrich Windl wrote:
> Hi,
>
> in ocf:heartbeat:exportfs (as found in SLES11 SP1) there is a problem with "grep -zqs":
> The "-z" is expected to fix the problem where exportfs splits a lenghty name into two lines. Unfortunately exportfs does not output any binary zeros that "grep -z" is looking for. Thus effectively "-z" makes grep succeed when it shouldn't.
>
> Source:
> exportfs_monitor ()
> {
> # "grep -z" matches across newlines, which is necessary as
> # exportfs output wraps lines for long export directory names
> exportfs | grep -zqs "${OCF_RESKEY_directory}[[:space:]]*${OCF_RESKEY_clientspec}"
> [...]
>
> Example (test):
> # exportfs | grep -z h06
> /home/windl/src/scripts/OCF/twuc/.git/objects/39
> h02
> /home/windl/src/scripts/OCF/twuc/.git/objects/39
> h06
> /mnt h02
> /mnt h06
> # exportfs | grep h06
> h06
> /mnt h06
>
> So you see "grep -z" does produce false results. Probably never tested...
> BTW: Shouldn't the match be "anchored"? ^$directory ... $host\$


https://github.com/ClusterLabs/resource-agents/commit/5b0bf96e77ed3c4e179c8b4c6a5ffd4709f8fdae

There also was a medium length discussion on the mailing list on that.


--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
_______________________________________________
Linux-HA mailing list
Linux-HA [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems


lars.ellenberg at linbit

Apr 12, 2012, 6:35 AM

Post #3 of 3 (362 views)
Permalink
Re: "grep -zqs" in ocf:heartbeat:exportfs [In reply to]

On Thu, Apr 12, 2012 at 03:30:06PM +0200, Lars Ellenberg wrote:
> On Thu, Apr 12, 2012 at 03:20:08PM +0200, Ulrich Windl wrote:
> > Hi,
> >
> > in ocf:heartbeat:exportfs (as found in SLES11 SP1) there is a problem with "grep -zqs":
> > The "-z" is expected to fix the problem where exportfs splits a lenghty name into two lines. Unfortunately exportfs does not output any binary zeros that "grep -z" is looking for. Thus effectively "-z" makes grep succeed when it shouldn't.
> >
> > Source:
> > exportfs_monitor ()
> > {
> > # "grep -z" matches across newlines, which is necessary as
> > # exportfs output wraps lines for long export directory names
> > exportfs | grep -zqs "${OCF_RESKEY_directory}[[:space:]]*${OCF_RESKEY_clientspec}"
> > [...]
> >
> > Example (test):
> > # exportfs | grep -z h06
> > /home/windl/src/scripts/OCF/twuc/.git/objects/39
> > h02
> > /home/windl/src/scripts/OCF/twuc/.git/objects/39
> > h06
> > /mnt h02
> > /mnt h06
> > # exportfs | grep h06
> > h06
> > /mnt h06
> >
> > So you see "grep -z" does produce false results. Probably never tested...
> > BTW: Shouldn't the match be "anchored"? ^$directory ... $host\$
>
>
> https://github.com/ClusterLabs/resource-agents/commit/5b0bf96e77ed3c4e179c8b4c6a5ffd4709f8fdae
>
> There also was a medium length discussion on the mailing list on that.

There:
http://www.gossamer-threads.com/lists/linuxha/dev/77166

--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
_______________________________________________
Linux-HA mailing list
Linux-HA [at] lists
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Linux-HA users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.