Commit Graph

18560 Commits

Author SHA1 Message Date
Fabian Boehm
6eaaa3adc3 Revert "Try to fix OBS tumbleweed builds"
This was a misunderstanding, the OBS tumbleweed builds build from a tarball that's pushed manually.

We no longer use corrosion so this dependency is unused.

This reverts commit bdde2b2b35.

Fixes #10391
2024-03-23 11:51:19 +01:00
Pi-Cla
0cbac81130 Bump serial_test dependency to 1.0.0
The current version of serial_test we use (0.4.0)
depends on parking_lot 0.10.2 which in turn
depends on lock_api 0.3.4.
This version of lock_api is vulnerable to [RUSTSEC-2020-0070](https://rustsec.org/advisories/RUSTSEC-2020-0070)
This was patched in lock_api 0.4.2 but we need to update serial_test
to get the update.
2024-03-23 11:01:35 +01:00
Johannes Altmanninger
8baf7de4c0 Vi mode: remove stale comment 2024-03-23 10:38:28 +01:00
Johannes Altmanninger
0f758f12b7 environment.rs: minor cleanup 2024-03-23 10:38:28 +01:00
Johannes Altmanninger
789a280ee8 Fix {Alt,Shift}-Return bindings not expanding abbreviations
Today,

    bind foo "commandline -f expand-abbr; commandline -i \n"

does not work because this
1. enqueues an expand-abbr readline event
2. "commandline -i" inserts \n
3. processes the expand-abbr readline event

Since there is no abbreviation on the new line, this doesn't do anything.

PR https://github.com/fish-shell/fish-shell/pull/9398 would fix this
particular instance however it does not fix the issue that "commandline -i"
is run before the expand-abbr is processed by the reader. This is harmless
here but there would be a problem if "commandline" tried to read commandline
state that was created by a preceding command.

It's not super clear to me whether the above binding should work as one
would naively expect. That would imply that "commandline" would need to
drain all input events (at least all synthetic ones) from the input queue,
to ensure it sees the current state.

Fortunately the parent commit makes it so if we separate them

    bind foo "commandline -f expand-abbr" "commandline -i \n"

both will be separate events and the commandline state will be synced after
each of them. This fixes abbreviation expansion here.

Also, we can now mix readline cmds and shell commands, which makes it shorter.
2024-03-23 10:06:11 +01:00
Johannes Altmanninger
c3cd68dda5 Process shell commands from bindings like regular char events
A long standing issue is that bindings cannot mix special input functions
and shell commands. For example,

    bind x end-of-line "commandline -i x"

silently does nothing. Instead we have to do lift everything to shell commands

    bind x "commandline -f end-of-line; commandline -i x"

for no good reason.

Additionally, there is a weird ordering difference between special input
functions and shell commands. Special input functions are pushed into the
the queue whereas shell commands are executed immediately.

This weird ordering means that the above "bind x" still doesn't work as
expected, because "commandline -i" is processed before "end-of-line".

Finally, this is all implemented via weird hack to allow recursive use of
a mutable reference to the reader state.

Fix all of this by processing shell commands the same as both special input
functions and regular chars. Hopefully this doesn't break anything.

Fixes #8186
Fixes #10360
Closes #9398
2024-03-23 10:06:11 +01:00
Johannes Altmanninger
c1f601f31e Don't bind Alt-Return in Vi normal mode
It seems wrong because it's for text insertion; if someone actually wants
to use it we can add it back.
2024-03-23 09:54:18 +01:00
Johannes Altmanninger
865118e3b4 On Shift+Return, insert a newline instead of executing the commandline
Most chat programs I found use Shift+Return to insert a newline while plain
Return sends the message. One user reported having only tried Shift+Return
and not knowing about Alt+Return.

No release notes yet because this only works on a very small number of
terminals. Once we enable CSI u, this should work on most modern terminals.
2024-03-23 09:54:18 +01:00
Johannes Altmanninger
232483d89a History pager to only operate on the line at cursor
Multiline search strings are weirdly broken (inserting control characters
in the command line) and probably not very useful anyway.
On the other hand I often want to compose a multi-line command
from single-line commands I ran previously.

Let's support this case by limiting the initial search string to the current
line; and replace only that line.

Alternatively this could operate on jobs (that is, replace a surrounding
"foo | bar") instead of using line boundaries.
2024-03-23 09:54:18 +01:00
Johannes Altmanninger
299fcde808 Better link for POSIX test 2024-03-23 09:51:09 +01:00
Mahmoud Al-Qudsi
0ca199ef98 Change wopen_cloexec() to return File 2024-03-23 01:34:23 -05:00
Mahmoud Al-Qudsi
8d9d4ce1f9 Add and use separate open_dir() method
This is resistant to misuse by including O_DIRECTORY in the open flags and it is
a separate function from {w,}open_cloexec() in preparation for making that one
return a `File` instead of an `OwnedFd`.
2024-03-23 01:15:43 -05:00
Mahmoud Al-Qudsi
99c9d6eef6 IoFile: Wrap File instead of OwnedFd 2024-03-23 00:44:27 -05:00
Mahmoud Al-Qudsi
6f9f9ee400 Use bitflags contains() instead of intersects()
`intersects()` is "any of" while `contains()` is "all of" and while it makes no
difference when testing a single bit, I believe `contains()` is less brittle
for future maintenance and updates as its meaning is clearer.

</pedantic>
2024-03-23 00:24:31 -05:00
Mahmoud Al-Qudsi
6ed4d09c93 Switch more to File/BorrowedFd from OwnedFd/RawFd
More work in prep for having wopen_cloexec() return `File` directly.

This eliminates checking for an invalid fd and makes both ownership and
mutability clear (some more operations that involve changes to the underlying
state of the fd now require `&mut File` instead of just a `RawFd`).

Code that clearly does not use non-blocking IO is ported to use
`Write::write_all()` directly instead of our rusty port of the `write_loop()`
function (which handles EAGAIN/EWOULDBLOCK in addition to EINTR, while
`write_all()` only handles the latter).
2024-03-23 00:01:57 -05:00
Mahmoud Al-Qudsi
c0d68084f7 Add AsFd impl for AutoCloseFd
Will be used to remove RawFd usages.
2024-03-22 23:58:12 -05:00
Mahmoud Al-Qudsi
4e50ae34da Add native read_retry() and write_retry() methods
These are equivalent to read_loop() and write_loop() but operate on native Rust
types without libc ffi.
2024-03-22 23:05:56 -05:00
Mahmoud Al-Qudsi
bdde2b2b35 Try to fix OBS tumbleweed builds
Add git as a build requirement. Package name guessed then confirmed by searching
on rpm.pbone.net against openSUSE Tumbleweed.

Log excerpt:

[   14s] CMake Error at /usr/share/cmake/Modules/ExternalProject.cmake:2910 (message):
[   14s]   error: could not find git for clone of corrosion-populate
2024-03-22 22:42:58 -05:00
Fabian Boehm
a5156e9e0e po/de: Fix a format string 2024-03-21 20:17:14 +01:00
David Adam
9105d6a82f fish.spec: better installation of documentation
The %{_docdir} macro is defined, but due to an oversight is not passed
to CMake in some versions of openSUSE where it should be.

Use doc directives to avoid mucking around with cp.
2024-03-21 22:45:57 +08:00
David Adam
b64c210ade fish.spec: fix documentation path on OpenSUSE
(It's a shame the _docdir macro is unusuable, but even downstream
doesn't use it.)
2024-03-20 23:45:51 +08:00
Fabian Boehm
46cde6cc55 Github Actions: Remove CXXFLAGS for ASAN
The only C++ we have left is fish_test_helper
2024-03-19 16:54:33 +01:00
Fabian Boehm
0ff1e50a33 rustc: Protect against lines starting with -
Fixes #10379
2024-03-19 16:49:46 +01:00
Fabian Boehm
ce62b284b1 test_helper: Give self-signalling a chance to trigger
This abort()ed right after the signal, so it's possible to crash
before the signal is delivered. This could trigger under ASAN on
Github Actions.
2024-03-19 16:41:25 +01:00
Fabian Boehm
c759a98b37 docs: Clarify that disowned jobs won't fire on-process/job-exit
Fixes #10381
2024-03-19 16:39:37 +01:00
David Adam
a551432f5c Merge branch 'Integration_3.7.1' 2024-03-19 20:14:40 +08:00
David Adam
80394ea4e3 Release 3.7.1 2024-03-19 11:40:45 +08:00
David Adam
445fba4464 CHANGELOG: work on 3.7.1 2024-03-18 22:53:13 +08:00
fortifiedhill
9cebf5c9b6 Update htop completions
Added and updated completions and updated htop link.

(cherry picked from commit 8678ad8ca0)
2024-03-18 22:34:55 +08:00
Xiretza
119d76bc0f Add completions for dmidecode
(cherry picked from commit 8271021fb6)
2024-03-18 22:34:55 +08:00
Felix Luciano Salomon
cc6df6d17f Added completion for ollama
Closes #10327

(cherry picked from commit 90b9bce174)
2024-03-18 22:34:55 +08:00
Mathis Chenuet
77e2fa343d Add completion for pstree (#10317)
* Add completion for pstree.fish

* use fish functions, much better

(cherry picked from commit 73d760560b)
2024-03-18 22:34:55 +08:00
QianChenglong
b864074288 add completion for mycli
Closes #10309

(cherry picked from commit b3c610feff)
2024-03-18 22:34:55 +08:00
Emily Grace Seville
c6f3b24dc5 feat: cobra-cli support (#10293)
* feat: cobra-cli support

* fix: cobra-cli completion

(cherry picked from commit 623f3463a5)
2024-03-18 22:34:55 +08:00
Daniel Kahn Gillmor
d24b1ef229 tab completions: avoid completing gpg --use-embedded-filename
gpg's --use-embedded-filename is a dangerous option that can cause gpg
to write arbitrary content to arbitrary files.

According to the GnuPG maintainer, this is not an option recommended
for use (https://dev.gnupg.org/T4500).  Fish shouldn't encourage users
to supply it.

I've offered https://dev.gnupg.org/T6972 to upstream to make it even
more clear that this option is a bad idea.

While removing it, we might as well also remove
--no-use-embedded-filename, since it is effectively a no-op.

(cherry picked from commit b265152fba)
2024-03-18 22:34:55 +08:00
Jason Nader
d655f40d43 completions: fix wg-quick interface completions
wg outputs space separated list

(cherry picked from commit 28d9f1878d)
2024-03-18 22:34:55 +08:00
Mark Huang
baf5102797 completions for apt and apt-get
(cherry picked from commit 65cf6ada56)
2024-03-18 22:34:55 +08:00
Ikko Eltociear Ashimine
7b595b2e2e Update iwctl.fish
colum -> column

(cherry picked from commit 1e925857f0)
2024-03-18 22:34:55 +08:00
Asuka Minato
f82e29d320 add more strace completion (#10227)
* Update strace.fish

* Update strace.fish

* upper case

(cherry picked from commit 0f97111290)
2024-03-18 22:34:55 +08:00
Damien Picard
d2e1ffc192 Completions: fix Blender completions when it prints to stderr
Some of the completions recently introduced called Blender itself to query some
arguments, and Blender sometimes prints messages to stderr. This output was not
filtered, resulting in the shell printing irrelevant messages during completion.

(cherry picked from commit 4f3e7ddef0)
2024-03-18 22:34:55 +08:00
mhmdanas
a6c00ee637 completions/xbps-query: complete package name after -X
(cherry picked from commit a67b089c89)
2024-03-18 22:34:55 +08:00
NextAlone
e2599545f2 completions/fastboot: fix flash completion
Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>
(cherry picked from commit c587b2ffcc)
2024-03-18 22:34:55 +08:00
David Adam
98662ae076 CHANGELOG: work on 3.7.1 2024-03-18 22:26:49 +08:00
Mahmoud Al-Qudsi
decf99f71b
Use File instead of OwnedFd in a few places (#10355)
This is a step towards converting `wopen_cloexec()` to return `File` instead of
`OwnedFd`/`AutocloseFd`.¹

In addition to letting us use native standard library functions instead of
unsafe libc calls, we gain additional semantic safety because `File` operations
that manipulate the state of the fd (e.g. `File::seek()`) require a `&mut`
reference to the `File`, whereas using `RawFd` or `OwnedFd` everywhere leaves us
in a position where it's not clear whether or not other references to the same
fd will manipulate its underlying state.

¹ We actually wouldn't even need `wopen_cloexec()` at all (just a widechar
wrapper) as Rust's native `File::open()`/`File::create()` functionality uses
`FD_CLOEXEC` internally.
2024-03-17 11:20:44 -05:00
Johannes Altmanninger
bc246d87b2 Add closed issues and PRs to 3.8 changelog
I used below script to list all GitHub issues and PRs that are not yet
mentioned in the changelog. It's almost empty now.

While at it, curate the "notable" section and move some entries around,
notably from "interactive improvements"  to "bindings".

```shell
ms="fish next-3.x"
{
    gh issue list --state closed --milestone "$ms" -L 500
    gh pr list --state all --search "milestone:\"$ms\"" -L 500
} | sort -n | while IFS='
' read line; do
    set -- $line
    grep -qE '\W'$1 CHANGELOG.rst ||
    echo https://github.com/fish-shell/fish-shell/issues/$1 "$line"
done
```
2024-03-17 11:41:32 +01:00
Johannes Altmanninger
cd71359c42 completions/git: complete files iff last token is not a fixupish
Closes #10371
2024-03-16 10:45:57 +01:00
Simon Junod
60ef93b85b Fixed typo in French translations
Closes #10372
2024-03-16 10:45:57 +01:00
Johannes Altmanninger
068f92ce7e Changelog update 2024-03-16 10:31:01 +01:00
Johannes Altmanninger
2972407b9e builtin read: minor code cleanup 2024-03-16 10:31:01 +01:00
Johannes Altmanninger
62d1720605 completions/htop: fix --sort-key completions 2024-03-16 10:31:01 +01:00