Commit Graph

6622 Commits

Author SHA1 Message Date
ridiculousfish
36a0f745cd Fix some bogus error messages in builtin_commandline 2017-01-23 09:32:50 -08:00
ridiculousfish
ab189a75ab Switch a job's process list from a linked list to a vector of pointers
Clarifies and simplifies the memory management around process handling.
2017-01-23 09:28:34 -08:00
ridiculousfish
f4476100f2 Remove comment about job_iterator_t being used from signal handlers
It is no longer used from signal handlers, and has not been for a while
2017-01-22 00:59:50 -08:00
ridiculousfish
6bdab62358 Make io_buffer_t::create return a shared_ptr
Eliminates some manual memory management
2017-01-22 00:44:04 -08:00
ridiculousfish
009a677e0d Use the STL's make_unique if available
Fixes a build error with g++ 6.1

Fixes #3759
2017-01-22 00:32:08 -08:00
ridiculousfish
2e47817adf Second attempt to fix Xcode build for PCRE2 changes
Update osx/shared_headers/pcre2.h

Fixes #3755
2017-01-22 00:11:40 -08:00
Kurtis Rader
176a291ed2 deal with multiline commands which have flags
Fixes #3758
2017-01-21 20:23:06 -08:00
ridiculousfish
1875222e93 Use one invocation of $INSTALL instead of looping
Speed up our Makefile by using $INSTALL once per type of file,
rather than passing them individually.
2017-01-21 17:39:00 -08:00
ridiculousfish
439f233ccc Make fire_event_callback take a std::function instead of function pointer 2017-01-21 17:15:45 -08:00
ridiculousfish
a91dad35db Use unique_ptr instead of new for history tests 2017-01-21 17:14:56 -08:00
ridiculousfish
6f745762bb Make universal_notifier_t use unique_ptr instead of raw pointers 2017-01-21 16:56:45 -08:00
ridiculousfish
f0065cda13 Clean up event_t handling
Use shared_ptr instead of the silly killme list
2017-01-21 16:48:07 -08:00
ridiculousfish
8a0d4854e8 Replace auto_ptr with unique_ptr 2017-01-21 16:10:42 -08:00
ridiculousfish
b3fff2d779 Switch to using unique_ptr for builtin_test
Removes a lot of terrifying manual memory management
2017-01-21 16:08:53 -08:00
ridiculousfish
754b0e9b91 Use unique_ptr in string_replace()
Eliminates some manual calls to delete
2017-01-21 15:47:12 -08:00
ridiculousfish
3139ad0d4d Use unique_ptr in builtin_commandline_scoped_transient_t
Allows removing a manual call to delete
2017-01-21 15:45:38 -08:00
ridiculousfish
3272505891 Eliminate the "Clean up the block stack" logic in eval_block_node
The block stack is now sound, and no longer needs this ancient
cleanup logic, which tried to account for cases where blocks
were pushed but never popped.
2017-01-21 15:42:35 -08:00
ridiculousfish
0991e398bb Clean up parser_t's block stack
Currently the block stack is just a vector of pointers.
Clients must manually use new() to allocate a block, and then
transfer ownership to the stack (so must NOT delete it).

Give the parser itself responsibility for allocating blocks too,
so that it takes over both allocation and deletion. Use unique_ptr
to make deletion less error-prone.
2017-01-21 15:35:35 -08:00
ridiculousfish
ac8b27fcb1 Implement and use make_unique
Allows avoiding some explicit calls to new(), which can look suspicious
2017-01-21 15:02:41 -08:00
ridiculousfish
5b108efde4 Use unique_ptr in builtin_string
Avoids manual calls to delete
2017-01-21 14:54:01 -08:00
ridiculousfish
f2884343b3 Use unique_ptr in a parser's execution_context list
Avoids requiring manual calls to delete
2017-01-21 14:53:52 -08:00
ridiculousfish
16bc7b48b5 Make profile_items use unique_ptr instead of raw pointers 2017-01-21 14:33:17 -08:00
ridiculousfish
9efa897d0d Early steps towards rationalizing SIGINT handling
Previously we would try to walk all the blocks (from within the
signal handler!) and mark them as skipped. Stop doing that, it's
wildly unsafe.

Also rationalize how the skip flag is set per block. Remove places
that shouldn't set it (e.g. break and continue shouldn't set skip
on the loop block).
2017-01-21 14:15:03 -08:00
ridiculousfish
d8a6c0a91b Add a SIGALRM handler that does nothing
This will be part of a future signal torture-test, to ensure
we are handling EINTR correctly
2017-01-21 14:07:54 -08:00
ridiculousfish
7e3db843cd Remove FUNCTION_DEF_BLOCK and FAKE_BLOCK
These are old-parser block types that are no longer used.
2017-01-21 13:57:05 -08:00
ridiculousfish
bb65b82c56 Mark some signal-related variables as 'volatile sig_atomic_t' 2017-01-21 13:33:46 -08:00
ridiculousfish
bb686a2236 Enable some test_illegal_command_exit_code tests
A comment suggests these cause bad_alloc, but this
doesn't seem to happen. If it does happen, we want to hit
it so we can track it down!
2017-01-21 12:56:22 -08:00
ridiculousfish
fc803c75a6 Remove some errant newlines in fish_tests.cpp 2017-01-21 12:55:01 -08:00
ridiculousfish
812e977e62 Clean up /tmp/fish_chunked_read_test.txt after tests 2017-01-21 12:47:05 -08:00
ridiculousfish
5a5a6a6968 Correctly handle multiple chunks from read_in_chunks
read_in_chunks does not clear the intermediate string 'str'
between iterations, so every chunk has every other chunk prepended
to it.

A secondary issue is that it calls str2wcstring() on an intermediate
chunk, which may split multi-byte sequences. This needs to be deferred
to the end.

Test added. Fixes #3756
2017-01-21 12:43:20 -08:00
ridiculousfish
f7c133da00 Use long instead of int in read_in_chunks()
Fixes warnings about narrowing conversions
2017-01-21 11:53:49 -08:00
ridiculousfish
4c56c89afc Use wcscmp instead of comparing against a string literal
Should fix OpenSUSE build
2017-01-21 11:51:06 -08:00
ridiculousfish
9361470070 Update Xcode build in response to PCRE2 upgrade
Replace the osx/pcre2/config.h with a new config.h
from the PCRE2 upgrade

Fixes #3755
2017-01-21 11:48:09 -08:00
Fabian Homborg
ab3149257b Make test errors redirectable
This can't use `fwprintf`, since that goes directly to actual stderr.

It needs to use the passed stream.
2017-01-21 13:11:54 +01:00
Kurtis Rader
2e38cf2a4b implement means to learn about a functions source
This implements a way to use the `functions` command to perform
introspection to learn about the characteristics of a function. Such as
where it came from.

Fixes #3295
2017-01-20 21:48:41 -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
Clément Martinez
082d4b5a7e Add light completions 2017-01-21 00:33:58 +01:00
Fabian Homborg
c111a65622 Stack completions: Fix dead link
This was just reshuffled a bit. Now it uses the main page (which then
redirects to the docs anyway), which should be a bit more stable.
2017-01-20 21:46:59 +01:00
Fabian Homborg
e89c66a224 git completions: git push uses set-upstream
This was a misunderstanding in 96a28df. git _branch_ now uses
set-upstream-to, while git _pull_ still only has set-upstream.

Thanks @moverest.
2017-01-20 15:55:39 +01:00
Clément Martinez
85212c57e8 Add castnow completions 2017-01-19 21:59:59 -08:00
Kurtis Rader
d6ceeb915d fix interaction of buffered/unbuffered output
Fixes #3747
2017-01-19 20:58:12 -08:00
David Adam
bc57c7710f pcre2: add maintainer mode and disable by default 2017-01-18 16:44:48 -08:00
mathbunnyru
9768653df7 New pcre2 2017-01-18 16:44:48 -08:00
Mehul Tikekar
59eb75021b Remove cd in __fish_print_interfaces 2017-01-18 15:44:28 -08:00
Kurtis Rader
d905ed33fe another glibc EIO workaround
Partial fix for #3737 and #3644
2017-01-15 19:27:53 -08:00
mathbunnyru
7a80610300 Delete trailing spaces 2017-01-15 14:57:21 -08:00
Kurtis Rader
d37e7bcc25 reinstate some bindings for vi mode
Fixes #3731
2017-01-15 11:11:38 -08:00
Kurtis Rader
5809608bd2 implement chunked reads
Provide a more efficient method for reading lines (or null terminated
sequences) when the input is seekable.

Another partial fix for #2007
2017-01-14 20:51:54 -08:00
Kurtis Rader
2e65e27189 refactor builtin_read
Refactor `builtin_read()` to split the code that does the actual reading
into separate functions. This introduces the `read_in_chunks()` function
but in this change it is just a clone of `read_one_char_at_a_time()`. It
will be modified to actually read in chunks in the next change.

Partial fix for #2007
2017-01-14 20:51:54 -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