Test case for an aspect of Redmine 6027

If create, depth_search and copy_from attributes are mixed in a
promise, then a file is created unless explicitly marked as a
directory via trailing "/.".
Minor cleanups.

Declare fd when it's needed, and move comment into right location.
Remove comment that adds no value.
Assume promiser is a directory if depth_search is set

depth_search only makes sense if the promiser should be a directory
that might be copied from a remote server. So make sure we execute
the same code as if the policy writer expliclty asked for the promiser
to be created as a directory by suffixing with "/.".

Attempt to fix various redmine tickets reporting that copy_from
promises for remote directories create local files. Assumption is
that network interruption aborts transmission of data that tells
client that remote sources are a directory tree, and lacking the
'/.' in the promiser the client defaults to file creation.

Redmine #3400, 6027
Move test case for bug in files into right place
Record a kept promise only if nothing was repaired.

There is no code anywhere that sets a class "repaired", so this
call to cfPS would happen in all cases where the basedir was
not included, incorrectly setting "kept" classes.

Fixes Redmine 6509
Fix bug in testcase.

The file_select body in those examples never should have
matched the base-directory, so no kept or repaired class
should have been set for it either.
Petty space changes.

Don't leave space between function name and open parentheses.
Put first line of function on a line after the the opening brace.
Clean-up in LinuxDebianSanitizeIssue()

Make its @brief actually brief.  Describe what it does more
accurately.  Its caller ignored its return which was always success;
so don't bother with it, just be void.  The implementation was messy;
tidied it up and simplified it.
Split some long lines, ditch some superfluous assignments.

Assigning a variable the value it already has is just distracting.

When a condition combines three flags with || and the flags are very
similar, it's much easier to see what they share and where they differ
if they're lined up vertically, with the identical parts equally
indented.
Simplify DetermineCfenginePort().

Make a variable more local, turn an else { if ... } into an else if.
Only Log() that we've set the port if we actually did set it.
Simplify return of a boolean.
Prefer strlcpy over snprintf; and use sizeof()
Minor de-uglifications.

Made variables more local, turn assignments into initializers for
declarations (especially where they were inside a conditional before),
skip spurious parentheses round various conditions.  Drop space
between assert and its parameter list.  Kill some fatuous casts.
Merge pull request #1987 from ediosyncratic/cfnet-fixes

cfnet clean-ups
Merge pull request #1991 from vohi/redmine/6027

Redmine/6027
Merge pull request #1993 from vohi/redmine/6509

Redmine/6509
Increase timeout in acceptance test for our slow Solaris machine.
Add ENOLINK define for Windows.

It is needed in order to test return values from safe_open, but it
will never actually be returned by safe_open on Windows, since it is
only a very thin wrapper there.
Redmine #6570: Improve error messages when encountering unsafe links.

Change the return code when we encounter unsafe symlinks so that the
message in general is more understandable. We're forced to use errno
codes, which doesn't give us the greatest selection, but ENOLINK
('Link has been severed') seems like the best one.
Detect when open fails due to an already existing file in safe_open.

This is in order to give better error messages based on the error
code.

Redmine #6570.