Commit graph

18188 commits

Author SHA1 Message Date
Johannes Altmanninger
5512f44899 Enable doctests
They are probably not terribly useful for us but let's see what happens.

Unfortunately cargo does not properly forward the combination of "RUSTFLAGS"
and "--target" that is currently required to build with ASan [1].  Hence doctests
will fail to link on ASan builds. Let's disable doctests when ASan is active.

[1]: https://github.com/rust-lang/cargo/issues/10666 et al
2024-01-13 03:58:33 +01:00
Johannes Altmanninger
07e3459fb0 Address clippy lints on 1.67.0 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
4bae1f3de9 Address clippy lints on stable Rust 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
6896898769 Add [lints] table to suppress lints across all our crates
This was stabilized in 1.74.  Until that's our MSRV, keep the warnings also in
"lib.rs", to prevent warning spew on old builds (CI logs etc.).
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
36b7723a93 Remove stale lint suppression
Feature fish-ffi-tests is no more so we don't need this warning.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
d6c96a0a68 Fix some minor warnings 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
793fb8f8f6 Minor cleanup in fish.rs
For now we always define FISH_BUILD_DIR though we could reconsider.
2024-01-13 03:07:29 +01:00
David Adam
d6cb049aff fish.rs: use some bare returns 2024-01-13 03:07:29 +01:00
David Adam
1683e720a8 Use Rust for executables
Use Rust for executables

Drops the C++ entry points and restructures the Rust package into a
library and three binary crates.

Renames the fish-rust package to fish.

At least on Ubuntu, "fish_indent" is built before "fish".
Make sure export CURSES_LIBRARY_LIST to all binaries to make sure
that "cached-curses-libnames" is populated.

Closes #10198
2024-01-13 03:07:29 +01:00
David Adam
4a2edbf97e Disable doc tests temporarily
None of the existing code blocks compile, so disable them running as tests
for now.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
5a570f187a Remove obsolete LSAN workaround 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
26d359b071 Ubuntu ASAN Dockerfile 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
e89a4f6cb4 Suppress _nc_doalloc memory leak
With the next commit, if I run

    docker/docker_run_tests.sh --shell-after docker/jammy-asan-clang.Dockerfile

I get this in test_string.fish and test_git.fish:

    =================================================================
    ==8339==ERROR: LeakSanitizer: detected memory leaks
    Direct leak of 72 byte(s) in 1 object(s) allocated from:
        #0 0x55a8a637eb45 in realloc /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:85:3
        #1 0x7facb841b6cc in _nc_doalloc (/lib/x86_64-linux-gnu/libtinfo.so.6+0x106cc) (BuildId: e22ba7829a55a0dec2201a0b6dac7ba236118561)
    SUMMARY: AddressSanitizer: 72 byte(s) leaked in 1 allocation(s).

Strangely there is no tparm in the call stack.  It does not seem to happen
in CI.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
2871f5070f CMake: re-enable cargo-test under ASAN
With autocxx/cxx gone, this seems to work fine now.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
e98a794d1c Fix memory leak in inotify tests 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
2d493621f4 test_cargo-test: use Corrosion target dir
This makes "ninja test" write only to the build directory, not to the source
tree. This enables our docker script which mounts the source as read-only.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
6c2271a6da cargo test: change directory to the build directory again
Some tests create files like "./test/test-home".  Traditionally the did so
in the first parent directory that contained tests/test.fish; so either a
build directory or the root.

The new rust version always changes directory to the root.  This blows up
when running with our docker/ files, which mount the source as read-only.

Fix this by always changing directory to the build directory.

In future we could extend this to not chdir if FISH_BUILD_DIR was not
specified, to match traditional behavior. No strong opinions here.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
7686c39d76 test_cargo-test: inherit same variables as Corrosion build targets
In particular, pass the build directory, which is required in some test
scenarios (see next commit).
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
a20525c44f build.rs: deduplicate the build-dir heuristic 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
67de32fe2d Enable pexpect tests in ASAN CI again 2024-01-13 03:07:29 +01:00
Johannes Altmanninger
6ab74c6b09 Human-readable ASAN stack traces CI
Show file names, line numbers and function names in ASAN stack traces
(instead of object file + raw memory address).
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
537e3cb9e1 CI: remove UBSAN_OPTIONS
Rust does not support  UBSan today.
2024-01-13 03:07:29 +01:00
Peter Collingbourne
0b3e9609f1 completions/fastboot: declare -s as taking an argument, add argument completions 2024-01-12 20:45:56 +01:00
Fabian Boehm
23a8967ecb fish_config: Fix on python < 3.12 if not on Windows 2024-01-12 18:42:55 +01:00
ahaoboy
8009469f8f Add support for the Windows MSYS environment. 2024-01-12 17:55:49 +01:00
yinm
b583145a00 Shorten long descriptions 2024-01-12 17:53:49 +01:00
Manlio Perillo
a953b7984d doc_src: add print media support to the Sphinx theme
Update the pydoctheme.css file to add support for print media.

The code was adapted from the existing support for screens that are less than
700px wide, with the following changes:

  - Remove the documents and sections index
  - Remove the quick search
  - Remove dead CSS code

Additionally, add section numbers and ensure that code blocks are never split
across multiple pages.
2024-01-12 17:52:43 +01:00
Mahmoud Al-Qudsi
fdbda18418 Use updated crates.io release for dev dependencies
The versions on crates.io now have the patches we need upstreamed.
2024-01-11 16:58:32 -06:00
Fabian Boehm
40feed56cf fmt
I wish this was shorter, but oh well
2024-01-10 20:59:50 +01:00
Fabian Boehm
2e14c32c5e fish_indent: Another crash
NUL at the end, which is now ignored.

Not *great*, but better than crashing.
2024-01-10 20:56:13 +01:00
Fabian Boehm
50acc4f4de fish_indent: Fix crash with NUL in the source
Really we should *reject* this
2024-01-10 20:47:39 +01:00
Fabian Boehm
52a3e1393f Add tests 2024-01-10 19:36:06 +01:00
Fabian Boehm
445406d251 fish_indent: Don't panic for gap text
It should be fine to just write the space out here.

This one triggered by `echo b\|\{ | ./fish_indent`
2024-01-10 19:33:47 +01:00
Fabian Boehm
ed251578d1 fish_indent: Fix crash if errors aren't sorted
I've found this for `echo \x1e\<\) | ./fish_indent`

Which is *extremely* broken script, to be fair
2024-01-10 19:33:00 +01:00
Fabian Boehm
76ddfca420 ast: Actually format debug messages
Also fixes two format strings
2024-01-10 19:20:07 +01:00
Fabian Boehm
b5ccacf5b5 fish_indent: Fix crash with redirection at the end of the source 2024-01-10 18:54:25 +01:00
Fabian Boehm
cb51b236f3 cmake: Include GNUInstallDirs earlier for BINDIR etc to take effect
GNUInstallDirs is what defines CMAKE_INSTALL_FULL_BINDIR and such, so
the setting in Rust.cmake didn't work.

This also makes build.rs error out if any of these aren't defined
2024-01-10 17:51:23 +01:00
Fabian Boehm
2aee930659 Revert "Remove redundantly set corrosion env vars."
This reverts commit 114ebe3b8f.
2024-01-10 17:21:05 +01:00
Fabian Boehm
fbfc6f8d8c Fix highlighting for slices with quotes
This would highlight `$var["foo"]` as an error because
parse_util_slice_length didn't advance the iterator.

There's got to be a nicer way to write this.
2024-01-10 17:04:54 +01:00
Johannes Altmanninger
e84d110995 Fix arithmetic overflow in up-line
The C++ code implicitly relied on wrapping behavior.

There are probably more cases like this.  Maybe we should disable
"overflow-checks" in release mode.
2024-01-10 09:38:45 +01:00
Johannes Altmanninger
114ebe3b8f Remove redundantly set corrosion env vars.
They should already be set in Rust.cmake.
See https://github.com/fish-shell/fish-shell/pull/10198#discussion_r1446402611
2024-01-10 09:38:45 +01:00
Johannes Altmanninger
113f76eecb Address minor clippy lint 2024-01-10 09:38:45 +01:00
Fabian Boehm
b82dad0160 Fix tokenizer crash
This would crash from the highlighter for something like

`PATH={$PATH[echo " "`

The underlying cause is that we use "char_at" which panics on
overread.

So instead this implements try_char_at and then just returns None.
2024-01-09 19:12:16 +01:00
Fabian Boehm
f7c9538fb0 wildcard: Check trailing components against
Forward-port of c31e194120,
Revert of 6823f5e337,
Fixes #10205
2024-01-09 19:08:52 +01:00
Fabian Boehm
96caee837c docs: Add else and end to keywords list 2024-01-09 16:27:33 +01:00
Fabian Boehm
a3c4d74ecd Don't always regenerate the exported array
This made launching external commands about 30% slower.
2024-01-08 17:50:02 +01:00
ridiculousfish
40fad20d7f Remove additional unnecessary uses of unsafe 2024-01-07 17:39:23 -08:00
ridiculousfish
92f49ca071 Remove unsafe from handling of DISOWNED_PIDS
This can be trivially safe.
2024-01-07 17:34:27 -08:00
ridiculousfish
5bff483fe1 Clean up io_chain in IoStreams
Previously this was a pointer; now it can just be a reference.
2024-01-07 17:28:36 -08:00
ridiculousfish
7d7c59611f Implement AtomicRef and use that instead of Lazy strings
This improves thread safety since we're now using actual atomics.
2024-01-07 17:04:41 -08:00