Commit graph

9284 commits

Author SHA1 Message Date
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
Benjamin Nied
eabda835d5 fish.spec: switch to using a common rpm macro
CentOS 7 does not have rhel_version as one of its macros, so trying to
build results in CMake errors, since we get `cmake` instead of
`cmake3`. These additional conditions allow the spec to build
successfully on CentOS 7.

Using %rhel should allow one set of conditionals to work across CentOS 7
and RHEL 7.

This has been tested on both.
2019-01-04 21:16:51 +08:00
Fabian Homborg
9d4e460b29 string: Fix crash with _GLIBCXX_ASSERTIONS
This asserted because we accessed wcstring::front() when it was empty.

Instead, check explicitly for it being empty before.

Fixes #5479
2019-01-04 08:45:53 +01:00
Fabian Homborg
3a885d5e82 tests/cd: cd back before cleaning up
Otherwise this'd run afoul of OpenIndiana's "no removing $PWD" rule. Spoilsports!

See #5472.
2019-01-03 23:21:26 +01:00
David Adam
9fb18f6322 README: update to version-independent OBS repository
[ci skip]
2019-01-03 23:34:26 +08:00
Fabian Homborg
72c0213d42 docs: Document $hostname
Fixes #5469.

[ci skip]
2019-01-03 12:31:35 +01:00
Takuya Noguchi
6b37ff0502 Update ppa repo to fish shell 3.x
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2019-01-03 11:32:17 +01:00
Fabian Homborg
12d7c7feb6 Switch to readdir from readdir_r
It's deprecated in glibc, and does not work properly on Solaris.

Fixes #5458.
2019-01-03 11:19:45 +01:00
Fabian Homborg
f3e87b7996 tests/psub: Don't use grep -o and diff -q
These aren't available on OpenIndiana.

`grep -o` is easily changed to `string`, `diff -q` imitated with
`comm` and `test`.

See #5472.
2019-01-03 11:05:03 +01:00
Mahmoud Al-Qudsi
380bae80bf Fix wcstod_l detection under Linux
This was broken in a8eb02f9f5 when the
detection was corrected for FreeBSD. This patch makes the detection work
for both Linux and FreeBSD instead of one or the other (tested).
2019-01-02 19:07:53 -06:00
Mahmoud Al-Qudsi
3444e1db18 Fix unsafe locale usage in wcstod_l fallback
Using `setlocale` is both not thread-safe and not correct, as
a) The global locale is usually stored in static storage, so
   simultaneous calls to `setlocale` can result in corruption, and
b) `setlocale` changes the locale for the entire application, not
   just the calling thread. This means that even if we wrapped the
   `wcstod_l` in a mutex to prevent the previous point, the results
   would still be incorrect because this would incorrectly influence the
   results of locale-aware functions executed in other threads while
   this thread is executing.

The previous comment mentioned that `uselocale` hadn't worked. I'm not
sure what the failing implementation looked like, but `uselocale` can be
tricky. The committed implementation passes the tests for me under Linux
and FreeBSD.
2019-01-02 18:43:43 -06:00
Mahmoud Al-Qudsi
bc0a0b4bc8 Fix wcstod_l infinite recursion under FreeBSD
This was the actual issue leading to memory corruption under FreeBSD in
issue #5453, worked around by correcting the detection of `wcstod_l` so
that our version of the function is not called at all.

If we are 100% certain that `wcstod_l` does not exist, then then the
existing code is fine. But given that our checks have failed seperately
on two different platforms already (FreeBSD and Cygwin/newlib), it's a
good precaution to take.
2019-01-02 18:43:43 -06:00
Mahmoud Al-Qudsi
7af0cad23d Fall back to CMake's pkg-config-based search for curses
CMake seems to have trouble finding libraries from multiarch packages
that do not have the compatibility symlink installed to the
arch-independent library directory. Users must either manually supply
the path to the library in question via command-line parameters or we
can fall back to CMake's alternate method of finding packages based off
of pkg-config rather than using the hard-coded `FindCurses` CMake module
specific to the CMake version/distribution installed.
2019-01-02 18:38:55 -06:00
Mahmoud Al-Qudsi
74422e476b Define _GNU_SOURCE for wcstod_l check 2019-01-02 14:05:49 -06:00
Sean Molenaar
41b3331175 Add support for wayland copy/paste 2019-01-02 16:46:04 +01:00
David Adam
7191a42ca0 fish.spec: turn the BUILD_SHARED_LIBS option off
PCRE2 should only be built as a static library.

Closes #5448.
2019-01-02 21:38:30 +08:00
David Adam
6783c63eee fish.spec: tidy up extra CMake arguments 2019-01-02 21:36:55 +08:00
Mahmoud Al-Qudsi
ef23923c8d Drop use of deprecated bzero(3)
Use `memset(__, 0, __)` instead. Also fixes #5461 by not needing `bzero`
from `strings.h` anymore.
2019-01-02 00:28:25 -06:00
Mahmoud Al-Qudsi
d1913f0df0 Add workaround for Cygwin process management and job control bugs
We cannot wait by pgroup under Cygwin for unknown reasons. Always
wait on jobs by individual processes. See code for more information.
2019-01-02 00:14:07 -06:00
David Adam
63e70d601d autoconf: quiet warning by using AC_LANG_PROGRAM
e4b6007f33 introduced the following warning:

configure.ac:327: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call
detected in body

Fix by using the right autoconf macros for the job.
2019-01-01 22:10:22 +08:00
Fabian Homborg
ea6631641f tests/read.expect: Skip /dev/stdin if it doesn't exist
Fixes a failing test on alpine/musl.
2019-01-01 14:52:26 +01:00
Fabian Homborg
7afd7a1985 tests/histfile Remove history --save
This might crash on arch on sr.ht?
2019-01-01 14:52:26 +01:00
Fabian Homborg
8b5fa6f572 tests/test9: Guard locale
Musl!
2019-01-01 14:52:26 +01:00
Fabian Homborg
a84d22b926 tests/printf: Skip locale test on musl
It does not provide a `locale`, so we can't list the locales.
2019-01-01 14:52:26 +01:00
Fabian Homborg
217486e547 math: Use simpler format string
It seems like musl's printf here fails on `%*lc`. So we use `%*ls`,
which we already use in string, so it should work.
2019-01-01 14:52:26 +01:00
Fabian Homborg
ba8748877a tests/functions: Don't compare diff output
Turns out busybox diff (used on alpine) defaults to unified output,
which we can't use because that prints filenames, and those are
tempfiles made by psub.

Instead, we use builtins to print the first line and compare the others.
2019-01-01 14:52:26 +01:00
Fabian Homborg
54438f8dc1 tests/invocation: Check for tput 2019-01-01 14:52:26 +01:00
Fabian Homborg
e7221a21ef tests/invocation: Disable bad-switch test
This isn't all that important, and it breaks on musl just because the message is different.
Just skip it for now, until we figure out how to better test this.
2019-01-01 14:52:26 +01:00
Fabian Homborg
e83c0b1a53 tests/read: Set TERM=xterm explicitly 2019-01-01 14:52:26 +01:00
Fabian Homborg
b7369213e2 tests/interactive: Scope variables correctly
This `set TERM`. Which, if $TERM is inherited, is already exported,
but not if it isn't.

This is the case on sr.ht's arch images, so we failed without a TERM variable.
2019-01-01 14:52:26 +01:00
Fabian Homborg
1074a59d75 tests/invocation: Set colors after $TERM
builds.sr.ht doesn't set $TERM, so this failed.
2019-01-01 14:52:26 +01:00
Takuya Noguchi
7aca69780c Replace deprecated options with newly introduced options for gem.
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2019-01-01 14:28:13 +01:00
Fabian Homborg
9dc79cd8d5 completions/screen: Replace eval with var-as-command
[ci skip]
2019-01-01 14:04:47 +01:00
Fabian Homborg
4b8da10215 completions/modinfo: Don't check uname
This checks if uname exists (we already call it elsewhere without
check, nobody has complained, uname is in POSIX), then calls to see if
it's "Linux", and only then offers any completions.

Since we don't have any other version to offer, the check is worse
than useless.
2019-01-01 13:57:32 +01:00
Mahmoud Al-Qudsi
131f0f2de5 Speed up wait.expect test
(This is being committed to a branch on the main repository so I can
verify that Travis is able to run this OK.)
2018-12-31 19:36:08 -06:00
Curtis Jiang
f871951a87 fix OpenWrt and opkg support (#5454)
* add OpenWrt and opkg support

Signed-off-by: Curtis Jiang <jqqqqqqqqqq@qq.com>

* fix opkg list

Signed-off-by: Curtis Jiang <jqqqqqqqqqq@qq.com>
2018-12-31 16:48:03 +01:00