Commit graph

305 commits

Author SHA1 Message Date
Johannes Altmanninger
610338cc70 On undo after execute, restore the cursor position
Ever since 149594f974 (Initial revision, 2005-09-20), we move the
cursor to the end of the commandline just before executing it.

This is so we can move the cursor to the line below the command line,
so moving the cursor is relevant if one presses enter on say, the
first line of a multi-line commandline.

As mentioned in #10838 and others, it can be useful to restore the
cursor position when recalling commandline from history. Make undo
restore the position where enter was pressed, instead of implicitly
moving the cursor to the end. This allows to quickly correct small
mistakes in large commandlines that failed recently.

This requires a new way of moving the cursor below the command line.
Test changes include unrelated cleanup of history.py.
2024-12-21 13:10:34 +01:00
Fabian Boehm
378dc9123a git_version_gen: Just print the version
This was needed because we #included it in C++, but now it's easier to
have just the version in there
2024-12-06 22:12:26 +01:00
Peter Ammon
0d5e6f356e
Correct spelling of "courtesy" 2024-10-24 20:25:22 -07:00
Peter Ammon
fbf0ad98af
Build macOS x86-64 with Rust 1.73.0 in make_pkg.sh
This retains compatibility with macOS 10.9.
Note that Apple Silicon Macs shipped with 10.15, so compatibility for Apple
Silicon is not a concern.
2024-10-13 14:36:02 -07:00
Peter Ammon
c33b35efd4
Set macOS version minimums harder
Fix the macOS app.
2024-10-06 16:38:21 -07:00
Peter Ammon
0e474768f4
Set macOS version minimums when building
Allows running on older versions of macOS.
2024-10-06 14:39:04 -07:00
Johannes Altmanninger
09797acf92 make_vendor_tarball: fix deprecated name for vendor Cargo manifest
> /builddir/build/BUILD/fish-3.7.1+2217.gbd5f9babd-build/fish-3.7.1-2217-gbd5f9babd/.cargo/config
> is deprecated in favor of config.toml
2024-08-09 15:07:42 +02:00
Peter Ammon
925382dc3e
Make make_pkg.sh create fat binaries again on macOS 2024-07-07 14:53:17 -07:00
Peter Ammon
96c5139254
Build, codesign, and notarize macOS packages in CI
This adds a new workflow and script to build macOS packages in GitHub CI.
It also adds some documentation for the process.
2024-07-05 17:29:28 -07:00
Peter Ammon
e67ffc1a3b
Revert accidentally pushed commits
This reverts commit 81de0ee97b.
This reverts commit b4450f0ee5.
This reverts commit d5a128d342.
This reverts commit 580028816c.
2024-07-04 19:01:11 -07:00
Peter Ammon
b4450f0ee5
more 2024-07-04 18:08:22 -07:00
Peter Ammon
d5a128d342
more 2024-07-04 17:21:54 -07:00
Peter Ammon
580028816c
Add a script to automate macOS codesign 2024-07-04 15:35:29 -07:00
David Adam
19d92a9476 make_vendor_tarball: stop trying to excise winapi
errno no longer depends on winapi, and nothing else does either. Stop
trying to remove it.
2024-06-10 22:13:27 +08:00
ridiculousfish
15c0313c33 Fix pexpect_helper.py prompt regex
The prompt regex for pexpect was:

```
    return re.compile(
        r"""(?:\r\n?|^)   # beginning of line
            (?:\x1b[\d[KB(m]*)* # optional colors
            (?:\x1b[\?2004h) # Bracketed paste
            (?:\x1b[>4;1m) # XTerm's modifyOtherKeys
            (?:\x1b[>5u) # CSI u with kitty progressive enhancement
            (?:\x1b=) # set application keypad mode, so the keypad keys send unique codes
            (?:\[.\]\ )?  # optional vi mode prompt
         """
        + (r"prompt\ %d>" % counter)  # prompt with counter
        + r"""
            (?:\x1b[\d\[KB(m]*)* # optional colors
        """,
        re.VERBOSE,
    )
```

This has a terrible bug: an accidentally unescaped bracket here:

    (?:\x1b[>4;1m) # XTerm's modifyOtherKeys
           ^

This bracket then extends throughout the entire regex, and is
accidentally terminated here:

    (?:\x1b[\d\[KB(m]*)* # optional colors
                    ^

Thus the whole regex is busted; in particular the prompt counters are
not being tested correctly.

A second issue is that these escape sequences are not emitted before the
first prompt, so correcting the regex will cause every test to fail.

Fix this by ignoring all of the escape sequences and merely look for
the "prompt %d>" portion.

THIS DELIBERATELY CAUSES TEST FAILURES.

The tests were already broken and falsely reported as passing.
These will be fixed in followup commits.

Good news is that the tests should become way more reliable after
this is fixed - hopefully no more introducing random sleep() calls.
2024-06-02 14:07:35 -07:00
David Adam
e05bbe06ca build tools: add make_vendor_tarball script 2024-04-30 23:36:56 +08:00
Johannes Altmanninger
64bc989e19 Drop invasive control sequences from pexpect debug output
A failing test might emit an OSC 133 prompt marking sequence, confusing
the parent terminal to think the test output contains a shell prompt. Let's
remove these.
2024-04-09 09:51:29 +02:00
Johannes Altmanninger
f285e85b0c Enable focus reporting only just before reading from stdin
Some terminals send the focus-in sequences ("^[I") whenever focus reporting is
enabled.  We enable focus reporting whenever we are finished running a command.
If we run two commands without reading in between, the focus sequences
will show up on the terminal.

Fix this by enabling focus-reporting as late as possible.

This fixes the problem with `^[I` showing up when running "cat" in
gnome-terminal https://github.com/fish-shell/fish-shell/issues/10411.

This begs the question if we should do the same for CSI u and bracketed paste.
It's difficult to answer that; let's hope we find motivating test cases.
If we enable CSI u too late, we might misinterpret key presses, so for now
we still enable those as early as possible.

Also, since we now read immediately after enabling focus events, we can get
rid of the hack where we defer enabling them until after the first prompt.
When I start a fresh terminal, the ^[I no longer shows up.
2024-04-06 11:22:19 +02:00
Johannes Altmanninger
8bf8b10f68 Extended & human-friendly keys
See the changelog additions for user-visible changes.

Since we enable/disable terminal protocols whenever we pass terminal ownership,
tests can no longer run in parallel on the same terminal.

For the same reason, readline shortcuts in the gdb REPL will not work anymore.
As a remedy, use gdbserver, or lobby for CSI u support in libreadline.

Add sleep to some tests, otherwise they fall (both in CI and locally).

There are two weird failures on FreeBSD remaining, disable them for now
https://github.com/fish-shell/fish-shell/pull/10359/checks?check_run_id=23330096362

Design and implementation borrows heavily from Kakoune.

In future, we should try to implement more of the kitty progressive
enhancements.

Closes #10359
2024-04-02 14:35:16 +02:00
Fabian Boehm
b3ce8eee60 Remove some more C++-isms 2024-03-23 11:54:23 +01:00
Fabian Boehm
d99a5bae88 Remove trace of corrosion 2024-03-23 11:52:49 +01:00
Fabian Boehm
360342bb9e pexpect: Check for signalstatus being none
This would happen if e.g. the child shell did `exit 1` before an
`expect()`.
2024-03-12 22:04:23 +01:00
Fabian Boehm
d3a66b2d96 translations: Remove tmpdir from location
This avoids changing the location every time you run fish_xgettext.
2024-03-10 16:40:58 +01:00
Fabian Boehm
d91ad2976c Make fish_xgettext sorta work with rust
This is absolutely disgusting code, but it works out okay-ish.

The problem is xgettext has no rust support (it's stuck in review
limbo). So we use cargo-expand to extract all invocations of
gettext, and massage all that to generate a
messages.pot ourselves.

We also assume any string constant could be translated.
2024-03-09 11:48:29 +01:00
Fabian Boehm
f62f1aaf99 Remove remaining mentions of curses 2024-02-23 16:36:10 +01:00
Johannes Altmanninger
e89a4f6cb4 Suppress _nc_doalloc memory leak
With the next commit, if I run

    docker/docker_run_tests.sh --shell-after docker/jammy-asan-clang.Dockerfile

I get this in test_string.fish and test_git.fish:

    =================================================================
    ==8339==ERROR: LeakSanitizer: detected memory leaks
    Direct leak of 72 byte(s) in 1 object(s) allocated from:
        #0 0x55a8a637eb45 in realloc /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:85:3
        #1 0x7facb841b6cc in _nc_doalloc (/lib/x86_64-linux-gnu/libtinfo.so.6+0x106cc) (BuildId: e22ba7829a55a0dec2201a0b6dac7ba236118561)
    SUMMARY: AddressSanitizer: 72 byte(s) leaked in 1 allocation(s).

Strangely there is no tparm in the call stack.  It does not seem to happen
in CI.
2024-01-13 03:07:29 +01:00
Fabian Boehm
0f5b2d4837 Remove C++ style/lint cruft 2024-01-07 15:12:21 +01:00
Johannes Altmanninger
ab98566c67 Remove fish_tests
The remaining tests are all obsolete or already ported.
2024-01-07 12:12:09 +01:00
ridiculousfish
f49efcc691 Use -DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic"
This works around the new linker breaking on old macOS, as documented in the
Xcode 15 release notes.

See https://stackoverflow.com/questions/77193298/crash-running-app-build-on-macos-13-6-clang-15-when-running-on-macos-11-dyna
2023-12-07 22:12:40 -08:00
Fabian Boehm
8cc0bdeed8 pexpect: Remove some unnecessary empty lines
This strips the newline from "code_context" (which is really just the
called function), and from the unescaped output.

Rather, in case the output doesn't end with a newline it'll mark it
with an explicit message "(no trailing newline)".
2023-10-04 18:51:44 +02:00
Fabian Boehm
7a22dcb687 pexpect: Check if the process exited with a signal
This would have been helpful in #10044:

> signals.py:28: SIGNAL SIGSEGV from expect_prompt()

instead of "EOF".
2023-10-04 16:02:13 +02:00
Fabian Boehm
77337fdc8a style.fish: Add rustfmt support 2023-06-01 18:14:12 +02:00
Mahmoud Al-Qudsi
7b0cc33f2e Add LSAN suppressions file
Suppress TLS variable leaks caused by outstanding background threads by
suppressing the ASAN interposer functions. This is possible because because
we're now using use_tls=1.

-----------------------

Direct leak of 64 byte(s) in 2 object(s) allocated from:
    #0 0x5627a1f0cc86 in __interceptor_realloc (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xb9fc86) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #1 0x7f04d8800f79 in pthread_getattr_np (/lib/x86_64-linux-gnu/libc.so.6+0x95f79) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #2 0x5627a1f2f664 in __sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbc2664) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #3 0x5627a1f2fb83 in __sanitizer::GetThreadStackAndTls(bool, unsigned long*, unsigned long*, unsigned long*, unsigned long*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbc2b83) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #4 0x5627a1f19a0d in __asan::AsanThread::SetThreadStackAndTls(__asan::AsanThread::InitOptions const*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbaca0d) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #5 0x5627a1f19615 in __asan::AsanThread::Init(__asan::AsanThread::InitOptions const*) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbac615) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #6 0x5627a1f19b01 in __asan::AsanThread::ThreadStart(unsigned long long) (/home/runner/work/fish-shell/fish-shell/build/fish_tests+0xbacb01) (BuildId: da87d16730727369ad5fa46052d10337d6941fa9)
    #7 0x7f04d87ffb42  (/lib/x86_64-linux-gnu/libc.so.6+0x94b42) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
    #8 0x7f04d88919ff  (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff) (BuildId: 69389d485a9793dbe873f0ea2c93e02efaa9aa3d)
2023-05-02 11:52:42 -05:00
Mahmoud Al-Qudsi
544bd183da Add and use ASAN blacklist
Blacklist an apparently false positive in the underlying runtime.
2023-04-29 11:02:59 -05:00
Johannes Altmanninger
6ede7f8009 Delete wcstring_list_t
We don't want it in Rust. Remove it to smoothen the transition.
2023-04-19 01:03:16 +02:00
David Adam
5a03a17b9a make_tarball: fix the vendor tarball generation path
Tilde expansion doesn't work inside quotes.
2023-04-02 21:20:49 +08:00
David Adam
e78560d927 make_tarball: quote variables
Fixes a shellcheck warning
2023-03-30 13:22:59 +08:00
David Adam
94ae87afa0 make_tarball: support generating a Corrosion vendor tarball 2023-03-30 13:22:01 +08:00
David Adam
9c8c7f9251 make_tarball: correct a comment 2023-03-30 12:12:09 +08:00
David Adam
7213102942 make_tarball: use Ninja over Make where possible 2023-02-25 19:32:24 +08:00
ridiculousfish
b42c00b706 macOS notarization: migrate from altool to notarytool
altool is deprecated and notarytool is much nicer. Switch to using it.
This only affects the notarization process for macOS binaries.
2022-12-26 15:25:42 -08:00
Fabian Boehm
36e8117206 Update littlecheck to 3d8a08bd164a96f53aef2a00a818e8778808e95a
No longer escaping quotes by moving the output around.
2022-12-23 18:49:41 +01:00
Johannes Altmanninger
c6e1704f00 pexpect test for commandline --current-process
It was not clear to me hwo this behaves when there are comments.

Include a friendly helper to compute control characters.
No functional change.
2022-11-12 22:34:31 +01:00
Aaron Gyes
1d81ec3730 Update include-what-you-use darwin mapping file
Fixed a line or two tripped IWYU asserts about visibility
when doing e.g. a private -> public mapping but the visibility
it came up with was identical. Like the <iosfwd> to <string>
mapping, it was defined as private -> public but they're both
"public".

Added a whole bunch of lines necessary to get sane/correct
reccomendations from current IWYU on clang 10 on macOS Ventura.
Incrementally I manually added these as needed while going through
each line change IWYU wanted in each file.
2022-08-20 23:38:28 -07:00
Aaron Gyes
c294c80214 style.fish --all improvements
clang-format (since 10) can output diagnostics which indicate
lines needing formatting with --dry-run and -Werror: the exit
code indicates if a file is correctly formatted or not.

We used to copy each .cpp file, run clang_format on the duplicate
and then `cmp` to see if there were changes made, before just
printing a line with the filename and moving the new ontop of
the original.

Now we show clang-format diagnostics which indicate which
lines will be changed, prompt for confirmation and then let
clang-format modify the files in-place without the juggling.

Looks like this: https://user-images.githubusercontent.com/291142/184561633-c16754c8-179e-426b-ba15-345ba65b9cf9.png
2022-08-14 17:57:36 -07:00
Fabian Boehm
0f3e58efe7 Update littlecheck to e2f243e80117aad27adfb8da73f4901c88b3af6d
Now prints a message if process was killed by a signal, truncates
output if no more checks were found, has an option to force color.
2022-08-05 18:29:29 +02:00
ridiculousfish
ed37cb6e35 Mac package: pass -f when deleting the temp directory
CMake's FetchContent package will check out a git repo and leave
permissions as read-only, causing rm to fail. Pass -f so that rm will
succeed.
2022-07-02 18:49:54 -07:00
ridiculousfish
780fc4b566 Pass FISH_USE_SYSTEM_PCRE2=OFF in Mac package build
This ensures we don't link against a system installed libpcre2.
Comment in the script why not.
2022-07-02 18:49:44 -07:00
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