Commit Graph

167 Commits

Author SHA1 Message Date
Fabian Homborg
b2b4ab4bab constref more things
Thanks @ridiculousfish!
2018-05-28 12:10:40 +02:00
Fabian Homborg
4dc1c6ca39 [string] Allow url/var escaping to handle NULs
Fixes #4605.
2018-05-28 12:10:40 +02:00
Fabian Homborg
a229f703ae Allow escape_string_url from escape_string with wcstring
This was an oversight.
2018-05-28 12:10:39 +02:00
Fabian Homborg
338b40bb43 Trust the passed size in escape_string_script
This allows it to handle NULs.
2018-05-28 12:10:39 +02:00
ridiculousfish
4194b4efee Add a feature_test() function
This is a convenience over fish_features().test()
2018-05-06 11:20:15 -07:00
ridiculousfish
762c31be87 Feature flag support for ? wildcard
This partially reverts 6e56637cf0 and #4520
by bringing back the ? wildcard, guarded by the qmark-noglob feature flag.
2018-05-06 11:20:15 -07:00
ridiculousfish
902af26253 Bring back caret redirections under a feature flag
This partially reverts 5b489ca30f, with
carets acting as redirections unless the stderr-nocaret flag is set.
This flag is off by default but may be enabled on the command line:

fish --features stderr-nocaret
2018-05-06 11:20:14 -07:00
Fabian Homborg
baeeef3233 Remove triggerable assert in unescape_string_internal
Fixes #4954 - in a hacky way.
2018-05-02 16:35:56 +02:00
Mahmoud Al-Qudsi
a9b582d2a8 Block .dll files from completion as potential heads under WSL 2018-04-14 23:56:30 -05:00
Peter Ammon
5b489ca30f Remove caret redirection
This removes the caret as a shorthand for redirecting stderr.

Note that stderr may be redirected to a file via 2>/some/path...
and may be redirected with a pipe via 2>|.

Fixes #4394
2018-04-01 13:48:21 -07:00
ridiculousfish
6e56637cf0 Remove support for the ? wildcard
Fixes #4520
2018-03-31 16:54:50 -07:00
Mahmoud Al-Qudsi
412c5aeaa6 Use alternative Unicode glyphs if compiled under Windows/WSL
The two unicode glyphs used to represent missing new lines and redacted
characters for secure entry are both not present in the glyph tables of
the default font under Windows (Consolas and Lucida Console), use an
alternative glyph instead.

The "return" symbol is replaced with a pilcrow (¶) and the "redacted
character" symbol is replaced with a bullet (•). Both of these are
well-defined in almost all fonts as they're very old symbols. This
change only takes place if -DWSL is supplied by the build toolchain.

Note: this means a Windows SSH client connecting to a fish remote
instance on a non-Windows machine will still use the (unavailable)
default glyphs instead.
2018-03-28 14:27:25 -05:00
ridiculousfish
669eafb55f Stop exporting empty variables as ENV_NULL
Localize the encoding of empty variables as ENV_NULL into the universal
variables component, and ensure they are not exported as ENV_NULL.

Fixes #4846
2018-03-24 23:42:09 -07:00
Mahmoud Al-Qudsi
0b96b516d5 Improve and expand is_whitespace helper functions 2018-03-12 08:06:50 -05:00
Mahmoud Al-Qudsi
24afff1c77 Handle whitespace within parameter expansion tokens
From the discussion in #3802, handling spaces within braces more
gracefully. Leading and trailing whitespace that isn't quoted or escaped
is stripped, whitespace in the middle is preserved. Any whitespace
encountered within expansion tokens is treated as a single space,
similar to how programming languages that don't hard break tokens/quotes
on line endings would.
2018-03-11 22:02:43 -05:00
Mahmoud Al-Qudsi
1629d339de Properly parse spaces and escaped/quoted spaces in expansion braces 2018-03-11 19:51:54 -05:00
Mahmoud Al-Qudsi
65a03c86cb Rename BRACKET in reference to { to BRACE instead per #3802
This `{` is a curly brace. This `[` is a square bracket.
2018-03-10 13:16:53 -06:00
Mahmoud Al-Qudsi
1fbf810946 Unify ellipsis_str[ing] with common variable set once 2018-03-09 14:40:35 -06:00
Mahmoud Al-Qudsi
e45e2bf20e Initial removal of '%' syntax for process/job expansion 2018-03-09 03:36:10 -06:00
Mahmoud Al-Qudsi
3c895c2839 Add whitespace helpers to complete.h/cpp 2018-03-06 12:52:42 -06:00
Mahmoud Al-Qudsi
000892e315 Use constexpr for is_windows_subsystem_for_linux()
To guarantee that at runtime there will be no branching, using a CMAKE
test/define combined with a constexpr wrapper for code-friendliness.
2018-03-04 21:13:31 -06:00
ridiculousfish
74e6a82849 Remove explicit 'void' parameters. 2018-02-18 19:12:45 -08:00
ridiculousfish
3a45cad12e Introduce fish_mutex_t wrapping std::mutex
Add a fish-specific wrapper around std::mutex that records whether it is
locked in a bool. This is to make ASSERT_IS_LOCKED() simpler (it can just
check the boolean instead of relying on try_lock) which will make Coverity
Scan happier.

Some details: Coverity Scan was complaining about an apparent double-unlock
because it's unaware of the semantics of try_lock(). Specifically fish
asserts that a lock is locked by asserting that try_lock fails; if it
succeeds fish prints an error and then unlocks the lock (so as not to leave
it locked). This unlock is of course correct, but it confused Coverity Scan.
2018-02-08 22:18:59 -08:00
Mahmoud Al-Qudsi
fbc6c68f3d Handle error opening /dev/null in redirect_tty_output
This fixes coverity scan defect number 7520299
2018-02-08 17:05:13 -06:00
Mahmoud Al-Qudsi
3083e0ea80 Work around false positive RESOURCE_LEAK in coverity scan
Fixes defect number 7520322
2018-02-08 16:59:38 -06:00
Mahmoud Al-Qudsi
82b7e6de69 Fix unused code (coverity defect #7520283)
Due to the logic above, isz cannot be zero if we take the else branch.
2018-02-08 16:54:28 -06:00
ridiculousfish
cef39cdcc0 Add is_windows_subsystem_for_linux to detect WSL 2018-02-07 12:49:11 -08:00
Fabian Homborg
aa58cae601 Don't count successive "," as literal in brace expansion
This was highly surprising.

Fixes #3002.
2018-01-07 15:00:44 +01:00
ridiculousfish
457213a768 Turn debug() into a macro
A large portion of time was spent constructing strings and passing
them to debug(). Turn debug into a macro so that the strings are only
constructed if they're going to be printed.
2017-12-22 15:19:08 -08:00
Fabian Homborg
f9d883dd74 Add and use str2wcstring(string, size_t)
This is just for convenience.
2017-12-20 14:31:29 +01:00
David Adam
216c4b811a only call ioctl to export new termsize if process is in the foreground
Closes #4477.
2017-10-21 07:21:17 +08:00
Kurtis Rader
026cb48dce Remove unintended change from prev commit 2017-09-21 12:45:54 -07:00
Kurtis Rader
b241bf4140 Use \uXXXX consistently for unicode code points
A recent discussion involving whether `can_be_encoded()` was broken
caused me to notice that we are inconsistent about whether Unicode code
points are specified using `\xXXXX` or `\uXXXX` notation. Which is
harmless but silly and potentially confusing.
2017-09-20 22:00:14 -07:00
Mahmoud Al-Qudsi
039c3c1673 Drop unused parameters to show_stackframe on non-Linux systems
Fixed a warning about unused parameters on systems where
HAVE_BACKTRACE_SYMBOLS is not defined.
2017-09-10 10:52:41 -05:00
ridiculousfish
cb352317bd Simplify the cached_esc_sequences_t structure
The type cached_esc_sequences_t caches escape sequences, and is tasked
with finding an escape sequence that prefixes a given string. Before
this fix, it did so by storing the lengths of cached escape sequences,
and searching for substrings of that length. The new implementation
instead stores all cached escape sequences in a sorted vector, and uses
binary search to find the shortest escape sequence that is a prefix of
the input. This is a substantial simplification that also reduces
allocations.
2017-09-01 14:36:16 -07:00
ridiculousfish
3d40292c00 Switch env_var to using maybe_t
This eliminates the "missing" notion of env_var_t. Instead
env_get returns a maybe_t<env_var_t>, which forces callers to
handle the possibility that the variable is missing.
2017-09-01 00:14:42 -07:00
Mahmoud Al-Qudsi
e76c1fd139 Remove custom lock types in favor of native C++11 mutexes
No longer using RAII wrappers around pthread_mutex_t and pthread_cond_t
in favor of the C++11 std::mutex, std::recursive_mutex, and
std::condition_variable data types.
2017-08-18 23:09:31 -05:00
Kurtis Rader
f872f25f5b change env_var_t to a vector of strings
Internally fish should store vars as a vector of elements. The current
flat string representation is a holdover from when the code was written
in C.

Fixes #4200
2017-08-18 16:24:30 -07:00
Mahmoud Al-Qudsi
e6bb7fc973 Silence unused result warnings on newer compilers
Newer versions of GCC and Clang are not satisfied by a cast to void,
this fix is adapted from glibc's solution.

New wrapper function ignore_result should be used when a function with
explicit _unused_attribute_ wrapper is called whose result will not be
handled.
2017-08-14 18:18:10 -07:00
Kurtis Rader
42ddab0cb4 make missing_var a singleton
Make the `env_var_t::missing_var()` object a singleton rather than a
dynamically constructed object. This requires some discipline in its use
since C++ doesn't directly support immutable objects. But it is slightly
more efficient and helps identify code that incorrectly mutates `env_var_t`
objects that should not be modified.
2017-08-14 18:18:10 -07:00
Kurtis Rader
58b604c5ba change order of env_set() args
It's bugged me forever that the scope is the second arg to `env_get()`
but not `env_set()`. And since I'll be introducing some helper functions
that wrap `env_set()` now is a good time to change the order of its
arguments.
2017-08-14 18:18:09 -07:00
Kurtis Rader
82b5ba1af4 fix bug in env_get() involving empty vars
My previous change to eliminate `class var_entry_t` caused me to notice
that `env_get()` turned a set but empty var into a missing var. Which
is wrong. Fixing that brought to light several other pieces of code that
were wrong as a consequence of the aforementioned bug.

Another step to fixing issue #4200.
2017-08-14 18:18:09 -07:00
Kurtis Rader
c36ad27618 stop subclassing env_var_t from wcstring
This is the first step to implementing issue #4200 is to stop subclassing
env_var_t from wcstring. Not too surprisingly doing this identified
several places that were incorrectly treating env_var_t and wcstring as
interchangeable types. I'm not talking about those places that passed
an env_var_t instance to a function that takes a wcstring. I'm talking
about doing things like assigning the former to the latter type, relying
on the implicit conversion, and thus losing information.

We also rename `env_get_string()` to `env_get()` for symmetry with
`env_set()` and to make it clear the function does not return a string.
2017-08-06 13:24:34 -07:00
Mahmoud Al-Qudsi
7a18c37b39 Using write_ignore instead of write where the result is not checked
This silences warnings from the compiler about ignoring return value of
‘ssize_t write(int, const void*, size_t)’, declared with attribute
warn_unused_result [-Wunused-result].
2017-07-27 18:07:58 -07:00
Kurtis Rader
a9aa234a64 implement helper functions for fish script vars
This is the first step in implementing a better abstraction for handling
fish script vars in the C++ code. It implements a new function (with two
signatures) to provide a standard method for construct the flag string
representation of a fish script array.

Partial fix for #4200
2017-07-08 13:14:30 -07:00
Fabian Homborg
bb90a4e4a9 Always initalize "success" in unescape_string
gcc warns about this.
2017-07-04 23:52:39 +02:00
Kurtis Rader
f3cb625802 implement string unescape
Fixes #3543
2017-06-23 22:23:01 -07:00
Kurtis Rader
60bca14b37 implement string escape --style=xxx
We need a way to encode arbitrary strings into valid fish variable
names. It would also be nice if we could convert strings to valid URLs
without using the slow and hard to understand `__fish_urlencode` function.
In particular, eliminating the need to manipulate the locale.

Fixes #4150
2017-06-23 22:23:01 -07:00
Alan Somers
652faa1a13 Rename __assert to __fish_assert
FreeBSD and possibly other platforms define __assert in their C
libraries.

Fixes #4133
2017-06-17 22:41:24 -07:00
Kurtis Rader
be2b6bfdc9 fix lint errors that have crept in 2017-05-06 22:08:07 -07:00
Kurtis Rader
275d658616 simplify and clarify valid identifiers
This is the first step in addressing issue #3965. It renames some of the
functions involved in validating variable and function names to clarify
their purpose. It also augments the documentation to make the rules for
such identifiers clearly documented.
2017-04-21 21:55:06 -07:00
Marc Garcia Sastre
8213885491 Capture read command contents without displaying it via a silent flag.
Implement a `read --silent` flag. This echos the input using an
obfuscation character.
2017-04-11 19:06:48 -07:00
Kurtis Rader
03571b82be cleanup env code and contains()
Switch from null terminated arrays to `wcstring_list_t` for lists of
special env var names. Rename `list_contains_string` to `contains` and
modify the latter interface to not rely on a `#define`.

Rename `list_contains_string()` to `contains()` and eliminate the
current variadic implementation. Update all callers of the removed
version to use the string list version.
2017-04-05 17:09:12 -07:00
Kurtis Rader
ae0321778f empty CDPATH elements are equivalent to "."
In the process of fixing the issue I decided it didn't make sense to
have two, incompatible, ways of converting variable strings to arrays.
Especially since the one I'm removing does not return empty array elements.

Fixes #2106
2017-03-22 19:30:42 -07:00
Kurtis Rader
84cf391faa style cleanups 2017-03-15 14:06:58 -07:00
Kurtis Rader
8efe88201e correct escape_string corner case
Fixes #3892
2017-03-13 20:38:57 -07:00
Kurtis Rader
e0f62c178f make not blocking signals the default
This is the next step in determining whether we can disable blocking
signals without a good reason to do so. This makes not blocking signals
the default behavior. If someone finds a problem they can add this to
their ~/config/fish/config.fish file:

set FISH_NO_SIGNAL_BLOCK 0

Alternatively set that env var before starting fish. I won't be surprised
if people report problems. Till now we have relied on people opting in
to this behavior to tell us whether it causes problems. This makes the
experimental behavior the default that has to be opted out of. This will
give us a lot more confidence this change doesn't cause problems before
the next minor release.

Note that there are still a few places where we force blocking of
signals. Primarily to keep SIGTSTP from interfering with the shell in
response to manipulating the controlling tty. Bash is more selective
in the signals it blocks around the problematic syscalls (c.f., its
`git_terminal_to()` function). However, I don't see any value in that
refinement.
2017-03-10 21:34:24 -08:00
Kurtis Rader
4ad5b756e4 more sanity involving fatal errors
This folds the "VOMIT_*" family of macros into the assert and DIE
family.

Another change related to issue #3276.
2017-02-14 21:09:15 -08:00
Kurtis Rader
509ee64fc9 implement our own assert() function
I recently upgraded the software on my macOS server and was dismayed to
see that cppcheck reported a huge number of format string errors due to
mismatches between the format string and its arguments from calls to
`assert()`. It turns out they are due to the macOS header using `%lu`
for the line number which is obviously wrong since it is using the C
preprocessor `__LINE__` symbol which evaluates to a signed int.

I also noticed that the macOS implementation writes to stdout, rather
than stderr. It also uses `printf()` which can be a problem on some
platforms if the stream is already in wide mode which is the normal case
for fish.

So implement our own `assert()` implementation. This also eliminates
double-negative warnings that we get from some of our calls to
`assert()` on some platforms by oclint.

Also reimplement the `DIE()` macro in terms of our internal
implementation.

Rewrite `assert(0 && msg)` statements to `DIE(msg)` for clarity and to
eliminate oclint warnings about constant expressions.

Fixes #3276, albeit not in the fashion I originally envisioned.
2017-02-14 18:48:27 -08:00
Kurtis Rader
69731f6642 more IWYU fixes
I'm starting to wonder if IWYU is worth the effort. Nonetheless, this
makes it lint clean on macOS and reduces the number of warnings on
FreeBSD and Linux.
2017-02-12 20:36:37 -08:00
Kurtis Rader
4ffb0adb78 lint cleanups 2017-02-11 21:30:38 -08:00
Kurtis Rader
0a929f7a0b don't export COLUMNS/LINES unless already exported
Fixes #3839
2017-02-10 15:20:09 -08:00
ridiculousfish
0fefdb458f Revert "Adopt owning_lock and some cleanup of termsize storage in common.cpp"
Tests are failing on Travis but not locally

This reverts commit c5d9e7e391.
2017-01-29 19:33:30 -08:00
ridiculousfish
c5d9e7e391 Adopt owning_lock and some cleanup of termsize storage in common.cpp 2017-01-29 18:15:38 -08:00
ridiculousfish
e78cefd759 Defeat "enumeral mismatch" g++ warnings through typecasting 2017-01-26 17:18:38 -08:00
ridiculousfish
1efb81456b Use std::move instead of swap in a few places where it improves clarity 2017-01-26 16:14:50 -08:00
Kurtis Rader
2be1288cac handling when stty reports zero for termsize
If the kernel reports a size of zero for the rows or columns (i.e., what
`stty -a` reports) fall back to the `COLUMNS` and `LINES` variables. If
the resulting values are not reasonable fallback to using 80x24.

Fixes #3740
2017-01-20 15:34:29 -08:00
Kurtis Rader
fd6d814ea4 remove unnecessary signal management
The shell was doing a log of signal blocking/unblocking that hurts
performance and can be avoided. This reduced the elapsed time for a
simple benchmark by 25%.

Partial fix for #2007
2017-01-14 20:51:54 -08:00
Kurtis Rader
56e05dab02 another attempt to workaround a glibc bug
This is another attempt to fix issue #3644 that we believe is due to issue
https://sourceware.org/bugzilla/show_bug.cgi?id=20632.
2017-01-13 21:18:34 -08:00
Kurtis Rader
2e9a349dd0 normalize use of stdio functions taking a stream
We should never use stdio functions that use stdout implicitly. Saving a
few characters isn't worth the inconsistency. Too, using the forms such
as `fwprintf()` which take an explicit stream makes it easier to find
the places we write to stdout versus stderr.

Fixes #3728
2017-01-13 20:48:55 -08:00
Fabian Homborg
177e06808c Replace all printf invocations with wprintf
Remember, GNU doesn't allow mixing narrow and wide IO.
2017-01-07 14:05:42 +01:00
Kurtis Rader
6f8775499f don't warn about EPIPE errors
Emitting warnings about EPIPE errors when writing to stdout or stderr is
more annoying than helpful. So suppress that specific warning message.

Fixes #2516
2017-01-06 23:59:06 -08:00
Kurtis Rader
b118ed69d3 convert narrow stderr output to wide forms
On some platforms, notably GNU libc, you cannot mix narrow and wide
stdio functions on a stream like stdout or stderr. Doing so will drop
the output of one or the other. This change makes all output to the
stderr stream consistently use the wide forms.

This change also converts some fprintf(stderr,...) calls to debug()
calls where appropriate.

Fixes #3692
2017-01-03 16:14:42 -08:00
Kurtis Rader
7c40abe4a6 switch from \1xb to \e in the code
Using `\e` is clearer and shorter than `\x1b`. It's also consistent with how
we write related control chars; e.g., we don't write `\x0a` we write '\n'.
2016-12-24 12:15:28 -08:00
Kurtis Rader
396bf1235d workaround glibc bug that can corrupt malloc arena
If an interactive shell has its tty invalidated attempts to write to
stdout or stderr can trigger this bug:

https://sourceware.org/bugzilla/show_bug.cgi?id=20632

Avoid that by reopening the stdio streams on /dev/null if we're getting
an ENOTTY error when trying to do things like give or take ownership of
the tty.

This includes some unrelated style cleanups but including them seems
reasonable.

Fixes #3644
2016-12-14 20:12:37 -08:00
ridiculousfish
754b78a748 Suppress certain stderr-printing during tests
Tests that exercise error paths may result in output to
stderr. This may make it look like the test failed when it did
not. Introduce should_suppress_stderr_for_tests() to suppress
this output so the test output looks clean.
2016-12-03 13:27:50 -08:00
Kurtis Rader
609100c196 detect if the magic fish wide chars can be encoded
Verified on Cygwin on MS Windows 7 when invoked as
`env LANG=zh_CN.GBK@cjknarrow fish`. No regression seen
when run on other systems with UTF-8 locales.

Fixes #3503
2016-11-07 13:19:09 -08:00
Kurtis Rader
b7d910a941 lint: long variable name 2016-11-03 16:19:41 -07:00
Kurtis Rader
71e69b6d75 lint: empty if statement 2016-11-01 20:42:02 -07:00
Kurtis Rader
6bef7b7be9 lint: constant if expression 2016-10-29 19:01:19 -07:00
Kurtis Rader
b0b2182535 lint: missing default in switch statements 2016-10-29 18:27:51 -07:00
Kurtis Rader
f382fa8e8a lint: multiple unary operator 2016-10-27 21:21:54 -07:00
Kurtis Rader
42458ff7ab lint: "collapsible if statements" warnings 2016-10-22 19:09:40 -07:00
Kurtis Rader
6e6b294a3f lint: deal with "double negative" warnings 2016-10-20 21:14:40 -07:00
Kurtis Rader
00303ed07f lint cleanup: parameter reassignment 2016-10-20 18:53:31 -07:00
Kurtis Rader
8a2d6a9752 fix/unify tests for chars in fish reserved ranges 2016-10-17 18:46:53 -07:00
Kurtis Rader
c07c98ac05 eliminate many "unused parameter" warnings
Partially addresses issue #3430.
2016-10-09 14:38:26 -07:00
Kurtis Rader
851e449347 eliminate signed/unsigned comparison warnings
This partially addresses #3430.
2016-10-09 14:36:08 -07:00
Kurtis Rader
92dd6de73c deal with broken unicode implementations
Both GNU and BSD have bugs regarding the classification of
non-characters and private use area characters. Provide wrappers around
iswalnum(), iswalpha(), and isgraph() to provide a consistent
experience. We don't bother to autoconf the use of these wrappers for
several reasons. Including the fact that a binary built for one distro
release should behave correctly on another release (e.g., FreeBSD 10
does the right thing while FreeBSD 11 and 12 do not with respect to
iswalnum() of code points in the range 0xFDD0..0xFDFF).

Also move a few functions from common.* to wutil.* because they are wide
char specific and really belong in the latter module.

Fixes #3050
2016-09-27 21:34:02 -07:00
Aaron Gyes
acfd380176 Fix two things -Wconditional-uninitialized warned about
Rather minor stuff:
* Initliaze first case to 0.
* The other (saved_errno), move the error output it is for
  in-scope and not need at all.
2016-07-30 03:34:46 -07:00
Aaron Gyes
44cde9e0e9 fish_key_reader #includes need to be updated 2016-06-28 02:57:14 -07:00
Kurtis Rader
b2a2705df4 croak if gettimeofday() fails
There is no conceivable way in which timef()'s invocation of gettimeofday()
can fail where it makes sense to continue running.  Yes, one such,
legitimate, failure mode is a 32-bit kernel and the date is greater than
2038-01-19 03:14:07. If you're running a fish binary on such a system
it's time to upgrade.  Otherwise, either the hardware or OS is broken.

Fixes #3167.
2016-06-24 19:32:46 -07:00
Aaron Gyes
fa78a7101c Make IWYU output in lint.cpp less messy
And re-run IWYU, adjust #includes.
2016-06-23 17:26:08 -07:00
Kurtis Rader
8e21d5de92 deal with broken ttys on MS Windows
The tty device timestamps on MS Windows aren't usable because they're always
the current time. So fish can't use them to decide if the entire prompt needs
to be repainted.

Fixes #2859
2016-06-18 19:33:54 -07:00
Aaron Gyes
9f0c31611c Lint Cleanup
This remove some stores that clang assures me are very dead.

And an assert() for an unlikely NULL pointer dereference I can't quite
figure out.
2016-06-14 19:27:00 -07:00
Kurtis Rader
d70be18c42 use fish_wcwidth rather than wcwidth
Minor cleanup related to issue #2199.
2016-06-14 17:17:31 -07:00
Kurtis Rader
0b385f145c simplify, and fix, setting the current locale
Fix test setup bogosities. Specifically, they weren't hermetic with respect to
locale env vars.

Rewrite the handling of locale vars to simplify the code and make it more like
the pattern most programs employ.

Fixes #3110
2016-06-05 15:49:34 -07:00
Kurtis Rader
8f420b9272 Fix wide char related tests on Cygwin
This makes the wide char tests run by `./fish_tests` pass on systems where
sizeof wchar_t is two (e.g., Cygwin). In doing so it corrects several
problems with the underlying code in module *utf8.cpp* such as allowing
five and six byte UTF-8 sequences. They were allowed by the original
Unicode proposal but are not allowed by the adopted standard.
2016-05-26 20:24:03 -07:00
Kurtis Rader
7c24369454 fix building on Cygwin
Cygwin still doesn't support any of the backtrace functions. Also, remove a
spurious newline from a debug message.

Fixes #2993
2016-05-19 19:27:22 -07:00
Kurtis Rader
46be5ac468 make fish buildable on OS X Snow Leopard
I noticed that the `test_convert()` function was randomly failing when
run on OS X Snow Leopard. I tracked it down to the `mbrtowc()` function on
that OS being broken. Explicitly testing for UTF-8 prefixes that identify
a sequence longer than four bytes (which the Unicode standard made illegal
long ago) keeps us from having encoding errors on those OS's.

This also makes the errors reported by the `test_convert()` function actually
useful and readable.

Lastly, it makes it possible to build fish on OS X Snow Leopard.
2016-05-19 18:42:34 -07:00