Commit graph

12949 commits

Author SHA1 Message Date
Avery
06218a4074 IPv4: Truncate raw socket reads past buffer length
In addition to being the proper POSIX etiquette, it seems like a bad idea
for issues like the one seen in #3428 to result in a kernel crash. This patch
replaces the current behavior of failing on insufficient buffer size to truncating
SOCK_RAW messages to the buffer size. This will have to change if/when MSG_PEEK
is implemented, but for now this behavior is more compliant and logical than
just bailing.
2020-09-10 12:03:56 +02:00
Nico Weber
61060c0da8 LibVT: Let Terminal keep history in a circular buffer
This makes Terminal::scroll_up() O(1) instead of O(n) in the
size of the history. (It's still O(n) in the size of visible
lines.)

Reduces time to run `disasm /bin/id` with the default terminal
window size from 530ms to 409ms (min-of-5) on my system.
2020-09-10 12:01:26 +02:00
Nico Weber
90d9c83067 LibVT: Let Terminal only expose history_size, not storage 2020-09-10 12:01:26 +02:00
AnotherTest
927e2fc6bc Shell: Do not reset the terminal attributes when command is run in bg
Also removes a FIXME that no longer applies.
2020-09-10 11:20:22 +02:00
AnotherTest
c296bcc1d9 Base: Tweak Shell(5) manpage a bit
Someone brought to my attention that "or missing" is not correct there.
2020-09-10 11:20:22 +02:00
Devashish Jaiswal
2a3166e523
JPGLoader: Check existence of Huffman tables in scan header segment (#3442)
DC and AC table IDs read in the scan header segment weren't validated
against the IDs of Huffman tables read in the DHT segment. This caused
an OOB read when a Huffman table was accessed using the ID read in the
scan header segment. Furthermore, the decoder now replaces the old DC
or AC table if a redefinition has been found prior to the scan header.

Fixes #3439.
2020-09-10 11:20:04 +02:00
Andreas Kling
d830c107ce LibJS: Deal with a FIXME in Shape::ensure_property_table()
Prevent GC while messing with the shape transition chain.
2020-09-09 21:34:02 +02:00
Andreas Kling
606f83436d test-js: Catch SIGINFO and dump the current test name + pass/fail/skip
This is pretty handy if the JS tests take a long time to run and you
wonder what they're doing. :^)
2020-09-09 21:10:23 +02:00
Andreas Kling
f8e59addf7 Kernel+LibC+UE: Introduce SIGINFO (generated with ^T)
This signal is ignored by default, but can be caught to implement state
reporting a la BSD. :^)
2020-09-09 21:10:23 +02:00
Andreas Kling
687aad01be test-js: Add -g option to run a garbage collection on each allocation
This is very slow, but very good at flushing out GC bugs. :^)
2020-09-09 21:10:23 +02:00
Nico Weber
01ff17d374 LibGUI: Do not paint scrollbar button highlight for scrollbars without scrubber
If a scrollbar doesn't have a scrubber (because the view it scrolls is
large enough to display all its contents without scrolling), then
it ignores all clicks. We shouldn't draw a hover highlight that suggests
clickability in that case.
2020-09-09 21:04:15 +02:00
AnotherTest
34d210ecf5 Shell: Update the Shell(5) manpage
This patchset adds the following to the manpage:
- Mention `if` expressions.
- Add section about subshells
- Mention that control structures can now be used as commands
- Update the grammar.
- Fix small header size mistake with "Example"'s being larger than their
  containing sections.
2020-09-09 20:35:21 +02:00
AnotherTest
2488815bdb Shell: Add some tests for subshells 2020-09-09 20:35:21 +02:00
AnotherTest
b194d79c53 Shell: Add the (now) free subshell support 2020-09-09 20:35:21 +02:00
AnotherTest
0fd8d5ad3d Shell: Add a test for control structures as commands 2020-09-09 20:35:21 +02:00
AnotherTest
54b453be57 Shell: Fix event loop processing and backgrounding in subshells 2020-09-09 20:35:21 +02:00
AnotherTest
c3dbe77024 LibCore: Add 'notify_forked()' to tear down the eventloop in forked child
This makes the forked process capable of constructing a new event loop,
should it choose to.
2020-09-09 20:35:21 +02:00
AnotherTest
aa2df9277d Shell: Allow control structures to appear in pipe sequences
This makes commands like the following to be possible:
```sh
$ ls && for $(seq 10) { echo $it }
$ ls | for $(seq 1) { cat > foobar }
```
2020-09-09 20:35:21 +02:00
AnotherTest
7b5ead64a5 Shell: Announce job events at the right times
This fixes a duplicate message when running `jobs` for the first time
after a job has been moved to the background.
Also actually announces background exits now :^)
2020-09-09 20:35:21 +02:00
AnotherTest
715e11f692 Shell: Fix job control and backgrounding
This patchset makes the shell capable of lazily resolving and executing
sequences of commands, to allow for putting logical sequences in the
background.
In particular, it enables And/Or/Sequence nodes to be run in the background,
and consequently unmarks them as `would_execute`.
Doing so also fixes job control to an extent, as jobs are now capable of
having 'tails', so sequences can be put in the background while
preserving their following sequences.
2020-09-09 20:35:21 +02:00
Nico Weber
a2a54f459f sleep: Make variable written in signal handler volatile
No difference in practice, but it's tidier and protects us
if we ever use g_interrupted earlier in main -- in that case,
the compiler might chose to keep the variable in a register without
the volatile.

Found by @bugaevc, thanks!
2020-09-09 20:25:19 +02:00
asynts
a7f786fc0a AK: Use TypedTransfer in Span::copy_to. 2020-09-09 20:15:50 +02:00
asynts
910924f559 AK: Moved TypedTransfer into it's own header. 2020-09-09 20:15:50 +02:00
Tom
678bbd29ca Kernel: Fix heap expansion loop
By being a bit too greedy and only allocating how much we need for
the failing allocation, we can end up in an infinite loop trying
to expand the heap further. That's because there are other allocations
(e.g. logging, vmobjects, regions, ...) that happen before we finally
retry the failed allocation request.

Also fix allocating in page size increments, which lead to an assertion
when the heap had to grow more than the 1 MiB backup.
2020-09-09 20:14:30 +02:00
Tom
efe2b75017 Kernel: Optimize single physical page allocation and randomize returns
Rather than trying to find a contiguous set of bits of size 1, just
find one single available bit using a hint.

Also, try to randomize returned physical pages a bit by placing them
into a 256 entry queue rather than making them available immediately.
Then, once the queue is filled, pick a random one, make it available
again and use that slot for the latest page to be returned.
2020-09-09 13:02:14 +02:00
Tom
92e400c7f9 AK: Add Bitmap::find_one_anywhere and optimize Bitmap::find_first
Leverage constexpr and __builtin_ffs for Bitmap::find_first. Also add
a variant Bitmap::find_one_anywhere that can start scanning at a
provided hint.

Also, merge Bitmap::fill_range into the already existing Bitmap::set_range
2020-09-09 13:02:14 +02:00
Nico Weber
42153221a5 sleep: On SIGINT, call default SIGINT handler after printing remaining time
With this, hitting ctrl-c twice in `for i in $(seq 10) { sleep 1 }`
terminates the loop as expected (...well, I'd expect it to quit after
just one ctrl-c, but serenity's shell makes a single ctrl-c only
quit the current loop iteration).

Part of #3419.
2020-09-09 12:44:35 +02:00
Tom
92bfe40954 Kernel: Keep signal state in sync
In c3d231616c we added the atomic variable
m_have_any_unmasked_pending_signals tracking the state of pending signals.
Add helper functions that automatically update this variable as needed.
2020-09-09 12:43:56 +02:00
Jakob-Niklas See
dcc2c8a125
LibWeb: Add support for viewport-relative length units (#3433)
We can now use vh, vw, vmax and vmin as length units in CSS.
2020-09-08 20:39:09 +02:00
Andreas Kling
d467a0ffef LibJS: ArrayIterator needs to mark the array it's iterating 2020-09-08 16:20:34 +02:00
Andreas Kling
3143fea1eb LibJS: GlobalObject needs to mark the iterator prototypes
Otherwise they all disappear in the first garbage collection.
2020-09-08 15:37:39 +02:00
Andreas Kling
b32c0c8181 LibJS: Convert two suspicious Vector<Value> to MarkedValueList 2020-09-08 14:16:59 +02:00
Andreas Kling
d85eed585c LibJS: get_iterator_values() should pass Value to callback (not Value&)
Value& implies that the callback is expected/able to modify the value,
which is not the case.
2020-09-08 14:15:13 +02:00
Andreas Kling
b4bfc3ed54 Spreadsheet: Add "final" to JS objects and tweak declarations 2020-09-08 14:11:43 +02:00
asynts
a7cbc7fcb2 AK: Remove empty destructor from JsonParser. 2020-09-08 14:01:21 +02:00
asynts
70dd97c46e AK: Remove FixedArray class. 2020-09-08 14:01:21 +02:00
asynts
ec1080b18a Refactor: Replace usages of FixedArray with Vector. 2020-09-08 14:01:21 +02:00
asynts
9c83d6ff46 Refactor: Replace usages of FixedArray with Array. 2020-09-08 14:01:21 +02:00
asynts
76e37e8c96 AK: Add Array<T, Size> template. 2020-09-08 14:01:21 +02:00
asynts
1b3ecb01a5 AK: Add generic SimpleIterator class to replace VectorIterator. 2020-09-08 14:01:21 +02:00
Simon Danner
9648bf4ada LibWeb: SVG: implement SmoothQuadraticBezierCurve
For this we need to track the control point of the previous command and
calculate a new control point based on it.
2020-09-08 13:57:18 +02:00
Simon Danner
772fcba814 LibWeb: SVG: draw commands can also be repeated after a comma
Consume comma or whitespace to make it possible to also parse commands
that use comma separation.
2020-09-08 13:57:18 +02:00
Simon Danner
6e61532e06 LibWeb: SVG: T commands only take two coordinates
The shortcut for Bezier curves only takes two coordinates.
2020-09-08 13:57:18 +02:00
Simon Danner
05be6481b7 LibWeb: make it possible to directly load .svg files
Make LibWeb load svg files by guessing the svg mime type from the file
extension and parsing it with the HTML parser.
2020-09-08 13:57:18 +02:00
AnotherTest
699e1fdc07 LibJS: Eliminate some (unnecessary) Vector copies 2020-09-08 13:43:03 +02:00
AnotherTest
8d9c5a8e70 LibJS: Make MarkedValueList inherit from Vector<Value>
This makes the nicer vector API available to MVL without extra wrapper
functions.
2020-09-08 13:43:03 +02:00
AnotherTest
9a00699983 LibJS: Format IndexedProperties.cpp 2020-09-08 13:43:03 +02:00
Tom
0c2d36d1cd WindowServer: Draw minimize animation inverted
Inverting the pixels makes the animation visible over most colors.
2020-09-08 10:45:35 +02:00
Tom
607c78336b LibGfx: Add ability to draw inverted rectangles 2020-09-08 10:45:35 +02:00
Andreas Kling
c460f4a3cb IRCClient: Add the "/me" command to send CTCP ACTION emotes :^)
You can now express your feelings and actions with our IRC client by
using the /me command.
2020-09-07 20:49:35 +02:00