Commit graph

9448 commits

Author SHA1 Message Date
Fabian Homborg
cbc25d7829 [tinyexpr] Port to C++
This removes the need to run c-compilation on one file, and allows us
to in future c++-ify this a bit.

There's a lot of bit-fiddling here that is quite unnecessary, better
error-handling would be nice...

So far this removes a few more unused things (because I would have had
to port them), including:

- Functions with ARITY > 3 (even 3 isn't used, but just so we don't
get complacent)

- Variables

- Most functions moved out of the header, because only te_interp is used.

- The te_print function
2018-12-30 19:34:06 +01:00
Fabian Homborg
dabd05f2e3 Remove string fallback function
We already have a fallback here, and upgrading from 2.3.0 to 3.X will be rare.

This costs every shell on every start.

See #5279.
2018-12-30 19:24:03 +01:00
Fabian Homborg
a7998c4829 Don't ASSERT_IS_NOT_FORKED_CHILD so much
This is hammered sooo much that it actually hurts performance.

    for i in (seq 100000); test 1 = 1; end

is about 40% (!) slower with it.
2018-12-30 18:59:41 +01:00
Mahmoud Al-Qudsi
040d921fa1 Fix check for valid disowned pgids
The function `add_disowned_pgid` adds process *group* ids and not
process ids. It multiplies the value by negative 1 to indicate a wait
on a process group, so the original value must be positive.
2018-12-30 10:15:07 -06:00
Fabian Homborg
4a3ac6e91e Don't wait for disowned pgids if they are special
If a job is disowned that, for some reason, has a pgid that is special
to waitpid, like 0 (process with pgid of the calling process), -1 (any
process), or our actual pgid, that would lead to us waiting for too
many processes when we later try to reap the disowned processes (to
stop zombies from appearing).

And that means we'd snag away the processes we actually do want to
wait for, which would end with us in a waiting loop.

This is tough to reproduce, the easiest I've found was

    fish -ic 'sleep 5 &; disown; set -g __fish_git_prompt_showupstream auto; __fish_git_prompt'

in a git repo.

What we do is to not allow special pgids in the disowned_pids list.
That means we might leave a zombie around (though we probably wait on
0 somewhere), but that's preferable to infinitely looping.

See #5426.
2018-12-30 16:04:57 +01:00
David Adam
32e6bf6f64 debian packaging/fish.spec: drop bc dependency 2018-12-29 23:16:09 +08:00
David Adam
8261eb18d2 pcre2: add maintainer mode and disable by default 2018-12-29 22:54:54 +08:00
David Adam
b60a9d8c4a pcre2: move to PCRE2 10.32
Closes #5353.
2018-12-29 22:54:40 +08:00
Fabian Homborg
742fde0dd6 Don't use less in highlighting test
It doesn't have to be installed.

`cat` is in our dependencies, so we can assume it's there.

Fixes #5436.
2018-12-28 17:57:53 +01:00
David Adam
9e4ece8d89 CHANGELOG: next-minor updates, up to 05222a055a
[ci skip]
2018-12-28 22:18:35 +08:00
David Adam
05222a055a Merge branch 'Integration_3.0.0' 2018-12-28 22:10:49 +08:00
David Adam
938ce48d25 Bump version for 3.0.0 2018-12-28 21:01:03 +08:00
David Adam
0c25d7a49c CHANGELOG: 3.0.0 updates 2018-12-28 20:56:17 +08:00
hrvoj3e
69a1c5a3a1 Fix typos in anchor to fish_opt 2018-12-27 14:45:14 +01:00
Mahmoud Al-Qudsi
fb679ac9c3 Add completions for pkg [info|show|list] 2018-12-23 20:06:25 -06:00
David Adam
d6e315d25d cmake: define _GNU_SOURCE
Fixes the build on Cygwin. Analogous to AC_USE_SYSTEM_EXTENSIONS under Autoconf.

Closes #5423.
2018-12-20 21:36:01 +08:00
Fabian Homborg
50fbc36b73 sample_prompts/sorin: Correct git_action function name
We renamed this, and apparently missed it.

[ci skip]
2018-12-19 09:35:26 +01:00
Leonard Hecker
082450b1e7 Severely extended the sorin theme (#5411)
* Severely extended the sorin theme

This theme should now mostly match the original.

* Removed superfluous whitespace

* Inlined external links as ASCII art

* Made myself the author of the sorin theme

* Removed superfluous read delemiter

* Renamed __fish_git_action to fish_print_git_action

* Adde a minor comment
2018-12-18 15:01:38 +01:00
Fabian Homborg
14ee19cc1b Use HAVE_WCSTOD_L also in header 2018-12-18 11:03:33 +01:00
Aaron Gyes
57d6124e6e builtin_test: don't exit 1 for eval errors, add tests for big args
Return STATUS_INVALID_ARGS when failing due to evaluation errors,
so we can tell the difference between an error and falseness.

Add a test for the ERANGE error
2018-12-16 14:51:26 -08:00
Aaron Gyes
cf2b40040a STATUS_INVALID_ARGS = 2
The rest of the high-numbered exit codes are not values used by scripts
or builtins, they are internal to fish and come out of
the parser for example.

Prior to adding STATUS_INVALID_ARGS, builtins were usually exiting 2
if they had a special exit status for the situation of bad arguments.

Set it to 2.
2018-12-16 14:51:18 -08:00
Aaron Gyes
b404b9392c builtin_test.cpp: split a long line, add braces 2018-12-16 14:51:10 -08:00
Aaron Gyes
1f871c4d0c builtin_test.cpp: check for ERANGE and special fish_wcstoll errno
We were not parsing an in-range number when we claimed we were,
and were thus failing to error with invalid numbers and returned
a wrong test result. Fixed #5414

Also, provide the detail we can for the other error cases.
2018-12-16 14:51:02 -08:00
Aaron Gyes
1adcd2d591 builtin_test: don't exit 1 for eval errors, add tests for big args
Return STATUS_INVALID_ARGS when failing due to evaluation errors,
so we can tell the difference between an error and falseness.

Add a test for the ERANGE error
2018-12-15 22:05:19 -08:00
Aaron Gyes
b8113f8e97 STATUS_INVALID_ARGS = 2
The rest of the high-numbered exit codes are not values used by scripts
or builtins, they are internal to fish and come out of
the parser for example.

Prior to adding STATUS_INVALID_ARGS, builtins were usually exiting 2
if they had a special exit status for the situation of bad arguments.

Set it to 2.
2018-12-15 21:05:27 -08:00
Fabian Homborg
e07b45f447 Revert "completions/git: Allow aliases with whitespace in the command"
This reverts commit 081e14fd21, which was bogus.
2018-12-15 11:13:38 +01:00
Mahmoud Al-Qudsi
3855c2217f Remove scripted XDG_CONFIG_HOME uses
Cleaned up the code to no longer replicate in fishscript what fish
already does (and caches to boot) in C++ in setting up the paths to the
user configuration directory.

Also introduced a `$__fish_user_data_dir` instead of the sporadic
definitions of `$userdatadir` that may or may not go through
`XDG_DATA_HOME`.
2018-12-14 22:09:29 -06:00
Aaron Gyes
1634c0fa49 builtin_test.cpp: split a long line, add braces 2018-12-14 12:43:18 -08:00
Aaron Gyes
4aa069a8ff builtin_test.cpp: check for ERANGE and special fish_wcstoll errno
We were not parsing an in-range number when we claimed we were,
and were thus failing to error with invalid numbers and returned
a wrong test result. Fixed #5414

Also, provide the detail we can for the other error cases.
2018-12-14 11:42:23 -08:00
Aaron Gyes
c1be3284c1 __fish_config_interactive: inline combinational logic
Boost readability of this long, logic-heavy script with the new
&& and || syntax added to fish 3.
2018-12-14 05:49:08 -08:00
Aaron Gyes
ba9c387590 __fish_config_interactive: tighten up checks for OSC 7 feature
I spent some time figuring out $TERM_PROGRAM_VERSION and Terminal.app's
capabilities over time. [1]

Only use OSC 7 if running on the version of Terminal.app that added it
or newer. In the past this would have been harder because `test` couldn't
do float comparisons.

cleanup:
Don't bother setting a local $TERM_PROGRAM if it's unset: quoting
is enough to keep test happy. For the version numbers, 0"$var" is safe
against unset variables for numerical comparisons.

[1]: https://github.com/fish-shell/fish-shell/wiki/Terminal.app-characteristics
2018-12-14 05:00:55 -08:00
David Adam
f8338d63ed Merge branch 'Integration_3.0.0'
Post-3.0b1 fixes merge.
2018-12-14 13:09:39 +08:00
David Adam
5959114103 Revert "history.fish: colorize with fish_indent -d0"
This reverts commit 7ebef0a396 in order to
make merging the changes that drop fish_indent easier and history more
understandable.
2018-12-14 13:09:00 +08:00
Fabian Homborg
081e14fd21 completions/git: Allow aliases with whitespace in the command
Fixes #5412.
2018-12-13 22:49:12 +01:00
Fabian Homborg
99ba07354a fish_vi_key_bindings: Remove weird argv handling
Instead of maybe adding "-s" and "-M" if "-s" hasn't already been
given, just add "-s" to _every_ bind invocation, and "-M" to those who
need it.

Fixes #5028.
2018-12-13 17:33:48 +01:00
David Adam
79d53a32dc history: drop use of fish_indent
Largely reverts 007d794b6e.

fish_indent is extremely resource-intensive on large inputs and can crash; it also does not handle
invalid characters gracefully.

Work on #5402.
2018-12-13 21:57:24 +08:00
Fabian Homborg
ffab420e43 Add fallback wcstod_l for musl
Just sets locale to "C" (because that's the only one we need), does
wcstod and resets the locale.

No idea why uselocale(loc) failed for me, but it did.

Fixes #5407.
2018-12-12 15:12:12 +01:00
Aaron Gyes
40de04cc6c input.cpp: remove impossible switch case
R_BEGIN_INPUT_FUNCTIONS <= c < R_END_INPUT_FUNCTIONS, so c cannot be
R_EOF.
2018-12-11 10:02:25 -08:00
Fabian Homborg
4cf3e62643 Move bare source test to expect
This previously used /dev/tty to make sure we have `source` connected
to a terminal. Only as it turns out, FreeBSD doesn't have that (https://builds.sr.ht/~faho/job/15308).

So instead, let's just use the expect tests since stdin there is by
definition a terminal.
2018-12-11 18:23:37 +01:00
Fabian Homborg
cf16d39872 Explicitly mark fallthrough
Silences a compiler warning (that is otherwise a good thing!)
2018-12-11 18:23:37 +01:00
Aaron Gyes
7ebef0a396 history.fish: colorize with fish_indent -d0
We don't need to alert the user about stripped sequences here.
2018-12-11 06:47:49 -08:00
Aaron Gyes
d080182686 fish_indent: skip past illegal byte sequences
garbage input, indented garbage output.
We print a warning, and will eventually exit 1
2018-12-11 06:45:07 -08:00
David Adam
355cb88e38 Bump version for 3.0b1 2018-12-11 22:04:20 +08:00
David Adam
e0d7f0bc96 osx/config.h: update to match current configure output on 10.11 2018-12-11 21:59:45 +08:00
David Adam
83fbd881e7 osx/config.h: mirror changes in f2a829aa23
[ci skip]
2018-12-11 21:46:43 +08:00
David Adam
87721049db README: small text improvement
[ci skip]
2018-12-11 21:37:41 +08:00
David Adam
566aa6e78f CHANGELOG: final edits to 3.0b1
Up to 99d56ea2f9
2018-12-11 21:37:12 +08:00
Aaron Gyes
99d56ea2f9 Colorful Ninja error output with Apple's clang
CMake detects the clang that comes with Xcode as AppleClang.
6.0 corresponds to upstream LLVM 3.5svn
2018-12-11 03:53:12 -08:00
Aaron Gyes
0b45b474f3 Update bugreport()
I left this out of the last commit accidentally.
2018-12-11 02:50:03 -08:00
Aaron Gyes
f2a829aa23 Direct people to github to report bugs. 2018-12-11 02:47:34 -08:00