Commit Graph

9222 Commits

Author SHA1 Message Date
Fabian Homborg
7367e545f2 Revert "wrealpath: Fail for file/something"
Apparently macOS realpath is broken.

This reverts commit ca1c499069.
2018-11-19 09:12:26 +01:00
Mahmoud Al-Qudsi
3d557518d5 Replace 0/1 with true/false in calls to job_reap 2018-11-18 17:40:18 -06:00
Mahmoud Al-Qudsi
d0085cae3c Fix zombie job on failed redirection in exec_job
Closes #5346.
2018-11-18 17:40:18 -06:00
ridiculousfish
a8ce7bad7b Always pass in the working directory in path_get_cdpath
If the user is in a directory which has been unlinked, it is possible
for the path .. to not exist, relative to the working directory.
Always pass in the working directory (potentially virtual) to
path_get_cdpath; this ensures we check absolute paths and are immune
from issues if the working directory has been unlinked.

Also introduce a new function path_normalize_for_cd which normalizes the
"join point" of a path and a working directory. This allows us to 'cd' out of
a non-existent directory, but not cd into such a directory.

Fixes #5341
2018-11-18 14:36:42 -08:00
Fabian Homborg
1ab84ac62a Test setting readonly variables 2018-11-18 22:33:02 +01:00
Mahmoud Al-Qudsi
8730b482a7 Prevent zombie processes after disowned child procs exit
Closes #5346.
2018-11-18 15:27:58 -06:00
Fabian Homborg
58b29fb5d1 Revert "Remove unnecessary "string_set_contains" function"
I have no idea why this worked or passed the tests?

This reverts commit 1836e704c4.

Fixes #5349.
2018-11-18 22:25:17 +01:00
Aaron Gyes
4221d6c3e6 Realpath styling tweaks.
Add braces I forgot, improve comments, make line spacing more
consistent around if blocks.
2018-11-18 12:29:35 -08:00
Fabian Homborg
442eb028c1 wrealpath: Simplify
- Reuse the buffer
- Don't duplicate the code for no "/"
2018-11-18 20:30:26 +01:00
Fabian Homborg
ca1c499069 wrealpath: Fail for file/something
This incorrectly allowed "file/something" if file existed (as a file), because it
checked "afile".

Fixes #5352.
2018-11-18 20:30:21 +01:00
Aaron Gyes
b00b1af152 Improve realpath error reporting, fix a crasher
realpath() will return NULL and sets errno if it fails.
We asserted that realpath(".") does not fail. We also didn't really
check that it was successful. Made sure we'll get a perror telling
us about what went wrong if something like this happens again.

Updated tests and added test case

Fixes #5351
2018-11-18 09:35:58 -08:00
Mahmoud Al-Qudsi
59197d12e0 Better handling of cases where man is not installed
Thanks to @floam, adapted to reduce nesting.

Works around override of command-not-found handler in previous solution
(c.f. 13e025bdb0).
2018-11-17 22:05:48 -06:00
Fabian Homborg
7b21f1c3cb Revert "mount completions: don't truncate mounts with spaces in them"
This does not work with util-linux mount, because that prints a "type" in between.

This reverts commit 1c364722a7.
2018-11-17 14:06:15 +01:00
Aaron Gyes
1c364722a7 mount completions: don't truncate mounts with spaces in them 2018-11-17 04:46:25 -08:00
Mahmoud Al-Qudsi
31d17f4559 Rename string escape --style=pcre2 to string escape --style=regex 2018-11-16 20:22:06 -06:00
Mahmoud Al-Qudsi
13e025bdb0 Clean up error message for man wrapper when man isn't installed
Closes #5329
2018-11-16 20:04:43 -06:00
Wojciech Siewierski
75515a4917 Update the docs regarding floats support in test (#5344)
* Replace "env" with "expr" in the test manpage

I'm pretty sure `env` isn't capable of comparing numbers and the author meant `expr`.

* Update the docs regarding floats support in test
2018-11-16 13:32:15 +01:00
Mahmoud Al-Qudsi
ab0f1d33fe Make use of the new PCRE2 escaping feature
Fixes some potentially unsafe uses of direct substitution into regex
expressions and also switches some completions to regex-based now that
there is a safe way of using it.
2018-11-15 12:37:29 -06:00
Mahmoud Al-Qudsi
680040d17d Document new PCRE2 string escaping in CHANGELOG and string.txt 2018-11-15 12:00:56 -06:00
Mahmoud Al-Qudsi
e160cde606 Implement PCRE2 escaping
Closes #5309.
2018-11-15 12:00:56 -06:00
Mahmoud Al-Qudsi
f56c317bd0 Add note about literal 0 indices to changelog
[ci skip]
2018-11-14 23:35:03 -06:00
Fabian Homborg
1fffdbce79 Fix status current-command
As it turns out, this just always printed "fish".

The solution here is a bit hacky as we go via the $_ variable.

Fixes #5339.
2018-11-14 12:15:40 +01:00
Fabian Homborg
278cbc5ff1 env_universal_common: Constref env_var_t as well 2018-11-14 12:15:40 +01:00
Fabian Homborg
8343e61795 cppcheck: Suppress incorrectStringBooleanError
This triggers on `assert(condition && "message")`, which we use
fairly frequently.
2018-11-14 12:15:40 +01:00
Fabian Homborg
534f694cee parse_execution: Check array index before using it 2018-11-14 12:15:40 +01:00
Aaron Gyes
7437f82d92 obnam completions: use $hostname instead of (hostname) 2018-11-13 15:49:03 -08:00
Aaron Gyes
920be02fe9 __update_cwd_osc: Use $hostname var instead of hostname command
Changing directories should be a few ms faster.
2018-11-13 15:40:19 -08:00
David Adam
eed274ff78 CHANGELOG: editing for upcoming 3.0
[ci skip]
2018-11-13 22:54:59 +08:00
Mahmoud Al-Qudsi
6dafcc4960 Partially revert 55b3c45 to create pgrp when launched with invalid pgrp
If fish detects that it was started with a pgrp of 0 (which appears to
oddly be the case when run under firejail), create new process group for
fish and give it control of the terminal.

This selectively reverts 55b3c45 in cases where an invalid pgrp is
detected. Note that this is known to cause problems in other cases, such
as #3805 and Microsoft/WSL#1653, although the former may have been
ameliorated or even addressed by the recent job control overhaul, so
that's why we are careful to only assign fish to its own pgroup if an
invalid pgroup was detected and not as the normal case.
2018-11-13 15:00:52 +01:00
David Adam
ae581c7dbc fix tests
Broken in 5bd0472682.
2018-11-13 21:54:41 +08:00
David Adam
5bd0472682 abbr: tidy description 2018-11-13 21:42:49 +08:00
Fabian Homborg
7257c69979 completions/string: Add escaping styles 2018-11-12 18:56:11 +01:00
Fabian Homborg
7a20e8d64d completions/busctl: Port to argparse
This is much faster!
2018-11-12 18:53:30 +01:00
Fabian Homborg
2d2f7c8fb1 completions/ip: Restyle
Just run `fish_indent` on the entire thing.
2018-11-12 16:28:24 +01:00
Fabian Homborg
15f089897d completions/ip: Add basic ip link set completions 2018-11-12 16:22:43 +01:00
David Adam
322b232fc0 Clarify and improve read documentation 2018-11-12 23:13:41 +08:00
David Adam
8e5b1f9e4d docs: drop reference to process expansion 2018-11-12 23:13:41 +08:00
David Adam
4b28e9d2e4 read: update completions to include --lines and --null
Does not include --all-lines pending discussion in #5332.
2018-11-12 23:13:41 +08:00
David Adam
7abfd1db30 fish.spec: drop hostname dependency 2018-11-12 21:46:08 +08:00
ridiculousfish
121991b98c Revert "Convert job list to a dequeue"
This reverts commit 54050bd4c5.

Type job_list_t was changed from a list to a deque in
commit 54050bd4c5.

In process_clean_after_marking(), we remove jobs while iterating.
dequeues do not support that. Make it a list again.
2018-11-11 16:57:30 -08:00
ridiculousfish
6f46eaaeeb Revert "Fix a stale comment"
This reverts commit efa9553dc1.

The comment was not stale.
2018-11-11 16:56:49 -08:00
ridiculousfish
efa9553dc1 Fix a stale comment 2018-11-11 16:08:45 -08:00
ridiculousfish
aa6be9bee4 Pass the original string into wildcard's decsription function
wildcard_complete was invoking the description function with some fragment
of the wildcard string. Instead pass in the original string.

Fixes #5327
2018-11-11 14:15:45 -08:00
Mahmoud Al-Qudsi
d6ab3db159 fixup! Extend __fish_complete_suffix to support a virtual $PWD 2018-11-08 16:17:56 -06:00
Fabian Homborg
77229effb5 expand: Fix get_home_directory_name
This fixes the `~floam/` case, where the out_tail_idx pointer needs to
point to the "/", not the last letter.

The `~/` and `~floam` cases still work.

Unfortunately, I'm unsure of how to test this.

Fixes #5325.
2018-11-08 10:07:45 +01:00
Mahmoud Al-Qudsi
34440165aa Add completions for openocd 2018-11-07 20:08:16 -06:00
Mahmoud Al-Qudsi
da6937e0cf Extend __fish_complete_suffix to support a virtual $PWD
In writing the completion script for openocd I found the need to
complete paths at the command-line as if they were relative to a
path other than the current $PWD. Given that `$PWD` is currently
global in fish (i.e. no side-effect free `cd` within a subshell)
this is probably good to have for other completions too.

This also fixes a bug in support for explicitly supplying the
description for completions via a `$argv` parameter, which prefixed
the description with `\t` (which is correct) except it did so in
the local scope within an `if` statement, meaning the changes never
had any effect and in the output the description was directly
concatenated to the completions, instead of separated by a tab.
2018-11-07 20:08:16 -06:00
Mahmoud Al-Qudsi
6b7501d715 Correct pandoc data directory path in completions
Incorrectly assumed that pandoc uses XDG_CONFIG_HOME, it turns out the
path is hard-coded as $HOME/.pandoc unless explicitly otherwise
specified in the command-line.
2018-11-07 18:34:50 +00:00
Fabian Homborg
460bc00698 Fix string escape var and url styles
Turns out I broke these in my zeal to remove wcs2string.

This reverts commit 583d771b10.

Fixes #5322.
2018-11-07 12:48:11 +01:00
ridiculousfish
bfd50863b8 Correct fish_wcstod and fix Linux build failure
Limit the fish_wcstod fast path to ASCII digits only, to fix the problem
observed in the discussion for a700acadfa
where LANG=de_DE.UTF-8 would cause `test` to interpret commas instead of
periods inside floating point values.
2018-11-06 23:17:41 -08:00