1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 14:57:35 +00:00
Commit graph

1176 commits

Author SHA1 Message Date
Fabian INGREMEAU
5f602e39e9 md: Port to LibMain 2022-01-25 00:11:14 +00:00
Fabian INGREMEAU
dff6460373 mv: Port to LibMain 2022-01-25 00:11:14 +00:00
Fabian INGREMEAU
daf7f72ff3 tail: Port to LibMain 2022-01-25 00:11:14 +00:00
Rummskartoffel
f3341f48e3 less: Fix memory leak when scrolling to EOF 2022-01-24 21:57:58 +00:00
Sam Atkins
c388a879d7 AK+Userland: Make AK::decode_base64 return ErrorOr 2022-01-24 22:36:09 +01:00
Sam Atkins
45cf40653a Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Daniel Bertalan
b509d8a2f7 Utilities/readelf: Add support for printing the content of sections 2022-01-24 10:41:47 +00:00
Kenneth Myhra
eeb74e2578 mktemp: Port to LibMain 2022-01-24 14:01:58 +03:30
Kenneth Myhra
b4d55f2a55 mkfifo: Port to LibMain 2022-01-24 14:01:58 +03:30
Kenneth Myhra
3af7a5dd61 mknod: Port to LibMain 2022-01-24 14:01:58 +03:30
Michel Hermier
395d9a2702 sort: Port to LibMain 2022-01-24 05:38:30 +00:00
Michel Hermier
176de579f2 shuf: Port to LibMain 2022-01-24 05:38:30 +00:00
Michel Hermier
4e02b204ef rev: Port to LibMain 2022-01-24 05:38:30 +00:00
Rummskartoffel
5f639493f0 gunzip: Don't truncate output filename when input file suffix is omitted
Before this commit, `$ gunzip abcd` would incorrectly uncompress
`abcd.gz` to `a` instead of to `abcd`.
2022-01-23 20:52:16 +00:00
David Lindbom
fb06d494f0 find: Fix crash on missing arguments
Fixes #12075
2022-01-23 16:29:06 +01:00
Timothy Flynn
6057a2ca30 timezone: Add a command line utility to set the system time zone 2022-01-23 12:48:26 +00:00
Timothy Flynn
bcf4ec9c61 Userland: Add promises to programs that will read /etc/timezone
This will require unveiling /etc/timezone itself for reading, as well as
the rpath pledge promise.
2022-01-23 12:48:26 +00:00
dayarthvader
67b7bbe1f6 ping: Handle optional field in the IPv4 header 2022-01-22 22:11:21 +00:00
Idan Horowitz
bb340f1272 markdown-check: Ignore absolute icon paths
We have no good way to handle these yet, and there's no point in
forcing everyone to skip their pre-commit checks.
2022-01-22 21:40:09 +02:00
Federico Guerinoni
e37af0b073 umount: Port to LibMain 2022-01-22 13:31:52 +02:00
Nico Weber
3831e5fcff Utilities+Lagom: Remove test-crypto
After 4d5ffd364a, Tests/{LibCrypto,LibTLS} test the same things
and test-crypto has been redundant since then.
2022-01-22 01:44:05 +00:00
davidot
0e56dac51e js: Display a warning if multiple files are given
Also instead of making a frankenstein path with all the paths combined
just take the first one, this is needed for resolving modules.
2022-01-22 01:21:18 +00:00
davidot
7cbf4b90e8 LibJS: Implement ImportCall and HostImportModuleDynamically
This allows us to load modules from scripts.
This can be dangerous as it can load arbitrary files. Because of that it
fails and throws by default. Currently, only js and JavaScriptTestRunner
enable the default hook.

This also adds tests to test-js which test module code. Because we
form a spec perspective can't "enter" a module this is the easiest way
to run tests without having to modify test-js to have special cases for
modules.
To specify modules in test-js we use the extension '.mjs' this is to
ensure the files are not executed. We do still want to lint these files
so the prettier scripts have changed to look for '.mjs' files as well.
2022-01-22 01:21:18 +00:00
Luke Wilde
631bbcd00a LibJS: Refactor interpreter to use Script and Source Text Modules
This also refactors interpreter creation to follow
InitializeHostDefinedRealm, but I couldn't fit it in the title :^)

This allows us to follow the spec much more closely rather than being
completely ad-hoc with just the parse node instead of having all the
surrounding data such as the realm of the parse node.

The interpreter creation refactor creates the global execution context
once and doesn't take it off the stack. This allows LibWeb to take the
global execution context and manually handle it, following the HTML
spec. The HTML spec calls this the "realm execution context" of the
environment settings object.

It also allows us to specify the globalThis type, as it can be
different from the global object type. For example, on the web, Window
global objects use a WindowProxy global this value to enforce the same
origin policy on operations like [[GetOwnProperty]].

Finally, it allows us to directly call Program::execute in perform_eval
and perform_shadow_realm_eval as this moves
global_declaration_instantiation into Interpreter::run
(ScriptEvaluation) as per the spec.

Note that this doesn't evalulate Source Text Modules yet or refactor
the bytecode interpreter, that's work for future us :^)

This patch was originally build by Luke for the environment settings
object change but was also needed for modules. So I (davidot) have
modified it with the new completion changes and setup for that.

Co-authored-by: davidot <davidot@serenityos.org>
2022-01-22 01:21:18 +00:00
Jean-Baptiste Boric
736af8c7da groups: Do not attempt to open /etc/groups 2022-01-21 22:10:23 +01:00
Jean-Baptiste Boric
7fe7eab308 pwd: Add missing rpath pledge 2022-01-21 22:10:23 +01: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
Nico Weber
013799a4dd LibCrypto+LibJS: Better bigint bitwise_or binop
Similar to the bitwise_and change, but we have to be careful to
sign-extend two's complement numbers only up to the highest set bit
in the positive number.
2022-01-18 20:04:06 +03:30
Rummskartoffel
487377d1d7 disasm: Don't fail when trying to disassemble empty files
Given an empty file, disasm would try to create a zero-size memory
mapping of that file, which would fail with EINVAL.
2022-01-18 09:08:14 +01:00
Rummskartoffel
0aa5725f72 disasm: Convert to east-const and C++-style casts 2022-01-18 09:08:14 +01:00
Thijs Waalen
6210f62b1d readelf: Fall back to default interpreter path on empty path
This fixes readelf failing to map the interpreter for dynamic
libraries. When an ELF does not have the PT_INTERP header the
StringView will be of the inline capacity of the StringBuilder, not a
null StringView. This would cause readelf not to fallback on the
default interpreter path.
2022-01-16 22:36:06 -08:00
davidot
a5b11f7484 LibJS: Fix that '_' no longer accessed the last value in the REPL
This is now also not a concept that VM knows about and handled
completely by the REPL.
2022-01-16 14:57:12 +01:00
Kenneth Myhra
b76c66a9ed groupadd: Port to LibMain and use the new Core::Group abstraction :^) 2022-01-16 11:19:07 +01:00
Kenneth Myhra
294cbb7108 nc: Port to LibMain 2022-01-15 22:01:07 +01:00
Rummskartoffel
4aaab80649 unzip: Don't fail from mmap when trying to decompress empty files
Given an empty file, unzip would try to create a zero-size memory
mapping of that file, which would fail with EINVAL. With this commit,
attempting to unzip an empty file of course still fails, since that's
not a valid PKZIP file, but it now fails for the correct reason and with
the correct error message.
2022-01-15 22:24:19 +02:00
Timothy Flynn
58ccca6a9d LibJS+js: Pretty-print Date objects using the ToDateString AO 2022-01-15 20:13:48 +01:00
sin-ack
2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
alexmajor
67473085a1 Utilities: Port ifconfig to LibMain 2022-01-14 21:38:38 +01:00
kleines Filmröllchen
4d3a5c21b0 Utilities/aplay: Print progress in seconds and minutes by default
By default, aplay now prints the played time, the remaining time and the
total duration of the file in seconds and minutes. This is much more
intuitive. The old sample-based format is kept and hidden behind the -s
flag.
2022-01-14 21:37:23 +01:00
kleines Filmröllchen
8467327807 Utilities/aplay: Print format name under "Format"
This is not only nice to see, but it additionally tells developers that
the correct loader plugin was selected.
2022-01-14 21:37:23 +01:00
Lucas CHOLLET
8bc1a9e946 hostname: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
63466d385c host: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
dbcccde062 hexdump: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
02cb34a48a head: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
5ac52d0e4c gunzip: Remove StringView assignment on rhs-value 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
80a1ab3487 gunzip: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
c2e7acc8bb grep: Port to LibMain 2022-01-14 19:42:19 +02:00