Commit Graph

872 Commits

Author SHA1 Message Date
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
Peter Elliott
6312742257 less: Remove all formatting before printing status line 2021-12-29 00:00:02 +01:00
Peter Elliott
3677e88fb1 less: Dynamically re-wrap lines on resize
This change moves from wrapping lines at the start to operating on whole
lines and wrapping them as needed.

This has a few added benefits:
- line numbers are now always accurate.
- going to a line actually works
2021-12-29 00:00:02 +01:00
Kenneth Myhra
7772309169 LibCore+chown: Return ErrorOr<Optional<...>> for getgrnam and getpwnam
This patch returns an empty Optional<...> instead of an Error for
Core::System::getgrname and Core::System::getpwnam if we can't find a
matching group or user entry.

It also updates the 'chown' utility to support this new behavior.
2021-12-28 23:23:54 +01:00
Idan Horowitz
11599a3342 pls: Stop on first non option when parsing arguments
This allows using pls on a program with arguments more ergonomically,
e.g. `pls -- echo "hello friends"` can now simply be done as:
`pls echo "hello friends"`.
2021-12-28 22:03:33 +02:00
Sam Atkins
d702678d16 LibJS+WebContent+Browser+js: Implement console.group() methods
This implements:
- console.group()
- console.groupCollapsed()
- console.groupEnd()

In the Browser, we use `<details>` for the groups, which is not actually
implemented yet, so groups are always open.

In the REPL, groups are non-interactive, but still indent any output.
This looks weird since the console prompt and return values remain on
the far left, but this matches what Node does so it's probably fine. :^)
I expect `console.group()` is not used much outside of browsers.
2021-12-27 21:44:07 +01:00
Sam Atkins
ff5e07d718 LibJS+WebContent+js: Bring console.trace() to spec
The spec very kindly defines `Printer` as accepting
"Implementation-specific representations of printable things such as a
stack trace or group." for the `args`. We make use of that here by
passing the `Trace` itself to `Printer`, instead of having to produce a
representation of the stack trace in advance and then pass that to
`Printer`. That both avoids the hassle of tracking whether the data has
been html-encoded or not, and means clients don't have to implement the
whole `trace()` algorithm, but only the code needed to output the trace.
2021-12-27 21:44:07 +01:00
Sam Atkins
ce694490f3 LibJS+WebContent+js: Bring console.assert() to spec 2021-12-27 21:44:07 +01:00
Sam Atkins
9b78e287b0 LibJS+WebContent+js: Bring console.clear() to spec
This is identical to before, since we don't have "group stacks" yet, but
clear() now uses ThrowCompletionOr.
2021-12-27 21:44:07 +01:00
Sam Atkins
834ced82d4 LibJS+WebContent+js: Bring console.count[Reset]() to spec
The `CountReset` log level is displayed as a warning, since the message
is always to warn that the counter doesn't exist. This is also in line
with the table at https://console.spec.whatwg.org/#loglevel-severity
2021-12-27 21:44:07 +01:00
Sam Atkins
260836135a LibJS+WebContent+js: Reimplement console.log() and friends to spec
This implements the Logger and Printer abstract operations defined in
the console spec, and stubs out the Formatter AO. These are then used
for the "output a categorized log message" functions.
2021-12-27 21:44:07 +01:00
Liav A
105d558922 Meta: Remove kernel modules remains
Apparently Andreas found remains for that in the build system.
Let's remove them for completeness of that process of removing support
for kernel modules, which didn't work for many months before being
removed.
2021-12-25 18:42:41 +02:00
Andreas Kling
e923cf6624 strace: Port to LibMain :^) 2021-12-25 11:12:03 +01:00
Brian Gianforcaro
d6f1d11aa0 pro: Convert to serenity_main(..) 2021-12-24 14:29:52 -08:00
Brian Gianforcaro
74948950bb ini: Convert to serenity_main(..) 2021-12-24 14:29:52 -08:00
Brian Gianforcaro
831242f32a env: Convert to serenity_main(..) 2021-12-24 14:29:52 -08:00
Brian Gianforcaro
81c98502f3 pwd: Convert to serenity_main(..) 2021-12-24 14:29:52 -08:00
Elyse
c78a8b94c5 Everywhere: Refactor 'muted' to 'main_mix_muted' in all AudioConnections
The 'muted' methods referred to the 'main mix muted' but it wasn't
really clear from the name. This change will be useful because in the
next commit, a 'self muted' state will be added to each audio client
connection.
2021-12-24 00:19:01 -08:00
Daniel Bertalan
a73c71e877 strace: Fix out-of-bounds read when formatting realpath()
The actual length of the resulting string is encoded in the return
value; treating the entire buffer as a string leads to reading
uninitialized memory.
2021-12-23 23:08:10 +01:00
Daniel Bertalan
77f9272aaf Kernel+UE: Add MAP_FIXED_NOREPLACE mmap() flag
This feature was introduced in version 4.17 of the Linux kernel, and
while it's not specified by POSIX, I think it will be a nice addition to
our system.

MAP_FIXED_NOREPLACE provides a less error-prone alternative to
MAP_FIXED: while regular fixed mappings would cause any intersecting
ranges to be unmapped, MAP_FIXED_NOREPLACE returns EEXIST instead. This
ensures that we don't corrupt our process's address space if something
is already at the requested address.

Note that the more portable way to do this is to use regular
MAP_ANONYMOUS, and check afterwards whether the returned address matches
what we wanted. This, however, has a large performance impact on
programs like Wine which try to reserve large portions of the address
space at once, as the non-matching addresses have to be unmapped
separately.
2021-12-23 23:08:10 +01:00
Xavier Defrang
26bb3e1acf chmod+mkdir: Use convert_to_uint_from_octal 2021-12-21 13:13:04 -08:00
Xavier Defrang
6ca34f5647 mkdir: Implement --mode option
Only supports permissions given in octal format
at the moment.
2021-12-21 13:13:04 -08:00
Xavier Defrang
1255316d26 mkdir: Use LibMain 2021-12-21 13:13:04 -08:00
Timothy Flynn
10a8b6d411 Userland: Add unveil/pledge requisites for dynamic Unicode data loading
Loading libunicodedata.so will require dlopen(), which in turn requires
mmap(). The 'prot_exec' pledge is needed for this.

Further, the .so itself must be unveiled for reading. The "real" path is
unveiled (libunicodedata.so.serenity) as the symlink (libunicodedata.so)
itself cannot be unveiled.
2021-12-21 13:09:49 -08:00
Ali Mohammad Pur
f0709c7a24 LibC+AK: Implement all sorts of wprintf variants 2021-12-21 21:24:36 +03:30
Linus Groh
92672b1520 Meta: Add a fuzzer for the QOILoader 2021-12-21 13:27:27 +01:00
Linus Groh
0717e484f6 file: Add description & image details for image/x-qoi 2021-12-21 13:27:27 +01:00
Andreas Kling
bcd49ad834 touch: Port to LibMain :^) 2021-12-20 22:16:05 +01:00
PerikiyoXD
bdc028da1c cp: Print proper error message with strerror
When cp fails, now it prints an error string (strerror)
instead of an error code.
2021-12-20 10:40:02 -08:00
Junior Rantila
3d63e688f7 watch: Port to LibMain 2021-12-19 18:26:57 -08:00