Fix configure dirname. Also streamline dirname usage.
POSIX 1003.1 states: "The dirname() function may modify the string
pointed to by path, and may return a pointer to static storage
that may then be overwritten by subsequent calls to dirname()."
Source: http://www.unix.com/man-page/POSIX/3posix/dirname/
Because of this the only sane way of using dirname is to allocate
our own copy of the argument, call dirname and then copy to the
result.
The interesting news is we don't call xdirname anywhere in our
code, yes, not even in Ffile_dirname. In fact the contract as far
as the '/' termination and behavior on "non directory" is
completely different and actually changing it would break
build-autoloads.el and packages.el (easily fixed), and god knows
what other user code.
* m4/sxe-fs-funs.m4: Remove _SXE_CHECK_DIRNAME_SIDE_EFFECT,
_SXE_CHECK_DIRNAME_RETVAL_OWNER and
_SXE_CHECK_DIRNAME_RETVAL_OWNER tests since the change in xdirname
makes these checks not necessary.
* m4/sxe-fs-funs.m4 (SXE_CHECK_BROKEN_DIRNAME): Remove calls to
_SXE_CHECK_DIRNAME_SIDE_EFFECT, _SXE_CHECK_DIRNAME_RETVAL_OWNER
and _SXE_CHECK_DIRNAME_RETVAL_OWNER.
* src/sysdep.h (x__dirname): Provide only a POSIX-aware usage of
dirname. This means copying the argument to the result buffer
before calling dirname and the result (if not at start of the
result buffer), using xstrncpy if non-overlapping, memmove if
overlapping.