Commit Graph

4314 Commits

Author SHA1 Message Date
ridiculousfish
451c97f35a Merges changes to support running fish without fishd.
In the new mode (not yet enabled), universal variables are set by reading and writing the fishd file directly, with some file locking for synchronization. This enables forwards and backwards compatibility. However there is no compatibility with simultaneous edits. Changes may be lost if fishd and the new mechanisms both attempt writes.

fishd is still enabled by default for now; it will be disabled in a future commit. You can opt into the new mechanism (disabling fishd) by setting the environment variable fish_use_fishd to 0 before starting fish. This cannot itself be a universal variable, because of bootstrapping: the value is needed to determine how we read universal variables in the first place.

Universal variable change notifications (i.e. reacting immediately to live edits) are tricky. Checking for changes is simple and relatively inexpensive (just a stat()), but relying solely on that would require frequent wakeups, and show up in fs_usage. So how do we get change notifications into an fd that we can monitor via select()? We support a few strategies, expressed as universal_notifier_t::notifier_strategy_t. By default we use notifyd on OS X and a named pipe on Linux / everywhere else. This is also configurable at runtime via the fish_universal_notifier variable.
2014-05-21 11:02:17 -07:00
ridiculousfish
8a577a9d4d Remove an errant system("ls") 2014-05-21 10:55:00 -07:00
ridiculousfish
950150469a Disable inotify tests pending investigation into why it fails on
travis-ci
2014-05-21 10:50:57 -07:00
ridiculousfish
3cbace98a7 'echo -' should output a dash instead of treating it as options
Fixes #1459
2014-05-16 15:19:07 +08:00
ridiculousfish
e214df8980 Try using IN_DELETE_SELF with inotify 2014-05-16 13:37:23 +08:00
ridiculousfish
e3cccdf571 Add check for kernel version to try to determine why travis-ci is
failing with inotify
2014-05-16 13:09:10 +08:00
ridiculousfish
a0bf841be2 Check for non-negative watch object in inotify_add_watch 2014-05-16 12:54:52 +08:00
ridiculousfish
73cbb0c65f Add a check to ensure the file really is deleted in inotify test 2014-05-16 12:35:07 +08:00
ridiculousfish
2f89ddbead Add test for inotify support to try to track down travis-ci is failing 2014-05-16 12:16:10 +08:00
ridiculousfish
a526693915 Refine test for enabling strategy_inotify in fish_tests 2014-05-15 17:25:13 +08:00
ridiculousfish
31f2a3a7d7 Fix a warning about missing enum in fish_tests.cpp 2014-05-15 14:44:17 +08:00
ridiculousfish
147403f958 Use mkostemp in universal variables when available 2014-05-15 14:37:44 +08:00
ridiculousfish
38c52cf9b5 Formatting fixes 2014-05-15 14:31:57 +08:00
ridiculousfish
64c1c75c42 Improve universal variable error messages 2014-05-15 14:27:06 +08:00
ridiculousfish
2b11d1060c Make initialize_synchronizes_via_fishd default to false. Add some
logging support to universal variables.
2014-05-15 10:49:06 +08:00
ridiculousfish
a73b903df9 Null notifier to support fishd synchronization, so we can select the
synchronization mechanism at runtime
2014-05-14 15:03:44 +08:00
ridiculousfish
30cfb3e795 Correct a comment and clean up code that listens for universal notifier
changes
2014-05-14 14:16:53 +08:00
ridiculousfish
a0e6d4375a Merge branch 'master' into death_of_fishd 2014-05-14 14:09:32 +08:00
ridiculousfish
c7aca5cc35 Hopefully better fix for prompt under Windows. Things that may store
NOT_A_WCHAR must be wint_t, not wchar_t
2014-05-14 13:30:41 +08:00
David Adam
3225d7e169 avoid symlink attacks in __fish_print_packages and spawning fishd
* use $XDG_CACHE_HOME for __fish_print_packages completion caches
 * when starting fishd, redirect fishd output to /dev/null, not a
   predictable path

Fix for CVE-2014-3219.

Closes #1440.
2014-05-12 09:30:05 +08:00
Konrad Borowski
6596d91c82 Fix prompt under Windows.
The fix is obviously a hack caused by that NOT_A_WCHAR
doesn't fit in wchar_t. Better fix would be nice.
2014-05-10 17:13:08 +02:00
ridiculousfish
d554b7da08 Merge branch 'master' into death_of_fishd 2014-05-09 16:07:11 -07:00
Philipp Schroer
cd7f1a15f8 Automatically add include paths for ncurses on Cygwin 2014-05-09 14:43:23 -07:00
ridiculousfish
fa68c2619f Use parm_left_cursor and parm_right_cursor for bulk cursor motions.
Fixes #1448
2014-05-09 14:37:23 -07:00
ridiculousfish
e97bec10ea Remove needs_polling from universal_notifier_t. Add some expository
comments.
2014-05-07 14:22:05 -07:00
ridiculousfish
7763718b60 Further cleanup and rationalization of named pipe universal notifier. 2014-05-06 14:10:55 -07:00
Konrad Borowski
7f2c4cbf8a Move the empty function test to tests. 2014-05-06 12:31:44 +02:00
Konrad Borowski
91ebe12fc2 Add test for empty function name. 2014-05-06 12:18:09 +02:00
Konrad Borowski
13e1e7e1e9 Fix NULL dereference when function name is not specified
It was possible to type `function ""; end`, and this caused fish to
crash because of NULL pointer.
2014-05-06 12:07:16 +02:00
ridiculousfish
8a263952ad Fix named pipe universal notifier. No more threads. Tests now pass. 2014-05-05 23:33:05 -07:00
ridiculousfish
f27232bd0a Initial work on strategy_named_pipe universal notifier. 2014-05-04 15:06:40 -07:00
Konrad Borowski
16534ec644 Improve test_wchar2utf8().
Currently it contains strange code like using `do` loop in order to
avoid `goto`s (they aren't evil, honestly), the pointless `if (mem)`
conditional which doesn't even work (had semicolon for some reason).

You may think this code had a bug where the code didn't check for
the pointer to be null before calling `free`, but this is not the case,
as according to C and C++ standard, `free` should allow `NULL` pointers,
and ignore them.
2014-05-04 15:48:50 +02:00
ridiculousfish
7e44bcfd8a Make inotify-based universal variable notifier tests pass 2014-05-03 19:57:20 -07:00
ridiculousfish
8cbd66b0f9 Merge branch 'death_of_fishd' of https://github.com/fish-shell/fish-shell into death_of_fishd 2014-05-03 19:36:22 -07:00
ridiculousfish
47a81c2b39 Re-establish inotify watch when file is deleted 2014-05-03 16:31:11 -07:00
ridiculousfish
56bf209f84 Merge branch 'master' into death_of_fishd
Conflicts:
	configure.ac
2014-05-03 15:33:48 -07:00
ridiculousfish
333fb1bf97 Use mkostemp instead of mktemp where available 2014-05-03 15:27:58 -07:00
Josh Kuhn
cbef88a593 Fix python completion to work for pypy
Pypy outputs 2 lines with the -V option, as well as adding a whole lot of stuff that confuses the very general sed regex that was used before.
2014-05-03 15:06:57 -07:00
SanskritFritz
b13179d4f4 Functions instead of static variables for conditions. 2014-05-03 12:30:41 -07:00
SanskritFritz
cf89d9bfb0 Fixed an unintended result of some copy paste. 2014-05-03 12:30:41 -07:00
SanskritFritz
f49848c8a4 Removed unnecessary comments. 2014-05-03 12:30:41 -07:00
SanskritFritz
0101b39f6c Completions added/updated. 2014-05-03 12:30:41 -07:00
Maurizio De Santis
4285baa6e1 Prompt sample: Debian chroot environment
When you chroot in Debian, bash shows the chroot environment in the prompt:

```bash

...

if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

...
```

This is the effect:

```
(chroot_env) user@host:~#
```

It is useful when chrooting, since usually the hostname remains the same and thus you can't distinguish where you are.
2014-05-03 12:28:38 -07:00
ridiculousfish
e530af1ff7 Use adjusted_pos when determining the token for tab completing
redirecitons, per #1296
2014-05-03 00:15:13 -07:00
ridiculousfish
60e94a4ec8 fishd to link against fish_version.o in Xcode build 2014-05-02 23:36:47 -07:00
ridiculousfish
c66a574fa0 Simple test for completing redirections 2014-05-02 23:25:54 -07:00
Konrad Borowski
ef3259035d Use precompiled parse files. 2014-05-02 10:31:04 +02:00
Konrad Borowski
4226f4412b fishd requires fish_version.o. 2014-05-02 10:30:01 +02:00
Konrad Borowski
368983d8da Fix header name in fishd.cpp. 2014-05-02 10:26:22 +02:00
ridiculousfish
16b982958b Correctly complete redirections. Fixes #1296 2014-05-02 01:22:39 -07:00