[ovs-git] [openvswitch/ovs] 39bd2f: ovs-macros.at: Better hide 'exec -a' checking.

GitHub noreply at github.com
Fri Jan 25 19:09:10 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 39bd2f6b7074780418880f156fac7276affea6a3
      https://github.com/openvswitch/ovs/commit/39bd2f6b7074780418880f156fac7276affea6a3
  Author: Ilya Maximets <i.maximets at samsung.com>
  Date:   2019-01-25 (Fri, 25 Jan 2019)

  Changed paths:
    M tests/ovs-macros.at

  Log Message:
  -----------
  ovs-macros.at: Better hide 'exec -a' checking.

There is some issue with parsing of redirection options
on some shells. For example:

  $ (exec -a name true) 2>&1 >/dev/null || echo "failed"
  sh: 10: exec: -a: not found
  failed

  $ (exec -a name true) >/dev/null 2>&1 || echo "failed"
  failed

So, the order of redirections matters for some reason.
Let's replace our current version with simple redirection of stderr.
This version seems to work in most of shells except [t]csh. But it's
really tricky to write portable redirections that works with csh and
this shell will not be used by the testsuite on most of the systems.

With the new version:

  # cat test.sh
  ((exec -a myname true 2>/dev/null) && echo "OK") || echo "fail"

  # sh ./test.sh
  fail
  # bash ./test.sh
  OK
  # tcsh ./test.sh
  -a: Command not found.
  fail

Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>



      **NOTE:** GitHub Services has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      We will provide an alternative path for the email notifications by January 31st, 2019.


More information about the git mailing list