Commit Graph

9775 Commits

Author SHA1 Message Date
Fabian Homborg
7508865374 Include string.h where we use memset
This is needed on Solaris/Illumos/OpenIndiana/SunOS.

Presumably it's harmless elsewhere.
2019-02-13 13:27:20 +01:00
Fabian Homborg
02ca7be416 functions/_.fish: Use ggetext if available
It turns out the default gettext on the sunny operating system with
the many names interprets at least `\n` itself, so we'd end up
swallowing it.

This allows us to move past the interactive tests and onto the expect
ones.

See #5472.
2019-02-13 13:05:50 +01:00
Fabian Homborg
1ee57e9244 tests/realpath.in: We want to delete $PWD, darnit!
Illumos/OpenIndiana/SunOS/Solaris has an rm/rmdir that tries to
protect the user by not allowing them to delete $PWD.

Normally, this would be a good thing as deleting $PWD is a stupid
thing to do. Except in this case, we absolutely need to do that.

So instead we weasel around it by invoking an sh to cd out of the
directory to then invoke an `rmdir` to delete it. That should throw
off any attempts at protection (we could also have tried $PWD/. or
similar, but that's possibly still protected against).

This is the last failing test on
Illumos/OpenIndiana/SunOS/Solaris/afunnyquip, so:

Fixes #5472.
2019-02-13 13:05:50 +01:00
Fabian Homborg
c62d95e428 tests: Move directory redirection test to invocation
This tested #1728, where redirecting a directory (`begin; something;
end < .`) would cause `status` to misbehave.

Unfortunately, on Illumos/OpenIndiana/SunOS, this returns a different
error (EINVAL instead of EISDIR), so we can't check that with our test harness, because
we can't redirect it.

Since it's not important that this gives the same error across
systems (and indeed we provide no way of intercepting the error!),
use an invocation test instead, because that allows different output per-uname.

See #5472.
2019-02-13 13:05:50 +01:00
Fabian Homborg
ca5b7c0ec4 math: Allow --scale=max 2019-02-13 12:54:58 +01:00
Fabian Homborg
c5a6d0bfde Split $fish_user_paths on ":" explicitly
It's used with $PATH, so it is _always_ split on ":".

We could also force it to be a path variable, but that seems a bit
overkill.

Fixes #5594.
2019-02-13 12:35:15 +01:00
Andrew Childs
56309f1c2e Only invoke path_helper in login shells
Matches upstream path_helper which is invoked in /etc/profile and only
applies to login shells. Enables running interactive, non-login shells
with altered PATH values.

Reverts change in c0f832a7, which reverts change in adbaddf.
2019-02-13 00:02:03 -08:00
Mrmaxmeier
6e9250425a src/exec: fix assertion on failed exec redirection
Minimal reproducer: `fish -c "exec cat<x"`
2019-02-12 20:52:03 -08:00
Mahmoud Al-Qudsi
b247c8d9ad Explicitly close input fd to fish_title
`fish_title` as invoked by fish itself is not running in an interactive
context, and attempts to read from the input fd (e.g. via `read`) cause
fish to segfault, go into an infinite loop, or hang at the read prompt
depending on the exact command line and fish version.

This patch addresses that by explicitly closing the input fd when
invoking `fish_title`.

Reported by @floam in #5629. May close that issue, but situation is
unclear.
2019-02-12 19:55:20 -06:00
Aaron Gyes
717718353e Remove unused macros 2019-02-12 16:10:18 -08:00
Aaron Gyes
8d9089c78b Revert "io.cpp: use BUFFER_SIZE"
This reverts commit c931e33759.
2019-02-12 15:50:43 -08:00
Aaron Gyes
c931e33759 io.cpp: use BUFFER_SIZE
-Wunused-macros showed that a recent change used 4096 instead of
BUFFER_SIZE as previously (also 4096).
2019-02-12 15:37:09 -08:00
Aaron Gyes
a19206036c output.{h,cpp}: remove unused enum and correct a comment 2019-02-12 13:53:49 -08:00
Fabian Homborg
c588d58663 CHANGELOG: Add -q
[ci skip]
2019-02-12 20:34:19 +01:00
Fabian Homborg
dc0746bc45 Let command -q work
This required "-sq" to be used and errored if just "-q" was given.

Instead, if only "-q" is given, we behave just as if "-sq" was.
2019-02-12 20:34:19 +01:00
Fabian Homborg
fb7a6e5f34 Add builtin -q
Used to query for a builtin's existence, like `type -q` and `functions
-q` can be used to query for a things and a functions existence respectively.
2019-02-12 20:34:19 +01:00
Fabian Homborg
3382a2145f doc_src/math: Document needed escaping harder
Fixes #5650.

[ci skip]
2019-02-12 18:14:33 +01:00
Fabian Homborg
016d83c3fc completions/git: Handle MM files
These are files with staged modifications, and additional unstaged
ones.

In practice what happened was that you ran

   git add somefile

then editted it some more and tried to

   git add <TAB>

which didn't offer it anymore.

Now, we offer it if either modified or modified-staged is set.

Currently modified-staged isn't ever set alone, but through
all-staged, so we still need to keep offering the file then.

(This shows that the current switch/case might have some holes)

Fixes #5648.

[ci skip]
2019-02-12 16:59:44 +01:00
David Adam
7200f7ff4a Revert "Drop hard requirement on explicit -lpthread support"
This reverts commit b402b635a9f7466616cef6e2b9cfd55a6e7068c5; as discussed in #5512 it is not
required.
2019-02-12 22:30:53 +08:00
Aaron Gyes
bbc3fecbeb env.cpp: Simplify update_fish_color_support
Taking advantage of the maybe_t's, the logic and nesting here
can be a bit less intense.

Small adjustments to debug output, and found a more accurate
version number for Lion Terminal.app.

Longer term we should have a terminal_t class or something
encapsulating all the kinds of terminal detection we have
with methods that return the color support, and also stuff
like whether the terminal has the newline glitch, the
ambiguous width character behavior, etc.
2019-02-12 01:37:47 -08:00
David Adam
43002f1822 Merge branch 'Integration_3.0.1'
Re-sync CHANGELOG.md
2019-02-12 12:15:54 +08:00
Aaron Gyes
1c6efc6378 'kill' is not a builtin.
I guess I was on autopilot.
2019-02-11 09:08:28 -08:00
David Adam
e26ab3d81c Bump version for 3.0.1 2019-02-11 20:13:15 +08:00
David Adam
339b195e74 CHANGELOG: updates for 3.0.1 2019-02-11 20:13:15 +08:00
Aaron Gyes
bcc4240d2b config.fish: Clean up the . function a bit. 2019-02-10 23:19:24 -08:00
Aaron Gyes
4d6a97d35c Retire the bit of config.fish that detected missing builtin string
It's been a few years.
2019-02-10 21:47:10 -08:00
Aaron Gyes
4c6b4188a0 Drastically improve fish completions
* complete .fish files
* --debug -> --debug-level
* add --init-command/-C
* add --debug-stack-frames/-D
* add --private/-P
* add --features/-f: lists supported features, supports foo,<TAB>
* -c now completes commands
* -d requires argument, describes 0..5
* --profile: require argument, allow file completion
2019-02-10 21:27:26 -08:00
Aaron Gyes
634e97a85e Remove unnecessary _NSGetExecutablePath declaration
We do this in common.cpp now, and are including dyld.h anyhow.
2019-02-10 16:47:05 -08:00
Aaron Gyes
1c9fe71240 config.fish: loop over bg, fg, etc. wrappers
Now that we can do `builtin $x`, this code can be simplified.
2019-02-10 15:03:42 -08:00
Aaron Gyes
038fea1a47 Fix builtin $var expansion
A special case added for #1252 needed adjustment.

Fixes #5639
2019-02-10 14:45:03 -08:00
ridiculousfish
1701e2c558 Revert "add $pipestatus support"
This reverts commit ec290209db.
2019-02-10 13:46:58 -08:00
ridiculousfish
6da9d96241 Revert "Make $pipestatus thread safe and other misc cleanup"
This reverts commit 34c1f24716.
2019-02-10 13:46:49 -08:00
ridiculousfish
34c1f24716 Make $pipestatus thread safe and other misc cleanup 2019-02-10 13:43:02 -08:00
zabereer
ec290209db add $pipestatus support 2019-02-10 13:30:40 -08:00
ridiculousfish
83884c2c13 Improve reliability of signal handling in child processes
fish forks child processes when (for example) writing out builtin output.
After fork it resets signal handlers, but if a signal is delivered before
the signal handlers are reset, it will inherit fish's default handlers,
which do things like swallow SIGINT. Teach fish's default signal handlers
to detect this case and re-raise signals with default handlers.

This improves the reliability of control-C in the face of builtins.
2019-02-10 12:57:54 -08:00
ridiculousfish
28e2cfeb4b Switch signal table lookups to range-based for loops 2019-02-10 12:07:48 -08:00
Andrew Childs
fe73fbdb9a Document that snippets are run before system config 2019-02-10 18:25:44 +01:00
Fabian Homborg
df28f76698 git-prompt: Test untracked the right way around
This only showed untracked files if showuntrackedfiles was != true.

That's just exactly wrong.

Fortunately this wasn't in a release.

[ci skip]
2019-02-10 14:54:32 +01:00
Fabian Homborg
b7e0f14fe0 CHANGELOG: vcs prompt renamination 2019-02-10 14:44:50 +01:00
Fabian Homborg
b999ba7b47 Update fish_hg_prompt reference in terlar prompt 2019-02-10 14:44:50 +01:00
Fabian Homborg
3a320d7584 Update fish_vcs_prompt reference in sampleprompts 2019-02-10 14:44:50 +01:00
Fabian Homborg
8c6ae4612b Document fish_svn_prompt 2019-02-10 14:44:50 +01:00
Fabian Homborg
b19b1ee23a Document fish_hg_prompt 2019-02-10 14:44:50 +01:00
Fabian Homborg
f7c981af63 Document vcs prompt 2019-02-10 14:44:50 +01:00
Fabian Homborg
9c82979459 Rename __fish_hg_prompt -> fish_hg_prompt 2019-02-10 14:44:50 +01:00
Fabian Homborg
c29023b3e8 Rename __fish_svn_prompt -> fish_svn_prompt 2019-02-10 14:44:50 +01:00
Fabian Homborg
c771334924 Rename __fish_vcs_prompt -> fish_vcs_prompt
Still keep a stub under the old name for compatibility.
2019-02-10 14:44:50 +01:00
Fabian Homborg
f2b08ec592 Document fish_git_prompt
Shows how convoluted the thing is, really.
2019-02-10 14:44:50 +01:00
Fabian Homborg
cb7762b7c0 Move __fish_git_prompt -> fish_git_prompt
This exposes it more, since it's quite an important function.

We should do the same with the other vcs functions.

We leave a compatibility shim in place for now.
2019-02-10 14:44:50 +01:00
Aaron Gyes
34fa8ef2d2 Prefer c++11-style [[attr]] syntax over __attribute__ (attr)
Where Clang and GCC both support __attribute__ (attr) and
GCC supports [[gnu::attr]], Clang promises it will support
[[gnu::attr]]
2019-02-10 04:22:40 -08:00