Commit Graph

4386 Commits

Author SHA1 Message Date
ridiculousfish
3fe1069219 Stop reaping children from SIGCHLD signal handler
Prior to this fix, a child process may be reaped in one of two ways:
1. By a call to waitpid() within job_continue
2. By a call to waitpid() within the SIGCHLD signal handler

Only the second call was with the WNOHANG option. Thus if the signal
handler fired first, and then the waitpid call fired, we could get a
deadlock because we'd end up waiting on a long-running process. I have
not been able to reproduce this on fish 1.x, though it seems like it
ought to reproduce there too.

This fix migrates the waitpid() call out of the signal handler; the
second class of calls moves to job_reap. This eliminates the possibility
of a race, because we check for job completion before calling waitpid,
and there is no longer the possibility of the job being marked as
complete asynchronously. It also results in a massive conceptual
simplification, since the signal handler is now very simple and easy to
reason about (no more walking jobs lists, etc).

This partially fixes a bug reported in #1273
2014-10-20 15:50:54 -07:00
ridiculousfish
98091faeaf Add an assertion to reflect unreachable code 2014-10-19 18:00:49 -07:00
ridiculousfish
15e095233b Allow funced to retry on error
Fixes #1371
2014-10-17 11:50:09 -07:00
David Adam
a64c372a28 web_config: add support for adding and editing abbreviations
Possible future enhancements include explanatory text and an image for
the 'save' action.

Work on #731.
2014-10-17 10:28:26 +08:00
David Adam
1f91a2a6f5 web_config: map nonexistent post requests to 404 2014-10-17 10:28:26 +08:00
David Adam
4aa38db56f ls: find and use various dircolors initialisation files, if they exist
Closes #1758.
2014-10-17 10:23:05 +08:00
ridiculousfish
9e32b330aa Unescape strings in keyword detection.
This allows keywords to be quoted. However, they may not contain
variable or process expansions, etc. Fixes #1398
2014-10-15 12:49:02 -07:00
ridiculousfish
049bd227ed Remove EXPAND_SKIP_PROCESS, which did not actually work 2014-10-15 12:43:06 -07:00
ridiculousfish
ff7108877b Use binary search to determine what tokens are keywords 2014-10-15 12:04:23 -07:00
ridiculousfish
1927ebbc5d Improve error reporting for unclosed blocks 2014-10-14 00:41:39 -07:00
Kevin Ballard
5db9548f40 Run make depend 2014-10-13 19:29:07 -07:00
Kevin Ballard
cab115c8b9 Don't stop job execution on wildcard errors
Wildcard errors are only reported interactively, and they're also not
really errors. Commands with multiple wildcards would in fact continue
executing if at least one wildcard matched, which is quite surprising.
But they would report an error if there is only one wildcard in the
arguments list and the wildcard has no match, even if there are other
remaining arguments.

Given this inconsistency, and given that sh does not stop execution if a
wildcard fails to match, it seems better to allow execution to continue.
This is better from a scripting perspective anyway, as it means
constructs like `set -l paths foo/*.txt` will actually create the
variable (with an empty value) instead of skipping the `set`
altogether and perhaps causing subsequent code to read or modify a
global or universal variable.
2014-10-13 18:51:51 -07:00
Kevin Ballard
4568359e27 Remove some obsolete job flags
These flags were used by the old parser, but not by the new one.
2014-10-13 18:33:55 -07:00
Kevin Ballard
07e4170418 Suppress wildcard errors in functions
Wildcard errors are only supposed to reported when encountered during
interactive use. The old parser also suppressed them if `is_block` was
true. This was lost in the new parser. However, this also suppresses
errors generated from `begin; code_here; end` and other block
constructs.

Instead, check the parser block stack when we hit an error, and suppress
the error if there are any function calls / events / source invocations.
These all indicate that the code being executed came from somewhere
other than the commandline.
2014-10-13 17:49:26 -07:00
Kevin Ballard
0372cdbe7e Standardize unmatched wildcard errors
Unmatched wildcard errors during parsing are normally only reported when
run interactively. The switch command was unconditionally reporting them
anyway (and not setting the status to 124). Fix it so switch goes
through the same code path as everything else.
2014-10-13 17:27:56 -07:00
ridiculousfish
5d1ddc9c58 Report certain errors from parser_t::eval() that were previously ignored 2014-10-12 20:09:45 -07:00
ridiculousfish
c0b8e81b02 Change how arrays and environment variables interact.
Prior to this change, inherited environment variables
would be split on colons, becoming an array. This change
eliminates that behavior. Now environment variables are
always split on the record separator character (ASCII 0x1e),
with the exception of a short whitelist of PATH, MANPATH,
CDPATH. Likewise, exported variables are also exported
delimited by rs, with the exception of the above whitelist.

Fixes #1374, also see #1656
2014-10-12 15:01:44 -07:00
Konrad Borowski
c3bacc78c7 Mark unknown versions as unknown. 2014-10-12 15:01:48 +02:00
David Adam
4140e678f4 web_config: further python2/3 unification 2014-10-12 16:04:40 +08:00
David Adam
cc0fcdc18d web_config: use only Python 3-style (Unicode) string literals
Improves Python 2/3 compatibility.
(It is the distant future, the year TWO THOUSAND.)
2014-10-12 15:48:14 +08:00
ridiculousfish
fbade198b9 Support space separators for abbreviations as part of #731 2014-10-11 16:50:16 -07:00
Diego Zamboni
d982f2a575 Vagrant completion updates
Improve vagrant completions for some commands to avoid spurious
completions, and add completions for some missing Vagrant commands.

Fixes #1748.
2014-10-10 15:06:00 -07:00
David Xia
becdc8b4fc Add GPL2 LICENSE file
Fixes #1073.
2014-10-10 14:25:47 -07:00
Kevin Ballard
76c6985f82 A little extra tweaking so builtin_print_help looks better
The terminal width magic that __fish_print_help learned doesn't help
when builtin_print_help runs it in a subshell. Instead, add an
undocumented --tty-width flag to __fish_print_help that's used to pass
the terminal width.
2014-10-10 00:11:23 -07:00
Kevin Ballard
ac8c5910eb Rewrite __fish_print_help to produce better results
As a result of this rewrite, the output now:

* Expands to fit the terminal width, like `man` does
* Preprocesses the manpage with `tbl` just in case, since `man` does
  this, even though I doubt any fish manpages use `tbl` formatting.
* Handle bold/underline with the `ul` command as it was designed for
  instead of trying to fake it with `sed`.
* Compresses blank lines as `man` does with the default `less -is`
  pager.
2014-10-09 23:48:10 -07:00
Kevin Ballard
cc7f1755aa web_config: Interpret fish output as utf-8
Use the unicode replacement character in place of non-utf-8 sequences.
2014-10-09 20:21:26 -07:00
Kevin Ballard
7493c9a040 fish_config: Log the path for errors 2014-10-09 18:33:59 -07:00
Kevin Ballard
9fc8729b96 Support -h/--help with eval
`eval` prints help if given a single argument of -h or --help.

Fixes #1379.
2014-10-09 18:07:57 -07:00
Kevin Ballard
80859b8483 Revert "Remove help completion for eval, which doesn't work"
This reverts commit d2f23e1df4.
2014-10-09 17:59:14 -07:00
David Adam
71c55e1a4a web_config: send correct MIME type (and actually send it) 2014-10-09 18:45:17 +08:00
ridiculousfish
d2f23e1df4 Remove help completion for eval, which doesn't work
Fixes #1379
2014-10-08 11:50:04 -07:00
ridiculousfish
c70769c656 Raise debug level to 2 on annoying Changing language to English message
Fixes #1386
2014-10-08 11:46:03 -07:00
Kevin Ballard
a13e067b85 Fix test breakage from 14724401f
We can't use $PATHS to test the :-splitting because the global config
file adds extra paths based on /etc/paths and /etc/paths.d.

Ideally fish would have a way to suppress behavior like that, but for
the time being it doesn't.
2014-10-07 19:37:13 -07:00
Kevin Ballard
8e8e63144b Rewrite abbr function
The usage is still the same, but it's a lot more robust, and also no
longer assumes $fish_user_abbreviations must be a universal variable.

This also fixes the unexpected error output when calling `abbr -a` with
no existing abbreviations.

Calling `abbr -a` with an abbreviation that already exists now silently
overwrites the abbreviation, just like `function` and `bind` do, instead
of complaining.
2014-10-07 19:14:44 -07:00
David Adam
14724401ff env.cpp: correctly check variable_can_be_array
Closes #1746.
2014-10-08 09:53:29 +08:00
Kevin Ballard
72f5ab3186 Fix typo in abbr documentation
[skip ci]
2014-10-07 16:48:22 -07:00
David Adam
3f0210dc96 web_config: fix output if no abbreviations defined 2014-10-07 12:21:02 +08:00
Kevin Ballard
3c8b344a41 Rebuild fish.pc as appropriate
Re-running ./configure will cause fish.pc to rebuild, in case any of the
paths changed. It looks like this actually won't rebuild the rest of
fish, but figuring out how to handle that is out of scope for this
commit.

More importantly, this will rebuild fish.pc when the version string
changes.
2014-10-06 19:08:26 -07:00
David Adam
46241e383f license.hdr: reduce duplication and clarify some comments
[skip ci]
2014-10-06 16:30:00 +08:00
David Adam
ea79f6b03f license.hdr: remove licensing information for XSel, no longer shipped
[skip ci]
2014-10-06 16:30:00 +08:00
ridiculousfish
649c3f262d Don't complain if no errors occurred due to cancellation
Fixes #1166
2014-10-06 00:47:55 -07:00
David Adam
f85ec782a0 set: warn on setting a universal variable when a global is active
Closes #806.
2014-10-06 15:18:03 +08:00
ridiculousfish
9df0bcea99 Clean up string handling in parse_util_detect_errors_in_argument 2014-10-05 15:40:46 -07:00
David Adam
7764a1a6f8 web_config: add support for viewing abbreviations
Add a new tab which lists the current abbreviations defined, by wrapping
the `abbr` command.

Work on #731.
2014-10-05 12:23:31 +08:00
David Adam
980bf6e2f4 web_config: set width to dynamic 80% of window
As we add more tabs, 800px looks increasingly cramped, and our config
should take advantage of the screen space available.
2014-10-05 12:23:31 +08:00
David Adam
501c3d5518 abbr.fish: add abbr, a command to manipulate abbreviations
Work on #731.
2014-10-05 12:23:31 +08:00
David Adam
6a0931aeae web_config: update AngularJS to 1.0.8 2014-10-05 12:23:31 +08:00
ridiculousfish
d7b3821c0a Use ferror instead of checking errno to detect errors in read_file
glibc sets errno even though the file read did not have an error
Fixes #1731
2014-10-04 14:28:26 -07:00
Konrad Borowski
1665f84d60 Fix Perl module completions.
This fixes the issue with nonexistant directories (some Linux
distributions put these for local modules), and also fixes the
issue of dot meaning any character instead of simply dot.
2014-10-04 11:22:56 +02:00
Roman Inflianskas
fabee7e246 add yast2 completion 2014-10-04 00:41:10 +04:00