Commit Graph

11784 Commits

Author SHA1 Message Date
David Adam
5a8685b26c debian packaging: bump Python requirement to 3.5+
Work on #6537.
2020-02-06 12:46:00 +08:00
Jason Nader
fb00d6638e completions/apt: Add support for filename completions
Plus some small fixes.
Fixes #6209
[ci skip]
2020-02-06 02:17:38 +01:00
Johannes Altmanninger
5d135d5556 prompts: fix pipestatus for jobs prefixed with "not"
6902459566 was an attempt to not print
$status twice in the prompt. As a result we print $pipestatus but
not $status, which /usually/ is the same as $pipestatus[-1] --- unless
the builtin "not" is used, which inverts the $status of a job (it does
not alter $pipestatus).

As a result, the default prompt prints unexpected status codes:

	~ > not false
	~ [1]> not true
	~ > not true | true
	~ > not false | false
	~ [1|1]>

This commit reintroduces printing of $status after $pipestatus, but only
if it is different from $pipestatus[-1].
Additionally, we only print anything at all if the $status is nonzero,
to avoid confusing output on `not false | false`

	~ > not false
	~ > not true
	~ [0] 1> not true | true
	~ [0|0] 1> not false | false
	~ >

I think this is closer to users' expectations for those cases; they should
not have to think about this implementation detail of the not-statement.
2020-02-06 01:43:17 +01:00
Johannes Altmanninger
14c6a12782 Use accessor functions for editable_line_t::{text,position}
This is paving the way for undo, where we want to have one central place
for modifying an editable_line_t.
2020-02-06 01:30:45 +01:00
ridiculousfish
a765026c4c Adopt fd_monitor in bufferfill
This switches bufferfills from using an exclusively-owned thread, to
sharing an fd_monitor. This allows multiple bufferfills to all use the same
thread.
2020-02-05 12:05:39 -08:00
ridiculousfish
057c3a9e75 Introduce fd_monitor
fd_monitor is a new class which can monitor a set of fds, waiting for them
to become readable. When an fd becomes readable, a callback is invoked.
Timeouts are also supported.

This is intended to replace the "bufferfill" threads. Rather than one
thread per bufferfill, we will have a single fd_monitor which can service
multiple bufferfills. This helps today with nested command substitutions,
and will help in the future with concurrent execution.
2020-02-05 12:04:51 -08:00
Mahmoud Al-Qudsi
9bf5dfd738 Further enrich cargo completions
* Replace multiple calls to `tail` and `string` with a single `string
  replace` execution
* Dynamically generate list of available benches, bins, and tests for
  `--bench`, `--bin`, and `--test` switches

[ci skip]
2020-02-04 18:12:02 -06:00
ridiculousfish
eaecb817ca Retain leading spaces in non-expanding braces
This makes two changes:

1. Remove the 'brace_text_start' idea. The idea of 'brace_text_start' was
to prevent emitting `BRACE_SPACE` at the beginning or end of an item. But
we later strip these off anyways, so there is no apparent benefit. If we
are not doing brace expansion, this prevented emitting whitespace at the
beginning or end of an item, leading to #6564.

2. When performing brace expansion, only stomp the space character with
`BRACE_SPACE`; do not stomp newlines and tabs. This is because the fix in
came from a newline or tab literal, then we would have effectively
replaced a newline or tab with a space, so this is important for #6564 as
well. Moreover, it is not easy to place a literal newline or tab inside a
brace expansion, and users who do probably do not mean for it to be
stripped, so I believe this is a good change in general.

Fixes #6564
2020-02-04 12:34:34 -08:00
ridiculousfish
bd06a9aa6c Retain leading spaces in non-expanding braces
This makes two changes:

1. Remove the 'brace_text_start' idea. The idea of 'brace_text_start' was
to prevent emitting `BRACE_SPACE` at the beginning or end of an item. But
we later strip these off anyways, so there is no apparent benefit. If we
are not doing brace expansion, this prevented emitting whitespace at the
beginning or end of an item, leading to #6564.

2. When performing brace expansion, only stomp the space character with
`BRACE_SPACE`; do not stomp newlines and tabs. This is because the fix in
came from a newline or tab literal, then we would have effectively
replaced a newline or tab with a space, so this is important for #6564 as
well. Moreover, it is not easy to place a literal newline or tab inside a
brace expansion, and users who do probably do not mean for it to be
stripped, so I believe this is a good change in general.

Fixes #6564
2020-02-04 11:49:12 -08:00
Mahmoud Al-Qudsi
8f4797a38b Update cargo completions to use dynamic --example options
[ci skip]
2020-02-03 13:48:11 -06:00
Jason Nader
c6f85238b9 docs: Reword description for -D 2020-02-02 18:10:04 -08:00
ridiculousfish
1101cff566 Factor out some of the crazy logic in reader_interactive_init 2020-01-31 11:11:03 -08:00
ridiculousfish
8d8bcb7d8a Stop acquiring the terminal before running builtins
fish has some unprincipled code that attempts to tcsetpgrp() to own the
terminal before running a builtin; this was added because 'read' might
want to read from the terminal. I added this code before fully
understanding how process groups and terminals work. A better fix would
be to ensure that fish is marked as the pgroup leader in the job when
the builtin is the first process in the job, and we do that now.

Courageously back out the changes to grab the terminal; see #5147 and
also #5133.
2020-01-31 10:42:21 -08:00
Jason Nader
9b4cb28c8f Remove explicit .html links
See commit 1711636

(cherry picked from commit ce61c745a5)
2020-01-31 23:22:44 +08:00
Jason Nader
5932440e49 Fix broken links to index.html in cmd docs
(cherry picked from commit bc3b64bb50)
2020-01-31 23:22:43 +08:00
Jason Nader
ce61c745a5 Remove explicit .html links
See commit 1711636
2020-01-31 23:21:43 +08:00
Jason Nader
bc3b64bb50 Fix broken links to index.html in cmd docs 2020-01-31 23:12:05 +08:00
David Adam
578cde6ec6 CHANGELOG: work towards 3.1.0 2020-01-31 22:25:35 +08:00
Michael Sanders
3f8907d7cf Add pyenv completions 2020-01-30 21:53:45 -08:00
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