Merge pull request #2041 from pasinskim/3.6.x

Redmine#6674 cherries
cf_popen() generates an error message on distributions where ifconfig cannot be found during IPv6 discovery, affects RHEL 7

(cherry picked from commit b957ad6eb19c3fdb3c62940c61a24266f4fbcff3)
cf_popen() generates an error message on distributions where netstat et al cannot be found during monitoring probing, affects RHEL 7

(cherry picked from commit 6bebdcc08a1899a89f17a8a0e9e2b4904c61c1bb)
Fix broken variables tree iteration.

This fixes whole number of problems with iterating through RB tree
containing variables. Especially:
https://dev.cfengine.com/issues/6033
https://dev.cfengine.com/issues/6779

EvalContextVariableTableIteratorNew is calling VariableTableIteratorNew
which is not aware of variable indexes (VarRef->indices). Then while picking
value form tree to be iterator it might or might not contain indexes.
Randomly selecting variable with wrong index (and number of indexes)
is causing wrong behavior while iterating through list of variables.
VariableTableIteratorNext is checking indexes and returning variables
based on VariableTableIterator selected previously by
EvalContextVariableTableIteratorNew which is totally unreliable in case
of arrays.
(cherry picked from commit e2c8cd0f2fb9724e47330ecaca7fdd452a7bc60a)

Conflicts:

	libpromises/evalfunction.c
Fix relaying on order of keys returned by maparray.
(cherry picked from commit e4809443a5b959f3166ea718df87792380733712)