Commit Graph

191 Commits

Author SHA1 Message Date
ridiculousfish
b44f40547b Rationalize exit codes for failed execs
This cleans up some exit code processing. Previously a failed exec
would produce exit code 125 unconditionally, while a failed posix_spawn
would produce exit code 1 (!).

With this change, fish reports exit code 126 for not-executable, and 127
for file-not-found. This matches bash.
2021-03-27 21:37:46 -07:00
ridiculousfish
eb71e4555f Clean up and relnote shebangless script support
This adds a test for shebangless support from #7802, cleans up some of
its tricks, and includes it in the changelog.
2021-03-27 16:08:42 -07:00
Fabian Homborg
b9a68e9e86 Update CHANGELOG 2021-03-26 19:32:14 +01:00
Michael Jarvis
cd1f0cc5d5 Add a placeholder to last section of CHANGELOG.rst
This placeholder silences a warning, and allows the horizontal
line between releases to be retained.
2021-03-25 07:34:20 +08:00
Michael Jarvis
620344b076 Fix Sphinx warning
When regenerating documentation with Sphinx, there's a warning issued about CHANGELOG.rst:

```
../CHANGELOG.rst:33: WARNING: Document or section may not begin with a transition.
```

This is almost identical to the fix in commit 84a89f5195.
2021-03-25 07:34:20 +08:00
Ilan Cosman
bcbfd70d41
Create empty directories and files on interactive startup (#7796)
Closes #7402
2021-03-23 21:01:00 +01:00
ridiculousfish
66a873ad23 Relnote fix for 7837 2021-03-21 16:59:22 -07:00
Karolina Gontarek
e4eaca1032
Fix wrapping for cd (#7843) 2021-03-21 09:27:19 +01:00
Johannes Altmanninger
7fea321b3e
Use the correct case in completion pager (#7744)
Consider

	$ complete -c foo -a 'aab aaB' -f
	$ foo A<TAB>

since 28d67c8 we would insert the common prefix AND show the pager.
Due to case-insensitive comparison, "b/B" was considered to be part
of the prefix. Since the prefix is added to each pager item [1]
we get wrong results. Fix this by removing the insensitive comparison
between completions - I don't think it was of much use anyway.
Commandline tokens are still matched case-insensitively, this is
just about completions.

Test this by running interactive fish inside tmux (pexpect's terminal
emulation not have enough capabilities).  Also add tests for recent
interactive regressions #7526 and #7738.

Closes #3978

[1]: b38a23a would solve this differently by giving every pager item
its own prefix, but was reverted since it needs more fixes.
2021-03-21 09:25:29 +01:00
David Adam
c2eef7c250 CHANGELOG: add separator (minor formatting fix) 2021-03-18 12:36:48 +08:00
David Adam
23f613723f Merge branch 'Integration_3.2.1' 2021-03-18 12:23:06 +08:00
David Adam
156d57d270 Release 3.2.1
Closes #7772.
2021-03-18 11:05:28 +08:00
David Adam
a1653c928e CHANGELOG: work on 3.2.1 2021-03-17 21:51:02 +08:00
ridiculousfish
9ab77c7ddc Relnote fix for #7770 2021-03-10 22:50:57 -08:00
ridiculousfish
7e8b8345e7 Fix some graphical glitches in fish_config
fish_config has some shadows and other elements which don't align
propertly. Fix these, and apply some other miscellaneous polish.

Fixes #7811
2021-03-10 18:46:06 -08:00
Fabian Homborg
f204fd147d CHANGELOG Updates 2021-03-10 07:30:27 +01:00
Fabian Homborg
76f7b3e98e Update CHANGELOG 2021-03-08 18:01:51 +01:00
Ilya Grigoriev
762f3aa0ce
Rewrite the real file if history file is a symlink (#7754)
* Rewrite the real file if history file is a symlink

When the history file is a symbolic link, `fish` used to overwrite
the link with a real file whenever it saved history. This makes
it follow the symlink and overwrite the real file instead.

The same issue was fixed for the `fish_variables` file in 622f2868e
from https://github.com/fish-shell/fish-shell/pull/7728.
This makes `fish_history` behave in the same way. The implementation
is nearly identical.

Since the tests for the two issues are so similar, I combined them
together and slightly expanded the older test.

This also addresses https://github.com/fish-shell/fish-shell/issues/7553.

* Add user-facing error when history renaming fails

Currently, when history file renaming fails, no message is shown to the
user. This happens, for instance, if the history file is a symlink
pointing to another filesystem.

This copies code (with a bit of variation, after reviewer comments) from

589eb34571/src/env_universal_common.cpp (L486-L491)

into `history.cpp`, so that a message is shown to the user.

* fixup! Rewrite the real file if history file is a symlink
2021-03-08 17:46:17 +01:00
Fabian Homborg
c7c9ff9a4a Update CHANGELOG 2021-03-07 10:26:56 +01:00
Ilya Grigoriev
f725cd402d Make help and fish_config work on Chrome OS
When `fish` is running in the Chrome OS Linux VM (Crostini),
both `help` and `fish_config` opened a "file not found"
page. That is because on Crostini, `BROWSER` is usually set to
`garcon-url-handler`, which opens URLs in the host OS Chrome
browser. That browser lacks access to the Linux file system.

This commit fixes these commands. `help` now opens the URL on
www.fishshell.com.  `fish_config` now opens the URL for the
server it starts. Previously, it opened a local file that
redirects to the same URL.

In the case of `help`, the situation could be improved further
by starting a web server to serve help. I don't know of another
way to access `/share/fish` from outside the VM without user
intervention, and I think that might be a part of the security
model for the Crostini VM.

It's hard to write a test for this. I checked that `help math`,
`python2 webconfig.py`, and `python3 webconfig.py` work on my
machine running in Crostini.
2021-03-07 09:42:41 +01:00
Mahmoud Al-Qudsi
99e02ba47a Add #7782 to CHANGELOG.rst
[ci skip]
2021-03-05 17:13:51 -06:00
Fabian Homborg
a561904afd Add CHANGELOG for 3.2.1
(to be clear the current state, this isn't yet the release)
2021-03-04 16:17:27 +01:00
David Adam
d655d24148 CHANGELOG: add headers for next release 2021-03-01 22:53:29 +08:00
David Adam
670868f853 Release 3.2.0
Closes #6585.
2021-03-01 20:47:02 +08:00
David Adam
bffb18043f CHANGELOG: work on 3.2.0 2021-03-01 20:29:45 +08:00
David Adam
3090f8b501 CHANGELOG: work on 3.2.0 2021-02-27 22:45:56 +08:00
Fabian Homborg
b8d28158a6 Do disown the completion updating without $last_pid
In this context, as it stands, $last_pid will give fish's pid (because
of pgroup shenanigans).

Since that doesn't really work, just `disown` without and let fish
figure out what the last process was.

Theoretically this has an issue if someone started a background
process *before* the python script *and* that exits before we run
disown.

That's a vanishingly small window and this is only run on first start,
so it seems acceptable.

Fixes #7739.
2021-02-24 20:30:01 +01:00
Fabian Homborg
bb0d4ed878 CHANGELOG: Completion generation still warns
Apparently the fix for #6269 doesn't work until we set job-control to
full, which we won't do for this release.

So just drop it from the CHANGELOG.

See #7739.
2021-02-23 19:47:31 +01:00
David Adam
9e1cd95eb1 CHANGELOG: work on 3.2.0 2021-02-21 21:44:26 +08:00
David Adam
0808e5094b CHANGELOG: work on 3.2.0
Drops the headers for next-minor for now
2021-02-21 10:43:56 +08:00
ridiculousfish
11a373f121 Prevent redirecting internal processes to file descriptors above 2
The user may write for example:

    echo foo >&5

and fish would try to output to file descriptor 5, within the fish process
itself. This has unpredictable effects and isn't useful. Make this an
error.

Note that the reverse is "allowed" but ignored:

    echo foo 5>&1

this conceptually dup2s stdout to fd 5, but since no builtin writes to fd
5 we ignore it.
2021-02-20 16:16:45 -08:00
Ilya Grigoriev
622f2868e1 Fix set -U when fish_variables is a symlink
Previously, `set -U` would overwrite the symlink with a
regular file.

Fixes https://github.com/fish-shell/fish-shell/issues/7466
2021-02-20 14:24:11 -08:00
ridiculousfish
9db51e7156 Relnote fix for 7723 2021-02-17 15:49:55 -08:00
Johannes Altmanninger
7c9da2ce61 CHANGELOG: fix some wrong issue references 2021-02-16 18:39:03 +01:00
David Adam
39dbcef68d CHANGELOG: work on 3.2.0
This commit brings the changelog up-to-date with the 3.2.0 milestone at the
date of commit.
2021-02-16 22:29:48 +08:00
ridiculousfish
c35535dee7 Do not show the history variable in fish_config
The history variable may be so large that it hangs the browser, as
spotted in #7714. Omit this from the variable list.
2021-02-15 10:47:13 -08:00
David Adam
d5ac8a01b6 CHANGELOG: work on 3.2.0 2021-02-13 22:41:11 +08:00
Johannes Altmanninger
5e8a248758 Indent escaped newlines
Similar to what fish_indent does. After typing "echo \" and hitting return,
the cursor will be indented.

A possible annoyance is that when you have multiple indented lines

	echo 1 \
	    2 \
	    3 \
	    4 \

If you remove lines in the middle with Control-k, the lines below
the deleted one will start jumping around, as they are disconnected
from and reconnected to "echo".
2021-02-13 09:01:41 +01:00
Johannes Altmanninger
fffcdf8792 Highlight redirection target as valid if it contains a to-be-defined variable
If a variable is undefined, but it looks like it will be defined by the
current command line, assume the user knows what they are doing.
This should cover most real-world occurrences.

Closes #6654
2021-02-13 08:59:54 +01:00
Johannes Altmanninger
4c1173f2ae fish_clipboard_paste: trim indentation when pasting multiple lines
When pasting a multiline command with indented blocks, extra indentation
from spaces, or tabs, is generally undesirable, because fish already indents
pipes and blocks. Discard the indentation unless the cursor or the pasted
part is inside quotes.

Users who copied fish_clipboard_paste need to update it because
__fish_commandline_is_singlequoted had an API change and was renamed.
2021-02-13 08:55:59 +01:00
Ethel Morgan
5a0aa7824f Saturate exit codes to 255 for all builtins
After commit 6dd6a57c60, 3 remaining
builtins were affected by uint8_t overflow: `exit`, `return`, and
`functions --query`.

This commit:
- Moves the overflow check from `builtin_set_query` to `builtin_run`.
- Removes a conflicting int -> uint8_t conversion in `builtin_return`.
- Adds tests for the 3 remaining affected builtins.
- Simplifies the wording for the documentation for `set --query`.
- Does not change documentation for `functions --query`, because it does
  not state the exit code in its API.
- Updates the CHANGELOG to reflect the change to all builtins.
2021-02-13 08:41:51 +01:00
Johannes Altmanninger
e27d97b02e Do not add spaces after completions ending in "-"
Some programs use this to separate things in a word, see
https://github.com/spf13/cobra/pull/1249#discussion_r563605048

Require the token to be at least length 2 for the no-space behavior,
for completions of "-" like for python.
2021-02-13 08:13:31 +01:00
ridiculousfish
84d59accfc builtins to allow stdin to be closed
Prior to this fix, if stdin were explicitly closed, then builtins would
silently fail. For example:

    count <&-

would just fail with status 1. Remove this limitation and allow each
builtin to handle a closed stdin how it sees fit.
2021-02-10 17:43:10 -08:00
Ethel Morgan
6dd6a57c60 Saturate return value in builtin_set_query
builtin_set_query returns the number of missing variables. Because the
return value passed to the shell is an 8-bit unsigned integer, if the
number of missing variables is a multiple of 256, it would overflow to 0.

This commit saturates the return value at 255 if there are more than 255
missing variables.
2021-02-08 20:38:56 +01:00
Fabian Homborg
42c75111c8 CHANGELOG: Fix code inside bold blocks
Sphinx doesn't like it, so either use normal quotes or put the code
outside of the bold block.
2021-02-08 17:18:53 +01:00
Michael Jarvis
84a89f5195 Fix sphinx warning
[100%] Building HTML documentation with Sphinx
../CHANGELOG.rst:48: WARNING: Document or section may not begin with a transition.
../CHANGELOG.rst:48: WARNING: Document or section may not begin with a transition.
2021-02-08 17:16:40 +01:00
Johannes Altmanninger
e487f193b8 CHANGELOG: add headers for fish-next-minor 2021-02-08 07:31:33 +01:00
Fabian Homborg
48b3b826aa CHANGELOG fish_color_keyword 2021-02-07 21:20:34 +01:00
Mahmoud Al-Qudsi
1651db23fe Update CHANGELOG to add issue 4873 to 3.2.0 release 2021-02-07 10:36:38 -06:00
David Adam
c633ce7e76 CHANGELOG: work on 3.2.0 2021-02-07 22:14:03 +08:00