Commit Graph

33216 Commits

Author SHA1 Message Date
Idan Horowitz
0adee378fd Kernel: Stop using LibKeyboard's CharacterMap in HIDManagement
This was easily done, as the Kernel and Userland don't actually share
any of the APIs exposed by it, so instead the Kernel APIs were moved to
the Kernel, and the Userland APIs stayed in LibKeyboard.

This has multiple advantages:
 * The non OOM-fallible String is not longer used for storing the
   character map name in the Kernel
 * The kernel no longer has to link to the userland LibKeyboard code
 * A lot of #ifdef KERNEL cruft can be removed from LibKeyboard
2022-01-21 18:25:44 +01:00
Liav A
cecfd42916 Kernel/PCI: Verify Access is not initialized before initializing it
There's no valid case where we should try to initialize the Access
singleton multiple times, therefore just assert if it ever happens.
2022-01-21 19:09:16 +02:00
Ali Mohammad Pur
78d1093dab Shell: Make Juxtaposition autocompletion smarter
Now something like `"$HOME"/` autocompletes correctly.
Note that only the first element of lists is used to autocomplete
things.
2022-01-21 18:58:28 +03:30
Ali Mohammad Pur
2e333b3571 Shell: Make SimpleVariable::hit_test_position not hit irrelevant offsets
Without this, any offset would be accepted as being part of the
SimpleVariable.
Fixes #11976 (by making it no longer crash).
2022-01-21 18:58:28 +03:30
Idan Horowitz
3c1ca61e74 Kernel: Use KString instead of String in InodeWatcher::Event's path 2022-01-21 16:27:21 +01:00
Idan Horowitz
d5189b6677 Kernel: Replace {String => KString}::formatted in ACPISysFSDirectory 2022-01-21 16:27:21 +01:00
Idan Horowitz
77a81f5eed Kernel: Use KString instead of String in Ext2FSInode's lookup cache 2022-01-21 16:27:21 +01:00
Idan Horowitz
7356110033 AK: Support setting with non copyable keys in HashMap 2022-01-21 16:27:21 +01:00
Idan Horowitz
fdfdb5bd1c Kernel: Make ACPI reboot OOM-fallible 2022-01-21 16:27:21 +01:00
Idan Horowitz
c3099382b8 Kernel: Make VirtIO::Queue construction fallible 2022-01-21 16:27:21 +01:00
Idan Horowitz
17584d8a84 Kernel: Stop adopting non-heap memory into OwnPtrs in VirtIO::Queues 2022-01-21 16:27:21 +01:00
Idan Horowitz
d65347d39d Kernel: Make Memory::RingBuffer construction fallible 2022-01-21 16:27:21 +01:00
Ali Mohammad Pur
9eccd4c56e LibRegex: Allow the pattern to match the zero-length end of the string
...only if Multiline is not enabled.
Fixes #11940.
2022-01-21 18:14:08 +03:30
Ali Mohammad Pur
c11be92e23 LibRegex: Implement an ECMA262 Regex quirk with negative lookarounds
This implements the quirk defined by "Note 3" in section "Canonicalize"
(https://tc39.es/ecma262/#sec-runtime-semantics-canonicalize-ch).

Crosses off another quirk from #6042.
2022-01-21 18:14:08 +03:30
Ali Mohammad Pur
bfe8f312f3 LibRegex: Correct jump offset to the start of the loop block
Previously we were jumping to the new end of the previous block (created
by the newly inserted ForkStay), correct the offset to jump to the
correct block as shown in the comments.
Fixes #12033.
2022-01-21 18:14:08 +03:30
sin-ack
3de51a4b99 LibCore: Make sockets close-on-exec by default
This mirrors the previous default in Core::LocalSocket, and is the safer
default anyway. This prevents fds from living on in other processes when
exec() is called in certain programs such as Assistant.

Fixes #12029.
2022-01-21 15:21:52 +01:00
Luke Wilde
483ab7fe26 LibGL: Fix incorrect GL_DECAL constant value
The constant value for GL_DECAL is 0x2101 instead of 0x2102.
This was tripping up Half-Life when making the water texture
transparent when under water. The Half-Life port uses its own OpenGL
header, meaning this error wasn't hidden by us.
2022-01-21 15:21:25 +01:00
Rummskartoffel
5b2c973cc3 UserspaceEmulator: Correctly fail in execve when binary is inaccessible
Previously, Emulator::virt$execve would not report ENOENT and EACCES
when the binary to be executed was nonexistent or not executable. This
broke the execp family of functions, which rely on ENOENT being reported
in order to know that they should continue searching $PATH.
2022-01-21 14:45:04 +02:00
Rummskartoffel
d2f99c200f UserspaceEmulator: Fix execve messing up command lines with "--"
Emulator::virt$execve would construct command lines such as
`/bin/UserspaceEmulator echo -- hello` instead of
`/bin/UserspaceEmulator -- echo hello`, which naturally caused problems.
This commit moves the "--" to the correct place.
2022-01-21 14:45:04 +02:00
Maciej
2cda579b07 Taskbar: Remove QuickLaunch entries if corresponding file was deleted 2022-01-21 13:44:36 +01:00
Maciej
0252c1f8fa Taskbar: Support arbitrary *files* as QuickLaunch entries 2022-01-21 13:44:36 +01:00
Maciej
07cf2218cb LibDesktop: Add Launcher::ensure_connection()
This can be use force connection at startup and not to leave 'unix'
pledge all the time.
2022-01-21 13:44:36 +01:00
Maciej
3022baddc2 Taskbar: Support arbitrary executables as QuickLaunch entries 2022-01-21 13:44:36 +01:00
Maciej
2e8e959896 Taskbar: Abstract out quick launch entries
... into QuickLaunchEntry class. It will be used to implement adding
plain executables to the taskbar. For now, it adds TRY() error handling
to app launching :^)
2022-01-21 13:44:36 +01:00
Maciej
ccb8374434 LibCore: Add Core::System wrapper for disown() 2022-01-21 13:44:36 +01:00
Maciej
0badfd7b32 LibCore: Handle null lines in ConfigFile
Fixes nullptr dereference when trying to read binary files.
2022-01-21 13:44:36 +01:00
Morten Larsen
f71584b917 LibJS: Increase margin in check for stack space limit
test-js crashes with a segmentation fault when running on macOS on Arm.
Increasing the margin in the test in did_reach_stack_space_limit() to
32 * KiB makes the tests pass. To simplify the code, this is applied
independently of platform, and the previous test for use of an address
sanitizer is removed.
2022-01-21 13:37:27 +02:00
David Lindbom
2ed4e47300 zip: Add unveil and pledge promises 2022-01-21 02:00:53 +01:00
David Lindbom
9d7a862509 cal: Add unveil and pledge promises 2022-01-21 02:00:53 +01:00
David Lindbom
5c74e66f85 aplay: Add unveil and pledge promises 2022-01-21 02:00:53 +01:00
mjz19910
2cf02c6f38 adjtime: Port to LibMain 2022-01-21 01:52:22 +01:00
mjz19910
14a267347c LibCore: Add ArgsParser::add_option for Optional double 2022-01-21 01:52:22 +01:00
mjz19910
a9fb34ca6f LibCore: Add ErrorOr wrapper for adjtime 2022-01-21 01:52:22 +01:00
Luke Wilde
5ac57db5e9 LibWeb: Don't match the node querySelector(All) was called on
In querySelector(All)'s use of "Match a Selector Against a Tree", it
passes in the node the function was called on as the "optional scoping
root", which causes it and the nodes which aren't descendants of it 
to be excluded from the list of possible nodes to match against.
For us, this is the equivalent of using the non-inclusive variant of
`for_each_in_subtree_of_type`.

This was tripping up the node re-ordering logic of d3 and would cause
it to try and reinsert nodes into their parent, causing an exception
to be thrown.

Note that this should be shadow-including, but we don't currently have
shadow-including tree traversal as per https://dom.spec.whatwg.org/#concept-shadow-including-tree-order

https://drafts.csswg.org/selectors-4/#match-a-selector-against-a-tree
https://dom.spec.whatwg.org/#scope-match-a-selectors-string
2022-01-20 22:18:07 +00:00
Idan Horowitz
29cb7316d0 LibJS: Implement ECMA-402 compliant TypedArray.prototype.toLocaleString 2022-01-20 12:50:37 +00:00
sin-ack
c63feb4f09 Tests: Add should_error_when_connection_fails test to TestLibCoreStream
This test makes sure that Socket classes such as TCPSocket properly
return an error when connection fails rather than crashing or creating
an invalid object.
2022-01-20 10:40:51 +01:00
sin-ack
ab36fb7a23 LibCore: Use Core::System and Error::from_syscall in Stream classes
This makes what caused a failure more obvious.
The use of Core::System additionally allows us to remove a lot of
boilerplate code from Stream classes.
2022-01-20 10:40:51 +01:00
sin-ack
301f4c469f LibCore: Implement Core::System::lseek 2022-01-20 10:40:51 +01:00
sin-ack
4d2e3de94c LibCore: Don't manually close the fd when connection fails in sockets
This is wrong because we have already set the fd in the
PosixSocketHelper, and the destructor of the respective Socket class
will close the fd for us. With the manual closing of the fd, we attempt
to close the same fd twice which results in a crash.

Thanks to stelar7 for noticing this bug.
2022-01-20 10:40:51 +01:00
sin-ack
2d4261df49 Tests: Fix the TestLibCoreStream local_socket_write test
Accidentally regressed this test during the Core::LocalServer refactor,
and didn't catch it since TestLibCoreStream is disabled in the CI right
now. We have to wait for some data to become available, as pending_bytes
will immediately return 0 and a 0-sized read immediately returns.
2022-01-20 10:39:54 +01:00
Mustafa Quraish
ee74aafdca FileSystemAccessClient: Remove old API returning file descriptors :^)
Since all users of the old API are now removed, this commit removes all
the methods that returned raw file descriptors, in favor of returning
`ErrorOr<NonnullRefPtr<Core::File>`.
2022-01-20 10:39:12 +01:00
Mustafa Quraish
bba32de857 SpreadSheet: Use FileSystemAccessClient::try_* APIs 2022-01-20 10:39:12 +01:00
Mustafa Quraish
ca2c7dced5 3DFileViewer: Use FileSystemAccessClient::try_* APIs
This commit also removed the redundant `filename` parameter from
`GLContextWidget::load_file`, since the filename is already stored
within the file itself.
2022-01-20 10:39:12 +01:00
Mustafa Quraish
abb16683c9 ThemeEditor: Use FileSystemAccessClient::try_* APIs 2022-01-20 10:39:12 +01:00
Mustafa Quraish
f674102447 TextEditor: Use FileSystemAccessClient::try_* APIs 2022-01-20 10:39:12 +01:00
Mustafa Quraish
effb19f996 PDFViewer: Use FileSystemAccessClient::try_* APIs 2022-01-20 10:39:12 +01:00
Mustafa Quraish
1c3e93c6e0 PixelPaint: Use FileSystemAccessClient::try_* APIs 2022-01-20 10:39:12 +01:00
Mustafa Quraish
aae96af812 HexEditor: Use FileSystemAccessClient::try_* APIs 2022-01-20 10:39:12 +01:00
Mustafa Quraish
0c98e553e8 FileSystemAccessClient: Add try_* variants returning Core::File
The current implementation is a bit of a hack since we also want to keep
around the previous variants for now, but will be cleaned up later once
all applications have been ported to the new API.
2022-01-20 10:39:12 +01:00
Sam Atkins
94f2508519 CrashReporter: Don't crash when investigating a HackStudio crash
Previously when opening a crash report for HackStudio, the
`unveil("/bin/HackStudio", "rx")` call was failing because of the
earlier `unveil(executable_path.characters(), "r")` call requesting only
"r" permissions for it. This patch handles this specific case, so you
can crash HackStudio to your heart's content. :^)

Also, we were unveiling the executable path twice, once manually and
once implicitly as part of the coredump's libraries, so we now check for
the latter and avoid it.

Thanks to Daniel for noticing what was right in front of me and I didn't
see!

Co-authored-by: Daniel Bertalan <dani@danielbertalan.dev>
2022-01-20 10:38:10 +01:00