RedMine 6397 mitigation: use alternate column instead of empty.

In SplitProcLine(), we parse the line two ways; if the two don't
agree, we winge about it; but we use the first one anyway.  We see
some cases where Solaris ps gets a better answer from the second than
from the first; so use the second by default and fall back to the
first if it's empty.
Redmine #6421: Fix incorrect newline mode when reading in execresult.

The output is expected to be text, so it should be read in text mode,
converting "\r\n" to "\n" in the resulting variable.
Merge pull request #1872 from kacfengine/execresult_newline_mode

Redmine #6421: Fix incorrect newline mode when reading in execresult.
Changelog entry for LMDB robustness patch.
Merge pull request #1873 from kacfengine/master

Changelog entry for LMDB robustness patch.
disable failing unit test redmine 6314
Merge pull request #1874 from MatthewCattell/disable-failing-aix-unit-tests

disable failing unit test redmine 6314
Fix memory leak in IsProcessNameRunning().

When it finds a matching row, it breaks out of the loop over rows;
otherwise, it free()s the fragments into which it parsed the line that
just failed.  The matching line's fragments need free()d just as much.
Assorted clean-up in processes_select.c

Casting the paramater of isspace to int is dumb; even without the
overt cast, that would happen.  As it happens, isspace wants to be
given an int whose value is either that of an unsigned char or EOF
(which is -1).  So, when passing a char to it (which is what we're
doing) we *do* need to cast it - to unsigned char - after all.
Likewise for isalnum().

Various loops were needlessly complicated by mishandling the 0 case,
leading to kludges to not end up with the wrong answer.  Use the right
test, avoid the dumb kludges.

Prefer memcpy (with explicit termination) over strncpy and kill the
wanton memset(,0,)s implicit in an initializer that assured the
strncpy() would have a trailing '\0'.

Kill a spurious continue (in an if, whose else was the rest of the
loop anyway).

Removed misleading " INFO - " from the front of a LOG_LEVEL_VERBOSE.
Chop() was being called with the wrong size for its buffer.
A loop variable could be made more local and const.
Turn some untidy while loops into for loops.
Split some lines to make them more readable.
Made diverse other locals more local.
Fewer parentheses.
Rework SplitProcLine(): smarter growing of fields outside columns.

GetProcessColumnNames() records the start and end columns of the
headings for ps-output.  SplitProcLine() uses these in its second
heuristic for parsing the columns from data lines.  (The first
heuristic simply splits on spaces, aside from a minor kludge for
STIME.  If the two heuristics disagree, we Log() a warning.)  It used
to grow the field outwards, to a space on each side, but limiting
growth to the right to (arbitrarily) ten characters.  This might
extend beyond the next column to either side.  We see Solaris ps can
have fields that abut, which would lead several fields to use the same
text, this way.

Having now studied actual ps output (details documented in a comment
at the start of the heuristic), I've changed this so that:
 * for numeric fields, it grows left, potentially into the previous
   column but never to its start;
 * for text columns it grows right but never overlaps the next column
   header.
Other columns are limited to the width of their header.

It also now strips all leading and trailing space (it used to neglect
this for the last column, even after I fixed assorted off-by-one
errors), which eliminates the need for Chop().

I've also eliminated the assumption that CMD/COMMAND is the last
column - it's easier, safer and correct to test for last column, for
all that this always just happens, for good reason, to be CMD.
Rewrite SplitProcLine() without temp buffers.

Rather than scanning the line twice, filling two arrays with fragments
obtained by two heuristics, so as to be able to compare them, do the
two scans in parallel.  This removes the needs for arrays to hold the
fragments, hence the need to clip a long field if we hit one (it'll be
COMMAND, if it happens), and saves a lot of copying.  We only need to
copy the contents (and clip them) when warning and as part of the
xstrndup(), replacing xstrdup() of a copy, needed to allocate the
fragment saved.
Merge pull request #1871 from ediosyncratic/process-fixes

RedMine 6397: rewrite SplitProcLine and clean up in its file
Redmine #6370: Discard call collect connection.

Instead of sending "BAD: Unspecified server refusal
(see verbose server output)" message to the call collected client
which is not having access to call collect simply refuse connection.

Message sent to the client is interpreted as a call collect queue
length and client assumes that connection is valid.
Redmine #6434: Fix AIX missing a lot of log output.

It happens because we list a static library as a dependency for
libpromises, and then we list the same static library as a dependency
for a binary that depends on libpromises. Then the symbol will be
included both in the library and in the binary.

Exactly how the symbols are resolved appears to be platform dependent,
but what can happen is this: At any point, when you call a duplicate
symbol, depending on where you call it from, you will either call the
version in the binary or in the library. This is fine, since they both
contain exactly the same code. However, they do not refer to the same
global symbols. They each have their own set. This means that
something that was initialized in the binary may not be initialized in
the library, even though the symbol name is the same. This has weird
effects, like a symbol suddenly switching from a valid value to zero
when the stack trace crosses a library boundary.

The problem was observed on AIX, where the log level randomly switches
between verbose and non-verbose, depending on where the Log() function
was called from.
Merge pull request #1876 from pasinskim/ha

Redmine #6370: Discard call collect connection.
patch configure to correctly find libxml2
Redmine #4716: Lots of fixes to dirname(), esp. on Windows.

These problems were fixed:
* AddSlash() always adds Unix slash when argument is empty.
* DeleteSlash() removes root slash.
* DeleteSlash() does not handle repeated path separators.
* FirstFileSeparator() returns NULL on all relative Unix paths, even
  if it has a file separator.
* ChopLastNode() gives empty string when removing last directory
  component of a relative path. It should give '.'.
* ChopLastNode() does not handle Windows drive letters.
* ChopLastNode() does not handle repeated path separators.
* IsAbsoluteFileName() does not handle absolute paths on Windows that
  don't start with a drive letter. Both types are considered absolute
  paths.

This also fixes a Windows issue where creating a directory in policy
would lead to an error message about not being able to chdir into a
directory with the name ''. This was due to the final root slash not
being preserved.
Merge pull request #1877 from kacfengine/dirname_fixes

Redmine #4716: Lots of fixes to dirname(), esp. on Windows.
Merge pull request #1878 from MatthewCattell/mingw-libxml2-configure-fix

patch configure to correctly find libxml2
Switching to masterfiles inventory_os.description for attribute_name OS for portability