Commit Graph

2352 Commits

Author SHA1 Message Date
yogendra
6bed255a52 Fix Issue 5910 2019-06-14 08:56:42 -07:00
ridiculousfish
1c66d56d3a Add debug categories for reaping processes 2019-06-13 14:29:13 -07:00
Fabian Homborg
e363552ef0 screen: Include termios for NetBSD
Otherwise it won't build.
2019-06-11 11:34:14 +02:00
Mahmoud Al-Qudsi
cfe1f1db9e Fix build on FreeBSD 12.0 with stock Clang
`isspace()` is in `ctype.h`.
2019-06-10 16:51:42 -05:00
ridiculousfish
aa950e5c13 Provide an optimized override of get_pwd_slash() 2019-06-10 10:26:33 -07:00
Fabian Homborg
38a7c77e4b Re-double-super-fix tilde completion crash
Yeah, I was too clever with the operators here.

Fixes #5929.
2019-06-10 18:50:40 +02:00
Fabian Homborg
d1ca392393 math: Allow "x" for multiplication
It's always a bit annoying that `*` requires quoting.

So we allow "x" as an alternative, only it needs to be followed by
whitespace to distinguish it from "0x" hexadecimal notation.
2019-06-10 18:45:10 +02:00
ridiculousfish
42138f00c6 Remove wchdir()
It's unused, and will soon be dangerous as the process-wide cwd will
lose meaning.
2019-06-10 09:37:08 -07:00
ridiculousfish
6637ccd3a2 Keep an fd for the cwd in the parser
To support distinct parsers having different working directories, we need
to keep the working directory alive, and also retain a non-path reference
to it.
2019-06-10 09:27:51 -07:00
ridiculousfish
6ce85aebc6 Switch file_io_t to store a wcstring
We no longer use file_io_t after fork(). We don't need to use a malloc'd
string any more. Use a wcstring.
2019-06-09 17:43:25 -07:00
ridiculousfish
1baa479bbf Eliminate the global list of scoped transient commandlines
Store this in a parser's libdata instead.
2019-06-09 14:11:25 -07:00
ridiculousfish
421cf92380 Use a generation count for uvars exports
Because an exported universal variable must be exported in all variable
stacks, explicit invalidation is infeasible. Switch the universal variables
to a generation count.
2019-06-09 13:48:07 -07:00
ridiculousfish
7dffaf1a02 Reimplement exported variable change detection
Prior to this fix, fish would invalidate the exported variable list
whenever an exported variable changes. However we soon will not have a
single "exported variable list." If a global variable changes, it is
infeasible to find all exported variable lists and invalidate them.

Switch to a new model where we store a list of generation counts. Every
time an exported variable changes, the node gets a new generation. If the
current generation list does not match the cached one, then we know that
our exported variable list is stale.
2019-06-09 13:25:30 -07:00
ridiculousfish
79ee59adc0 Convert the create_export_array message to flog 2019-06-09 13:22:18 -07:00
Per Bothner
e05a0716e5 Make sure initial indentation is done using cursor move, not spaces.
The goal to allow a terminal to reliably distinguish user input
from indentation and prompts, in the context of shell integration.
2019-06-09 11:36:47 -07:00
Per Bothner
7448e7825f Avoid code duplication relating to screen clearning in s_update. 2019-06-09 11:32:26 -07:00
Mahmoud Al-Qudsi
c9a77bb474 Optimize history search reset checking
`history_search.active()` is an atomic read, whereas
`command_ends_history_search(..)` is a little bit heavier.
2019-06-08 21:07:32 -05:00
ridiculousfish
be97499106 Revert "Revert "Add a test for autoload_t""
This reverts commit 2507162f80.

Put back the autoload test.
2019-06-07 12:12:43 -07:00
Per Bothner
18cf2b8509 Rename incorrect is_single_byte_escape_seq to is_three_byte_escape_seq. 2019-06-07 08:31:52 +02:00
Per Bothner
060a068a3c Fix comment for is_single_byte_escape_seq. 2019-06-07 08:31:52 +02:00
Fabian Homborg
ae59fdeda5 src/builtin_read: Remove more references to fish_history 2019-06-06 15:07:46 +02:00
Fabian Homborg
51fcb79d96 Remove read history
This was undocumented, not all that useful and potentially unwanted.

In particular it means that things like

   mysql -p(read)

will still keep the password in history.

Also it allows us to simply implement asking for the history deletion
term.

See #5791.
2019-06-06 15:07:46 +02:00
ridiculousfish
fc99d6c7af clang-format all files 2019-06-03 20:30:48 -07:00
ridiculousfish
d1fc8d5f71 Improve the iothread port structure
Mark both fds in the ioport as non-blocking, and allow bulk reads.
2019-06-03 16:42:51 -07:00
ridiculousfish
b478f877ee Clean up g_fork_count
Make it static and atomic
2019-06-03 12:58:59 -07:00
ridiculousfish
bc103c2ea6 Make the list of event handlers thread safe 2019-06-03 12:33:10 -07:00
ridiculousfish
ead16958b2 Make set_signal_observed thread-safe 2019-06-03 12:32:48 -07:00
ridiculousfish
ad301ab3a0 Remove an incorrect shadowing use of principal_parser 2019-06-03 02:55:36 -07:00
ridiculousfish
ff55249447 Make events per-parser
This makes the following changes:

1. Events in background threads are executed in those threads, instead of
being silently dropped

2. Blocked events are now per-parser instead of global

3. Events are posted in builtin_set instead of within the environment stack

The last one means that we no longer support event handlers for implicit
sets like (example) argv. Instead only the `set` builtin (and also `cd`)
post variable-change events.

Events from universal variable changes are still not fully rationalized.
2019-06-03 02:48:35 -07:00
ridiculousfish
890c1188ab Instantize and rationalize locking around the input mapping set
Hypothetically a background thread could invoke builtin_bind, etc.
Protect the set of input bindings with a lock.
2019-06-02 22:54:01 -07:00
ridiculousfish
2ef4d982df Clean up some dependencies in input.h 2019-06-02 17:49:52 -07:00
ridiculousfish
ad35fb7457 Make the bind mode per-parser
Eliminates a use of principal_parser
2019-06-02 16:57:52 -07:00
ridiculousfish
671df14178 Thread a parser into inputter_t 2019-06-02 16:41:13 -07:00
ridiculousfish
a48dbf23b8 Instantize the character event queue
Wrap this stuff up in structs so it's no longer global.
2019-06-02 16:37:05 -07:00
Fabian Homborg
6c1d29e14d fixup! Fix build
I deleted the lines that defined "narrow_path" and
"explicit_vars_path", but didn't see the two remaining uses.

Sorry!
2019-06-01 10:32:30 +02:00
Fabian Homborg
7525befadb path_get_path: Narrow string before
This cuts down on the wcs2string here by ~25%.

The better solution would be to cache narrow versions of $PATH, since
we compute that over and over and over and over again, while it rarely changes.

Or we could add a full path-cache (where which command is), but that's
much harder to invalidate.

See #5905.
2019-06-01 09:57:18 +02:00
Fabian Homborg
5ca14904d0 Store narrow version of uvar path
This sets the explicit path to the default one, which should be okay,
since the default path never changes (not even if $XDG_CONFIG_HOME
does).

Then it saves a narrow version of that, which saves most of the time
needed to `sync` in most cases.

Fixes #5905.
2019-06-01 09:56:57 +02:00
Fabian Homborg
bc19647be2 wutil: Give narrow versions of a few functions
Note that this isn't technically *w*util, but the differences between
the functions are basically just whether they do the wcs2string
themselves or not.
2019-06-01 09:34:47 +02:00
ridiculousfish
4e03d3c264 Correct a race in topic monitor
This fixes a race condition in the topic monitor. A thread may decide to
enter the wait queue, but before it does the generation list changes, and
so our thread will wait forever, resulting in a hang.

It also simplifies the implementation of the topic monitor considerably;
on reflection the whole "metagen" thing isn't providing any value and we
should just compare generations directly.

In the new design, we have a lock-protected list of current generations,
along with a boolean as to whether someone is reading from the pipe. The
reader (only one at a time) is responsible for broadcasting notifications
via a condition variable.
2019-05-31 09:31:42 -07:00
ridiculousfish
d920a618de Add FLOG logging to the topic monitor 2019-05-31 09:31:42 -07:00
ridiculousfish
b20bdcebfa FLOG narrow-string output to use fwprintf
This avoids mixing narrow and wide I/O on the same stream.
Extends the fix in #5900 by allowing narrow string literals again.
2019-05-31 09:31:42 -07:00
Fabian Homborg
4ebb6cf39e complete: Add "--force-files"
This allows a completion to specify that *it* takes files.

Useful for things like `sudo -e`, because sudo usually doesn't take
any files.
2019-05-30 19:13:42 +02:00
Fabian Homborg
87971e1f2e Widen the rest of the FLOGs
Fixes #5900.
2019-05-30 13:08:35 +02:00
Fabian Homborg
d73ee4d54b More using FLOGF when formatting is needed
sed-patched, every time a "%" is used in a call to `FLOG`, we use
`FLOGF` instead.
2019-05-30 11:54:09 +02:00
Fabian Homborg
9d62d8e3fd Use FLOGF when formatting is needed
This passed a format string in a variable which is why it was
presumably overlooked.

[ci skip]
2019-05-30 11:48:56 +02:00
ridiculousfish
ee9e5d4996 Allow disabling debug categories with leading -
This was always supposed to work but the string_prefixes_string call
had the wrong order.
2019-05-29 14:21:50 -07:00
ridiculousfish
0863c237b0 Make thread_id a visible thing
Every thread now has a non-recyclable thread id. This will be an aid in
debugging.
2019-05-29 12:34:11 -07:00
ridiculousfish
f3ee6a99c3 Add some FLOG logging around internal processes 2019-05-29 12:34:11 -07:00
Fabian Homborg
61292b0c6c fish_tests: Fix warnings 2019-05-29 21:11:08 +02:00
Fabian Homborg
6617c4d79e Use C++11 value-initialization instead of { 0 }
Removes a warning in GCC.
2019-05-29 20:50:35 +02:00