Commit graph

29488 commits

Author SHA1 Message Date
Marcin Undak 3cc5752a69 Kernel: Refactor Aarch64 MailBox class
The goal was to reduce common setup of messages. Changes:
* MailBox turned into singleton to follow existing patterns
* Removed device specific messages from MailBox requiring
  clients to know the details instead
* Created base Message class which clients should deriver from

It really simplify the usage for more complicated message queues
like framebuffer setup - see followup commits.
2021-10-31 12:35:53 +01:00
Marcin Undak 82a73b8499 Kernel: Add temporary debug printing utilities for Aarch64
Added dbgln() and warnln() debug functions to help bootstraping.
Eventually they are going to be replaced by AK/Format.h implementation.
2021-10-31 12:35:53 +01:00
Kyle Ambroff-Kao 0329a37271 Userland: Handle terminal window resizing in less(1)
Before this patch less would query the terminal geometry only at
startup and use this information to render the file when
appropriate. If the terminal is resized then the output is broken in
several different ways because of this.

This patch adds a SIGWINCH signal handler receive notification any
time the terminal is resized. This signal handler just sets a flag to
notify the main loop that a resize has occurred.

The main loop of the program just calls get_key_sequence() to get
input from the user, interpreting keystrokes as commands like scroll
up or down. The get_key_sequence() function has been changed to return
Optional<String>, so it either returns a keystroke from the user or it
returns nothing as an empty Optional.

While the user is not pressing any keys on the keyboard, the program
is blocking on a read() system call in get_key_sequence(). When
SIGWINCH is received, this read() will return with -1 and errno is set
to EINTR since the system call was interrupted by the signal. When
this happens we just return an empty Optional.

The mainloop now checks to see if a resize has been requested by
checking the flag, and if it has it performs a resize.

init() now just calls resize() since the required logic is the same.

Setters for m_filename and m_prompt are removed because these are now
just initialized by the constructor, as they never change for the life
of the program.
2021-10-31 12:34:37 +01:00
Daniel Bertalan fed9cb5d2d AK+Tests: Fix formatting of infinity and NaN values
When I added this code in 1472f6d, I forgot to add tests for it. That's
why I didn't realize that the values were appended to the wrong
FormatBuilder object, so an empty string was returned instead of the
expected "nan"/"inf". This made debugging some FPU issues with the
ScummVM port significantly more difficult.
2021-10-31 12:15:34 +01:00
ForLoveOfCats 2c93ee50cd SpaceAnalyzer: Display scan progress with popup window during analysis 2021-10-31 12:15:12 +01:00
Musab Kılıç 8f9948ad66 Calculator: Add Constants menu 2021-10-31 12:10:44 +01:00
Musab Kılıç 2ef8cbe6cf Calculator: Fix copy button not copying the fractional part bug :^) 2021-10-31 12:10:33 +01:00
Musab Kılıç 8936d15efa Calculator: Improve KeypadValue conversion to handle integer values 2021-10-31 12:09:37 +01:00
Tim Schumacher 8f060bed17 Toolchain: Use dynamic paths for cross-compile CMake toolchains
`CMAKE_INSTALL_PREFIX` is supposed to be the in-system installation
path. The sysroot path on the host doesn't belong there, since other
applications will duplicate that path when applying their respective
sysroot.
2021-10-31 12:09:25 +01:00
Ben Wiederhake 9a4e125468 Kernel: Remove misleading FIXME in DevTmpFS
This FIXME does not seem to apply anymore. Yes, symbolic links in all
filesystems appear to be slightly broken, but that has nothing to do
with File::absolute_path. Let's remove the wrong FIXME instead of adding
to the confusion.
2021-10-31 12:06:28 +01:00
Ben Wiederhake c05c5a7ff4 Kernel: Clarify ambiguous {File,Description}::absolute_path
Found due to smelly code in InodeFile::absolute_path.

In particular, this replaces the following misleading methods:

File::absolute_path
This method *never* returns an actual path, and if called on an
InodeFile (which is impossible), it would VERIFY_NOT_REACHED().

OpenFileDescription::try_serialize_absolute_path
OpenFileDescription::absolute_path
These methods do not guarantee to return an actual path (just like the
other method), and just like Custody::absolute_path they do not
guarantee accuracy. In particular, just renaming the method made a
TOCTOU bug obvious.

The new method signatures use KResultOr, just like
try_serialize_absolute_path() already did.
2021-10-31 12:06:28 +01:00
Ben Wiederhake 88ca12f037 Kernel: Enable early-returns from VFS::for_each_mount 2021-10-31 12:06:28 +01:00
Ben Wiederhake 735da58d44 Kernel: Avoid OpenFileDescription::absolute_path 2021-10-31 12:06:28 +01:00
Ali Mohammad Pur d020d46846 Shell: Unwind execution after runtime errors
This commit makes the Shell check for errors after a node is run(), and
prevents further execution by unwinding until the error is cleared.
Fixes #10649.
2021-10-31 12:02:20 +01:00
Jelle Raaijmakers 8f332ac6a3 LibC: Add labs()
We defined it in `stdlib.h` but forgot to implement it.
2021-10-31 12:00:57 +01:00
Brendan Coles 3ce4d0f89a Ports: Add FreeDink port 2021-10-31 11:52:27 +01:00
Brendan Coles 287bbabbc1 Ports: Add OpenGL Mathematics (GLM) port 2021-10-31 11:52:27 +01:00
Marco Cutecchia 0086466b61 Utilities: Add option to suppress errors to grep 2021-10-31 14:18:29 +03:30
Marco Cutecchia 647f89f15e Utilities: Add 'quiet' mode to grep 2021-10-31 14:18:29 +03:30
Timothy Flynn 0f91b22795 js: Convert JavaScript REPL to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn e8f722fb27 LibJS: Convert %IteratorPrototype% to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn d1abf3d8ce LibJS: Convert ObjectConstructor to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn 0f224779aa LibJS: Convert ObjectConstructor GetOwnPropertyKeys to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn e92d14d498 LibJS: Convert GlobalObject to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn 875b563664 LibJS: Convert GlobalObject's Encode and Decode AOs to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Timothy Flynn 2a967fd107 LibJS: Convert Object.prototype to ThrowCompletionOr 2021-10-31 07:50:30 +02:00
Jelle Raaijmakers a6c5ce11b8 Ports: Remove ScummVM FMOPL patch
This patch is no longer required after this PR fixes the x86_64 PLT
trampoline:
https://github.com/SerenityOS/serenity/pull/10711
2021-10-31 00:21:42 +02:00
Peter 24fdf99d8b LibELF: Store SSE registers in x86_64 PLT Trampoline
Save and restore XMM registers so userspace programs don't
randomly lose values from calls. This fixes a crash in ScummVM.
2021-10-31 00:21:31 +02:00
Peter 80aa1b93d1 Debugger: Add logging for the other 8 GPRs too 2021-10-31 00:20:35 +02:00
Brian Gianforcaro 35617ba2d3 Meta: Suppress rule v1047 in PVS-Studio Static Analysis
This rule appears to produce a lot of noise, most of them look like
false positives (400+). Lets suppress for now to try to move the signal
to noise ratio higher for PVS-Studio.

Reference: https://pvs-studio.com/en/docs/warnings/v1047/
2021-10-31 00:19:33 +02:00
Marco Cutecchia 5f04fb0ece Spreadsheet: Make the 'Help' window accessory 2021-10-31 00:58:05 +03:30
Linus Groh 2cbcb99ec7 LibJS: Update spec comment in parse_temporal_time_zone_string()
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/19b693c
2021-10-30 23:15:18 +02:00
Linus Groh a7cb042ca8 LibJS: Fix format_time_zone_offset_string() for negative offsets
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/ec43be3
2021-10-30 23:14:50 +02:00
Linus Groh 5da8ae0020 LibJS: Update parse_temporal_time_zone_string() substring bounds
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/73b9fe3
2021-10-30 23:14:43 +02:00
Brendan Coles 91de60d912 Lagom/Fuzzers: Add fuzzer for PDF document 2021-10-30 10:33:56 -07:00
Andreas Kling 34cc4803af Websites: Import serenityos.org website changes
I hadn't synced this for a while. The repo copy now matches the live
site once again.
2021-10-30 17:42:26 +02:00
Ben Wiederhake fa018d3ba1 Kernel: Fix common misuse of KString in debug messages 2021-10-30 17:35:18 +02:00
Brendan Coles 6ccfa3e75e LibPDF: Parser::parse_header() return false if remaining bytes is zero 2021-10-30 17:34:56 +02:00
Linus Groh 92fdae178b LibJS: Implement Temporal.TimeZone.prototype.getPreviousTransition() 2021-10-30 16:32:20 +02:00
Linus Groh e9cbeeac45 LibJS: Implement Temporal.TimeZone.prototype.getNextTransition() 2021-10-30 16:32:20 +02:00
Linus Groh 5fde02184d LibJS: Implement Temporal.TimeZone.prototype.getPossibleInstantsFor() 2021-10-30 16:32:20 +02:00
Linus Groh 82792a6815 LibJS: Mark single argument BigInt() constructor as 'explicit' 2021-10-30 16:32:20 +02:00
Noah Haasis 05aeff1c4d LibGUI: Focus next tab after closing active tab
Focus the next tab after closing the currently active tab.
If the tab being closed is the last one then the new last
tab is active.
2021-10-30 17:13:25 +03:30
Linus Groh de2e95b278 LibJS: Ensure make_day()'s temporary Core::DateTime is treated as UTC
DateTime::create() and subsequently DateTime::set_time() uses mktime()
internally to ensure out-of-range input values still result in a valid
date (Jan 32 -> Feb 1 etc.).
This however also means that the input is treated as local time, and
then shifted to UTC accordingly for the returned time_t - it is however
already in UTC in this case! The temporary solution is simply to set the
"TZ" environment variable to "UTC" and back after create(). The proper
solution is probably to have better timezone support in Core::DateTime.
This should only affect Lagom, as serenity itself has no timezone
support yet and always assumes UTC.
2021-10-30 10:15:49 +02:00
Linus Groh 28a9a248d6 LibJS: Fix off-by-one in make_day()'s temporary Core::DateTime
Just like in the previous commit, the day value of Core::DateTime is
one-based, not zero based.
Noticed while implementing a new Temporal function, this likely would've
been caught earlier if we'd also use it for the Date API (we don't).
2021-10-30 10:15:49 +02:00
Linus Groh 232f54cd9b LibCore: Fix off-by-one in DateTime::{create,set_time} day default arg
Just like month, the day value here is one-based. This resulted in the
following situation, which is obviously unexpected:

    Core::DateTime::create(1970); // 1970-01-00 -> 1969-12-31
2021-10-30 10:15:49 +02:00
Daniel Bertalan e9f0ebd4bd LibHTTP: Fix logic error leading to buffer over-read
When we receive HTTP payloads, we have to ensure that the number of
bytes read is *at most* the value specified in the Content-Length
header.

However, we did not use the correct value when calculating the truncated
size of the last payload. `m_buffered_size` does not store the total
number of bytes received, but rather the number of bytes that haven't
been read from us.

This means that if some data has already been read from us,
`m_buffered_size` is smaller than `m_received_size`. Because of this, we
ended up resizing the `payload` ByteBuffer to a larger size than its
contents. This garbage data was then read by consumers, producing this
warning when executing scripts:

> Extension byte 0xdc in 1 position after first byte 0xdc doesn't make
> sense.
2021-10-30 00:54:34 +03:30
Andreas Kling 47b8d80864 Meta: Add note about abandoned PR's to CONTRIBUTING.md 2021-10-29 22:59:44 +02:00
Marco Cutecchia 3428e2a76c HackStudio: Add 'Show Dotfiles' option 2021-10-29 22:40:11 +02:00
Timothy Flynn ef62118c8b LibWeb: Render any specified list-style-image for list items 2021-10-29 22:06:49 +02:00