Commit graph

9319 commits

Author SHA1 Message Date
ridiculousfish
50c83463f1 Switch some uses of env_get to instanced environment_t 2019-01-10 20:07:31 -08:00
ridiculousfish
3eb15109cf Instantize env_set in env.h and env.cpp 2019-01-10 20:07:23 -08:00
ridiculousfish
abcd24f716 Eliminate env_snapshot_t::current()
These uses are better served by passing in the real environment stack,
now that we have environment_t as a shared base class.
2019-01-10 20:07:14 -08:00
ridiculousfish
03b92ffe00 Clean up path_get_cdpath and path_can_be_implicit_cd 2019-01-10 20:07:10 -08:00
ridiculousfish
c1dd284b3e Instantize env_set
Switch env_set to an instance method on environmnet_t.
2019-01-10 20:05:45 -08:00
ridiculousfish
421fbdd52a Instantize env_get_pwd_slash
This requires threading environment_t through many places, such as completions
and history. We introduce null_environment_t for when the environment isn't
important.
2019-01-10 20:01:28 -08:00
ridiculousfish
26fc705c07 Instance env_set_empty 2019-01-10 20:01:20 -08:00
ridiculousfish
a00de96a57 Instance env_remove 2019-01-10 20:01:15 -08:00
ridiculousfish
ede66ccaac Instance env_set_argv and env_set_pwd 2019-01-10 20:29:10 -08:00
ridiculousfish
5055621e02 Eliminate env_push and env_pop 2019-01-10 20:29:10 -08:00
ridiculousfish
94adb53b1f Eliminate complete_set_variable_names 2019-01-10 20:29:10 -08:00
ridiculousfish
e6b13c6bac Begin to thread environments explicitly through completions 2019-01-10 20:29:10 -08:00
ridiculousfish
e6872b83b0 Eliminate global env_export_arr()
This assumes the set of exported variables is a global property; but we
want it to be a local property.
2019-01-10 20:29:10 -08:00
ridiculousfish
a47f6859bd Equip parser_t with a variable stack
Prepares to eliminate env_get and env_set by accessing variables through
a parser.
2019-01-10 20:29:10 -08:00
ridiculousfish
bba66a3ecc Use shared_ptr instead of unique_ptr in environments
This prepares for multiple environment stacks sharing the same parent.
2019-01-10 20:29:10 -08:00
ridiculousfish
8d7cae63ff Introduce env_stack_t
This will instance environment variable stacks.
2019-01-10 20:29:10 -08:00
ridiculousfish
391af6af0c Introduce class environment_t
This will be used as a base class for variable snapshots and variable stacks.
2019-01-10 20:29:10 -08:00
ridiculousfish
895c2c4af0 Minor cleanup of parser interface 2019-01-10 20:29:10 -08:00
Mahmoud Al-Qudsi
e7715eecf6 Add regression question to GitHub issue template 2019-01-10 21:48:42 -06:00
Mahmoud Al-Qudsi
16a94db702 Check for -Werror=unguarded_availability support before forcing it
The compiler flag `-Werror=unguarded_availability` was hard-coded for
macOS, but is not supported by GCC on macOS 10.10 (Yosemite). Test for
support with CHECK_CXX_COMPILER_FLAG before forcing it.
2019-01-10 20:03:38 -06:00
Mahmoud Al-Qudsi
2bb53f7253 Fix locale_t under macOS 10.10
`xlocale.h` is not available on Linux, so we can't just universally
include it.

`HAVE_XLOCALE_H` was already being tested/set in the CMake script as a
possible requirement for `wcstod_l` support, this just adds it to
`config_cmake_h.in` and uses it in `wutil.h` to gate the include.
2019-01-10 20:03:38 -06:00
Mahmoud Al-Qudsi
b402b635a9 Drop hard requirement on explicit -lpthread support
Closes #5512
2019-01-10 20:03:38 -06:00
David Adam
f5893ba475 debian packaging: turn on tests in Debian packages 2019-01-10 21:37:08 +08:00
David Adam
d518b01281 fish_tests.cpp: mock the home directory
Removes the dependency on the current user's home directory, instead
overriding it to be within the current hierarchy.

Fixes the tests on Debian buildd, where the home directory is
deliberately unwriteable to pick up errors in builds.
2019-01-10 21:22:44 +08:00
Varun Arora
89d77df658 add missing tmux new-session flags to tmux completion script 2019-01-10 13:22:02 +01:00
Versus
9743cd77d3 yaourt: recognize *.pkg.tar as valid package extension 2019-01-10 13:13:59 +01:00
ridiculousfish
c15a702f18 Revert "Fix unsafe locale usage in wcstod_l fallback"
This reverts commit 3444e1db18.

The reverted commit broke tests on the Mac.
2019-01-09 15:23:55 -08:00
John McKay
a6fa237db2 print --help to stdout like other builtins (#5495) 2019-01-09 15:07:09 -08:00
David Adam
4a8db53bcf status docs: add current-command
Note deprecation of $_.

[ci skip]
2019-01-09 22:38:57 +08:00
David Adam
b4365e972a status completions: tidy, add current-command, fish-path and aliases 2019-01-09 22:32:42 +08:00
Fabian Homborg
5612f47e33 Revert "Revert "tests/invocation.sh: Port to sh (from bash)""
The one thing I was missing:

`echo -n` isn't POSIX. In practice, it appears the only shell to encounter this
is macOS' crusty old bash in sh-mode. Just replace it with `touch`.

This reverts commit fc5e8f9fec.
2019-01-08 22:57:56 +01:00
John McKay
f553cedff1 README: update to reflect mandoc support 2019-01-08 18:25:28 +01:00
John McKay
827bce6c88 Use mandoc when nroff not available
mandoc users do not need to install nroff to be able to format and view
manual pages. If both nroff and mandoc cannot be found it will show an
error.
2019-01-08 18:25:28 +01:00
David Adam
1f897d2c43 debian packaging: recommend python3 or python2
Closes #5492.
2019-01-08 14:50:08 +08:00
Fabian Homborg
fc5e8f9fec Revert "tests/invocation.sh: Port to sh (from bash)"
This reverts commit 9aa8740c36, which broke on macOS.

If anyone wants to try, feel free to do so!
2019-01-07 21:27:32 +01:00
Fabian Homborg
9aa8740c36 tests/invocation.sh: Port to sh (from bash)
This makes the script worse, but it's good enough.

The required changes are:

- `shopt -s nullglob`, which we simply don't use (we have one glob, but that's
  guaranteed to match because we ship the files)

- One array, which we replace with a direct use of the glob (plus it
  used `echo` again?)

- The `function` word, which I'm still annoyed is even a thing!

- Variable indirection (`color=${!color_var}` - instead we pass the
  value directly - which makes the script uglier!)

- One array, which we replace with a function

- A use of `type -t`, replaced with `command -v`

- A use of `${var:begin:end}` substring expansion, replaced with trickery.

- `set -o pipefail` is replaced with a function

Note that checkbashisms still complains about `command -v`, because
we're not using it with "-p". But we _want_ to check the current
$PATH, and `command -v` is POSIX.

This still uses `local`, which technically isn't in POSIX.

The tests now appear to pass in:

- bash

- dash

- zsh

- mksh

- busybox
2019-01-07 18:47:40 +01:00
Fabian Homborg
d4be5f08f3 Fix nim prompt (via web_config)
This had a helper function defined outside of the fish_prompt
function, so `funcsave` missed it (see #736).

Fixes #5490.

[ci skip]
2019-01-07 17:25:58 +01:00
Fabian Homborg
adb97772c5 doc_src/printf: Add missing space
[ci skip]
2019-01-06 13:46:11 +01:00
Benjamin Nied
e7bfd1d71c Remove shebangs from py scripts
Starting with Fedora 30 and RHEL 8, ambiguous python shebangs will now
throw errors during the RPM build process instead of just warnings,
since these systems have moved to Python 3 by default, and Python 2 may
not be available in the future.

See [this
page](https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error)
for more details.

Drop these shebangs as the scripts are only ever called from fish
wrappers.
2019-01-06 20:39:04 +08:00
Stephen M. Coakley
d776a366fa Pass final Fish exit status to fish_exit event
For fish_exit to be a suitable replacement for --on-process-exit, we need to be able to provide scripts with access to the shell's final exit code.
2019-01-05 21:27:13 +01:00
David Adam
896d6f41f4 fish.spec: drop stanza for RHEL 5
CentOS / Red Hat Enterprise Linux 5 are end-of-life and builds are not
made for these platforms any more.
2019-01-05 20:27:57 +08:00
David Adam
f4790a8767 fish.spec: check if %rhel is defined before expanding.
Work on #5446.
2019-01-05 20:27:06 +08:00
Fabian Homborg
40fa3c21f0 Switch Travis to Xenial (16.04) 2019-01-05 12:58:52 +01:00
Fabian Homborg
b8b0c39c77 fish_tests: Use std::isnan
Fixes the tests on Ubuntu 16.04 "xenial".
2019-01-05 12:58:52 +01:00
David Adam
4548f4f4b0 fish.spec: run all tests 2019-01-05 17:28:37 +08:00
David Adam
2c01e67a74 histfile tests: tweak expect commands to avoid crash on 32-bit platforms
Rather than killing the process with close, read EOF after sending the
"exit" command and wait for OS cleanup (per the expect examples).

Not cleaning up with wait caused expect to crash on all 32-bit platforms
including i586 and armv7l with "alloc: invalid block: 0xbf993ccb: 3d 3b".

64-bit platforms were not affected, for reasons that are not clear.
2019-01-05 16:03:15 +08:00
Mahmoud Al-Qudsi
4f196eef64 Bypass mutually exclusive CMake checks
There are some redundant CMake checks, in the sense that they are either
not needed or cannot possibly match if a previous check already passed.
2019-01-04 14:46:36 -06:00
Mahmoud Al-Qudsi
5196a42165 Prevent CMake configure checks for affecting future checks
Using CMAKE_PUSH_CHECK_STATE/CMAKE_POP_CHECK_STATE to prevent CMake
checks from permanently altering the environment used by future checks.
2019-01-04 14:30:14 -06:00
Mahmoud Al-Qudsi
490432c177 Globally set the _GNU_SOURCE define for CMake configuration checks 2019-01-04 14:18:02 -06:00
Fabian Homborg
04f1ea0680 share/config: Don't split /etc/paths entries on spaces
This used `read -la`, which _splits_.

Instead, don't do that, each line is its own entry.

Fixes #5481.

[ci skip]
2019-01-04 14:50:12 +01:00