Commit Graph

22641 Commits

Author SHA1 Message Date
Nahor
c3e3658157 ulimit: remove unreachable error message
When there is no limit value, ulimit will have printed the current one
and exited

Part of #12603
2026-04-05 00:22:41 +08:00
Nahor
8d92016e72 string: error messages fixes
- fix wrong pattern used in `string replace` error message
- replace unreachable error with `unreachable!` in `string`
- fix cmd being used in place of subcmd 

Part of #12603
2026-04-05 00:22:41 +08:00
Nahor
f6a72b4e19 status: replace unreachable code with an assert!
Part of #12603
2026-04-05 00:22:40 +08:00
Nahor
2f9c2df10d set: report an error when called with -a,-p and no NAME
Previously executing `set -a` or `set -p` would just list all the
variables, which does not make sense since the user specifically ask
for an action (append/prepend).

Update the help page synopsis

Part of #12603
2026-04-05 00:22:40 +08:00
Johannes Altmanninger
0367aaea7d Disable relocatable tree logic when DATADIR or SYSCONFDIR are non-default
If all of

	$PREFIX/bin/fish
	$PREFIX/share/fish
	$PREFIX/etc/fish

exist, then fish assumes it's in a relocatable directory tree.
This is used by homebrew (PREFIX=/usr/local) and maybe also nix(?).

Other Linux distros prefer to use /etc/fish instead of $PREFIX/etc/fish
[1].  To do so, they need to pass -DCMAKE_INSTALL_SYSCONFDIR=/etc.
The relocatable tree logic assumes default data and sysconf dirs
(relative to a potentially relocatable prefix). If the user changes
any of those, and the relocatable tree logic happens to kick in,
that'd overrule user preference, which is surprising.

So a non-default data or sysconf path is a strong enough signal that
we want to disable the relocatable tree logic. Do that.

Closes #10748

[1]: ff2f69cd56/PKGBUILD (L43)
2026-04-04 01:22:54 +08:00
Johannes Altmanninger
e25b4b6f05 tests/checks/realpath.fish: fix on macOS 2026-04-03 23:26:37 +08:00
Yakov Till
90cbfd288e Fix test_history_path_detection panic: call test_init()
test_history_path_detection calls add_pending_with_file_detection(),
which spawns a thread pool task via ThreadPool::perform(). This
requires threads::init() to have been called, otherwise
assert_is_background_thread() panics.

Add the missing test_init() call, matching other tests that use
subsystems requiring initialization.

Closes #12604
2026-04-03 14:48:53 +08:00
Nahor
68453843d4 set: fix unreachable error messages
- Remove unreachable error message in `handle_env_return()`
While we could have put an empty block in `handle_env_return()` and
removed the condition on `NotFound` in `erase()`, we prefered to use
`unreachable!` in case `handle_env_return()` gets called in new scenarios
in the future

- Make reachable the error message when asking to show a slice

Part of #12603
2026-04-03 13:53:42 +08:00
Nahor
fb57f95391 realpath: fix random error message
With empty argument, `realpath` skips all processing, so the error
message, based on `errno`, was unrelated and changed depending on what
failed before. E.g:

```
$ builtin realpath "" /tmp "" /no-exist ""
builtin realpath: : Resource temporarily unavailable
/tmp
builtin realpath: : Invalid argument
/dont-exist
builtin realpath: : No such file or directory
```

Part of #12603
2026-04-03 13:53:41 +08:00
Nahor
1ed276292b read: remove unnecessary code
`to_stdout` is set to `true` if and only if `argv` is not empty.
- `argv` length and `to_stdout` are redundant, so we can remove `to_stdout`
- some tests in `validate_read_args` are necessarily false

Part of #12603
2026-04-03 13:53:41 +08:00
Branch Vincent
09e46b00cc completions: update ngrok
Closes #12598
2026-04-03 13:53:41 +08:00
Johannes Altmanninger
695bc293a9 contrib/debian/control: allow any "man" virtual pkg (man-db/mandoc)
We support multiple "man" implementations; at least man-db's and
mandoc's.

So we can relax the mandoc dependency to a dependency on the virtual
package providing "man". Note that as of today, "mandoc" fails to
have a "Provides: man".

However since Debian policy says in
https://www.debian.org/doc/debian-policy/ch-relationships.html

> To specify which of a set of real packages should be the default
> to satisfy a particular dependency on a virtual package, list the
> real package as an alternative before the virtual one.

we want to list possible real packages anyway, so do that.

Closes #12596
2026-04-03 12:20:08 +08:00
Nahor
344ff7be88 printf: remove unreachable code
Remove an unreachable, yet translated, error string and make the code
more idiomatic

Closes #12594
2026-04-01 09:37:57 +08:00
Nahor
014e3b3aff math: fix error message
Fix badly formatted error message, and make it translatable

Part of #12594
2026-04-01 09:37:57 +08:00
Nahor
68c7baff90 read: remove deprecation error for -i
`-i` has been an error and undocumented for 8 years now (86362e7) but
still requires some translating today. Time to retire it fully.

Part of #12594
2026-04-01 09:37:56 +08:00
Johannes Altmanninger
6eaad2cd80 Remove some redundant translation sources 2026-03-31 14:55:04 +08:00
Johannes Altmanninger
b321e38f5a psub: add missing line endings to error messages
Fixes #12593
2026-03-31 14:43:34 +08:00
Daniel Rainer
a32dd63163 fix: simplify and correct trimming of features
The previous handling was unnecessarily complex and had a bug introduced
by porting from C++ to Rust: The substrings `\0x0B` and `\0x0C` in Rust
mean `\0` (the NUL character) followed by the regular characters `0B`
and `0C`, respectively, so feature names starting or ending with these
characters would have these characters stripped away.

Replace this handling by built-in functionality, and simplify some
syntax. We now trim all whitespace, instead of just certain ASCII
characters, but I think there is no reason to limit trimming to ASCII.

Closes #12592
2026-03-31 14:43:34 +08:00
Bacal Mesfin
ef90afa5b9 feat: add completions for dnf copr
Closes #12585
2026-03-31 14:43:34 +08:00
r-vdp
7bd37dfe55 create_manpage_completions: handle groff \X'...' device control escapes
help2man 1.50 added \X'tty: link URL' hyperlink escapes to generated
man pages. coreutils 9.10 is the first widely-deployed package to ship
these, and it broke completion generation for most of its commands
(only 17/106 man pages parsed successfully).

The escape wraps option text like this:

  \X'tty: link https://example.com/a'\fB\-a, \-\-all\fP\X'tty: link'

Two places needed fixing:

- remove_groff_formatting() didn't strip \X'...', so Type1-4 parsers
  extracted garbage option names like "--all\X'tty"

- Deroffer.esc_char_backslash() didn't recognize \X, falling through
  to the generic single-char escape which stripped only the \, leaving
  "X'tty: link ...'" as literal text. Option lines then started with
  X instead of -, so TypeDeroffManParser's is_option() check failed.

Also handle \Z'...' (zero-width string) which has identical syntax.

Closes #12578
2026-03-31 13:15:52 +08:00
Johannes Altmanninger
14ce56d2a5 Remove unused fish_wcwidth wrapper 2026-03-30 13:57:27 +08:00
Johannes Altmanninger
01ee6f968d Support backward-word-end when cursor is past end
Closes #12581
2026-03-30 13:57:27 +08:00
Johannes Altmanninger
7f6dcde5e0 Fix backward-delete-char not stopping after control characters
Fixes 146384abc6 (Stop using wcwidth entirely, 2026-03-15)

Fixes #12583
2026-03-30 13:57:27 +08:00
Johannes Altmanninger
34fc573668 Modernize wcwidth API
Return None rather than -1 for nonprintables.  We probably still
differ from wcwidth which is bad (given we use the same name), but
hopefully not in a way that matters.

Fixes 146384abc6 (Stop using wcwidth entirely, 2026-03-15).
2026-03-30 13:57:10 +08:00
Johannes Altmanninger
93cbf2a0e8 Reuse wcswidth logic for rendered characters 2026-03-29 17:04:14 +08:00
Nahor
8194c6eb79 cd: replace unreachable code with assert
Closes #12584
2026-03-29 16:49:24 +08:00
Nahor
3194572156 bind: replace fake enum (c_int) with a real Rust enum
Part of #12584
2026-03-29 16:49:24 +08:00
Johannes Altmanninger
e635816b7f Fix Vi mode dl deleting from wrong character
Fixes b9b32ad157 (Fix vi mode dl and dh regressions, 2026-02-25).

Closes #12580
(which describes only the issue already fixed by b9b32ad157).
2026-03-28 21:45:33 +08:00
Johannes Altmanninger
2b3ecf22da start new cycle
Created by ./build_tools/release.sh 4.6.0
2026-03-28 13:16:34 +08:00
Johannes Altmanninger
c7ecc3bd78 Release 4.6.0
Created by ./build_tools/release.sh 4.6.0
4.6.0
2026-03-28 12:56:37 +08:00
Johannes Altmanninger
828a20ef30 Use cfg!(apple) 2026-03-28 12:41:58 +08:00
Fabian Boehm
7f5692dfd3 Skip ttyname on apple systems
Not relevant there because they don't have a "console session" as
such, and the ttyname call may hang.

Fixes #12506
2026-03-27 17:36:08 +01:00
Fabian Boehm
454939d5ab Update docs for fish_emoji_width defaulting to 2 2026-03-27 16:23:30 +01:00
Johannes Altmanninger
8756bc3afb Update changelog 2026-03-27 22:24:03 +08:00
Johannes Altmanninger
272f5dda83 Revert "CI: disable failing ubuntu-asan job"
This reverts commit 23ce9de1c3.

The compilation failure on Rust nightly was fixed in rust-shellexpand
commit b6173f0 (Rename WstrExt and WstrRefExt methods, 2026-02-23).
2026-03-27 22:23:08 +08:00
Johannes Altmanninger
dde33bab7e Clean up word-end special case handling in forward-word 2026-03-27 22:22:29 +08:00
David Adam
63f642c9dd CHANGELOG: log #12562 2026-03-27 22:21:08 +08:00
Fabian Boehm
146384abc6 Stop using wcwidth entirely
wcwidth isn't a great idea - it returns "-1" for anything it doesn't
know and non-printables, which can easily break text.

It is also unclear that it would be accurate to the system console,
and that's a minority use-case over using ssh to access older systems.

Additionally, it means we use one less function from libc and
simplifies the code.

Closes #12562
2026-03-27 21:31:19 +08:00
Fabian Boehm
8561008513 Unconditionally default emoji width to 2
"Emoji width" refers to the width of emoji codepoints. Since Unicode
9, they're classified as "wide" according to
TR11 (https://www.unicode.org/reports/tr11/).

Unicode 9 was released in 2016, and this slowly percolated into C
libraries and terminals. Glibc updated its default in 2.26, released
in August 2017.

Until now, we'd guess support for unicode 9 by checking the system
wcwidth function for an emoji - if it returned 2, we'd set our emoji
width to 2 as well.

However, that's a problem in the common case of using ssh to connect
to an old server - modern desktop OS, old server LTS OS, boom.

So now we instead just figure you've got a system that's *displaying*
the emoji that has been updated in the last 9 years.

In effect we're putting the burden on those who run old RHEL et al as
their client OS. They need to set $fish_emoji_width to 1.

Fixes #12500

Part of #12562
2026-03-27 21:31:19 +08:00
Remo Senekowitsch
88d01f7eb8 completions/cargo: avoid auto-installing toolchain via rustup
When cargo is installed via rustup, running cargo actually goes through
a proxy managed by rustup. This proxy determines the actual toolchain
to use, depending on environment variables, directory overrides etc. In
some cases, the proxy may automatically install the selected toolchain
if it's not yet installed, for example when first working on a project
that pins its rust toolchain via a `rust-toolchain.toml` file. In that
case, running cargo in the completion script can block the prompt for
a very long time. To avoid this, we instruct the rustup proxy not to
auto-install any toolchain with an environment variable.

Closes #12575
2026-03-27 20:11:22 +08:00
rohan436
4467822f6e docs: fix typo in MANPATH guidance string
Closes #12574
2026-03-27 18:55:38 +08:00
Johannes Altmanninger
5fe1cfb895 Bump initial Primary DA query timeout
Commit 7ef4e7dfe7 (Time out terminal queries after a while,
2025-09-21) though that "2 seconds ought to be enough for anyone".
But that's not true in practice: when rebooting a macOS system, it
can take longer. Let's see if 10 seconds is enough.  It should be fine
to have such a high timeout since this shouldn't happen in other cases.

Closes #12571
2026-03-26 16:31:24 +08:00
Daan De Meyer
484032fa9e Support SHELL_PROMPT_PREFIX, SHELL_PROMPT_SUFFIX, and SHELL_WELCOME
Add support for the SHELL_PROMPT_PREFIX, SHELL_PROMPT_SUFFIX, and
SHELL_WELCOME environment variables as standardized by systemd v257.

SHELL_PROMPT_PREFIX and SHELL_PROMPT_SUFFIX are automatically prepended
and appended to the left prompt at the shell level, so all prompts
(default, custom, and sample) pick them up without modification.

SHELL_WELCOME is displayed after the greeting when an interactive shell
starts.

These variables provide a standard interface for tools like systemd's
run0 to communicate session context to the shell.

Fixes https://github.com/fish-shell/fish-shell/issues/10924

Closes #12570
2026-03-26 15:45:50 +08:00
Johannes Altmanninger
fdd10ba9b2 Fix forward-word regression on single-char words followed by punctuation
The `forward-word` readline command on "a-a-a" is wrong (jumps to
"a"); on "aa-aa-aa" it's right (jumps to "-"); that's a regression
from bbb2f0de8d (feat(vi-mode): make word movements vi-compliant,
2026-01-10).

The is_word_end check for ForwardWordEmacs only tests for blank
(whitespace) after the current char. In the Punctuation style, words
also end before punctuation.

Fix this.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

See https://github.com/fish-shell/fish-shell/issues/12543#issuecomment-4125223455
2026-03-26 15:31:00 +08:00
Nahor
8679464689 color: prefer set_color --reset over set_color normal
`set_color normal` is too ambiguous and easily misinterpreted since
it actually reset all colors and modes instead of resetting just
the foreground color as one without prior knowledge might expect.

Closes #12548
2026-03-25 21:53:05 +08:00
Rodolfo Gatti
9ea760c401 Accept |& as an alias for &|
Closes #12565
2026-03-25 21:53:05 +08:00
Steffen Winter
d36c53c6e2 functions: dynamically query gentoo system paths
Use portageq to retrieve system paths instead of hardcoding them in.
This helps especially in Gentoo Prefix, where the installation is not
in / but rather offset inside a subdirectory (usually a users home
directory).

This only affects the "slow" path. When eix is installed it will be used
instead. It already accounts for Prefix installations.

Closes #12552
2026-03-25 21:53:05 +08:00
Steffen Winter
b047450cd0 functions: enable eix fast path for gentoo packages
The idea is taken from the deprecated/unused __fish_print_portage_packages.

Part of #12552
2026-03-25 21:53:05 +08:00
Johannes Altmanninger
0b93989080 fix ProcStatus::status_value in pipeline after ctrl-z
Repro (with default prompt):

	$ HOME=$PWD target/debug/fish -C '
	  function sleep_func; sleep 1; false; end
	  commandline "sleep 2 | sleep 3 | sleep 4 | sleep_func"
	  '
	Welcome to fish, the friendly interactive shell
	Type help for instructions on how to use fish
	johannes@e15 ~> sleep 2 | sleep 3 | sleep 4 | sleep_func
	^Zfish: Job 1, 'sleep 2 | sleep 3 | sleep 4 | s…' has stopped
	johannes@e15 ~ [0|SIGTSTP|SIGTSTP|1]> 

I'm not sure why the first sleep is not reported as stopped.

Co-authored-by: Lieuwe Rooijakkers <lieuwerooijakkers@gmail.com>

Fixes issue #12301

Closes #12550
2026-03-25 21:53:05 +08:00
rohan436
6b4ab05cbc docs: fix duplicated word in language docs
Closes #12554
2026-03-25 17:36:37 +08:00