Commit Graph

14727 Commits

Author SHA1 Message Date
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
Fabian Homborg
aa17ed51ce tests/checks/complete: Do $PWD stuff in the tempdir
This broke the tests on my machine, and doing

```fish
cd $dir
cd -
```

seems wrong in any case.
2021-08-30 17:07:11 +02:00
Fabian Homborg
c02cc110e0 screen: Support tmux escape sequences
Tmux has support for wrapping arbitrary escape sequences inside

```
\ePtmux;\e%s\e\\
```

Since this ends like the screen title escape, we just reuse that.

Characteristically, this is basically undocumented, but we already use
it in e.g. fish_vi_cursor.
2021-08-30 16:55:14 +02:00
Fabian Homborg
d62e22dcc0 Correct a realpath test
This used the *logical* $PWD, but realpath would operate on the
physical $PWD if given ".", even with -s. This makes this test fail if the $PWD is
logically different from physical.
2021-08-29 23:10:50 +02:00
Fabian Homborg
0bcf5ac88d cmake: Use progress output for tests
This means instead of printing at least two lines per successful test,
we overwrite one line again and again with the current status, and
for *failed* (i.e interesting) tests we print the output.

Makes test failures much more visible.
2021-08-29 23:04:11 +02:00
Johannes Altmanninger
77c434bc42 Extract setup and teardown for tmux tests
This was long overdue since the setup logic is much more complex than
the actual tests.

tmux-prompt.fish had extra logic to protect against XDG_CONFIG_HOME
with leading double double-dot.  I believe this is no longer necessary
with the new test driver.

We still use our own temp dir because we want to be able to run this
independently of the test driver, This can be useful for debugging
tests.  For example we can insert a "$tmux attach" command in a test,
and then run

	build/fish -C 'source tests/test_functions/isolated-tmux.fish' tests/checks/tmux-bind.fish

This allows to inspect the state of the test and debug interactively.
Attaching to the terminal doesn't work when running inside littlecheck
because littlecheck consumes our output and doesn't give us a terminal.
(Maybe there's an easy way to fix that?)
2021-08-29 20:22:16 +02:00
Johannes Altmanninger
bd79e753ff Fix detection of zombies in test
Due to the second column the old glob no longer worked.
2021-08-29 20:22:16 +02:00
Fabian Homborg
8334df9368 CHANGELOG: Work on 3.4.0 2021-08-29 20:19:18 +02:00
Mahmoud Al-Qudsi
069d396ebc Merge branch 'ctest' 2021-08-29 13:03:16 -05:00
Mahmoud Al-Qudsi
9a071090dc Allow tests/checks/basic.fish to run without test driver
On request of a team member, this patches `basic.fish` to no longer
depend on being invoked by the test driver and started up in a $PWD that
points to a clean temporary directory.
2021-08-29 12:53:37 -05:00
Mahmoud Al-Qudsi
2157d91a5c Re-add explicit littlecheck HOME/XDG_CONFIG_HOME overrides on request
This was requested by a team member who would like for some tests to
remain invokable (in thier own $HOME) directly via littlecheck without
relying on the test driver to prep the environment.

A comment explaining the rationale is also added so this doesn't get
passed down as folklore "you need to include this for tests to run" even
though no one understands why.
2021-08-29 12:38:28 -05:00
Rosen Penev
e62e6c35f7 add constexpr
This was not const before.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-08-29 19:14:27 +02:00
mtoohey31
25b9568f2a completion: exif (#8246)
Adds completion support for the exif command line tool (upstream:
https://github.com/libexif/exif).
2021-08-29 11:35:08 +02:00