This fixes a problem with non-threadsafe errno.
Ideally, this would be the use of the AX_PTHREAD macro, but it is GPL 3+
only, which is incompatible with the GPL 2 license of fish. It also
would need extending to cover C++.
For now, fish doesn't build on anything except GCC under Solaris anyway,
so `-pthread` is the right thing to use.
Work on #3340.
Without `-pthread` specified to the compiler, errno is not threadsafe on
Solaris (as _REENTRANT is undefined, and _POSIX_C_SOURCE may not be set
until after the inclusion of <errno.h>).
Work on #3340.
On Solaris, some standard wide character functions are only contained in
the std:: namespace. The configure script now checks for these, enabling
the appropriate `uses` statements in src/common.h.
The checks are handwritten, because Autoconf's AC_CHECK_FUNC macro
always uses C linkage, but the problem only appears under C++ linkage.
Work on #3340.
Currently, the ./configure script generated by autotools will
test if the configure.ac script is newer than its output configure
script, and if so, run autoconf to rebuild it. However autoconf
is no longer sufficient because we have some m4 macros. So now
run autoreconf --no-recursive (per #3572)
* Fix building on Android by avoiding getpwent() if missing with autoconf check
The getpwent() function does not link when building for Android,
and user names on that platform are not interesting anyway.
Using a configure check for stat.st_ctime_nsec fixes building on
Android which has that field but does not define STAT_HAVE_NSEC.
Before this change the Android build failed on the st_ctim.tv_nsec
fallback #else clause.
This change causes our configure script to just use the default behavior
of autoconf: in practice it will try g++ instead of clang++ first.
There are good reasons to use the behavior this reverts, namely g++
might be a symlink to clang++ and clang++ is never a symlink to g++ -
when `configure` says using "g++" that doens't tell us much.
On more systems than not, as far as I can tell, clang++ will often be a
newer compiler than g++ from what I can see as well.
However, it appears we have some bad things happening with Cygwin on
clang.
Fixes#3435
It is believed there are no longer any platforms we support that do not
support passing NULL as the second argument to realpath(). So rather
than duplicating the logic to get reasonable behavior from our
wrealpath() wrapper simply remove the redundant implementation.
Not sure why I crammed $(v) up like that with the parens. This is
a little sed job after regretting the Makefile seeming harder to read.
Certainly better.
We want clang or gcc picked for both C++/C
Few final cleanups - time to feed it to Travis.
Teach autotools about clang++.
- Use AC macros for these utilities in Makefile:
LN_S, MKDIR_P, AWK, GREP, FGREP.
This has the effect on OS X with prefixed coreutils installed
from macports: > make show-LN_S show-MKDIR_P show-AWK show-GREP
LN_S = 'ln -s'
MKDIR_P = '/opt/local/bin/gmkdir -p'
AWK = 'awk'
GREP = '/opt/local/bin/grep'
FGREP = '/opt/local/bin/grep -F'
- Use GNU Make findstrings, wildcard,notdir,
- SHELL = @SHELL@ per reccomended practice and in line with
actual behavior.
- Add output for string wrangling steps
Cppcheck was complaining about the `return val.c_str()` at the end of the
`wgettext()` function. That would normally a bug since the lifetime of
`val` ends when the function returns. In this particular case that's not
true because the string is interned in a cache. Nonetheless, rather than
suppress the lint warning I decided to modify the API to be more idiomatic.
In the process of fixing the aforementioned lint warning I fixed several other
lint errors in that module.
This required making our copy of `wgetopt()` compatible with the rest of
the fish code. Specifically, by removing its local definitions of the
"_" macro so it uses the same macro used everywhere else in the fish
code. The sooner we kill the use of wide chars the better.
This only eliminates errors reported by `make lint`. It shouldn't cause any
functional changes.
This change does remove several functions that are unused. It also removes the
`desc_arr` variable which is both unused and out of date with reality.
Drops configure check for wcsdup, wcslen, wcscasecmp, wcsncasecmp,
wcwidth, wcswidth, wcstok, fputwc, fgetwc, and wcstol. Drop the fallback
implementations of these on non-Snow Leopard platforms.
Work on #2999.
fwprintf would segfault on DragonFly BSD 1.4.0, released in January
2006. This was fixed by DragonFly BSD 1.4.4, released in April 2006. It
seems unlikely that anyone is still running a ten-year-old, unsupported
version, and hoping that fish will continue to build.
I've checked this in virtual machines.
Work on #2999.
This change does several things. First, and most important, it allows
dumping the "n" most recent stack frames on each debug() call. Second,
it demangles the C++ symbols. Third, it prepends each debug() message
with the debug level.
Unrelated to the above I've replaced all `assert(!is_forked_child());`
statements with `ASSERT_IS_NOT_FORKED_CHILD()` for consistency.
- Add options to the autotools build to set the path for the "vendor"
or "extra" configuration snippets, functions and completions
directories.
- Remove the vendor_completions directory from the Xcode build, as
these are relocatable and compiling the paths in does not make sense.
This allows packaging tools like Homebrew and Nix to use a common
directory outside of the main prefix for third-party completions, and
to make these available for programmatic discovery through `pkg-config`.
Closes#2113
There is no longer a good reason to detect whether or not getopt_long()
is available. All UNIX implementations we're likely to run on have it. And
if we ever find one that doesn't the right thing to do is not fallback to
getopt() but to include the getopt_long() source in our package like we
do with the pcre2 library. Since it's licensed under LGPL we can legally
do so if it becomes necessary.
This partially addresses issue #2790.
We identify when the universal variable file has changed out from under us by
comparing a bunch of fields from its stat: inode, device, size, high-precision
timestamp, generation. Linux aggressively reuses inodes, and the size may be
the same by coincidence (which is the case in the tests). Also, Linux
officially has nanosecond precision, but in practice it seems to only uses
millisecond precision for storing mtimes. Thus if there are three or more
updates within a millisecond, every field we check may be the same, and we are
vulnerable to the ABA problem. I believe this explains the occasional test
failures.
The solution is to manually set the nanosecond field of the mtime timestamp to
something unlikely to be duplicated, like a random number, or better yet, the
current time (with nanosecond precision). This is more in the spirit of the
timestamp, and it means we're around a million times less likely to collide.
This seems to fix the tests.