Commit Graph

17358 Commits

Author SHA1 Message Date
Fabian Boehm
e09f7e4e4d create_manpage_completions: Skip more prefixes
This also skips the 192 git- and 64 npm- pages that

1. have better completions already (for the most part)
2. don't have the same name as a command typically in $PATH

In doing so it reduces the runtime on my system from 9s to 7s. Granted
I have all of these, so that's the best case.
2023-05-12 17:57:29 +02:00
Fabian Boehm
5f672ece84 create_manpage_completions: Also clear already_output_completions
Prevents issues if we try to read a manpage twice - in which case we
could fall back to another parser, creating different results.

Fixes #9787
2023-05-12 16:35:05 +02:00
Fabian Boehm
56743ae770 tests: More slack for ASAN
Disable one and add a sleep to another
2023-05-11 22:14:12 +02:00
Fabian Boehm
8d5a223b39 tests/pexpect: Disable wait.py under SAN CI 2023-05-11 21:42:19 +02:00
Fabian Boehm
055e40467f github actions: Disable pexpect for ASAN for now
This fails basically every commit, just by blowing the time budget.
2023-05-08 19:05:44 +02:00
Fabian Boehm
d855725965 completions/dnf: Use lowercase queryformat
See de9c5c5b59

Fixes #9783
2023-05-08 18:34:02 +02:00
ridiculousfish
e71b75e0e4 Reimplement environment and the environment stack in Rust
This reimplements the environment stack in Rust.
2023-05-07 15:15:56 -07:00
ridiculousfish
8ec1467dda Implement (but do not yet adopt) Environment in Rust
This implements the primary environment stack, and other environments such
as the null and snapshot environments, in Rust. These are used to implement
the push and pop from block scoped commands such as `for` and `begin`, and
also function calls.
2023-05-07 15:15:56 -07:00
ridiculousfish
0681b6b53a Make C++ env_var_t wrap Rust EnvVar
This reimplements C++'s env_var_t to reference a Rust EnvVar.
The C++ env_var_t is now just a thin wrapper.
2023-05-07 15:15:56 -07:00
ridiculousfish
10ee87eb28 Reimplement owning_null_terminated_array in Rust
owning_null_terminated_array is used for environment variables, where we need to
provide envp for child processes. This switches the implementation from C++ to
Rust.

We retain the C++ owning_null_terminated_array_t; it simply wraps the Rust
version now.
2023-05-07 15:15:56 -07:00
ridiculousfish
d4c3c77318 Changelog fix in #9776 2023-05-07 14:34:19 -07:00
Rocka
c21e13e62e completions: fix qdbus Q_NOREPLY method completion 2023-05-07 14:34:03 -07:00
AsukaMinato
e2fdc63cdb
simplify some logic (#9777)
* simplify some logic

* simplify a &*
2023-05-07 08:39:34 -05:00
Mahmoud Al-Qudsi
6a301381c8 Fix compilation on 32-bit non-Linux platforms
The `u64::from(buf.f_flag)` was needed in two places. The existing handled macOS
which always has a 32-bit statfs::f_flag, but statvfs::f_flag is an `unsigned
long` which means it needs to be coerced to 64-bits on 32-bit targets.
2023-05-05 19:35:17 -05:00
Mahmoud Al-Qudsi
7d617d7d58 Support cross-compilation w/ detect_bsd() check
Also assert that the code works as expected by asserting the result under known
BSD systems.
2023-05-05 19:03:23 -05:00
Mahmoud Al-Qudsi
220ffaeb65 Add completions for builtin disown
It completes identical to `fg` and `bg` w/ this change. I'm not aware of any
reason why it shouldn't, but feel free to enlighten me if I've missed something.

[ci skip]
2023-05-05 16:08:58 -05:00
Mahmoud Al-Qudsi
d55b65a8d2
Merge pull request #9771 from mqudsi/asan_take5
Rework ASAN integration
2023-05-04 19:43:37 -05:00
Mahmoud Al-Qudsi
4f5cef446a apt.fish: Fix compatibility with newer versions of Debian/Ubuntu
Why drop support for `awk -e`? Linux sees so much needless churn!
2023-05-03 21:27:46 -05:00
Mahmoud Al-Qudsi
8bd5183944 Remove unnecessary UTF-8 decode in is_wsl() 2023-05-02 14:58:44 -05:00
Mahmoud Al-Qudsi
d3abd5d600 Fix inverted is_console_session() logic
The $TERM matching logic was inverted.
2023-05-02 14:55:04 -05:00
Mahmoud Al-Qudsi
c94fce75e5 Add multi-byte test for wcscasecmp()
The lowercase of İ is two bytes, making it a good test candidate.
2023-05-02 14:18:43 -05:00
Mahmoud Al-Qudsi
8668ce336c Fix common::wcscasecmp() for multi-byte lowercase strings 2023-05-02 14:10:12 -05:00
Mahmoud Al-Qudsi
6c8409fd45 Remove unnecessary use of static mut.
Atomic don't need to be `mut` to change since they use interior mutability.
2023-05-02 13:22:39 -05:00
Mahmoud Al-Qudsi
f71a75f3bb Avoid unnecessary vector shift in re::regex_make_anchored()
There's no reason to inject prefix into our newly allocated str after storing
pattern in there. Just allocate with the needed capacity up front and then
insert in the correct order.
2023-05-02 13:15:02 -05:00
Mahmoud Al-Qudsi
40be27c002 Avoid unnecessary vector shift in re::regex_make_anchored()
There's no reason to inject prefix into our newly allocated str after storing
pattern in there. Just allocate with the needed capacity up front and then
insert in the correct order.
2023-05-02 13:13:11 -05:00
Xiretza
1dafb77cda Use bitflags for ParseTreeFlags + ParserTestErrorBits
For consistency with simlar code.
2023-05-02 19:03:51 +02:00
Mahmoud Al-Qudsi
7b0cc33f2e Add LSAN suppressions file
Suppress TLS variable leaks caused by outstanding background threads by
suppressing the ASAN interposer functions. This is possible because because
we're now using use_tls=1.

-----------------------

Direct leak of 64 byte(s) in 2 object(s) allocated from:
    #0 0x5627a1f0cc86 in __interceptor_realloc (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xb9fc86) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #1 0x7f04d8800f79 in pthread_getattr_np (/lib/x86_64-linux-gnu/libc.so.6+0x95f79) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #2 0x5627a1f2f664 in __sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbc2664) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #3 0x5627a1f2fb83 in __sanitizer::GetThreadStackAndTls(bool, unsigned long*, unsigned long*, unsigned long*, unsigned long*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbc2b83) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #4 0x5627a1f19a0d in __asan::AsanThread::SetThreadStackAndTls(__asan::AsanThread::InitOptions const*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbaca0d) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #5 0x5627a1f19615 in __asan::AsanThread::Init(__asan::AsanThread::InitOptions const*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbac615) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #6 0x5627a1f19b01 in __asan::AsanThread::ThreadStart(unsigned long long) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbacb01) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #7 0x7f04d87ffb42  (/lib/x86_64-linux-gnu/libc.so.6+0x94b42) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #8 0x7f04d88919ff  (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
2023-05-02 11:52:42 -05:00
Mahmoud Al-Qudsi
91485c90ca Also free ncurses terminal state when exiting under ASAN 2023-05-02 11:52:42 -05:00
Mahmoud Al-Qudsi
73983bada5 Fix ncurses memory leak in init_curses()
init_curses() is/can be called more than once, in which case the previous
ncurses terminal state is leaked and a new one is allocated.

`del_curterm(cur_term)` is supposed to be called prior to calling `setupterm()`
if `setupterm()` is being used to reinit the default `TERMINAL *cur_term`.
2023-05-02 11:52:42 -05:00
Mahmoud Al-Qudsi
905430629d Use ASAN_OPTIONS fast_unwind_on_malloc=0
This is much slower but gives proper stack traces for calls emanating from code
that wasn't compiled with -fno-omit-frame-pointer.
2023-05-02 11:52:42 -05:00
Mahmoud Al-Qudsi
3651e0e9d8 Actually report ASAN memory leaks
The new asan exit handlers are called to get proper ASAN leak reports (as
calling _exit(0) skips the LSAN reporting stage and exits with success every
time).

They are no-ops when not compiled for ASAN.
2023-05-02 11:52:41 -05:00
Mahmoud Al-Qudsi
c43e040c7c Fix spurious ASAN __cxa_thread_atexit_impl() leaks
Set use_tls back to its default of 1.

This is required to work around an ASAN/LSAN virtualization bug but seems to be
behind the random __cxa_thread_atexit_impl() leaks?
2023-05-02 11:52:41 -05:00
Mahmoud Al-Qudsi
cb368f70ee Fix rust formatting for BSD signal tests 2023-05-02 11:51:56 -05:00
Mahmoud Al-Qudsi
6a3ece6766 Rename Sigchecker to SigChecker to be more idiomatic
Idiomatic rust naming for types is "PascalCase" and this was more "Pascalcase".
2023-05-02 11:29:18 -05:00
Mahmoud Al-Qudsi
55c3df7f41 Fix BSD test failure regression
Nothing major. Introduced in 1ecf9d013d.
2023-05-02 11:23:11 -05:00
Xiretza
afe2e9d8db builtins/printf: avoid string copies by formatting directly to buffer
Closes #9765.
2023-05-01 13:32:44 -05:00
ridiculousfish
4771f25102 Adopt the new Rust signal implementation
This switches the signals implementation from C++ to Rust.
2023-04-30 16:22:57 -07:00
ridiculousfish
1ecf9d013d Port (but do not adopt) signal handling bits in Rust
This ports some signal setup and handling bits to Rust.

The signal handling machinery requires walking over the list of known signals;
that's not supported by the Signal type. Rather than duplicate the list of
signals yet again, switch back to a table, as we had in C++.

This also adds two further pieces which were neglected by the Signal struct:

1. Localize signal descriptions
2. Support for integers as the signal name
2023-04-30 16:22:55 -07:00
ridiculousfish
603a2d6973 Rename sigchecker_t to Sigchecker
This matches Rust naming conventions
2023-04-30 11:32:18 -07:00
ridiculousfish
2848be6b73 Add an empty test case to the join_strings tests 2023-04-29 17:02:18 -07:00
Fabian Boehm
a9708367db doc: Link path in commands 2023-04-29 19:58:41 +02:00
Xiretza
81cdd51597 Update printf-compat 2023-04-29 19:57:33 +02:00
Mahmoud Al-Qudsi
544bd183da Add and use ASAN blacklist
Blacklist an apparently false positive in the underlying runtime.
2023-04-29 11:02:59 -05:00
Mahmoud Al-Qudsi
ecf1676601 Add and use type-erased RAII callback wrapper for ffi
This allows the rust code to free up C++ resources allocated for a callback even
when the callback isn't executed (as opposed to requiring the callback to run
and at the end of the callback cleaning up all allocated resources).

Also add type-erased destructor registration to callback_t. This allows for
freeing variables allocated by the callback for debounce_t's
perform_with_callback() that don't end up having their completion called due to
a timeout.
2023-04-29 11:02:59 -05:00
Mahmoud Al-Qudsi
6cd2d0ffed Integrate threads.rs w/ legacy C++ code
Largely routine but for the trampolines in iothread.h and iothread.cpp which
were a real PITA to get correct w/ all their variants.

Integration is complete with all old code ripped out and the tests using the
rust version of the code.
2023-04-29 11:02:59 -05:00
Mahmoud Al-Qudsi
7f9a942f1d Port remainder of iothreads from C++ 2023-04-29 11:02:59 -05:00
Fabian Boehm
0963e6769e completions/wvdial: Use path 2023-04-29 16:15:13 +02:00
Fabian Boehm
2f997ba8a2 Remove a useless sort 2023-04-29 16:15:07 +02:00
Fabian Boehm
32715ee504 completions/sv: Use path 2023-04-29 15:58:52 +02:00
Fabian Boehm
05e7732cb8 tests: Disable one commandline test
Keeps failing under ASAN on Github Actions
2023-04-28 17:41:29 +02:00