Commit Graph

19553 Commits

Author SHA1 Message Date
Peter Ammon
3aa12c1be9
Rename ParseExecutionContext to ExecutionContext 2024-06-29 18:03:52 -07:00
Kendell R
2a0f7e411f
don't error if only dependencies or devDependencies are present (#10594) 2024-06-29 18:01:41 -05:00
Mahmoud Al-Qudsi
8f563846e8
Compile in release mode for at least one CI runner (#10591)
When we changed our default from RelWithDebInfo to Debug, we inadvertently ended
up with all CI building and running in Debug mode. Change at least one of them
back to Release to make sure we don't have any optimizations that cause funky
stuff.

I'm changing the Ubuntu CI image because it's hopefully the fastest (since rust
is relatively dog-slow to compile in release mode).
2024-06-27 21:46:18 -05:00
Mahmoud Al-Qudsi
b5f5fa98bf Fix __fish_describe_command integration test under macOS
__fish_apropos is a huge hack under macOS and it seems that it's either broken
or man pages are missing/not indexed under CI. In all cases, hard-code the
results of __fish_describe_command to test the integration machinery
specifically and get the test to pass under macOS CI.
2024-06-27 21:35:06 -05:00
Mahmoud Al-Qudsi
dd7d537d90 Add regression test for command completion descriptions 2024-06-27 20:45:38 -05:00
Mahmoud Al-Qudsi
0adebdfbc4 Fix completely broken __fish_describe_command integration
Command completion descriptions were not being generated from `apropos`. Well,
they were being generated but that was not being correctly used by fish core.

Not sure when this was broken, but there's a possibility it was during the rust
port.

In addition to simply not working, it seems the old code tried to avoid
allocations but String::split_at_mut() allocates a new string (since one
allocation from the global allocator can't be split into two allocations to be
freed separately). Use `String::as_mut_utfstr()` before splitting the &wstr
instead of splitting the &str to actually do this alloc-free.
2024-06-27 20:43:14 -05:00
Mahmoud Al-Qudsi
ee4d578171 completions/env: Fix errant loud string match
This was vexing me for a while because the extraneous output presented as a
valid (but unwanted) completion, i.e. with RUSTC_WRAPPER exported, `env RUSTC_W`
would offer `RUSTC_W=` and `RUSTC_WRAPPER=` as completions (when only the latter
should have been offered up).
2024-06-26 19:10:51 -05:00
Mahmoud Al-Qudsi
f711c874ce Fix broken __fish_bin_dir when running out of build directory
`exec_path` is the path to the `fish` binary itself. This would cause the shell
to try to execute /foo/bar/fish/fish, which would, of course, fail.
2024-06-26 19:01:57 -05:00
Johannes Altmanninger
90150e1729 fish_key_reader: enable terminal protocols again
Fixes 29f2da8d1 (Toggle terminal protocols lazily, 2024-05-16).
2024-06-25 19:55:24 +02:00
Ryan Patterson
2d9f8547e2 Fix completion for port
This blames to a40b019, when @floam made some changes to various completions,
but this one seems to not quite fit the pattern and had a copy/paste error
resulting in using an undeclared variable.

Also disable filename completion on port.
2024-06-25 22:18:53 +08:00
Mahmoud Al-Qudsi
4d7ef1fad8 Speed up kldload descriptions with alternative to __fish_whatis
__kld_whatis is an order of magnitude faster than calling `whatis` by means of
`__fish_whatis`. (It could be even faster if we could somehow tell `string
replace` to return after the first result, since the .Nd line comes at the start
of the file.)

It still takes some ~3.5 to print descriptions for all available klds (864 under
FreeBSD 13), so we still need to decide when it's prudent to do so and when it's
not.
2024-06-24 15:21:06 -05:00
Mahmoud Al-Qudsi
d914f4e991 Fix broken __fish_whatis
This has been broken for a *long* time.
2024-06-24 14:30:37 -05:00
David Adam
2d3bb36b8c GitHub Actions: drop CXXFLAGS as no C++ remains 2024-06-24 18:57:23 +08:00
Peter Ammon
73c46db609
Remove some (hopefully) unnecessary clippy and compiler directives 2024-06-23 17:13:14 -07:00
Peter Ammon
d059bdb877
Bring topic monitor naming in line with Rust conventions 2024-06-23 17:06:20 -07:00
Peter Ammon
6163999ec7
Remove the ParserRef type
No need to pass around Rc any more.
2024-06-23 16:49:11 -07:00
Peter Ammon
4557d9fc09
Remove the notion of principal parser
The "principal" parser is the one and only today; in the future we hope to
have multiple parsers to execute fish script in parallel.

Having a globally accessible "principle" parser is suspicious; now we can
get rid of it.
2024-06-23 16:49:11 -07:00
Peter Ammon
631516398e
Remove the notion of the "principal" environment stack
The "principal" environment stack was the one that was associated with the
"principal" parser and would dispatch changes like to TZ, etc.

This was always very suspicious, as a global; now we can remove it.
2024-06-23 16:49:11 -07:00
Peter Ammon
dbf54f49ff
Remove principal_parser() from the last of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
fd84dc4cdd
Remove principal_parser() from yet more of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
2bd3bcf7fc
Remove principal_parser() from yet more of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
0d7e8c22a6
Remove principal_parser() from yet more of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
077f439283
Remove uses of EnvStack::principal() in the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
0e96a420d6
Remove a use of EnvStack::principal()
Try to get off of globals.
2024-06-23 16:49:11 -07:00
Peter Ammon
01d45ad755
Clarify a comment about safety in the environment impl
We use an unusual pattern of protecting data via a global lock, but it's safe.
2024-06-23 16:49:11 -07:00
Peter Ammon
0378cb750b
Be more explicit about when to dispatch variable changes
This controls e.g. when we react to TZ changes. Rather than having a special
blessed environment stack, simply store it as a property.
2024-06-23 16:49:11 -07:00
Peter Ammon
9ad875cdb7
Enforce that nobody can push/pop from the global environment stack
This is just a precaution.
2024-06-23 16:39:39 -07:00
Peter Ammon
7fcbe5b8ab
Thread variables into autoload_names
Stop fetching a global set of variables.
2024-06-23 16:39:39 -07:00
Peter Ammon
d2d2d8cb45
Remove the shared_from_this for Parser
We no longer need this.
2024-06-23 16:39:39 -07:00
ridiculousfish
924d6aac71
Remove another call to current_data()
Continue to get off of globals.
2024-06-23 16:39:39 -07:00
ridiculousfish
dee692759a
Split Reader off from ReaderData
Prior to this commit, there was a stack of ReaderDatas, each one has a
reference to a Parser (same Parser in each, for now). However, the current
ReaderData is globally accessible. Because it holds a Parser, effectively
anything can run fish script; this also prevents us from making the Parser
&mut.

Split these up. Create ReaderData, which holds the data portion of the
reader machinery, and then create Reader which holds a ReaderData and a
Parser. Now `reader_current_data()` can only return the data itself; it
cannot execute fish script.

This results in some other nice simplifications.
2024-06-23 16:39:39 -07:00
ridiculousfish
dfd948fcb5
Eliminate a call to reader_current_data
Try to get off of these globals.
2024-06-23 16:39:39 -07:00
ridiculousfish
c297df38c7
Migrate the Inputter type to a trait
This is a start on untangling input. Prior to this, a ReaderData and an
Inputter would communicate with each other; this is natural in C++ but
difficult in Rust because the Reader would own an Inputter and therefore
the Inputter could not easily reference the Reader. This was previously
"resolved" via unsafe code.

Fix this by collapsing Inputter into Reader. Now they're the same object!
Migrate Inputter's logic into a trait, so we get some modularity, and then
directly implement the remaining input methods on ReaderData.
2024-06-23 16:39:39 -07:00
ridiculousfish
c9a76bd634
Make OperationContext not hold a Parser via Rc
Exploit Rust's lifetimes. This will lead to simplifications.
2024-06-23 16:39:39 -07:00
ridiculousfish
d36f94d96c
Remove additional call to Parser::shared() 2024-06-23 16:39:39 -07:00
ridiculousfish
832ed31687
Start removing calls to Parser::shared()
Parser::shared() gets an Rc to a Parser, but we can do without it.
Let's aim to get rid of the cyclic ref.
2024-06-23 16:39:39 -07:00
Mahmoud Al-Qudsi
245ee466cb completions/magento: remove sed dependency
This runs in about half the time, too.
2024-06-23 18:08:34 -05:00
Jean-Bernard Valentaten
3c74f14569
completions/magento: Fixes module aggregation for module related commands (#10446)
* completions/magento: Fixes module aggregation for module related commmands

Previousely when attempting completion for commands `module:enable`,
`mmodule:disable` and `module:uninstall` and error would be disaplyed,
stating that "magento" was not found.
Upon inspection of the issue in the related completion script it became
clear that:
1. The shell command `magento` does not exist as the CLI script of
   Magentoresides under `bin/magento`.
2. The module aggregation would not work after referncing the
   appropriate CLI command as an undeclared variable was being
   introspected.
3. Using Magento's CLI command took too long to respond as it has to
   bootstrap the whole Magento stack in order to deliver modules.

Thus the whole aggregation was rewritten to a form that actually works
and reduces the aggregation to reading the appropriate information
directly from the configuration file, provided that the file exists and
PHP is installed.

* completions/magento: Refactors module aggregation for module related commmands to not use PHP script

Executing random scripts from fish completion poses a threat to the
system. While this would indicate that the Magento installation has been
corrupted, it still is better to not run `app/etc/config.php` to get
hold of the modules.
Thus the module aggregation was rewritten to make use of `sed` instead,
which has the additional benefit of being faster than using PHP.
2024-06-23 18:05:52 -05:00
Mahmoud Al-Qudsi
2f46186f2b Fix formatting 2024-06-23 18:01:31 -05:00
Mahmoud Al-Qudsi
1a18d06a57 math: Fix copy-and-paste error in error message 2024-06-23 17:53:49 -05:00
Mahmoud Al-Qudsi
1a7a7a5dcb math: Support abbreviated scale modes 2024-06-23 17:52:14 -05:00
Mahmoud Al-Qudsi
80c02400eb Fix hard-coded decimal separator in builtin math 2024-06-23 17:50:02 -05:00
Mahmoud Al-Qudsi
c0028a0ec9 math: Rename ZeroScaleMode
It's no longer only for the zero scale.
2024-06-23 17:47:21 -05:00
Looouiiis
480d48351c feat(math): add round options (#9117)
Add round options, but I think can also add floor, ceiling, etc. And
the default mode is trunc.

Closes #9117

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-06-23 17:45:52 -05:00
Mahmoud Al-Qudsi
f1ae170155 printf: Ignore some floating point tests under i586
A few specific tests fail under i586 due to its inherent floating point
inaccuracy issues (rust-lang/rust#114479), so ignore these tests if certain
are met.

We have specific integration tests elsewhere in fish to check that even under
i586 we get mostly sane results, so this is OK. I tried to modify the assert
macros to check for a loose string match (up to one character difference) or an
f64 abs diff of less than epsilon, but it was a lot of code with little value
and increased the friction to contributing to the tests. Also, let's just
acknowledge the fact that all of i686, let alone i586 specifically, is a dead
end and not worth investing such time and effort into so long as it more or less
"works".

Closes #10474.
2024-06-23 16:14:02 -05:00
Mahmoud Al-Qudsi
7d1942a023 Add reduced-accuracy variants of some math tests under x86
Due to the inherent floating point accuracy issues under i586 described
in #10474 and at https://github.com/rust-lang/rust/issues/114479, we need to add
a workaround to our littlecheck math tests to perform less stringent comparisons
when fish was built for x86 without SSE2 support.

This commit addresses the littlecheck issues that caused #10474 to be re-opened,
but I still have to reproduce the cargo test failures for
`negative_precision_width`, `test_float`, `test_float_g`, and `test_locale`.
2024-06-23 16:14:02 -05:00
Lzu Tao
e0266067c4 git: completion for git commit --edit 2024-06-22 20:00:31 +00:00
Fabian Boehm
d917b89009 docs: Fix two links 2024-06-22 14:58:07 +02:00
Mahmoud Al-Qudsi
59daa5abce
Run 32-bit CI tests as i586 (#10578) 2024-06-21 12:45:54 -05:00
Mahmoud Al-Qudsi
298cdb0c5b Always pass --target to cargo test when CMake Rust_CARGO_TARGET is set
The CMake `cargo test` integration was broken if Rust_CARGO_TARGET were used
with `CARGO_FLAGS` set to `-Zbuild-std` (e.g. to target i586 under i686 without
the i586 toolchain installed).
2024-06-21 12:00:10 -05:00