Commit Graph

25128 Commits

Author SHA1 Message Date
Luke
cbbbc38f27 Kernel: Print panic backtrace to both the screen and serial
Previously it would only print the backtrace to serial, which would be
inaccessible if you don't have serial setup.
2021-08-04 20:14:54 +02:00
Liav A
7c617394a1 Kernel: Ensure we read valid values from the RTC CMOS registers
We try to read twice from the RTC CMOS registers, and if the values are
not the same for 5 attempts, we know there's a malfunction with the
hardware so we declare these values as bogus in the kernel log.
2021-08-04 19:53:04 +02:00
Liav A
517460d3a9 Kernel: Ensure we don't get in an endless loop while querying the CMOS
When we try to query the time from the RTC CMOS, we try to check if
the CMOS is updated. If it is updated for a long period of time (as a
result of hardware malfunction), break the loop and return Unix epoch
time.
2021-08-04 19:53:04 +02:00
Sam Atkins
74c9587798 LibWeb: Fix EOF handling in CSS Tokenizer peek_{twin,triplet}()
Previously, the loops would stop before reaching EOF, meaning that the
values that should have been set to EOF were left with their 0 initial
values. Now, we initialize to EOFs instead. The if/else inside the loops
always ran the else branch so I have removed the if branches.
2021-08-04 19:04:12 +04:30
Jelle Raaijmakers
31e3b3028b Documentation: Add ImageMagick as dependency for macOS 2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
d2379dfe96 Ports: Add PHP entry to taskbar menu 2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
a76c208bae Ports: Support icons for launchers with arguments 2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
1a4b1ecd04 LibDesktop: Add support for IconPath in AppFile
With `IconPath`, you can override the icon used for the application
shortcut. This currently only supports resolving the icon through
`GUI::FileIconProvider`, the implementation for pointing to actual
image files is left as an exercise for the reader.
2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
0ec39aafb6 LibDesktop: Collapse if-else in AppFile 2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
c7e72a52a3 Taskbar: Use provided AppFile icon instead of finding it ourselves 2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
8493477cc7 Ports: Convert only first index of ico files
When installing an icon, we fall back to a resizing strategy when an
exact match on the image dimensions is missing. However, if we are
dealing with an `.ico` file with multiple indices, `convert` will
resize every separate index and will create multiple files.

This changes makes sure we only resize the first index. A future
improvement could be to select an index most closely matching the
requested dimensions.
2021-08-04 13:54:08 +01:00
Jelle Raaijmakers
546af2d9ef Ports: Notify user of missing ImageMagick binaries 2021-08-04 13:54:08 +01:00
Timothy Flynn
6f2640d031 LibUnicode: Parse UCD DerivedBinaryProperties.txt and generate property 2021-08-04 13:50:32 +01:00
Timothy Flynn
9113f892a7 LibUnicode: Parse UCD emoji-data.txt and generate Unicode property 2021-08-04 13:50:32 +01:00
Timothy Flynn
484ccfadc3 LibRegex: Support property escapes of Unicode script extensions 2021-08-04 13:50:32 +01:00
Timothy Flynn
5edd458420 LibUnicode: Parse UCD ScriptExtensions.txt and generate property 2021-08-04 13:50:32 +01:00
Timothy Flynn
6bdb19fe21 LibUnicode: Remove unused parameter from Unicode data generator 2021-08-04 13:50:32 +01:00
Timothy Flynn
06088df729 LibRegex: Support property escapes of the Unicode script property
Note that unlike binary properties and general categories, scripts must
be specified in the non-binary (Script=Value) form.
2021-08-04 13:50:32 +01:00
Timothy Flynn
f5c1bbc00b LibUnicode: Parse UCD Scripts.txt and generate as a Unicode property
There are a couple of minor nuances with parsing script values, compared
to other properties. In Scripts.txt, the UCD file lists the full name of
each script; other properties, like General Category, list the shorter
name in their primary files. This means that the aliases listed in
PropertyValueAliases.txt are reversed for script values.
2021-08-04 13:50:32 +01:00
kleines Filmröllchen
619c924042 AudioWidget: Proper volume changes when scrolling on the widget
Because setting the slider's value in the mousewheel handler will cause
the volume logarithm logic and the volume setting to happen anyways, we
don't need to do it in the mousewheel handler again. By just moving the
slider up and down with the scroll wheel, we mimic normal SliderWidget
behavior that doesn't exhibit the multiple previous bugs.
2021-08-04 11:36:36 +02:00
Timothy Flynn
1bb6404a19 LibUnicode: Invoke Unicode data generator a single time
It takes a non-neglible amount of time to parse all of the UCD files and
generate the Unicode data files. To help compile times, only invoke the
generator once.
2021-08-04 11:18:24 +02:00
Timothy Flynn
9413c3a0d1 LibUnicode: Generate a map of code points to their Unicode table index
The current strategy of searching for a code point within the generated
table is slow for code points > U+0377 (the last code point whose index
is the same value as the code point itself). For larger code points, we
are doing a linear search through the table.

Instead, generate a HashMap of each code point to its entry in the table
for faster runtime lookups.

This had the added benefit of being able to remove a fair amount of code
from the generator. We no longer need to track that last contiguous code
point (U+0377) nor each code point's index in the generated table.
2021-08-04 11:18:24 +02:00
Timothy Flynn
70080feab2 AK+LibJS: Implement String.from{CharCode,CodePoint} using UTF-16 strings
Most of String.prototype and RegExp.prototype is implemented with UTF-16
so this is to prevent extra copying of the string data.
2021-08-04 11:18:24 +02:00
Timothy Flynn
b6ff7f4fcc LibJS: Allow PrimitiveString to be created with a UTF-16 string
PrimitiveString may currently only be created with a UTF-8 string, and
it transcodes on the fly when a UTF-16 string is needed. Allow creating
a PrimitiveString from a UTF-16 string to avoid unnecessary transcoding
when the caller only wants UTF-16.
2021-08-04 11:18:24 +02:00
Timothy Flynn
4c2cc419f9 LibJS: Decode UTF-16 surrogate pairs during string literal construction
Rather than deferring this decoding to PrimitiveString, we can decode
surrogate pairs when parsing the string. This prevents a string copy
when constructing the PrimitiveString.
2021-08-04 11:18:24 +02:00
Timothy Flynn
27d555bab0 LibRegex: Track string position in both code units and code points
In non-Unicode mode, the existing MatchState::string_position is tracked
in code units; in Unicode mode, it is tracked in code points.

In order for some RegexStringView operations to be performant, it is
useful for the MatchState to have a field to always track the position
in code units. This will allow RegexStringView methods (e.g. operator[])
to perform lookups based on code unit offsets, rather than needing to
iterate over the entire string to find a code point offset.
2021-08-04 11:18:24 +02:00
Timothy Flynn
dae7674ca9 AK: Allow configuring the BumpAllocator chunk size 2021-08-04 11:18:24 +02:00
Timothy Flynn
510bbcd8e0 AK+LibRegex: Add Utf16View::code_point_at and use it in RegexStringView
The current method of iterating through the string to access a code
point hurts performance quite badly for very large strings. The test262
test "RegExp/property-escapes/generated/Any.js" previously took 3 hours
to complete; this one change brings it down to under 10 seconds.
2021-08-04 11:18:24 +02:00
sin-ack
bed51d856a AK+Kernel: Print TODO when a TODO() is executed
Previously we would just print "ASSERTION FAILED: false", which was
kinda cryptic and also didn't make it clear whether this was a TODO or
an unreachable condition. Now, we actually print "ASSERTION FAILED:
TODO", making it crystal clear.
2021-08-04 11:01:16 +02:00
Karol Kosek
e500b39e47 LibAudio: Use an existing file stream when parsing a FLAC header
Before this change the file stream was generated two times:
one time in the parse_header(), and another time for the whole class
in the constructor.

The previous commit moved the m_stream initialization before
executing the parse_header function, so we can now reuse that here.
2021-08-04 11:00:27 +02:00
Karol Kosek
81261bc169 LibAudio: Initialize m_stream before parsing a FLAC header
Before this change opening the file in the system resulted in crash
caused by assertion saying:

  SoundPlayer(32:32): ASSERTION FAILED: m_ptr
  ../.././AK/OwnPtr.h:139
  [#0 SoundPlayer(32:32)]: Terminating SoundPlayer(32) due to signal 6
  [#0 FinalizerTask(4:4)]: 0xdeadc0de

The issue was that 845d403b8c started
using m_stream in the parse_header() function, but that variable wasn't
initialized if the Loader plugin was created using a file path
(which is used everywhere except for the fuzz testing),
resulting in a crash mentioned above.
2021-08-04 11:00:27 +02:00
Gunnar Beutner
07cc7eed29 Shell: Make sure TTY echo is enabled when running external commands
When running external commands via "Shell -c" LibLine turns of TTY echo
before running the command. This ensures that it is turned on.
2021-08-04 03:14:59 +04:30
Linus Groh
18f507520e Ports: Update Python to 3.10.0rc1
Released on 2021-08-02.
https://www.python.org/downloads/release/python-3100rc1/

This contains the first upstreamed change for SerenityOS, making the
webbrowser module work with Browser out of the box :^)
2021-08-03 21:01:07 +01:00
Linus Groh
5a0a426c18 Ports: Make Python version check work with suffixed versions
E.g. a1, b1, rc1. Simply don't parse anything beyond major and minor.
2021-08-03 21:01:07 +01:00
Linus Groh
a613e00caa Ports: Change Python's auth_type to sha256 2021-08-03 21:01:07 +01:00
Liav A
cca1498e09 Meta: Make the Q35 machine more realistic
Although it is nice to test the system without too many devices, in
reality bare metal hardware is far more complex than the default skeleon
that QEMU provides. As a preparation of supporting more devices, we
need to ensure we are capable of at least booting on complex hardware
setups without easily-observable problems. Later on, this can be the
foundations of testing new drivers :^)
2021-08-03 21:08:01 +02:00
Timothy
73c1b1617a Everywhere: Replace most cases of exit() with Application::quit()
Application::quit() is nicer for most cases where exit() is used. Cases
where exit() is used intentionally for early termination are left
intact.
2021-08-03 18:55:52 +02:00
Brian Gianforcaro
2caafacd9b Kernel: Remove OOM unsafe API KBuffer::create_with_size 2021-08-03 18:54:23 +02:00
Brian Gianforcaro
720a686a76 Kernel: Handle OOM when allocating Packet KBuffers 2021-08-03 18:54:23 +02:00
Brian Gianforcaro
8c4785bd10 Kernel: Use normal initialization for TCPPacket instead of memset 2021-08-03 18:54:23 +02:00
Brian Gianforcaro
c1a0e379e6 Kernel: Handle OOM when allocating IPv4Socket optional scratch buffer 2021-08-03 18:54:23 +02:00
Brian Gianforcaro
a6db2f985a Kernel: Handle OOM in DiskCache when mounting Ext2 filesystems
Create the disk cache up front, so we can verify it succeeds.
Make the KBuffer allocation fail-able, so we can properly handle
failure when the user asks up to mount a Ext2 filesystem under
OOM conditions.
2021-08-03 18:54:23 +02:00
Brian Gianforcaro
187c086270 Kernel: Handle OOM from KBuffer creation in sys$module() 2021-08-03 18:54:23 +02:00
Brian Gianforcaro
cbb263e350 Kernel: Remove OOM unsafe DoubleBuffer constructor
Remove this dangerous and now unused constructor.
2021-08-03 18:54:23 +02:00
Brian Gianforcaro
ca94a83337 Kernel: Handle OOM from DoubleBuffer usage in IPv4Socket
The IPv4Socket requires a DoubleBuffer for storage of any data it
received on the socket. However it was previously using the default
constructor which can not observe allocation failure. Address this by
plumbing the receive buffer through the various derived classes.
2021-08-03 18:54:23 +02:00
Brian Gianforcaro
109c885585 Kernel: Handle OOM from DoubleBuffer usage in Net/LocalSocket
LocalSockets keep a DoubleBuffer for both client and server usage.
This change converts the usage from using the default constructor
which is unable to observe OOM, to the new try_create factory and
plumb the result through the constructor.
2021-08-03 18:54:23 +02:00
Brian Gianforcaro
8d3b819daf Kernel: Handle OOM from DoubleBuffer creation in FIFO creation 2021-08-03 18:54:23 +02:00
Brian Gianforcaro
15cd5d324c Kernel: Handle OOM from KBuffer usage in Ext2FS::get_bitmap_block()
Fixes up error handling on an OOM-able path, and removes one more usage
of KBuffer::create_with_size.
2021-08-03 18:54:23 +02:00
Brian Gianforcaro
43f930d3aa Kernel: Convert MasterPTY creation to use DoubleBuffer factory
In order to remove the public DoubleBuffer constructor, we need to
convert the callers to the factory instead, allowing the caller to
observe OOM.
2021-08-03 18:54:23 +02:00
Brian Gianforcaro
f816abcbad Kernel: Add DoubleBuffer::try_create() factory method for OOM hardening
We need to expose the ability for DoubleBuffer creation to expose
failure, as DoubleBuffer depends on KBuffer, which also has to be able
to expose failure during OOM.

We will remove the non OOM API once all users have been converted.
2021-08-03 18:54:23 +02:00