Commit graph

11715 commits

Author SHA1 Message Date
Michael Sanders
5c8ef19ff8 Bring rbenv completions up-to-date 2020-01-30 21:53:14 -08:00
ridiculousfish
4cee045967 Update to latest widecharwidth
Fixes a Cygwin incompatibility. Fixes #6549

Cherry-pick from 73106198c8
2020-01-30 21:19:21 -08:00
ridiculousfish
73106198c8 Update to latest widecharwidth
Fixes a Cygwin incompatibility. Fixes #6549
2020-01-30 21:17:37 -08:00
ridiculousfish
2c4e15e267 Fix the Cygwin build for uvar notifiers 2020-01-30 20:44:29 -08:00
ridiculousfish
97c456a986 Improve support for job control in non-interactive scenarios
Avoid complaining about ENOTTY results from tcsetpgrp, and ensure we
ignore SIGTTOU the first time job control is enabled.
2020-01-30 15:18:10 -08:00
Fabian Homborg
ef618b2626 Add Solaris' error message to a test
Just another version of the error. We still want to get a bug if it
ever triggers a *wrong* error, so we still list all the options
instead of going for `.*option:.*Z.*`.

Fixes #6554

(cherry picked from commit e8000cfea9)
2020-01-30 21:43:42 +01:00
Fabian Homborg
105a256e5a Tests: Don't remove a parent of $PWD
Solaris/OpenIndiana/Illumos `rm` checks that and errors out.

In these cases we don't actually need it to be a part of $PWD as
it's just for cleanup, so we `cd` out before.

See #5472
See 1ee57e9244
Fixes #6555
Fixes #6558

(cherry picked from commit 9cbd3d57a0)
2020-01-30 21:43:42 +01:00
Fabian Homborg
9735a18add Always return a value, even in unreachable code
To placate dumb compilers, we sometimes have to include code that will
never be executed.

Should fix the build when -Werror=return-type is in effect.
2020-01-30 20:39:42 +01:00
ridiculousfish
70195164d4 Refactor child_set_group 2020-01-30 11:27:21 -08:00
ridiculousfish
a243e65939 Rename pgroup_mode to pgroup_provenance 2020-01-30 11:14:31 -08:00
ridiculousfish
aaaca9773a Unconditionally call set_child_group() after posix_spawn
Previously we did this conditionally only if GLIBC is defined, but
it looks harmless to do this unconditionally. Let's do it.
2020-01-30 11:07:28 -08:00
ridiculousfish
10da6df506 Factor out logic about how pgroups are assigned
Introduce pgroup_provenance_t, a type which captures "where the pgroup
comes from." This centralizes some logic around how pgroups are
assigned, and it anticipates concurrent execution.
2020-01-30 10:50:16 -08:00
ridiculousfish
d22c6af7a3 clang-format all C++ files 2020-01-30 10:50:11 -08:00
Fabian Homborg
e8000cfea9 Add Solaris' error message to a test
Just another version of the error. We still want to get a bug if it
ever triggers a *wrong* error, so we still list all the options
instead of going for `.*option:.*Z.*`.

Fixes #6554
2020-01-30 18:07:03 +01:00
Fabian Homborg
9cbd3d57a0 Tests: Don't remove a parent of $PWD
Solaris/OpenIndiana/Illumos `rm` checks that and errors out.

In these cases we don't actually need it to be a part of $PWD as
it's just for cleanup, so we `cd` out before.

See #5472
See 1ee57e9244
Fixes #6555
Fixes #6558
2020-01-30 17:34:48 +01:00
Fabian Homborg
cc7d9cc2ed flog: Save & restore errno
In some cases on some platforms this could clobber errno, so doing something like

    aThingThatFailsWithErrno();
    FLOG(category, "Some message");
    wperror("something");

would print the wrong error (presumably if that category was enabled).

In our case it was our (very) old friend RHEL6 returning ESPIPE instead of EISDIR.

Fixes #6545.
2020-01-30 17:31:30 +01:00
Johannes Altmanninger
50e08dc3a0 add completions for wireshark/tshark/dumpcap 2020-01-30 16:45:02 +01:00
Johannes Altmanninger
f4d0bafbd4 remove stale typedef 2020-01-30 16:32:47 +01:00
David Adam
696057ab57 Merge branch 'Integration_3.1.0' 2020-01-30 17:31:43 +08:00
David Adam
b313ba555a iothread: add missing #include
Closes #6553.
2020-01-30 17:21:15 +08:00
ridiculousfish
40ff4215a8 Express the "nested job control" idea directly
Prior to this fix, we would infer that nested jobs need job control.
Just pass that along explicitly in the job lineage.
2020-01-29 16:10:28 -08:00
ridiculousfish
28a8d0dbf7 Continued adoption of autoclose_fd_t and exec_close 2020-01-29 14:16:16 -08:00
ridiculousfish
3d47f042ac Be more consistent about using autoclose_fd_t and exec_close
Simplifying and improving file descriptor handling discipline.
2020-01-29 13:55:20 -08:00
ridiculousfish
29af84d733 Migrate get_interpreter into postfork.cpp
It's only used after fork.
2020-01-29 13:43:40 -08:00
Johannes Sasongko
8e8a3846fb __fish_prepend_sudo: Don't move the relative position of the cursor
At the moment the "prepend sudo" functionality always sets the cursor to
the end of the line. This changes it to restore the relative position of
the cursor.
2020-01-29 09:21:23 +01:00
ridiculousfish
376529a46d Clean up reader_read
Stop having reader_read close the input file descriptor. Make other
modernizations.
2020-01-28 11:39:26 -08:00
ridiculousfish
fc4557c784 Eliminate wopen()
It was large and mostly unnecessary. Prefer wopen() followed by
fdopen().
2020-01-28 10:43:37 -08:00
ridiculousfish
af2265b4b0 Migrate create_directory inside path.cpp
It is not used outside of path.cpp
2020-01-28 10:30:51 -08:00
ridiculousfish
1bbfb7044b Remove wopen
It was unused
2020-01-28 10:26:31 -08:00
ridiculousfish
f27958ef4d Clean up the open_cloexec interface
Remove the ability to make it non-cloexec - nobody was using it.
2020-01-28 10:25:49 -08:00
David Adam
0e75bcc61f fish.spec/debian packaging: add build dependency on Python
For littlecheck etc.
2020-01-28 16:55:05 +08:00
David Adam
dd1e526017 tests: remove an outdated comment
Code removed in af22d6b732
2020-01-28 16:54:29 +08:00
ridiculousfish
af22d6b732 Stop pretending to be interactive during the cancellation tests
Prior to this fix, the cancellation C++ test would mark the parser as
interactive in an effort to install interactive signal handling (so that,
for example, SIGINT would stop the job and return control to the user).

However this flag would also cause fish to attempt to save and restore tty modes
across the job. This would fail since there is no tty, and so the job would fail
with an unexpected error code.

We don't need to mark the parser as interactive, we can just remove that line.

Fixes #6539.
2020-01-27 12:13:46 -08:00
ridiculousfish
7d486c121a Revert "Add noexcept to completion_t definitions as well as declarations"
This reverts commit 89f5ae3e6a.

Apparently that broke gcc.
2020-01-26 20:59:58 -08:00
ridiculousfish
7a2a6d76f3 Migrate a test from C++ to littlecheck
This eliminates noisy warnings about tcsetpgrp when the tests are run
without a tty, as reported in #6539
2020-01-26 20:59:08 -08:00
ridiculousfish
ae77f1b163 Make locked_consumed_job_ids heap allocated rather than static
This prevents its destructor from running during normal exit.
Fixes #6539
2020-01-26 20:33:50 -08:00
ridiculousfish
89f5ae3e6a Add noexcept to completion_t definitions as well as declarations
This is required if we want to compile with exceptions enabled (which we
currently do not).
2020-01-26 20:33:47 -08:00
David Adam
1aa0dfe91b fish.spec: remove "Shell" FreeDesktop category, even from OpenSUSE
It's reserved and causes errors trying to build the AppImage.
2020-01-26 21:36:02 +08:00
David Adam
aabc208318 Release 3.1b1 2020-01-26 21:21:05 +08:00
Fabian Homborg
3bb15defbb
Replace debug() with flog
PR #6511 

Flog has the advantage of having *categories*, not severities, so it'll be easier to get output for a certain subsystem now.
2020-01-26 14:13:17 +01:00
Jason Nader
7d89cadd58 Stringify vared completions 2020-01-26 13:53:45 +01:00
Fabian Homborg
23042b6a43 Remove unused "prefix" variable in prompt presets
[ci skip]
2020-01-26 12:29:06 +01:00
Jason
bcf2e2cdbd Remove unused variable 2020-01-26 12:28:01 +01:00
Jason Nader
3142ef6dbc Add interface label/name to the completions for -b 2020-01-26 12:26:47 +01:00
ridiculousfish
d29bc720cd Remove some nonsense in exec_close
exec_close should assert that the fd is valid, then loop while EINTR.
Nothing else is needed.
2020-01-25 19:08:30 -08:00
ridiculousfish
86897cafd6 Clean up, debug, optimize some command description generation
Use some more move semantics to reduce allocations.

Correctly handle the case where the completion is empty. For example, if
you type:

    ls<tab>

we get an empty completion (since ls is already a valid command), but we
still want to show its description.

Remove some unsafe statics - these are unsafe today in weird cases where
completions might invoke complete recursively, and also will soon be
unsafe with concurrent execution.
2020-01-25 18:26:31 -08:00
ridiculousfish
38f4330683 Rationalize $status and errors
Prior to this fix, fish was rather inconsistent in when $status gets set
in response to an error. For example, a failed expansion like "$foo["
would not modify $status.

This makes the following inter-related changes:

1. String expansion now directly returns the value to set for $status on
error. The value is always used.

2. parser_t::eval() now directly returns the proc_status_t, which cleans
up a lot of call sites.

3. We expose a new function exec_subshell_for_expand() which ignores
$status but returns errors specifically related to subshell expansion.

4. We reify the notion of "expansion breaking" errors. These include
command-not-found, expand syntax errors, and others.

The upshot is we are more consistent about always setting $status on
errors.
2020-01-25 17:28:41 -08:00
ridiculousfish
81e78c78aa Rename eval_result_t to end_execution_reason_t
We're getting ready to stop returning eval_result_t from parser_t::eval
2020-01-25 14:11:32 -08:00
ridiculousfish
e640a01ea5 Express cancellation as a possible result of expand_string
This allows us to properly thread control-C signals from command
substitutions into the expanding string.
2020-01-25 14:11:32 -08:00
ridiculousfish
8a9c39d433 Add a test for some 'status' subcommands 2020-01-25 14:10:45 -08:00