Commit Graph

30864 Commits

Author SHA1 Message Date
Daniel Bertalan
8e2d0c8d5c Kernel: Do not return a null ref in Processor::current on aarch64
Clang rejects binding a reference to a null pointer at compile-time.
Let's just crash explicitly, instead of waiting for a null dereference
to mess things up.
2021-12-04 11:59:59 -08:00
Jan de Visser
c369626ac1 LibSQL: Gracefully react to unimplemented valid SQL
Fixes a crash that was caused by a syntax error which is difficult to
catch by the parser: usually identifiers are accepted in column lists,
but they are not in a list of column values to be inserted in an INSERT.

Fixed this by putting in a heuristic check; we probably need a better
way to do this.

Included tests for this case.

Also introduced a new SQL Error code, `NotYetImplemented`, and return
that instead of crashing when encountering unimplemented SQL.
2021-12-04 20:49:22 +03:30
Jan de Visser
001949d77a LibSQL: Improve error handling
The handling of filesystem level errors was basically non-existing or
consisting of `VERIFY_NOT_REACHED` assertions. Addressed this by
* Adding `open` methods to `Heap` and `Database` which return errors.
* Changing the interface of methods of these classes and clients
downstream to propagate these errors.

The constructors of `Heap` and `Database` don't open the underlying
filesystem file anymore.

The SQL statement handlers return an `SQLErrorCode::InternalError`
error code if an error comes back from the lower levels. Note that some
of these errors are things like duplicate index entry errors that should
be caught before the SQL layer attempts to actually update the database.

Added tests to catch attempts to open weird or non-existent files as
databases.

Finally, in between me writing this patch and submitting the PR the
AK::Result<Foo, Bar> template got deprecated in favour of ErrorOr<Foo>.
This resulted in more busywork.
2021-12-04 20:49:22 +03:30
Andreas Kling
108de5dea0 LibWeb: Stop sending "load" event twice to iframes
The "completely finish loading" algorithm (from the HTML spec) is
responsible for sending a "load" event to nested browsing context
containers (iframes).

This patch removes the old mechanism for sending "load" events, which we
had mistakenly kept around, causing two events to be sent instead of
one. :^)
2021-12-04 14:47:24 +01:00
Andreas Kling
58309444d7 LibWeb: Fix DOMImplementation changing content type of wrong document
DOMImplementation.createDocument() should set the content type of the
newly created document, not replace the content type of the
DOMImplementation's own host document.
2021-12-04 14:38:16 +01:00
Andreas Kling
d7a116bb0e groups: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling
96e4077c38 SystemMonitor: Port to LibMain :^)
There's a lot more work to do on this application to take full advantage
of TRY() etc. This patch just scratches the surface.
2021-12-04 14:24:04 +01:00
Andreas Kling
01228bf4ef CrashReporter: Port to LibMain and use TRY() while building the UI :^) 2021-12-04 14:24:04 +01:00
Andreas Kling
2511da1f57 gron: Use StringView literals more (instead of raw C strings) 2021-12-04 14:24:04 +01:00
Andreas Kling
855c425719 gron: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling
b0659b50dc jp: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling
c3733bea92 Applets/ClipboardHistory: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling
de182d4b46 stat: Modernize slightly :^)
- Port to LibMain
- Use AK::Format instead of printf()
2021-12-04 14:24:04 +01:00
Andreas Kling
0de575ec11 ls: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling
1640445cb2 LibCore: Add lstat() syscall wrapper 2021-12-04 14:24:04 +01:00
Daniel Bertalan
21acebd372 HackStudio: Fix cursor not jumping to column 1 in the embedded terminal
Normally, it's the TTY layer's job to translate '\n' into the separate
'\r' and '\n' control characters needed by the terminal to move the
cursor to the first column of the next line.
(see 5d80debc1f).

In HackStudio, we directly inject data into the TerminalWidget to
display command status. This means that this automatic translation
doesn't happen, so we need to explicitly give it the '\r' too.
2021-12-04 14:44:00 +03:30
Lady Gegga
a5548a97f1 Base: Add some Chinese characters to Katica Regular 10
https://www.unicode.org/charts/PDF/U4E00.pdf
4E00, 4E0A, 4E0D, 4E16, 4E28, 4E29, 4E2A, 4E2B, 4E2D, 4E3B,
4E3C, 4E3F, 4E42, 4E4B, 4E85, 4E86, 4EBA, 516C, 518B, 5727,
5728, 572D, 5927, 5928, 5929, 592B, 592D, 594C, 5B50, 5B51,
5F00
2021-12-03 08:55:27 -08:00
Tim Schumacher
0ca63cfd6e find: Implement support for multiple directories 2021-12-03 15:39:00 +01:00
Tim Schumacher
5a21c3b389 find: Use a Vector for parsing instead of moving optind 2021-12-03 15:39:00 +01:00
Tim Schumacher
4ca35ac1b8 find: Port to LibMain 2021-12-03 15:39:00 +01:00
Itamar
c3c2fe153b LibCpp: Add "ignore invalid statements" option to Preprocessor
When we run the Preprocessor from the CppComprehensionEngine of
the language server, we don't want the preprocessor to crash if it
encounters an invalid preprocessor statement (for example, an #endif
statement without an accompanying previous #if statement).

To achieve this, this commit adds an "ignore_invalid_statements" flag
to the preprocessor which is set by the CppComprehensionEngine.

Fixes #11064.
2021-12-03 15:38:21 +01:00
Itamar
408f05bbb9 HackStudio: Decrease the maximal crash frequency of the server to 10 sec
The maximal crash frequency of the language server was previously 3
seconds, but in practice it was too high.
When working with larger projects the language server can get into a
"crash and respawn" loop that takes more than 3 seconds.

10 seconds seems like a reasonable threshold beyond which we no longer
attempt to respawn the server.
2021-12-03 15:38:21 +01:00
Itamar
28ff7d49ad HackStudio: Only send the content of open files to language server
When respawning the language server, we only need to send the content
of opened files to the server.

The on-disk content of files that are not currently open is up to
date, so the server can read them on its own.
2021-12-03 15:38:21 +01:00
Itamar
3e9a96f1d8 HackStudio: Add HackStudio::for_each_open_file 2021-12-03 15:38:21 +01:00
Sam Atkins
3a44b8111b Documentation: Update instructions for using the Clang toolchain
The note that `Meta/serenity.sh` is incompatible with Clang is no longer
true.
2021-12-02 14:34:45 -08:00
Martin Blicha
8fb52c6962 LibGUI: Make FilteringProxyModel reference-count its parent model
Before this change, the destructor of FilteringProxyModel
would crash if the parent model had been destroyed earlier.

This unifies the behaviour of FilteringProxyModel with
SortingProxyModel in this respect.
2021-12-02 22:43:54 +01:00
Andreas Kling
6b32b775bf Meta: Add note about ideologically motivated changes to CONTRIBUTING.md 2021-12-02 12:20:52 +01:00
Idan Horowitz
246255527a Tests: Add a test to ensure sigaltstack() is working correctly 2021-12-01 21:44:11 +02:00
Idan Horowitz
711a7104f3 Kernel: Handle invalid stack pointer during signal dispatch
Instead of crashing the kernel, we simply terminate the process.
2021-12-01 21:44:11 +02:00
Idan Horowitz
40f64d7379 Kernel: Dispatch handle-able signals instead of crashing if possible
This matches the behaviour of the other *nixs and allows processes to
try and recover from such signals in userland.
2021-12-01 21:44:11 +02:00
Idan Horowitz
f415218afe Kernel+LibC: Implement sigaltstack()
This is required for compiling wine for serenity
2021-12-01 21:44:11 +02:00
Idan Horowitz
d5d0eb45bf Kernel: Clear up some comments in the sys$mprotect implementation 2021-12-01 21:44:11 +02:00
Idan Horowitz
f27bbec7b2 Kernel: Move incorrect early return in sys$mprotect
Since we're iterating over multiple regions that interesect with the
requested range, just one of them having the requested access flags
is not enough to finish the syscall early.
2021-12-01 21:44:11 +02:00
Idan Horowitz
a9e436c4a3 Kernel: Replace usages of SIGSTKFLT with SIGSEGV
SIGSTKFLT is a signal that signifies a stack fault in a x87 coprocessor,
this signal is not POSIX and also unused by Linux and the BSDs, so let's
use SIGSEGV so programs that setup signal handlers for the common
signals could still handle them in serenity.
2021-12-01 21:44:11 +02:00
Idan Horowitz
4ca39c7110 Kernel: Move the expand_range_to_page_boundaries helper to MemoryManager
This helper can (and will) be used in more parts of the kernel besides
the mmap-family of syscalls.
2021-12-01 21:44:11 +02:00
Idan Horowitz
ff6b43734c Kernel: Add Region::clear_to_zero
This helper method can be used to quickly and efficiently zero out a
region.
2021-12-01 21:44:11 +02:00
Idan Horowitz
5f95a1a7b7 LibC: Define the MADV_DONTNEED madvise advice macro
This isn't actually implemented at the moment, but it is required for
wine to compile
2021-12-01 21:44:11 +02:00
Idan Horowitz
fc13d0782f LibC: Make the madvise advice field a value instead of a bitfield
The advices are almost always exclusive of one another, and while POSIX
does not define madvise, most other unix-like and *BSD systems also only
accept a singular value per call.
2021-12-01 21:44:11 +02:00
Idan Horowitz
48f92f6482 LibC: Add the SIGFPE si_code macros 2021-12-01 21:44:11 +02:00
James Mintram
224b865fda Kernel: Add an x86 include check+error in x86/TSS.h 2021-12-01 11:22:04 -08:00
James Mintram
b08eb37b11 Kernel: Add an x86 include check+error in x86/TrapFrame.h 2021-12-01 11:22:04 -08:00
James Mintram
80cdfee10a Kernel: Add an x86 include check+error in x86/Spinlock.h 2021-12-01 11:22:04 -08:00
James Mintram
34b341e35d Kernel: Add an x86 include check+error in x86/RegisterState.h 2021-12-01 11:22:04 -08:00
James Mintram
1dc1412dee Kernel: Add an x86 include check+error in x86/ProcessorInfo.h 2021-12-01 11:22:04 -08:00
James Mintram
e20884dc0c Kernel: Add an x86 include check+error in x86/Processor.h 2021-12-01 11:22:04 -08:00
James Mintram
eb33df0c30 Kernel: Add an x86 include check+error in x86/PageFault.h 2021-12-01 11:22:04 -08:00
James Mintram
17fb2adf61 Kernel: Add an x86 include check+error in x86/PageDirectory.h 2021-12-01 11:22:04 -08:00
James Mintram
70a18a2271 Kernel: Add an x86 include check+error in x86/MSR.h 2021-12-01 11:22:04 -08:00
James Mintram
bffc3da9d7 Kernel: Add an x86 include check+error in x86/ISRStubs.h 2021-12-01 11:22:04 -08:00
James Mintram
1e5b82f0c6 Kernel: Add an x86 include check+error in x86/IO.h 2021-12-01 11:22:04 -08:00