Commit graph

6422 commits

Author SHA1 Message Date
Kurtis Rader
8d27f81a7b kill all jobs when exiting an interactive shell
Fish is not consistent with other shells like bash and zsh when exiting
an interactive shell with background jobs. While it is true that fish
explicitly claims no compatibility with POSIX 1003.1 this is an area
where deviation from the established practice adds negative value.

The reason for the current behavior seems to be due to two users who did
not understand why interactive shells managed background jobs as they
did and were not aware of tools like `nohup` or `disown`. See issue

There is also a fairly significant bug present due to a misunderstanding of
what a true value from `reader_exit_forced()` means. This change corrects
that misunderstanding.

Fixes #3497
2016-12-19 18:55:52 -08:00
Kurtis Rader
9f8d854c2a fix race condition in fkr test 2016-12-19 17:44:54 -08:00
Kurtis Rader
40fa0d5c83 stop assuming the interrupt key is [ctrl-C]
The recent discussion around allowing the user to change various termios
(i.e., stty) settings reminded me that there are places in our code
where we assume the interrupt key is [ctrl-C]. That's a bad assumption.
Instead use the actual value reported to us by the kernel.

This also makes the fkr program friendlier by always reporting when a
signal was received, not just when run with -d2, and prompting the user
to press the INTR or EOF key a second time to exit.
2016-12-19 16:23:30 -08:00
Fabian Homborg
e8c18386c8 Bind \x7f to backward-{delete,}-char in vi-mode again
Partially reverts 745bceb9d8.

This is now again in line with the default bindings.
2016-12-18 21:25:56 +01:00
Kurtis Rader
745bceb9d8 fix backspace/del vi mode bindings
The recent refactoring to separate default (emacs) from vi key bindings
overlooked adding `\cH` bindings to vi mode. This also fixes the
behavior of the [del] key bindings (\x7F).

Fixes #3653
2016-12-16 21:52:58 -08:00
Kurtis Rader
483e9fdea2 check if locking takes too long
If acquiring a lock on the history or uvar file takes more than 250 ms
disable locking of the file. On systems with broken remote file system
locking it can cause tens of seconds delay after running each command
which can make the shell borderline unusable.

This also changes history file locking to use flock() rather than
fcntl() to be consistent with uvar file locking. It also implements the
250 ms time limit before giving up on locking.

Fixes #685
2016-12-16 21:20:08 -08:00
ridiculousfish
c6e3dd7965 Bump Xcode project version to latest 2016-12-16 13:43:01 -08:00
ridiculousfish
c2c3813555 Merge pull request #3652 from tas50/master
Prevent error in acidhub prompt by quoting the regex
2016-12-16 13:24:44 -08:00
Tim Smith
1a1a9b9927 Prevent error in acidhub prompt by quoting the regex
string errors if this regex isn't quoted. This results in this error:

http://stackoverflow.com/questions/40942185/fish-shell-init-git-repo-yields-constant-terminal-output-after-every-command

Signed-off-by: Tim Smith <tsmith@chef.io>
2016-12-16 10:43:40 -08:00
David Adam
47b78b9eeb fish.spec: on OBS/RHEL 5, build with -march=i686
RHEL 5 defaults to the i386 architecture, which does not provide the
atomic instructions required by C++11.
2016-12-16 09:33:26 +08:00
Kurtis Rader
396bf1235d workaround glibc bug that can corrupt malloc arena
If an interactive shell has its tty invalidated attempts to write to
stdout or stderr can trigger this bug:

https://sourceware.org/bugzilla/show_bug.cgi?id=20632

Avoid that by reopening the stdio streams on /dev/null if we're getting
an ENOTTY error when trying to do things like give or take ownership of
the tty.

This includes some unrelated style cleanups but including them seems
reasonable.

Fixes #3644
2016-12-14 20:12:37 -08:00
Piotr Matląg
d885f00941 Update nmcli completions 2016-12-14 17:06:10 +01:00
David Adam
0ba02ee3d1 fish.spec: on OBS, print config.log if configure unsuccessful 2016-12-14 16:43:22 +08:00
Pierre Neidhardt
5a5b51c909 Fix fusermount completion 2016-12-13 12:54:13 +01:00
Kurtis Rader
07ef1e7c4b fix minor style nits
While investigating issue #3634 I noticed some inconsistent whitespace
that this cleans up.
2016-12-12 12:35:22 -08:00
Radomír Bosák
896b9ecc70 Add descriptions for dconf subcommands
Suggestions for the dconf command were missing descriptions (it was
marked as TODO). This commit adds them.
2016-12-12 11:56:29 +01:00
Fabian Homborg
4c7baa37a3 Add dconf completions
A configuration tool common with gnome stuff.

Fixes #3638.
2016-12-11 21:12:37 +01:00
David Adam
599089de80 fish.spec: add dependency on newer GCC on old platforms
Moving to C++11 requires a newer compiler on old systems; our Open Build
Service repository has a newer version available for RHEL 5 & 6 builds.
2016-12-11 16:58:15 +08:00
ridiculousfish
eb3ed2680b Fix macOS Xcode build
React to Solaris fixes (0019c12af3) by hiding some more
functions from macOS. The Xcode build uses special weak-linking
magic.
2016-12-10 20:48:54 -08:00
Fabian Homborg
90f7d4b081 clipboard_paste: Require non-empty clipboard contents
Fixes #3637.
2016-12-10 21:30:57 +01:00
ridiculousfish
05a640b027 Increase test coverage and improve completion commenting 2016-12-09 12:14:35 -08:00
Fabian Homborg
a8a10d634b Document *-of-buffer functions
See #3632.
2016-12-09 19:34:26 +01:00
Fabian Homborg
029d88e962 vi_cursor: Refactor detection logic
Makes it a bit easier to read.

Now we can begin reworking it (again) to make iTerm work.
2016-12-09 19:32:18 +01:00
Kurtis Rader
59fa04bd91 function for editing command line in ext editor
This implements a standard function and bindings for editing the command
line in an external editor. This feature has been requested multiple
times in the past year with various solutions cut and pasted into those
issues. This change combines the best aspects of those solutions.

Fixes #1215
2016-12-08 19:17:09 -08:00
Kurtis Rader
0019c12af3 changes to allow building on Solaris 10
Fixes #3456
2016-12-08 19:15:11 -08:00
ridiculousfish
8e1661cd22 Add a test for complete and -- 2016-12-08 02:00:24 -08:00
Kurtis Rader
b48b2ddfb2 fix extraction of LS_COLORS
Strip surrounding quotes if present.

Fixes #3630
2016-12-07 14:22:42 -08:00
Kurtis Rader
d0077d0910 fix default binding documentation
Several uses of @key{Alt,x} incorrectly used uppercase "X" where the
binding is only for the lowercase "x".
2016-12-06 21:04:05 -08:00
Kurtis Rader
e79d42aa52 fix handling dircolors output on Cygwin
Fixes #3563
2016-12-04 18:47:39 -08:00
Kurtis Rader
7bb3bf7c74 fix regression from commit 20bcbcc2
There were two places in the code that used the anti-pattern of
returning True on success else an error message. In python you should
always be able to replace `if x == True:` with just `if x:`. Which is
what the lint tool recommended. Unfortunately I didn't notice how the
return value was being used. This fixes that by changing the two
affected functions to return an error message or None on success.

This also adds `from __future__ import print_function` since the code
uses the `print(msg)` function form rather than the `print msg`
statement form. The former works by accident on python2 because the
parens are interpreted as creating parenthesized expression that
devolves to the single string inside the parens. So while the future
import isn't strictly speaking necessary it will help avoid mistakes in
the future if more complex `print()` calls are added.

Partial fix for #3620
2016-12-04 16:01:32 -08:00
David Adam
41acaced3f webconfig: separate arguments to abbr
`abbr` used to take a single argument and split in on the first space,
but 309e10e7 and predecessors altered this behaviour. Update the web
config use of abbr to the newer format.

Fixes #3620.
2016-12-04 21:32:49 +08:00
Kurtis Rader
42eaacd3a1 enable make style-all doing fish scripts
I had disabled having `make style-all` restyling fish scripts because a
majority of them did not conform to the style enforced by `fish_indent`.
I recently restyled most of the fish scripts with the exception of the
completion scripts. So this re-enables restyling all scripts with the
exception of completion scripts.
2016-12-03 20:39:32 -08:00
Kurtis Rader
9443a415bf time for another make style-all 2016-12-03 20:12:53 -08:00
Kurtis Rader
45d3a705be fix bug introduced by commit eaa37413
When I refactored the code to reduce redundancy and improve the error
messages when the config or data directories could not be used I botched
the customization of the $HOME based data path.
2016-12-03 18:38:00 -08:00
Maciej Ostaszewski
4288db9d39 correct option for bc completion 2016-12-04 00:22:31 +01:00
ridiculousfish
8324893565 Update osx/config.h with HAVE_FLOCK macro
flock() is available on OS X
2016-12-03 13:46:10 -08:00
ridiculousfish
41d4058156 Merge branch 'cleanup_pager'
Fixes those ugly compiler warnings in the pager
2016-12-03 13:41:30 -08:00
ridiculousfish
ed85393611 Restyle pager.cpp via make style 2016-12-03 13:38:50 -08:00
ridiculousfish
ffd4754cb2 Don't show the pager on terminals of height less than 4
Prevents some potential overflow bugs and janky UI
2016-12-03 13:35:24 -08:00
ridiculousfish
54dd4b7ed6 Untangle some pager code and fix some warnings
Fixes various warnings about implicit conversions
2016-12-03 13:29:16 -08:00
ridiculousfish
8041913e7a Stop including spacer width in width_by_column in pager
Additional refactoring to remove some sketchy-looking arithmetic
2016-12-03 13:29:16 -08:00
ridiculousfish
2d5ce72cb4 Remove the min_width parts of the pager
min_width dates back to the original full-screen pager.
After some careful inspection, the code path that uses min_width
is never executed and so the min_width machinery is useless.
Let's remove it!
2016-12-03 13:29:16 -08:00
ridiculousfish
d058d290be Factor pref_width into a function preferred_width()
Beginnings of some pager cleanup
2016-12-03 13:29:16 -08:00
ridiculousfish
85d697f13d Add some pager layout test cases
Helps ensure correct truncation logic
2016-12-03 13:29:16 -08:00
ridiculousfish
754b78a748 Suppress certain stderr-printing during tests
Tests that exercise error paths may result in output to
stderr. This may make it look like the test failed when it did
not. Introduce should_suppress_stderr_for_tests() to suppress
this output so the test output looks clean.
2016-12-03 13:27:50 -08:00
Radomír Bosák
254762f30f Fix status code when bad command name is entered
This commit fixes a bug which causes that

   fish -c ')'; echo $status

("Illegal command name" error) returns 0. This is inconsistent with
e.g. when trying to run non-existent command:

   fish -c 'invalid-command'; echo $status

("Unknown command" error) which correctly returns 127.

A new status code,

    STATUS_ILLEGAL_CMD = 123

is introduced - which is returned whenever the 'Illegal command name *'
message is printed.

This commit also adds a test which checks if valid commands return 0,
while commands with illegal name return status code 123.

Fixes #3606.
2016-12-03 13:14:40 -08:00
David Adam
bf53f39cdd cppcheck: warn on use of flock 2016-12-03 16:36:06 +08:00
David Adam
2b0bad889a configure: force use of -pthread on Solaris
This fixes a problem with non-threadsafe errno.

Ideally, this would be the use of the AX_PTHREAD macro, but it is GPL 3+
only, which is incompatible with the GPL 2 license of fish. It also
would need extending to cover C++.

For now, fish doesn't build on anything except GCC under Solaris anyway,
so `-pthread` is the right thing to use.

Work on #3340.
2016-12-03 16:36:06 +08:00
David Adam
ee15f1b987 configure: check that errno is threadsafe
Without `-pthread` specified to the compiler, errno is not threadsafe on
Solaris (as _REENTRANT is undefined, and _POSIX_C_SOURCE may not be set
until after the inclusion of <errno.h>).

Work on #3340.
2016-12-03 16:36:06 +08:00
David Adam
3289797248 flock fallback: remove noop path
"fail to no locking" is not an ideal strategy.
2016-12-03 16:36:06 +08:00