Commit Graph

257 Commits

Author SHA1 Message Date
Fabian Boehm
8dbd23372f style.fish: Just ask for uncommitted changes
I keep some files around that I don't *want* to commit or ignore, but
it's fine to restyle them.

It's also fine to restyle everything if you are about to commit
something because then it'll be committed in the correct style.
2022-06-16 18:45:46 +02:00
Fabian Homborg
15f1b5f368 Skip building version file if git describe fails the new perm check
git had a CVE related to arbitrary code being run when you run git status and similar, and instead of doing something about those arbitrary code bits they decided to lock it down entirely.

So now git will refuse to do basically anything once it detects the .git directory is owned by someone else.

So, what we do is:

If `git describe` failed with a status of 128, we keep an already
built version file.

This is an awful hack, but should help with the normal `cmake; make; sudo
make install` cycle.

(the only *real* way around this seems to be to not attempt to rebuild
the version file at install time entirely, but I have no idea how to
do that)

Fixes #8973.
2022-05-26 09:35:59 +02:00
ridiculousfish
cfbebb7201 Better support for helper functions in pexpect
When a pexpect test fails, it reports the "failing line." Prior to this
commit, it did so by walking up the Python call stack, looking for
the first frame which is not in the pexpect_helper module, and so presumably
in the test itself. However sometimes the test wants to define a helper
function; then if the test fails the helper function is reported as the
failing line, not the callsite of the helper.

Fix this by skipping functions which have the `callsite_skip` attribute set.

Nothing to relnote here.
2022-04-10 12:59:04 -07:00
Aaron Gyes
75d1a0cb5a welcome.html: Provide fallback font-families as we are unsure
Yosemite know's about system-ui.

We do know `-apple-system` predated `system-ui` and are otherwise
aware that `Menlo` and `Helvetica Neue` will exist and be 'right'
on 10.10 and earlier.
2022-01-28 19:47:58 -08:00
Aaron Gyes
3b41f8dfe8 Add missing newlines 2022-01-26 13:51:45 -08:00
Aaron Gyes
a617ef7ec1 Fix typo in preinstall script. 2022-01-22 20:08:32 -08:00
Aaron Gyes
fe9822bb20 Fix welcome text, don't use logger.
Logger was unneccessary - stderr was being captured.

Do the welcome message as HTML - it's easier. Fixes #8661
2022-01-22 20:06:37 -08:00
Aaron Gyes
0d5651b0ab .pkg scripts: remove old installs, fix install volume, logging
+ Adds a preinstall script to wipe out whatever the last .pkg
   installed. This should avoid systems that have mad many updates
   getting into strange states autoloading things that no longer
   exist. Fixes #2963

 + Run add-shell with ${DSTVOLUME} prepended to the path - the
   installer lets users intall onto any volume, so it's plausible
   not installed onto /

 + Use `logger` instead of rando /tmp files for logging - stuff
   should show up in Console.

 + make_pkg makes the pkg and also fish.app - the former was being
   built with -j12 already, make the latter do so as well.
2022-01-21 14:01:06 -08:00
ridiculousfish
c1a1b70203 macOS: Specify hostArchitectures in osx_distribution.xml
This allows the installer to work without Rosetta 2 on Apple Silicon
Macs. Note that fish shell itself has run natively since 3.3.1 but the
installer still wanted Rosetta 2, because this key was missing.

Fixes #8566. Credit to floam for finding missing key.
2022-01-08 11:31:23 -08:00
ridiculousfish
667057cb0d macOS: go back to using Apple-provided productsign
Previously we used a hacked up 'xar' tool for signing packages,
since productsign produced a package that could not be installed on
macOS 10.11. That was fixed in Xcode 12.5 so we can just use Apple's
tools again.

See #7656.
Also see https://developer.apple.com/forums/thread/664842
2022-01-08 11:31:23 -08:00
Ilan Cosman
566a673e4f Run fish_indent on all non-test .fish files 2021-11-23 09:49:45 +01:00
ridiculousfish
e08b71592e pexpect_helper to unconditionally output to the tty
With the new test runner, pexpect_helper no longer sees a tty so wasn't
outputting the buffer. Just always do it.
2021-10-29 20:45:42 -07:00
ridiculousfish
f373e6e923 Reformat pexpect_helper.py with black 2021-10-29 20:42:59 -07:00
Aaron Gyes
901dbd71b0 fix build when path has spaces in it.
Now it works.
2021-10-22 02:27:19 -07:00
Mahmoud Al-Qudsi
86a442fb62 Make find_weak_odrs work with Python 3.6
`text` is an alias for `universal_newlines` but wasn't introduced until
Python 3.7
2021-10-04 19:45:36 -05:00
ridiculousfish
799a2abac1 Add script to detect ODR violations
This is a little script that can be run manually to try and detect ODR
violations. It works by looking for weak symbols in .o files where the
symbol has the same name and different sizes.
2021-09-30 11:33:03 -07:00
Fabian Homborg
f97eac55e8 Tell cppcheck we're c++11
Not "posix", wow.

Did anyone ever use this?
2021-09-15 17:49:57 +02:00
Fabian Homborg
23e6698dc8 cmake: Force color in the tests
For littlecheck/pexpect this just unconditionally enables color.

I have no idea what happens if you run cmake outside of a terminal
, but the worst that can happen is that *errors* have color
escapes in them.

If someone figures out how to get cmake to tell us if it's running in
a terminal, we can add a check.
2021-08-30 17:16:19 +02:00
Mahmoud Al-Qudsi
a6a3563a6e Update littlecheck to e6d56a with support for skipped tests
This is in preparation for adding skipped test support to our ctest
integration.
2021-08-29 08:56:12 +02:00
Fabian Homborg
f8a46c027d Add script to extract help sections
Unfortunately, we now need to know which .html file has which sections
to link to the correct one in help.fish.

So this script helps extract the sections from pre-built docs. It's
not supposed to be run at build time because

1. These change rarely.
2. We should link to the correct document even if the user doesn't
have the docs built.

And before anyone mentions it: This does *not* parse html with regex.

This "parses" the restricted subset of "class followed by href without
embedded quotes" that sphinx uses here in practice.
2021-08-23 18:01:31 +02:00
ridiculousfish
aad64ccdc0 Add some sleep to mac_notarize.sh
Notarization fails because you can't check on its status right away.
Add a sleep to address this.
2021-06-29 13:46:08 -07:00
David Adam
fd184cb4ea GitHub Actions: drop UBSan suppressions
These were only needed on Travis, and only worked there in this form.
2021-04-07 20:29:54 +08:00
Fabian Homborg
c8c641dd63 Update littlecheck to 5f6c024fbdf6654e7851d3fd756a6d56e167476e
Now with 52% fewer "command not found" errors
2021-03-26 19:32:14 +01:00
Johannes Altmanninger
516a70d9cb Misc cleanups
Some as suggested by lgtm.com
2021-03-21 19:41:36 +01:00
Fabian Homborg
81af5b7ff3 pexpect: Allow specifying that a test should fail
I have no idea how to see that flow control has worked otherwise
2021-02-15 17:30:50 +01:00
Fabian Homborg
ccc5e7cb28 pexpect: Pass on keyword arguments to spawn()
This is useful for all the additional pexpect features.
2021-02-12 18:21:07 +01:00
ridiculousfish
e4a993c581 Use xar-based workflow for creating Mac packages
As spotted in #7656, macOS installer files built on Big Sur fail signature
verification on macOS 10.11. This is because Big Sur productsign no longer
supplies the SHA-1 hash, and 10.11 does not know how to read the SHA-256
hash.

Replace the productsign flow with a flow based on
http://users.wfu.edu/cottrell/productsign/productsign_linux.html . This
uses the xar tool to digitally sign the installer packages, with both
SHA-1 and SHA-256 hashes.

The xar tool is somewhat tricky to build, so is checked in (as binary!)
compiled for Mac.

To build a Mac package, run make_pkg.sh (which invokes the signing flow)
followed by mac_notarize.sh which adds the notarization.
2021-01-31 14:07:49 -08:00
Fabian Homborg
5ca27ac565 Update littlecheck
From commit b1369a52c24336da2d2d6d5dc6707a7834065d43

This adds the "REQUIRES" directive that allows specifying
preconditions for tests, which allows us to add tests that don't have
to run on all systems.

Now, I don't want to just make all tests specific to an OS or
something, but e.g. a `git` test would be a honkin' great idea, and we
can't ask everyone to have `git`!
2021-01-16 13:26:01 +01:00
Johannes Altmanninger
a205225b4e lint.fish: properly handle -I and -D args for cppcheck
lint.fish receives arguments that contain multiple includes and defines.
As a result, we passed arguments like
"-I/usr/include -I$HOME/fish-shell/build -I/usr/include"
to cppcheck which interprets this as a single include directory.
This leads to errors like this one (because the "build" dir was missing):

	src/common.h:4:0: information: Include file: "config.h" not found. [missingInclude]
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
53d922bde6 build_tools/lint.fish: correct cppcheck config location
Which was moved in 9b3bfb63d ("cppcheck: Move config files to build_tools")
Also get rid of the nonstandard cppcheck output format.
2020-12-29 16:31:43 +01:00
Johannes Altmanninger
84262b126b build_tools/style.fish: don't format other Python files 2020-12-29 16:31:43 +01:00
ridiculousfish
f4f7764390 Add Apple Silicon support to make_pkg
This checks in support for Apple Silicon builds in the Mac package maker
script.
2020-12-05 14:34:00 -08:00
Fabian Homborg
9567df4b15 Update littlecheck to 06457b194883879fe08282f84863fa37080c27a5
This fixes a bug where it would fail to match some regexes.
2020-11-30 18:16:42 +01:00
Fabian Homborg
6d98939445 Fix Littlecheck's diff-matcher
Unfortunately the previous solution was too naive and misidentified
some errors.

In essence, passing regex-source couldn't work, because those could
not match any other line, so we have to inject regex-matching into the
SequenceMatcher.

Through awful hackery, this is possible.

Updates littlecheck to 0f6841bbc1674e89f512b5f19d1ad4e0227d2934.
2020-11-25 17:23:29 +01:00
Fabian Homborg
2e55e34544 Reformat 2020-11-22 14:39:48 +01:00
Fabian Homborg
47ddb6d516 Update littlecheck
This lets littlecheck "diff" the given output with the checks, leading
to easier to understand errors.

E.g. changing some random lines in andandoror.fish yields error output
like:

```
Testing file checks/andandoror.fish ... Failure:

  The CHECK on line 36 wants:
    if test 4 ok

  which failed to match line stdout:9:
    if test 3 ok

  Context:
    [...] from line 17 (stdout:6):
    true && false || true: 0
    if test 1 ok
    if test 2 ok
    if test 3 ok <= no check matches this, previous check on line 35
    if test 4 ok
    0 0 0
    1 1 1
    2 2 2
    3 3 3 <= does not match CHECK '3 5 3' on line 55
    4 4 4
    0
    1
    [...] from line 126 (stdout:33):
    0
    0
    0
     <= nothing to match CHECK 'banana' on line 135

  when running command:
    ../test/root/bin/fish checks/andandoror.fish
```

This updates littlecheck to b9c24a3.
2020-11-22 11:28:12 +01:00
Fabian Homborg
236587774e cppcheck: Make less annoying
Force checking all #ifdef paths, disable StlAlgorithm
suggestion

Removes a lot of borderline useless spew.

[ci skip]
2020-11-15 12:41:55 +01:00
Fabian Homborg
9b3bfb63d3 cppcheck: Move config files to build_tools
It's weird having them in the parent directory.

Move them to build_tools/ and make them visible.

[ci skip]
2020-11-15 11:11:55 +01:00
Fabian Homborg
cb8ffb00d6 cppcheck.sh: Fix shebang
This was using "/usr/local/bin/fish" for no good reason - 1. fish
might not be installed, 2. fish might not be installed *there*.

Just use /bin/sh in this case, if that doesn't exist we have bigger
problems, and this is just a simple wrapper for a command call.

[ci skip]
2020-11-15 11:07:27 +01:00
Érico Rolim
ef4f3b7334 build_tools/list_committers_since: account for possibility of mktemp
failure.
2020-11-14 15:57:42 +01:00
Fabian Homborg
64b5a22274 Upgrade littlecheck to print all error lines
In #7459, asan printed error output. However, because we had a failure
on stdout already, littlecheck would only print the first unmatched
line from stderr, leading to output like

```
additional output on stderr:1:

    =================================================================
```

Which is of course entirely useless.

So in that case we just let it print *all* unmatched stderr lines, so
you'd get the full asan output, which presumably is of more use.

This upgrades littlecheck to 5f7deafcea4e58dd3d369eae069a3781bb6ce75e.
2020-11-14 13:15:33 +01:00
Érico Rolim
3e3a42c127 build_tools/fish_xgettext.fish: use temporary directory.
Instead of using /tmp/fish as a temporary directory for this operation,
which could lead to clobbering user files, use mktemp to create an
actual temporary directory.
2020-11-13 16:29:37 +01:00
ridiculousfish
63cf3e972f Correct parameter order of pexpect.expect_prompt
Ensure that the increment= param is set via keyword, not via positional arg.
This mistake was masking a bug where the "^a b c" match was not being tested,
because it was being set as the value for increment!
2020-10-06 16:03:06 -07:00
ridiculousfish
9e1800cb96 Rework increment param in pexpect.expect_prompt
This switches the 'increment' param from "after" to "before." Instead
of expect_prompt saying if the next prompt will be incremented, each
call site says if it should have been incremented sinec the last prompt.
2020-10-06 14:22:35 -07:00
Johannes Altmanninger
f415b3b551 Update littlecheck
4a3e4c8 Allow inline #CHECK directives and ignore double-commented directives
2020-09-26 14:56:03 +02:00
Fabian Homborg
04562300e8 Pexpect: Return the match object instead of the result
The result is just the *index* of the pattern that matched. But since
we never pass a *list* it's just always 0.

spawn.match is the MatchObject that produced the match, so it can be
used to post-process the matched output, e.g.

```python
m = expect_re('\d+')
m.group() # is now the matched number
```
2020-09-04 17:53:17 +02:00
ridiculousfish
47480b2dbd Remove redraw coalescing logic
Prior to this change, if we saw more than one repaint readline command in
a row, we would try to ignore the second one. However this was never the
right thing to do since sometimes we really do need to repaint twice in a
row (e.g. the user hits Ctrl+L twice). Previously we were saved by the
buginess of this mechanism but with the repainting refactoring we see
missing redraws.

Remove the coalescing logic and add a test. Fixes #7280.
2020-08-24 13:22:35 -07:00
Fabian Homborg
31e19db64a Update littlecheck
Update littlecheck to dda885bed9d4a4c6ea1d9d66d0ca93fb54492b7c,
which also displays the context view when the error is on the first line.
2020-07-18 22:10:11 +02:00
Johannes Altmanninger
826db22dbf Adjust deprecated stderr redirection in fish_xgettext.fish 2020-07-05 08:55:11 +02:00
Fabian Homborg
149a0b98af Another formatting run
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.

Like... lemme just add a break if it looks better, will you?

But it is the style at this time, so we shall tie an onion to our
belt.
2020-06-24 20:43:56 +02:00