Commit Graph

14639 Commits

Author SHA1 Message Date
ridiculousfish
dc3e5a233b Generate Xcode schemes in CMake
This makes Xcode a little more pleasant, since we suppress generating a
bunch of schemes for tests.
2021-09-18 22:09:31 -07:00
ridiculousfish
971073d429 Disable posix_spawn on OpenBSD
OpenBSD has a posix_spawn implementation which fails to return ENOEXEC
on a shebangless script, causing us to fail the shebangless tests.
Disable posix_spawn on OpenBSD.
2021-09-18 14:08:18 -07:00
ridiculousfish
3ed8a57bc5 Don't use mmap for history files on OpenBSD
OpenBSD's mmap is famously unsychronized with file IO. In theory fsync
and msync can be used to synchronize but I was unable to get it to work.
Just don't use mmap for history on OpenBSD. This fixes the history merge
tests.
2021-09-18 14:08:08 -07:00
ridiculousfish
881b987934 Explicitly error when reading directories
FreeBSD will allow read() on arbitrary directories, causing fish to
produce a nonsense error. Use fstat() to check for directories before
reading.
2021-09-17 20:48:58 -07:00
ridiculousfish
9a2482557d get_hostname_identifier to not return empty hostnames
When getting the hostname to construct the legacy uvar path, if the
hostname is empty, we will create a path pointing at a directory. On
BSDs this path can be successfully open'd and we will produce errors
about invalid uvar files.
2021-09-17 11:18:39 -07:00
ridiculousfish
6db631ae88 Fix test driver on BSDs
FreeBSD at least has `realpath` without `--no-symlinks`, so the tests
cannot start. Fix this by  using the `pwd -P` trick.
2021-09-17 11:18:39 -07:00
Kid
0d8ffa8f87 Make less version check compatible with older Fish 2021-09-17 17:32:03 +02:00
David Adam
2debc68ee9 Debian packaging: drop debug package
The build hosts generate -dbgsym packages automatically with newer
versions of debhelper.
2021-09-17 21:03:24 +08:00
David Adam
64311b279d Debian packaging: drop blank postrm script 2021-09-17 21:03:24 +08:00
David Adam
e2aa254722 Debian packaging: update debhelper compat level 2021-09-17 21:03:24 +08:00
David Adam
f35b343852 Debian packaging: drop fish-common package
Splitting fish into multiple packages was what the downstream Debian
packaging does, but it provides minimal benefit to end-users installing
from the fish repositories and in some cases made it harder. The only
benefit was a slightly reduced size on disk for download repositories.

Closes #7845.

Reverts 45ae726d4f and solves #3053
through a Conflict with fish-common.
2021-09-17 21:03:24 +08:00
ridiculousfish
05fdee1be7 Continue passing -X / --no-init for less < v530
The less -F / --quit-if-one-screen option is buggy before v530. To work
around this, pass --no-init less versions older than 530.

The --no-init option was previously passed; it was removed in d15a51897d
for mouse support. Unfortunately it looks like we can't have mouse
support and --quit-if-one-screen on macOS shipped less (version 487).

It's worth fixing this because otherwise history and help is just not
printed on stock macOS.

Relevant is https://unix.stackexchange.com/questions/107315/less-quit-if-one-screen-without-no-init

Fixes #8157.
2021-09-16 18:03:03 -07:00
ridiculousfish
5a6b966bfe Fix acidentally quadratic wildcard_match
The "linear" wildcard_match actually contained a bug that compared two
strings on every iteration, causing this to be much slower than
necessary. Fix this.
2021-09-16 17:38:03 -07:00
ridiculousfish
d6075885ef Reduce named pipe uvar notifier poll time from 100 msec to 10 msec
To broadcast a uvar change on Linux, we write to a named pipe, wait a bit,
and then read it back. While the pipe is readable, fish will enter a "polling
mode" where it will check for uvar changes every N msec, until the pipe is no
longer readable. If the pipe stays readable for too long (5 seconds), fish
will try to drain it; this may happen if broadcasting instance of fish is
killed before it can read back its data.

In #8209 we have a case where fish is launched in the background to set a
uvar, and then immediately exits, leaving data on the pipe. This means that
we are perpetually in a polling mode until we hit that timeout. Reduce the
timeout to 1 second and the polling interval to 10 msec.

This improves #8209; it doesn't fix it fully but I think it's the best we can
do absent some other IPC mechanism.
2021-09-16 15:25:31 -07:00
Johannes Altmanninger
7f71df0905 builtin cd: recognize EPERM, as it's returned by MacOS
Now that we removed EROTTEN which had the same error code as EPERM,
we can give a less confusing error in case a user has not allowed
their terminal access to a directory.

See #8264
2021-09-17 00:43:12 +02:00
Johannes Altmanninger
eae9ee7f35 builtin cd: print error about broken symlinks
When cd is passed a broken symlink, this changes the error message from
"no such directory" to "broken symbolic link".  This scenario probably
won't happen very often since completion won't suggest broken symlinks
but it can't hurt to give a good error.

Fish used to do this until 7ac5932.  This logic used to be in
path_get_cdpath, however, that is only used for highlighting, so we
don't need error messages there. Changing cd is enough.

Reword from "rotten" to "broken" since that's what file(1) uses.
Clean-up leftovers from old "rotten" code (nomen est omen).

See #8264
2021-09-17 00:43:12 +02:00
Fabian Homborg
41d6a5b9c4 screen: If prompt ends in newline, last line width is 0
This makes us start drawing the commandline at the beginning of the
line again.

See https://github.com/kovidgoyal/kitty/issues/4032#issuecomment-920094245
2021-09-15 17:49:58 +02:00
Fabian Homborg
600dd3bd0f range-for! range-for! range-for! 2021-09-15 17:49:58 +02:00
Fabian Homborg
0e8beab7bf lru: Make parameter const-ref
This has no effect here, but it's used in the tests, where the
override is constref.
2021-09-15 17:49:58 +02:00
Fabian Homborg
4c5d586249 tinyexpr: Check for null-pointer 2021-09-15 17:49:58 +02:00
Fabian Homborg
e38de3df64 iothread: Stop casting intptr_t to void*
This works without, and clang-tidy tells me there's "optimisation
opportunities" that may be concealed.
2021-09-15 17:49:58 +02:00
Fabian Homborg
f97eac55e8 Tell cppcheck we're c++11
Not "posix", wow.

Did anyone ever use this?
2021-09-15 17:49:57 +02:00
exploide
f32b887dba added completions for ethtool 2021-09-14 21:44:44 +02:00
David Adam
e21a5034bc debian packaging: manually build test infrastructure
CMake 3.5 (shipped in Ubuntu Xenial) doesn't generate the test target
with appropriate dependencies. Build them in dh_auto_build; it's too
hard to convince any of the other steps to do it.

See #7851.
2021-09-14 22:05:09 +08:00
David Adam
58124ad5d6 debian packaging: fixup missing comma 2021-09-14 21:53:59 +08:00
David Adam
08f55343d9 debian packaging: depend on libpcre2-dev
This is now available on all supported platforms.
2021-09-14 21:48:58 +08:00
Mahmoud Al-Qudsi
93aaa1851e Merge branch 'ctest_redux'
This fixes issues building on Debian and with older versions of CMake.
See individual commits for details.
2021-09-13 23:17:14 -05:00
Johannes Altmanninger
51a3885d8c funced: avoid interpreting special characters in function name
Commit c3374ffd0 ("Use read --tokenize instead of eval for $BROWSER &
$EDITOR") converted uses of "eval" for environment variables to use the
safer "read -at", which performs word splitting but no other expansion.

funced contained a leftover instance of "eval". Remove it in favor
of using the editor command that was already word-split.
This means that we don't accidentally evaluate the file name.

(Also "set -gx EDITOR=~/my-editor" won't work anymore because the ~
is not expanded anymore but no one has complained about that behavior
in edit_command_buffer.)

Fixes #8289
2021-09-13 19:16:41 +02:00
Victor Diaz
8c09fc7a3a Prepend command to cat
*Problem:*
edit_command_buffer uses `cat` to return the modified content.
If a person has an alias for `cat` to a different command such `bat`** the editing will not be useful anymore since bat decorates the text with frames, line counts, etc

*Solution*
Appending command to cat, fish will ignore the alias and execute the real command according to this https://fishshell.com/docs/current/cmds/command.html

** https://github.com/sharkdp/bat
2021-09-12 22:11:01 +08:00
ridiculousfish
29413665c5 Treat Fitzpatrick emoji modifiers as width 0
Fixes #8275
2021-09-09 18:06:59 -07:00
Fabian Homborg
40b40a4316 changuelogue 2021-09-09 18:42:31 +02:00
Fabian Homborg
4046b4cedf Remove redundant variable
normalize_path returns a wcstring, so the check can't fail.

Just pass it directly.
2021-09-09 18:41:38 +02:00
Fabian Homborg
a78d9d8e9a normalize_path: Squash leading slashes even without allow_leading
This currently changes builtin realpath with the "-s" option:

    builtin realpath -s ///tmp

previously would print "///tmp", now it prints "/tmp".

The only thing "allow_leading_double_slashes" does is allow *two*
slashes.

This is important for `path match`, to be introduced in #8265.
2021-09-09 18:41:11 +02:00
Adam Skoufis
1ff6160058 Fix typo in abbr docs 2021-09-09 15:13:17 +02:00
Mahmoud Al-Qudsi
e0476cf219 Hack around CMake < 3.9 reporting skipped tests as failed 2021-09-07 12:04:05 -05:00
Mahmoud Al-Qudsi
9151acc498 Split test_driver.sh into test_env.sh + test_driver.sh
This lets us run non-fish targets (such as `fish_tests`) under a clean
test environment without running into the fish-specific payload
configuration now carried out by `test_driver.sh` which expects a
`.fish` payload that it will run under a deterministically configured
instance of fish, running in an environment initialized by
`test_env.sh`.

This should fix the problem with in-tree builds leaving detritus behind
after a `make test` when `fish_tests` would be executed without
`test_driver.sh` - it is now executed under `test_env.sh` instead.
2021-09-07 11:33:56 -05:00
ridiculousfish
9aac663bb0 Remove operator< from builtin_data_t
It was unused.
2021-09-06 18:13:47 -07:00
Kid
139b74d8eb Fix fish_key_reader wrapper check 2021-09-05 21:42:35 +02:00
Johannes Altmanninger
7cdf624086 docs: mention the "all" feature group 2021-09-05 03:34:25 +02:00
ridiculousfish
5eb5aaf9da tmux-prompt test to wait a bit to allow the first prompt to draw
The tmux-prompt test would sometimes fail because the first call was:

     isolated-tmux capture-pane -p

this would run a capture-pane which would race with starting fish
itself; occasionally the pane would be empty since fish has not yet
drawn a prompt. Add a loop to give fish time to draw the prompt.
2021-09-04 16:59:50 -07:00
ridiculousfish
9070ed8039 Correct the order of pkill arguments
On macOS, the tests would often fail because calls to `pkill` would "leak"
across tests: kill processes run by other tests. This is because on macOS,
the -P argument to pkill must come before the process name. On Linux it
doesn't matter.

This improves test reliability on Mac.
2021-09-04 13:34:52 -07:00
Ariel Fermani
2e24aaa605 docs: Fix missing semicolon in Bash group command example 2021-09-04 16:30:28 +02:00
Fabian Homborg
aa58a54224 Webconfig: Add my own colorscheme
Already added my prompt, might a well.
2021-09-03 17:38:34 +02:00
Fabian Homborg
08690e0303 Webconfig: Use theme's name if available
The "name" here refers to the `# name:` line from the .theme file.
That's a much more descriptive name and allows using simpler filenames.
2021-09-03 17:37:54 +02:00
Fabian Homborg
4c98757f85 Stop tests from creating a share/functions/functions link 2021-09-02 17:27:10 +02:00
Fabian Homborg
8b4585d387 docs: Some mistakes in interactive
"This page" is no longer index, we don't match matching parentheses or
quotes and the `\n` didn't show up in the render as the backslash disappeared.
2021-09-01 19:48:33 +02:00
Fabian Homborg
1c64e27a59 CHANGELOG
The command substitution thing is a *bugfix*, not a deprecation.
2021-08-30 19:48:38 +02:00
Fabian Homborg
ac7e3a53c1 screen: Allow for doubled escapes in the tmux sequence
See
https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it.
2021-08-30 18:11:34 +02:00
Fabian Homborg
4194977569 Prompt demo: Only the unmatched quote is an error
The text after is normal quoted text since
822b53c67a.

We might want to find nicer error text.

Fixes #8260.
2021-08-30 17:32:55 +02:00
Fabian Homborg
23e6698dc8 cmake: Force color in the tests
For littlecheck/pexpect this just unconditionally enables color.

I have no idea what happens if you run cmake outside of a terminal
, but the worst that can happen is that *errors* have color
escapes in them.

If someone figures out how to get cmake to tell us if it's running in
a terminal, we can add a check.
2021-08-30 17:16:19 +02:00