Commit graph

10656 commits

Author SHA1 Message Date
Fabian Homborg
8013686d17 delete-or-exit: Only exit if the commandline is empty
This exitted if the cursor was at the end of the line as well (i.e. if
delete-char failed). That's a bit too eager.

Also documentation, which should have already been included.
2019-07-03 11:48:38 +02:00
Fabian Homborg
4ae18951ee Add NetBSD's error to the bad-option test
I'm kinda close to just checking `.*fish: .*option.*Z.*`
2019-07-02 23:48:25 +02:00
Fabian Homborg
d775c584a5 Port realpath tests to littlecheck
I'm gonna add more tests to this and I don't want to touch the old stuff.

Notice that this needs to have the output of the complete_directories
test adjusted because this one now runs later.

That's something we should take into account in future.
2019-07-02 23:05:50 +02:00
Fabian Homborg
7d3bec1297 test.fish: Notice littlecheck failures
This failed to propagate the exit status. Sorry!
2019-07-02 22:50:16 +02:00
Fabian Homborg
5133287873 CHANGELOG: List path_helper changes
Just replace the issue number because this is effectively a
replacement of the previous.

[ci skip]
2019-07-02 22:18:40 +02:00
Tim Riley
d1be300ac7 Emulate path_helper more faithfully when constructing paths on macOS
Previously, elements already existing in the path variable would keep their position when the path was being constructed from the config files. This caused issues given that $PATH typically already contains "/usr/bin:/bin" when fish initializes within a macOS terminal app. In this case, these would keep their position at the front of the $PATH, even though the system path_helper configs explicitly place them _after_ other paths, like "/usr/local/bin". This would render binaries in "/usr/local/bin" as effectively "invisible" if they also happen to live in "/usr/bin" as well. This is not the intended

This change makes the __fish_macos_set_env config function emulate the macOS standard path_helper behavior more faithfully, with:

1. The path list being constructed *from scratch* based on the paths specified in the config files
2. Any distinct entries in the exist path environment variable being appended to this list
3. And then this list being used to *replace* the existing path environment variable

The result, for a vanilla fish shell on macOS, is that the $PATH is now set to:

    /usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin

Where previously it was set to:

    /usr/bin /bin /usr/local/bin /usr/sbin /sbin

This new $PATH exactly matches the order of paths specified in `/etc/paths`.
2019-07-02 22:17:46 +02:00
Fabian Homborg
d263093a5a docs/cmds/fish: Document private mode there as well
Oversight, see #2376.

[ci skip]
2019-06-30 13:54:54 +02:00
ridiculousfish
09e4f8ff42 Refactor how the terminal is transferred to jobs
Centralize the logic around when a job acquires the terminal.
2019-06-29 15:58:36 -07:00
ridiculousfish
2931d869d5 Remove the foreground job property
This was not used consistently and was confused with the foreground job
flag. Whether a job is foreground is mutable, so it should remain a flag.
2019-06-29 15:54:49 -07:00
ridiculousfish
98ba7d7790 Simplify maybe_assign_terminal()
Move this out of postfork, it is not called after fork.
2019-06-29 14:36:14 -07:00
ridiculousfish
f58960ba01 Add a DIE("unreachable") in should_claim_process_group_for_job
Fixes a gcc warning.
2019-06-29 11:40:52 -07:00
ridiculousfish
4a2c709fb1 Eliminate shell_is_interactive
We used to have a global notion of "is the shell interactive" but soon we
will want to have multiple independent execution threads, only some of
which may be interactive. Start tracking this data per-parser.
2019-06-29 11:28:26 -07:00
ridiculousfish
3f1d7bbdc5 Call tcsetpgrp in child processes before resetting signal handlers
Also ignore SIGTTIN and SIGTTOU across the tcsetpgrp call.

Hopeful fix for #5963
2019-06-28 11:54:55 -07:00
Fabian Homborg
4c022a708f tests: Simplify directory-redirect test
This doesn't need the indirection, since it was only an invocation
test because we couldn't express it in the old runner.
2019-06-28 20:48:11 +02:00
ridiculousfish
262fe65121 Correctly mark a node when erasing an exported variable
Fixes #5965
2019-06-28 11:22:49 -07:00
ridiculousfish
3c800e0608 Make history tests more robust
history now often writes to the history file asynchronously, but the history
test expects to find the text in the file immediately after running the
command. Hack a bit in history to make this test more reliable.
2019-06-28 11:16:27 -07:00
ridiculousfish
e3f94f4b72 Centralize signal handling into a single function
Prior to this diff, fish had different signal handling functions for
different signals. However it was hard to coordinate when a signal needed
to be the default handler, and when it was custom. In #5962 we overwrote
fish's custom WINCH handler with the default_handler when fish script asked
for WINCH to be handled.

Just have a single big signal handler function. That way it can never be
set to the wrong thing.

Fixes #5969
2019-06-28 10:51:22 -07:00
ridiculousfish
8254342339 Remove the useless second parameter from signal_handle
It was always set to 1.
2019-06-28 10:33:03 -07:00
ridiculousfish
f3736e8fdf fish to claim a job's pgroup if the first process is fish internal
When executing a job, if the first process is fish internal, then have
fish claim the job's pgroup.

The idea here is that the terminal must be owned by a pgroup containing
the process reading from the terminal. If the first process is fish
internal (a function or builtin) then the pgroup must contain the fish
process.

This is a bit of a workaround of the behavior where the first process that
executes in a job becomes the process group leader. If there's a deferred
process, then we will execute processes out of order so the pgroup can be
wrong. Fix this by setting the process group leader explicitly as fish
when necessary.

Fixes #5855
2019-06-26 17:30:51 -07:00
ridiculousfish
f7e2e7d26b Don't generate exit events for jobs created from within event handlers
Add a new job property from_event_handler, and do not create exit events for
such jobs. This prevents easy accidental infinite recursion.
2019-06-26 17:30:51 -07:00
Fabian Homborg
d7a9bdf5c3 reader: Do the "delete" part for delete-or-exit
For some reason this is supposed to do a delete-*char*.

I was assuming the function was broken and it should delete the entire
line.

Fixes #5967.
2019-06-26 22:53:19 +02:00
Fabian Homborg
22d2620716 Rerun all interactive tests once
They are *all* flakey enough that we regularly see them fail, at least
on Travis.
2019-06-26 21:26:20 +02:00
Fabian Homborg
4d035cbd10 Port bind tests to littlecheck 2019-06-26 21:19:40 +02:00
Fabian Homborg
fdf0a661cf Port andandoror test to littlecheck 2019-06-26 21:19:40 +02:00
Fabian Homborg
8e11f802b4 Port alias test to littlecheck 2019-06-26 21:19:40 +02:00
Fabian Homborg
9462aacc5c Port abbr test to littlecheck 2019-06-26 21:19:40 +02:00
Fabian Homborg
21805759a3 Port math test to littlecheck
This shows one bit where not trimming whitespace would make sense.
2019-06-26 21:19:40 +02:00
Fabian Homborg
2f19ec1c34 Port count test to littlecheck 2019-06-26 21:19:40 +02:00
ridiculousfish
b672e1891e Port signal tests to littlecheck 2019-06-26 11:07:46 -07:00
Fabian Homborg
cdbd0891f7 Remove invocation tests
These are now all performed by littlecheck, so there's no need for the
entire target anymore.
2019-06-25 22:31:45 +02:00
Fabian Homborg
a33c2f0bce Port config tests to littlecheck
This required a bit of thinking.

What we do is we have one test that fakes $HOME, and then we do the
various config tests there.

The fake config we have is reused and we exercise all of the same codepaths.
2019-06-25 22:31:06 +02:00
Fabian Homborg
10949648e7 Port qmark1 test to littlecheck
This one just needs a random home.
2019-06-25 22:31:06 +02:00
Fabian Homborg
5c7b7fd609 Readd bad-switch and directory-redirection tests
Made possible by the power of regex.
2019-06-25 22:30:58 +02:00
Fabian Homborg
b9c1f4b122 Remove ported tests 2019-06-25 21:00:13 +02:00
Fabian Homborg
21667850b3 tests/test.fish: Normalize littlecheck output
This prints a green "ok" with the duration, just like the rest of the
tests.

Note that this clashes a bit with
https://github.com/ridiculousfish/littlecheck/pull/3.

(also don't check for python again and again and again)
2019-06-25 20:57:37 +02:00
Fabian Homborg
9d5620c170 Port most of the invocation tests to littlecheck
This is a bit weird sometimes, e.g. to test the return status (that
fish actually *returns $status*), we use a #RUN line with %fish
invoking %fish, so we can use the substitution.

Still much nicer.

The missing scripts are those that rely on config.
2019-06-25 20:56:29 +02:00
Fabian Homborg
d415350aaf reader: Add delete-or-exit bind function
This is an important binding and should therefore be in C++.
2019-06-25 19:57:00 +02:00
Fabian Homborg
c392a05db0 functions/__fish_anypython: Also try python{3,2}.7
NetBSD!!!!! *shakes fist*
2019-06-25 19:40:22 +02:00
Fabian Homborg
93d9fa4551 tests/test.fish: Run littlecheck with any python
Some operating systems don't have a "python" symlink, so we just run
it with the first python we find.
2019-06-25 19:25:36 +02:00
Fabian Homborg
7778e62bd7 CI: Add python dependencies
Littlecheck needs it.
2019-06-25 19:17:53 +02:00
Fabian Homborg
1bba77e485 Port string tests to littlecheck
`wc -l tests/string.*`
  329 tests/string.err
  422 tests/string.in
  520 tests/string.out
 1271 total

`wc -l tests/checks/string.fish`
 555 tests/checks/string.fish

and it looks nicer. 'nuff said.
2019-06-25 17:26:36 +02:00
Fabian Homborg
77d8487078 string: Also stop printing documentation
Especially as, in this case, the documentation is quite massive.

Caught by porting string's test to littlecheck.

See #3404 - this was already supposed to be included.
2019-06-25 17:26:30 +02:00
Fabian Homborg
60edc9a45d Port argparse tests to littlecheck
This is a nice test (ha!) for how this works and what littlecheck can
do for us.

1. Input is now the actual file, not "Standard Input" anymore. So
any errors mentioning that now include the filename.
2. Regex are really nice for filenames, but especially for line
numbers
3. It's much nicer to have the output where it's created, instead of
needing to follow three files at the same time.
2019-06-25 16:11:24 +02:00
Fabian Homborg
cc1388a78a Upgrade littlecheck to allow whitespace before comments
Necessary for test files that pass fish_indent.
2019-06-25 16:11:24 +02:00
Fabian Homborg
427a18c1ea fish_git_prompt: Add a way to use the informative chars
$__fish_git_prompt_use_informative_chars will use the informative
chars without requiring informative mode (which is really frickin'
slow!).

See #5726.

[ci skip]
2019-06-25 16:11:18 +02:00
Fabian Homborg
caedf01c00 Revert "Latch signal handlers"
This reverts commit 7ed1022cf4.

Fixes #5962.
2019-06-25 11:25:09 +02:00
Fabian Homborg
3bc392a6b3 functions/__fish_print_hostnames: Check getent's status
This previously effectively checked `string split ' '`s return status,
which was false if it didn't split anything. And while that should be
true if getent fails (because it should produce no output), it's also
true if it doesn't print a line with multiple aliases. Which should be
fairly typical.

Instead we use our new-found $pipestatus to check what getent returns,
in the assumption that it'll fail if it doesn't support hosts.

Follow up to 8f7a47547e.

[ci skip]
2019-06-25 08:40:31 +02:00
Fabian Homborg
9cd29e5166 cmake: Add -Wno-redundant-mode
This warns about one bit in env_dispatch, where a comment explains
that the move *is* necessary, on a different libc++.
2019-06-24 22:11:49 +02:00
Fabian Homborg
8f7a47547e functions/__fish_print_hostnames: Don't run getent hosts twice
`getent hosts` is expensive-ish - ~50ms, so we don't want to run it
twice just to figure out it works.

Apparently this works everywhere but CYGWIN and possibly older
OpenBSD, but we don't want to explicitly blacklist those.

[ci skip]
2019-06-24 19:19:31 +02:00
ridiculousfish
27e4d1d62d Revert "Revert "Don't service ioport completions if data is available on stdin""
This reverts commit 005e6f2ab8.

This allows new text entry to take priority over highlighting, improving the
performance of pasting.
2019-06-23 16:45:06 -07:00