Commit graph

901 commits

Author SHA1 Message Date
Brian Gianforcaro
6bf91d00ef run-tests: Make reproducing test failures behave closer to selftest mode
In CI / or local testing when you run `serenity.sh tests`, the system
will boot itself in self test mode, and the test runner will be launched
by SystemServer. Previously we were setting up settings for that
environment in the `SystemServer.ini`. This makes reproducing CI
failures a bit confusing, as the system will behavior differently if you
run in self-test mode, vs running `run-tests-and-shutdown.sh` or
`run-tests` manually in a session.

This change moves the settings to `run-tests`, so no matter how you try
to run the test runner, it will always behave the same.
2022-01-07 01:19:09 -08:00
Lucas CHOLLET
080c3164c7 du: Display true size of directory instead of 4 KiB
For each directory, we now go through each file and sum-up the contents.
2022-01-06 18:19:31 +01:00
RasmusNylander
4e65c4dae4 LibKeyboard: Change some Optional<T> returns to ErrorOr<T>
Makes CharacterMapFile::load_from_file and CharacterMap::load_from_file
return ErrorOr instead of Optional. This makes them a little nicer to
use and a little easier to read, as they seem to have been approximating
this.
2022-01-06 17:54:03 +01:00
Jun Zhang
0ac7931545 Utilities/ln: Port to LibMain
This patch simply ports the utility ln to LibMain :^)
2022-01-06 13:32:22 +01:00
Linus Groh
9d0d3affd4 LibJS: Replace the custom unwind mechanism with completions :^)
This includes:

- Parsing proper LabelledStatements with try_parse_labelled_statement()
- Removing LabelableStatement
- Implementing the LoopEvaluation semantics via loop_evaluation() in
  each IterationStatement subclass; and IterationStatement evaluation
  via {For,ForIn,ForOf,ForAwaitOf,While,DoWhile}Statement::execute()
- Updating ReturnStatement, BreakStatement and ContinueStatement to
  return the appropriate completion types
- Basically reimplementing TryStatement and SwitchStatement according to
  the spec, using completions
- Honoring result completion types in AsyncBlockStart and
  OrdinaryCallEvaluateBody
- Removing any uses of the VM unwind mechanism - most importantly,
  VM::throw_exception() now exclusively sets an exception and no longer
  triggers any unwinding mechanism.
  However, we already did a good job updating all of LibWeb and userland
  applications to not use it, and the few remaining uses elsewhere don't
  rely on unwinding AFAICT.
2022-01-06 12:36:23 +01:00
mjz19910
1f1383fe1e unzip: Remove useless .characters() calls 2022-01-04 23:53:46 -08:00
mjz19910
2351bb2db9 Utilities/CMakeList: Remove duplicate target_link_libraries(...) 2022-01-04 19:14:57 -08:00
mjz19910
87b719a494 Utilities/CMakeList: Sort target_link_libraries(...) 2022-01-04 19:14:57 -08:00
Linus Groh
9e50bd91a6 js: Remove uses of TRY_OR_DISCARD()
Slightly more verbose, but that's the last user of TRY_OR_DISCARD gone!
2022-01-04 23:37:26 +00:00
Marco Cutecchia
732e41714a ls: Fix duplicated error message when opening a directory fails 2022-01-04 22:47:57 +01:00
Marco Cutecchia
70f707d806 stat: Print an error if 'stat' fails 2022-01-04 22:47:57 +01:00
Michel Hermier
22efc34ec5 LibCrypto: Make Digests able to return bytes 2022-01-05 01:07:21 +03:30
Michel Hermier
25251f1b05 checksum: Use :hex-dump to format digest value 2022-01-05 01:07:21 +03:30
Michel Hermier
23fe07a148 checksum: Make name detection working even with a path 2022-01-05 01:07:21 +03:30
mjz19910
154d33f240 unzip: Port to LibMain 2022-01-04 10:59:42 +00:00
mjz19910
7c05db19a1 zip: Port to LibMain :^) 2022-01-04 10:59:42 +00:00
Mathieu PATUREL
571d090609 profile: Specify the /proc/profile path in the help message 2022-01-04 07:56:54 +00:00
Mathieu PATUREL
cdbcb70913 profile: Don't print anything when disabling profiling
Just like when enabling profiling. Plus it's more unixy to not print
anything on success
2022-01-04 07:56:54 +00:00
Andrew Kaster
f8ea9cd64e Userland: Resolve unused-but-set-varaible warnings
These are almost always bugs, so enable globally.

Remove unused counter variables in SystemMonitor and disk_benchmark.
2022-01-04 07:51:31 +00:00
Andrew Kaster
170a7e263c Userland: Fail Core::find_executable_in_path on empty inputs
Before this patch, `which ""` or `type ""` would say that the empty
string is `/usr/local/bin/`.

Convert callers to consistently call is_empty() on the returned string
while we're at it, to support eventually removing the is_null() String
state in the future.
2022-01-04 07:38:42 +00:00
mjz19910
7f9bd34d07 wc: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
fc78bbe78c which: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
92493b210a wsctl: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
d4748c608c xargs: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
f705f57d9a yes: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
e9a15995fd uname: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
35cd7c9a91 uniq: Port to LibMain 2022-01-04 07:33:23 +00:00
circl
69c757e92f tar: Implement -C option
This allows specifying which directory to extract to or create
from.

I would have used the *at variants of the functions, but some
weren't implemented yet.
2022-01-04 06:22:34 +00:00
Linus Groh
85f0fc2b83 LibJS: Return Optional<T> from Completion::{value,target}(), not T
In the end this is a nicer API than having separate has_{value,target}()
and having to check those first, and then making another Optional from
the unwrapped value:

    completion.has_value() ? completion.value() : Optional<Value> {}
    //                       ^^^^^^^^^^^^^^^^^^
    //         Implicit creation of non-empty Optional<Value>

This way we need to unwrap the optional ourselves, but can easily pass
it to something else as well.

This is in anticipation of the AST using completions :^)
2022-01-03 21:50:50 +01:00
Andreas Kling
c6ce606e47 LibCore+id: Make more use of Core::System wrappers in Core::Account 2022-01-02 18:08:02 +01:00
Lucas CHOLLET
4d557a4b81 rm: Check before removing '/'
A simple check to not erase '/' by mistake.
2022-01-02 17:37:35 +01:00
mjz19910
cd7b50a074 uptime: Port to LibMain :^) 2022-01-02 09:42:56 +00:00
Xavier Defrang
b17fef5133 mkdir: Use FilePermissionsMask to handle mode option 2022-01-01 17:33:43 +00:00
Xavier Defrang
005b0f7384 chmod: Use FilePermissionsMask to handle mode argument 2022-01-01 17:33:43 +00:00
circl
4b40d2cc07 chown+chgrp: Add --no-dereference option
This option will change the ownership of the symlink rather than the
file it points to.
2022-01-01 15:08:49 +01:00
Kenneth Myhra
22c27e1ba9 fgrep: Port fgrep to LibMain 2022-01-01 14:40:41 +01:00
Kenneth Myhra
8aafe6cd1f errno: Port to LibMain 2022-01-01 14:40:41 +01:00
Kenneth Myhra
2e0f53c25d du: Port to LibMain
This ports 'du' utility to LibMain. Also moves to use StringView and
StringView literals more instead of raw C strings.
2022-01-01 14:40:41 +01:00
davidot
676554d3f8 LibJS: Convert resolve_binding() to ThrowCompletionOr
The spec has a note stating that resolve binding will always return a
reference whose [[ReferencedName]] field is name. However this is not
correct as the underlying method GetIdentifierReference may throw on
env.HasBinding(name) thus it can throw. However, there are some
scenarios where it cannot throw because the reference is known to exist
in that case we use MUST with a comment.
2021-12-30 15:29:33 +01:00
creator1creeper1
dfaa6c910c Utilities/lsusb: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
creator1creeper1
575a8e6487 Utilities/arp: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
creator1creeper1
067e32c023 Utilities/netstat: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
creator1creeper1
9c832e3b0f Utilities/ifconfig: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
creator1creeper1
d9b3278074 Utilities/notify: Propagate errors in Gfx::Bitmap loading 2021-12-30 14:37:02 +01:00
creator1creeper1
9d6ecdca7b Utilities/lsirq: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
creator1creeper1
bceddb2073 Utilities/mount: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
creator1creeper1
904c8634eb Utilities/lsof: Propagate errors in JSON decoding 2021-12-30 14:37:02 +01:00
Timothy Flynn
565a880ce5 Userland: Link directly against LibUnicodeData where needed
This is partially a revert of commits:
    10a8b6d411
    561b67a1ad

Rather than adding the prot_exec pledge requried to use dlopen(), we can
link directly against LibUnicodeData in applications that we know need
that library.

This might make the dlopen() dance a bit unnecessary. The same purpose
might now be fulfilled with weak symbols. That can be revisted next, but
for now, this at least removes the potential security risk of apps like
the Browser having prot_exec privileges.
2021-12-30 14:18:12 +01:00
Peter Elliott
23e09eb7f4 less: Handle tabs in line wrapping
Before tabs were treated as a width of 1, which would cause issues with
man page headers.
2021-12-29 00:00:02 +01:00
Peter Elliott
20a0572de8 Userland: Port less(1) to LibMain 2021-12-29 00:00:02 +01:00