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

Mailing List Archive: Linux-HA: Dev

[PATCH] have_binary helper function: explicitly redirect stderr from which to /dev/null

 

 

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


florian.haas at linbit

Jun 22, 2009, 3:17 AM

Post #1 of 2 (315 views)
Permalink
[PATCH] have_binary helper function: explicitly redirect stderr from which to /dev/null

# HG changeset patch
# User Florian Haas <florian.haas[at]linbit.com>
# Date 1245665801 -7200
# Node ID fafbd221464648c5444de6bd26ff3bb5bb677bc0
# Parent 2aa649cdb8d3d3e35165a47fda8cbd47dc61d9ff
have_binary helper function: explicitly redirect stderr from which to /dev/null

Some incarnations of which will output
"/usr/bin/which: no <foo> in ($PATH)" on stderr, which will show up in
the logs as output from the RA. This is specifically the case if which
is aliased as suggested in its man page. Explicitly redirecting stderr
to /dev/null within the backticks will remove this minor nuisance.

diff -r 2aa649cdb8d3 -r fafbd2214646 resources/OCF/.ocf-binaries.in
--- a/resources/OCF/.ocf-binaries.in Mon Jun 22 11:45:16 2009 +0200
+++ b/resources/OCF/.ocf-binaries.in Mon Jun 22 12:16:41 2009 +0200
@@ -71,7 +71,7 @@

have_binary () {
bin=`echo $1 | sed -e 's/ -.*//'`
- if [ -x "`which $bin`" ] >/dev/null 2>&1 ; then
+ if [ -x "`which $bin 2>/dev/null`" ] >/dev/null 2>&1 ; then
return 0
fi
return 1
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev[at]lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


dejanmm at fastmail

Jun 22, 2009, 3:44 AM

Post #2 of 2 (275 views)
Permalink
Re: [PATCH] have_binary helper function: explicitly redirect stderr from which to /dev/null [In reply to]

Hi,

On Mon, Jun 22, 2009 at 12:17:04PM +0200, Florian Haas wrote:
> # HG changeset patch
> # User Florian Haas <florian.haas[at]linbit.com>
> # Date 1245665801 -7200
> # Node ID fafbd221464648c5444de6bd26ff3bb5bb677bc0
> # Parent 2aa649cdb8d3d3e35165a47fda8cbd47dc61d9ff
> have_binary helper function: explicitly redirect stderr from which to /dev/null
>
> Some incarnations of which will output
> "/usr/bin/which: no <foo> in ($PATH)" on stderr, which will show up in
> the logs as output from the RA. This is specifically the case if which
> is aliased as suggested in its man page. Explicitly redirecting stderr
> to /dev/null within the backticks will remove this minor nuisance.
>
> diff -r 2aa649cdb8d3 -r fafbd2214646 resources/OCF/.ocf-binaries.in
> --- a/resources/OCF/.ocf-binaries.in Mon Jun 22 11:45:16 2009 +0200
> +++ b/resources/OCF/.ocf-binaries.in Mon Jun 22 12:16:41 2009 +0200
> @@ -71,7 +71,7 @@
>
> have_binary () {
> bin=`echo $1 | sed -e 's/ -.*//'`
> - if [ -x "`which $bin`" ] >/dev/null 2>&1 ; then
> + if [ -x "`which $bin 2>/dev/null`" ] >/dev/null 2>&1 ; then

Actually, we can drop the rest of redirections:

+ if [ -x "`which $bin 2>/dev/null`" ]; then

Applied.

Cheers,

Dejan


> return 0
> fi
> return 1
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev[at]lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev[at]lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

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


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.