Commit Graph

13754 Commits

Author SHA1 Message Date
Fabian Homborg
56e1109609 Add test for caller-exit events
This was a bit fiddly!
2021-03-07 10:22:35 +01:00
Fabian Homborg
371516382d Create job-exit caller events inside event handlers
f7e2e7d26b forbid any job exit events
from happening inside jobs that were themselves event handlers, but
that causes e.g.

```fish
function f --on-event fish_prompt
source (echo "echo hello world" | psub)
end
```

to not trigger psub's cleanup, so it leaves files in $TMPDIR behind.

This was hit by pyenv, because that still uses `source (thing |
psub)`.

Fixes #7792.
2021-03-07 10:00:52 +01:00
Ilya Grigoriev
fe70c29c48 Incorporate black suggestions & rearrange imports slightly
This isn't really necessary, but it makes the file look nicer to
my eyes. Let me know if you want me to remove this commit.
2021-03-07 09:42:41 +01:00
Ilya Grigoriev
f725cd402d Make help and fish_config work on Chrome OS
When `fish` is running in the Chrome OS Linux VM (Crostini),
both `help` and `fish_config` opened a "file not found"
page. That is because on Crostini, `BROWSER` is usually set to
`garcon-url-handler`, which opens URLs in the host OS Chrome
browser. That browser lacks access to the Linux file system.

This commit fixes these commands. `help` now opens the URL on
www.fishshell.com.  `fish_config` now opens the URL for the
server it starts. Previously, it opened a local file that
redirects to the same URL.

In the case of `help`, the situation could be improved further
by starting a web server to serve help. I don't know of another
way to access `/share/fish` from outside the VM without user
intervention, and I think that might be a part of the security
model for the Crostini VM.

It's hard to write a test for this. I checked that `help math`,
`python2 webconfig.py`, and `python3 webconfig.py` work on my
machine running in Crostini.
2021-03-07 09:42:41 +01:00
Mahmoud Al-Qudsi
8a07db8e8f Revert "Revert "Speed up check-all-fish-files when executed locally""
This reverts commit e240d81ff8 and
introduces a more compatible method of finding newly added fish scripts
to syntax check.

`find -newer` is the original and is supported by everything under the
sun (including FreeBSD, NetBSD, Solaris, OpenIndiana, macOS 10.10, WSL,
and more), and if not, the tests will succeed anyway. `find -mnewer` was
added later around the time `find -cnewer` and co (which checks the
creation date rather than the modification date) was introduced, but
apparently the GNU version of coreutils never introduced the `-mnewer`
alias for `-newer`.

Yes, this is hacky and yes it would be ideal if the build system is the
one that picked which tests to run rather than the test itself picking.
But let's not pretend that our tests are idealogically ideal or pure
right now and until we fix the mess that is our CMake test integration
(e.g. use ctest and configure each test to be run separately with
configurable payloads, etc) eight seconds is still eight seconds, and
again, the CI isn't affected.
2021-03-06 17:13:20 -06:00
Fabian Homborg
e240d81ff8 Revert "Speed up check-all-fish-files when executed locally"
My find (GNU findutils 4.8.0) prints

> find: unknown predicate `-mnewer'

So we would have to test for support.

Also this is *super* hacky - tests aren't supposed to keep files
around, this is something you would do in the build system.

This reverts commit ddd0e28b4f.
2021-03-06 09:36:56 +01:00
Fabian Homborg
10ef0d9daf Fix clipboard_paste nicer
Instead of hacking in arbitrary characters to avoid splitting, just
use `string collect`.

This reverts commit e450190d50.

Fixes #7782, but nicer.
2021-03-06 08:40:07 +01:00
Fabian Homborg
25d85bdc64 path_get_path: Remove error on unknown errno
This seems like a good idea, but there isn't anything we or anyone
else can *do* in this case. All we ever do is pile on additional
errors on the ignore pile, we can't handle any of them differently.
The command isn't a thing, so we check the next path.

The impetus for this is Cygwin apparently returning a wonderfully
useless 0, and it's not even the first one to do so.

Fixes #7785
2021-03-06 08:12:27 +01:00
Mahmoud Al-Qudsi
a536ab810a Don't set check-all-fish-files timestamp in case of error
I'm not sure if this is necessary or if littlecheck would abort before
the for loop completed and `touch` was executed.
2021-03-05 22:50:26 -06:00
Mahmoud Al-Qudsi
ddd0e28b4f Speed up check-all-fish-files when executed locally
Only check fish files that have been modified since the last time they
were checked. (This continues with the assumption that we are testing
for broken /usr/share fish scripts and not breakage of the fish parser,
which is covered by all the other tests.)

This saves 8 seconds on an NVMe disk under WSL. Won't affect integrity
of CI runs, which start with a blank slate each time.
2021-03-05 22:40:40 -06:00
Mahmoud Al-Qudsi
11951a245f Optimize pruning of job/proc exit handlers
Pre-emptively delete the handler while we have possession of the lock
before calling the event itself. It's crude, but it works.
2021-03-05 22:40:06 -06:00
Mahmoud Al-Qudsi
e7398c0248 Prune job exit handlers after running
While pid values may be reused, it is logical to assume that fish event
handlers coded against a particular job or process id mean just the job
that is currently referred to be any given pid/pgrp rather than in
perpetuity.

This trims the list of registered event handlers nice and early, and as
a bonus avoids the issue described in #7721.

The cleanup song-and-dance is extremely ugly due to the repeated locking
and unlocking of the event handler list.

Closes #7221.
2021-03-05 22:32:57 -06:00
Mahmoud Al-Qudsi
99e02ba47a Add #7782 to CHANGELOG.rst
[ci skip]
2021-03-05 17:13:51 -06:00
Mahmoud Al-Qudsi
e450190d50 Fix regression causing error and prompt corruption on paste
Closes #7782

[ci skip]
2021-03-05 17:13:28 -06:00
Fabian Homborg
6bc0064a2a demangled_backtrace: Cast a thing to const char* instead of char*
Apparently this is const char* on NetBSD, so it complains.

Since it should be harmless to allow this one to be const, just do
that.
2021-03-05 19:40:44 +01:00
Fabian Homborg
69c71052ef Remove __fish_repaint
This was a handler for various prompt variables that called a repaint.

Unfortunately, if you set one of those *inside* the prompt (a logical
place for it), this would lead to something like #7775.

So, because this isn't actually *useful* as far as I can see (how do
you set these variables in a way that you're not already inside a
prompt or about to draw a prompt? in a key binding?), we remove it,
like we removed the repaint from git's variable handlers.
2021-03-04 19:20:31 +01:00
Fabian Homborg
b1c5e003ef fish_command_not_found: Actually define default handler
Fixes #7777
2021-03-04 18:30:12 +01:00
Jake
ece0aa5324
Update rsync completions (#7763)
* Add rsync flags completion

* Add missing rsync completions

* Remove bracket expansion and fix aka long options

* Improve rsync flags function code

* Replace "newness" with birth for creation times

* Improve rsync version option description

* Clarify rsync append-verify
2021-03-04 18:15:25 +01:00
Fabian Homborg
8bb2ca95c8 checks/git: Give grep a literal tab
Apparently the grep on FreeBSD doesn't do \s or \t. Since we're
looking for an actual tab, just give it an actual tab.

See https://builds.sr.ht/~faho/job/448496.
2021-03-04 16:25:41 +01:00
Fabian Homborg
a561904afd Add CHANGELOG for 3.2.1
(to be clear the current state, this isn't yet the release)
2021-03-04 16:17:27 +01:00
Fabian Homborg
d85bdf120f fish_add_path: Handle moving multiple arguments correctly
This `set -e` had a cartesian product that caused it to remove the
indexes separately, so the later indexes were off - removing the first
and then the second ends up removing the first and then the
old-*third* which is now the second.

Just quote the expansion so it runs in one go.

Fixes #7776
2021-03-04 16:10:27 +01:00
Fabian Homborg
76457bdc4e fish_git_prompt: Remove repaint from variable handlers
Because we removed repaint coalescing, currently setting any of the
git prompt variables in fish_prompt leads to a repaint loop (that
presumably aborts once it reaches the recursion limit).

Since repainting on these variables isn't really useful (when you
`set` them interactively you already get a new prompt), just remove
it.

There's two cases this "breaks":

- When you set a variable *after* the call to fish_git_prompt
- When you set a variable via a binding

In both of these it's not too much to expect an explicit "commandline
-f repaint", especially since for bindings that's already needed in
most cases, and setting a variable after using it isn't normal.

Fixes #7775.
2021-03-04 15:58:20 +01:00
Fabian Homborg
c96a07dc96 Revert "Prevent redirecting internal processes to file descriptors above 2"
FDs are inherited, and redirecting those is harmless, and forbidding
that is worse than allowing all.

Fixes #7769.

This reverts commit 11a373f121.
2021-03-03 22:26:33 +01:00
Fabian Homborg
791b42f065 Disable SIGIO notifier
It doesn't work on WSL, Solaris and Archlinux (and presumably that
means future versions of other linux distros).

In its current state I don't trust it enough to enable it anywhere by
default, especially since I'm not aware of an actual issue with the
named pipe (other than that the code is ugly).

Fixes #7774
2021-03-03 22:26:28 +01:00
Fabian Homborg
0a3fec5e8b __fish_print_pipestatus: Reset modifiers again
Called as

__fish_print_pipestatus "[foo" "oof]" "|" (set_color green) (set_color --bold blue) 0 1 2

it would make the closing `oof]` bold green.

Fixes #7771.
2021-03-03 19:20:28 +01:00
Fabian Homborg
a36dbad3b8 cmake: Stop copying css files
custom no longer exists and pygments is just with the theme
2021-03-02 17:04:47 +01:00
Fabian Homborg
54ff7b29a9 docs: Give logo a specific width 2021-03-02 17:03:32 +01:00
Fabian Homborg
5b4db4a6ea docs: Remove some useless wrappers
The "classic" theme is a mostly useless wrapper around the basic theme
that just adds a collapsible sidebar (that we no longer have).

Moving to basic directly drops a layer of indirection and a file that
needs to be transferred over the net.

Same thing goes for "default.css" which literally just includes
classic.css (WHYYYY???)

(also this removes some useless javascript)
2021-03-02 16:59:38 +01:00
Fabian Homborg
edfa6746c6 docs: Move pygments css 2021-03-02 16:52:28 +01:00
Fabian Homborg
bf801afef8 docs: Move custom.css into the main css
There's no real separation here so one file is preferable.

We'll leave the pygments.css intact because that handles a different thing
2021-03-02 16:49:23 +01:00
Fabian Homborg
955c0003ca fd_monitor: Explicity include <thread>
Might fix issues with gcc 11.0.1.

See #7764.
2021-03-02 15:27:13 +01:00
Fabian Homborg
119b978cbc type: Add --quiet back
It's supposed to be *deprecated*, not removed. The documentation even
specifically calls it out.

Fixes #7766
2021-03-02 14:53:02 +01:00
Fabian Homborg
12e059adf8 docs: Hardcode a list of short builtins for unmatched search
Unfortunately this has both stopwords and a length limit, and things
like "and" just are tough to search.

So what we do is leave everything as it is, but when a search fails,
we show a list of things that are hard to search for, currently that's
"and", "for", "if" and such.

Fixes #7757.
2021-03-02 14:17:29 +01:00
Érico Rolim
d948b34420 Include <termios.h> instead of <sys/termios.h>.
Slipped by with ffa24eb361. Given
daf5ef1bbd, fish should be using
<termios.h> in all cases.
2021-03-02 12:05:07 +01:00
Fabian Homborg
abaa057e5c Replace our only dynamic_cast with old-school casting
dynamic_cast requires rtti to be enabled. Now, this isn't a big
problem, but since this is our only dynamic_cast in the entire
codebase, and it's not serving an important function, we can just
replace it.

See #7764
2021-03-02 09:44:23 +01:00
David Adam
d655d24148 CHANGELOG: add headers for next release 2021-03-01 22:53:29 +08:00
David Adam
63fa8dfd26 fish.spec: drop RHEL 6 elements
RHEL/CentOS 6 are now out of support by upstream and fish.
2021-03-01 22:16:01 +08:00
David Adam
670868f853 Release 3.2.0
Closes #6585.
2021-03-01 20:47:02 +08:00
David Adam
bffb18043f CHANGELOG: work on 3.2.0 2021-03-01 20:29:45 +08:00
Ilya Grigoriev
a04ba04588 Fix git.fish test failing because of an alias
I have an alias `adda=add :/` in my globabl `.gitconfig`, which
made the test fail. This is the fix.
2021-03-01 10:02:03 +01:00
David Adam
c402ce0152 docs: note that function --on-variable is not fired for every change
As discussed in #7735.
2021-02-28 21:24:22 +08:00
David Adam
3e8e864c7c docs: note job expansion in bg/fg/jobs arguments
Discussed in #5019.
2021-02-28 20:56:23 +08:00
exploide
1f3fdf2de6 added hashcat completions 2021-02-28 12:13:58 +01:00
exploide
5ab61dde12 added completions for JohnTheRipper 2021-02-28 12:13:58 +01:00
Brett Jia
384975c892
git: Shorten various long descriptions (#7752)
* Shorten various long descriptions

* Address review comments
2021-02-28 12:12:57 +01:00
Afsar Pasha
9909623262 Fixed __fish_adb_get_devices 2021-02-28 12:12:01 +01:00
Fabian Homborg
6b6f8d2295 Avoid changing how custom fish_titles are called
This half-reverts commit a3cb1e2dcd,
avoiding the bit that passed arguments differently.

Note that this means the initial bug is kept in the hardcoded fallback title.

Fixes #7749.
2021-02-28 08:40:39 +01:00
David Adam
3090f8b501 CHANGELOG: work on 3.2.0 2021-02-27 22:45:56 +08:00
Birk Tjelmeland
2719179bc1 Fix pandoc completion error
Pandoc completions would give an error if the folder `~/.pandoc`
does exist. This commit fixes that.
2021-02-27 22:31:42 +08:00
nosed1ve
aa608a42ff
Ensure web_config works on WSL (#7742)
* Ensure web_config works on WSL

web_config could sometimes fail on WSL if the user chose not to append
windows directories to their linux $PATH. This change ensures that the
cmd.exe executable is found in most cases even if windows directories
are not appended to $PATH on linux.

An error message letting the user know that cmd.exe was not found, and
that they should add the cmd.exe dir to their $PATH before running
fish_config is displayed if cmd.exe is still not found.

* Exit with a non 0 status code if cmd.exe is not found
2021-02-25 16:21:34 +01:00