[ovs-dev] [PATCH] ovs-save: Do not depend on hardcoded set of $PATH for utilities.

Gurucharan Shetty shettyg at nicira.com
Mon Aug 26 19:45:33 UTC 2013


On Mon, Aug 26, 2013 at 11:29 AM, Ben Pfaff <blp at nicira.com> wrote:

> On Mon, Aug 26, 2013 at 10:48:30AM -0700, Gurucharan Shetty wrote:
> > Reported-by: Jian Qiu <swordqiu at gmail.com>
> > Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
>
> Scripts of this kind don't traditionally rely on "which".  I am not
> sure why--maybe it is only for historical reasons.  I do see that
> POSIX does not specify "which"; maybe some systems do not have it.
>
I wasn't sure what to do about iptables-save as it does not have a
--version option.
I am running this command twice in V2. Once to check if it exists and the
second time to actually get its o/p.

>
> I would add parentheses around the tests for programs, because the
> Autoconf manual says:
>
>        On the other hand, some shells, such as Solaris or FreeBSD
>     `/bin/sh', warn about missing programs before performing redirections.
>     Therefore, to silently check whether a program exists, it is necessary
>     to perform redirections on a subshell or brace group:
>          $ /bin/sh -c 'nosuch 2>/dev/null'
>          nosuch: not found
>          $ /bin/sh -c '(nosuch) 2>/dev/null'
>          $ /bin/sh -c '{ nosuch; } 2>/dev/null'
>          $ bash -c 'nosuch 2>/dev/null'
>
I should have remembered this non-portability.

>
> Thanks,
>
> Ben.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130826/7e7c5f2a/attachment-0003.html>


More information about the dev mailing list