Commit graph

2421 commits

Author SHA1 Message Date
Kemal Zebari
02d8aaa2e8 nohup: Use return code 127 for errors caught by serenity_main()
For any errors that occur during the runtime of nohup, POSIX uses
a 127 return code.
2024-01-19 12:16:56 -07:00
Andrew Kaster
05ea3d6be0 headless-browser: Navigate after attaching new callbacks for ref tests 2024-01-19 11:47:59 +01:00
implicitfield
de9fa25e11 cksum: Use the POSIX cksum algorithm rather than vanilla CRC32 2024-01-18 18:01:26 +03:30
Bastiaan van der Plaat
dc2233ef7a Ladybird+WebContent: Add chrome command line and exe path passing 2024-01-17 17:32:05 +01:00
Sam Atkins
cac66aeb53 mktemp: Use ByteString for paths 2024-01-16 08:42:34 +00:00
Sam Atkins
56c5ffe398 LibFileSystem+Userland: Return ByteString from real_path() 2024-01-16 08:42:34 +00:00
Sam Atkins
cdf17efb9a LibFileSystem+Userland: Return ByteString from absolute_path() 2024-01-16 08:42:34 +00:00
Kemal Zebari
b7dbdb4cd2 cksum: Print checksums as decimal rather than hexadecimal
POSIX and the implementations I see expect checksum to be printed
just as an unsigned integer.
2024-01-15 23:08:28 -07:00
Kemal Zebari
09a053a723 cksum: Handle edge case when no file operands are given when printing
Given no file operands, POSIX wants us to read from stdin as well
as omit "the pathname and its leading <space>" when printing.
2024-01-15 23:08:28 -07:00
Kemal Zebari
5d07c56d0d cksum: Decouple printing logic from checksum construction
This is to avoid duplicating the printing logic and so that we can
have an alternative way of printing the result (i.e. for the next
commit that will print without a pathname if no file operands were
provided). This also has us avoid the algorithm checks in the for
loop.
2024-01-15 23:08:28 -07:00
Kevin Meyer
284f14d046 LibVideo: Replace DeprecatedFlyString with FlyString 2024-01-14 15:00:13 -07:00
Nico Weber
96e8debf0b test-jpeg-roundtrip: Add a few more colors 2024-01-14 11:35:40 +00:00
Nico Weber
25efe65a83 test-jpeg-roundtrip: Print summary statistics at the end 2024-01-14 11:35:40 +00:00
Nico Weber
8ef3310525 test-jpeg-roundtrip: Print perceived delta of fixpoint to start color 2024-01-14 11:35:40 +00:00
Nico Weber
5a47e71604 Utilities: Add test-jpeg-roundtrip
This creates a bitmap filled with a fixed color, then (in memory)
saves it as jpeg and loads it again, and repeats that until the
color of the bitmap no longer changes. It then reports how many
iterations that took, and what the final color was.

It does this for a couple of colors.

This is for quality assessment of the jpeg codec. Ideally, it should
converge quickly (in one iteration), and on a color not very far from
the original input color.
2024-01-14 11:35:40 +00:00
Liav A
fc0dbd2334 Utilities: Add the listdir utility
This utility uses the Core::DirIterator facility which in turn uses the
get_dir_entries syscall. Therefore, this utility lets us to view the
actual values for inode numbers, and entry type value for directory
entries.
2024-01-13 19:01:07 -07:00
Dan Klishch
ccd701809f Everywhere: Add deprecated_ prefix to JsonValue::to_byte_string
`JsonValue::to_byte_string` has peculiar type-erasure semantics which is
not usually intended. Unfortunately, it also has a very stereotypical
name which does not warn about unexpected behavior. So let's prefix it
with `deprecated_` to make new code use `as_string` if it just wants to
get string value or `serialized<StringBuilder>` if it needs to do proper
serialization.
2024-01-12 17:41:34 -07:00
Ollrogge
90ff6cca8a LibELF: Correctly determine symbol amount for DT_GNU_HASH table 2024-01-12 17:04:43 -07:00
kleines Filmröllchen
eada4f2ee8 AK: Remove ByteString from GenericLexer
A bunch of users used consume_specific with a constant ByteString
literal, which can be replaced by an allocation-free StringView literal.

The generic consume_while overload gains a requires clause so that
consume_specific("abc") causes a more understandable and actionable
error.
2024-01-12 17:03:53 -07:00
kleines Filmröllchen
bdd92e881f pixelflut: Implement alternative flooding strategies
These allow column-wise, traditional scanline, or random pixel flooding.
Depending on the use case and amount of contestion, any of the
strategies may work best, as tested on 37c3.
2024-01-12 16:10:28 -07:00
kleines Filmröllchen
fdfd4b5e3d pixelflut: Ignore EAGAIN errors
Very contested servers are likely to cause EAGAIN socket errors on the
client. Since these errors are not supposed to be fatal, just try
sending the pixel again.

This was tested successfully against massively contested 37c3 pixelflut
servers.
2024-01-12 16:10:28 -07:00
Andrew Kaster
02edd240ae LibWeb+WebContent: Spawn Worker processes from the chrome
Instead of spawning these processes from the WebContent process, we now
create them in the Browser chrome.

Part 1/N of "all processes are owned by the chrome".
2024-01-12 15:53:11 -07:00
Nico Weber
7d796c83f1 image: Fix flag names and grammar in diagnostic texts 2024-01-11 08:00:27 +00:00
Timothy Flynn
0989a81a48 headless-browser: Add support for cookies with SQLServer
This will allow us to test cookies and the database during CI.
2024-01-10 23:26:40 +01:00
Nico Weber
07fe8b8d0a icc: Add a --debug-roundtrip flag
With this, we convert a bunch of random colors to a
profile's profile connection space and back, and count
how many u8 colors make it through unchanged.

With this, you can do something like:

    for f in ~/Downloads/Adobe\ ICC\ Profiles\ \(end-user\)/*/*.icc; do
        echo $f
        Build/lagom/bin/icc --debug-roundtrip $f
    done

to test conversion through a bunch of profiles. These profiles are
available at:
https://www.adobe.com/support/downloads/iccprofiles/iccprofiles_win.html

...which ultimately leads to:
https://download.adobe.com/pub/adobe/iccprofiles/win/AdobeICCProfilesCS4Win_end-user.zip

(Or use `Build/lagom/bin/icc --debug-roundtrip -n sRGB` to test the
built-in sRGB profile.)
2024-01-07 15:42:35 +01:00
Timothy Flynn
d8fa226a8f Ladybird+LibWebView+WebContent: Make the screenshot IPCs async
These IPCs are different than other IPCs in that we can't just set up a
callback function to be invoked when WebContent sends us the screenshot
data. There are multiple places that would set that callback, and they
would step on each other's toes.

Instead, the screenshot APIs on ViewImplementation now return a Promise
which callers can interact with to receive the screenshot (or an error).
2024-01-01 10:11:45 +01:00
Andreas Kling
b6d4eea7ac LibJS: Never give back virtual memory once it belongs to a cell type
Instead of returning HeapBlock memory to the kernel (or a non-type
specific shared cache), we now keep a BlockAllocator per CellAllocator
and implement "deallocation" by basically informing the kernel that we
don't need the physical memory right now.

This is done with MADV_FREE or MADV_DONTNEED if available, but for other
platforms (including SerenityOS) we munmap and then re-mmap the memory
to achieve the same effect. It's definitely clunky, so I've added a
FIXME about implementing the madvise options on SerenityOS too.

The important outcome of this change is that GC types that use a
type-specific allocator become immune to use-after-free type confusion
attacks, since their virtual addresses will only ever be re-used for
the same exact type again and again.

Fixes #22274
2023-12-31 15:35:56 +01:00
Andreas Kling
b344d39014 headless-browser: Use run_dump_test() for single-test runs as well
This avoids having two separate ways to set up the finish callbacks.
It also makes it possible to run a single async test on its own.
2023-12-24 13:23:40 +01:00
Shannon Booth
e2e7c4d574 Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as
to_number will handle something such as:

```
Optional<I> opt;
if constexpr (IsSigned<I>)
    opt = view.to_int<I>();
else
    opt = view.to_uint<I>();
```

For us.

The main goal here however is to have a single generic number conversion
API between all of the String classes.
2023-12-23 20:41:07 +01:00
Sam Atkins
ac63d1e59d headless-browser: Clear document and callbacks between tests
While it would be more hygienic to get a fresh Navigable each time,
loading `about:blank` still means we discard the current Document.

This does noticeably increase the duration of running the LibWeb test
suite. On my machine, we go from ~5.5 seconds to ~7.7.
2023-12-22 16:49:06 +01:00
Aliaksandr Kalenik
d28c400fcb headless-browser: Load test page after callbacks are registered
Eliminates possibility that page will load before callbacks are added.
2023-12-21 10:20:05 +01:00
Aliaksandr Kalenik
2f09bfeff2 headless-browser: Await on_load_finish() while running Text tests
Before this change, it was possible for a text test to finish before
on_load_finish() was triggered, resulting in the subsequent test
receiving the load event from the previous test.
2023-12-21 10:20:05 +01:00
Andrew Kaster
c7f7ee2c4b headless-browser: Log current test when WebContent crashes 2023-12-19 21:08:05 +01:00
Aliaksandr Kalenik
fc9a8c77d5 headless-browser: Update m_viewport_rect after changing scroll offset 2023-12-19 20:59:52 +01:00
Aliaksandr Kalenik
a93ab25487 headless-browser: Implement on_scroll_to_point and on_scroll_by_delta
Without these callbacks "scroll" events are not emitted so we can't
write tests for scrolling.
2023-12-19 10:45:07 +01:00
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Bastiaan van der Plaat
c069ab1ca0 LibWeb: Refactor int types in WebContentServer to DevicePixels 2023-12-15 17:01:16 +01:00
Liav A
f67b9cb680 Utilities/drain: Add an option to specify different block size
This is useful for a situation when handling a small file than 512 KiB
or being under low system memory pressure.
2023-12-12 06:44:10 -05:00
Kyle Pereira
8191f2b47a LibPDF: Add parameter for background color of render 2023-12-10 16:44:24 +01:00
implicitfield
84b981ade7 Utilities: Add a drain utility 2023-12-08 22:05:43 +03:30
Andrew Kaster
4786d9e3e6 headless-browser: Add ability to skip tests 2023-12-07 16:46:20 -05:00
Dan Klishch
d317309d89 Everywhere: Unport Core::System::current_executable_path from new string
Storing paths in AK::String is never correct.
2023-12-07 10:13:21 -07:00
Andreas Kling
8b7d27b349 LibJS+LibWeb: More bringing module loading closer to spec
In particular, this patch removes three host hooks on JS::VM in favor
of the new JS-side module loading stuff.
2023-12-03 20:46:55 +01:00
Timothy Flynn
07e9a8f79b Ladybird+LibWebView: Move options used to launch WebContent to a struct
It is currently a bit messy to pass these options along from main() to
where WebContent is actually launched. If a new flag were to be added,
there are a couple dozen files that need to be updated to pass that flag
along. With this change, the flag can just be added to the struct, set
in main(), and handled in launch_web_content_process().
2023-12-01 20:07:27 -05:00
Daniel Bertalan
45d81dceed Everywhere: Replace ElfW(type) macro usage with Elf_type
This works around a `clang-format-17` bug which caused certain usages to
be misformatted and fail to compile.

Fixes #8315
2023-12-01 10:02:39 +02:00
Andrew Kaster
890cce6fbb headless-browser: Centralize test timeouts and up default to 30 seconds
We're seeing timeouts for WebWorker based tests in some CI runs. It's
possible that these are legitimate timeouts, so bump the default timeout
to 30sec. When porting the test runner to run on CI, Andreas had to bump
the test timeout from 5 seconds to 10, to 15. It's likely that loading
our ASAN/UBSAN binaries on slow CI machines takes a significant amount
of time. Tests that use the new WebWorker process are spawning yet
another process that needs to load LibWeb and all its dependencies.
2023-11-28 16:38:51 +01:00
Sam Atkins
edaa5061c4 headless-browser: Add flag to dump screenshots of failing ref-tests
When the `--dump-failed-ref-tests` flag is provided, screenshots of the
actual and reference pages will be placed in
`Build/lagom/ladbybird/test-dumps`. This makes it a lot easier to spot
what's wrong with a failing test. :^)
2023-11-18 07:49:59 -05:00
Martin Janiczek
b56e022ce8 AK: Add roundtrip fuzzer for Base64 2023-11-18 10:01:29 +01:00
Martin Janiczek
0465ba242b LibCompress: Upgrade compression fuzzer into a roundtrip fuzzer 2023-11-18 10:01:29 +01:00
Sönke Holz
6824d2a788 Userland+Tests: Add initial riscv64 support 2023-11-10 10:30:08 -07:00
Nico Weber
ed7549c64f pdf: Add a --json flag that currently affects only --debugging-stats 2023-11-10 14:46:06 +01:00
Tim Schumacher
a2f60911fe AK: Rename GenericTraits to DefaultTraits
This feels like a more fitting name for something that provides the
default values for Traits.
2023-11-09 10:05:51 -05:00
Tim Ledbetter
e1099a1757 Fuzzers: Use a single fuzzer to test all LibTextCodec encodings
This commit replaces the 5 fuzzers that previously tested LibTextCodec
with a single fuzzer. We now rely on the fuzzer to generate the
encoding and separate it from the encoded data with a magic separator.
This increases the overall coverage of LibTextCodec and eliminates the
possibility of the same error being generated by multiple fuzzers.
2023-11-08 09:39:49 +01:00
Tim Ledbetter
33ad384a7d Fuzzers: Add a DNS packet fuzzer 2023-11-08 09:38:36 +01:00
Lucas CHOLLET
8612aee640 Lagom/Fuzzers: Add a fuzzer for our TIFF decoder 2023-11-06 12:29:30 -07:00
LevitatingBusinessMan (Rein Fernhout)
edd38358c2 ls: Use indicator for sockets and pipes
= indicator for sockets, | for pipes.
Pipes are now colored yellow like other special files
2023-11-04 22:08:56 +01:00
Liav A
55ea2d892c Utilities/beep: Restrict possible capabilities
We can now just unveil the /dev/beep device node, as well as to restrict
the utility functionality for rpath, wpath & stdio related syscalls only
because we don't actually need anything else.
2023-11-03 15:19:33 +01:00
Liav A
26f96d2a42 Kernel+Userland: Add option for duration of /dev/beep producing sound 2023-11-03 15:19:33 +01:00
Liav A
1b00618fd9 Kernel+Userland: Replace the beep syscall with the new /dev/beep device
There's no need to have separate syscall for this kind of functionality,
as we can just have a device node in /dev, called "beep", that allows
writing tone generation packets to emulate the same behavior.

In addition to that, we remove LibC sysbeep function, as this function
was never being used by any C program nor it was standardized in any
way.
Instead, we move the userspace implementation to LibCore.
2023-11-03 15:19:33 +01:00
Simon Wanner
93908fcbcb LibJS+Embedders: Unify stack trace format for uncaught errors
Previously these handlers duplicated code and used formats that
were different from the one Error.prototype.stack uses.

Now they use the same Error::stack_string function, which accepts
a new parameter for compacting stack traces with repeating frames.
2023-11-02 07:37:41 +01:00
Timothy Flynn
cf93e56833 headless-browser: Use LibWebView to sanitize input URLs
Remove the ad-hoc sanitization in favor of LibWebView. This was missed
after commit 191e20d639.
2023-10-31 07:03:15 +01:00
Timothy Flynn
1504469c50 js: Implement the exit builtin without calling the native exit function
If we invoke the exit native function from within the exit builtin, the
native call will then invoke global destructors. This ultimately ends up
deleting the JS::NativeFunction that defines the exit builtin, thus we
try to delete the AK::Function held inside the NativeFunction while that
AK::Function is executing. This is explicitly forbidden by AK::Function.

Instead, simply set a flag to exit the REPL after the builtin executes.
2023-10-30 18:12:17 +01:00
Gurkirat Singh
60640fe38d Utilities: Implement slugify using AK/Slugify 2023-10-30 10:39:59 +00:00
Andrew Kaster
86ce502ae2 LibGfx+Utilities: Add helpers to load vector fonts from Core::Resources 2023-10-29 13:12:28 -06:00
Aliaksandr Kalenik
b6732b0234 Ladybird+WebContent: Add option to use GPU painter
Adds `--enable-gpu-painting` param to enable painting command executor
that uses LibAccelGfx.
2023-10-29 17:13:23 +01:00
Lucas CHOLLET
5c7e5cc738 Ladybird: Decode images out of process
This patch brings a service to handle image decompression. With it comes
security enhancement due to the process boundary. Indeed, consequences
of a potential attack is reduced as only the decoder will crash without
perturbing the WebContent process.
It also allows us to display pages containing images that we claim to
support but still make us crash, like for not-finished-yet decoders.

As an example, we can now load https://jpegxl.info/jxl-art.html without
crashing the WebContent process.
2023-10-27 07:26:32 +02:00
Tim Ledbetter
fff1645c6b Fuzzers: Add WOFF2 fuzzer 2023-10-24 13:45:01 +02:00
Tim Ledbetter
03fbd6c0c8 Fuzzers: Add a fuzzer for JsonParser 2023-10-24 07:54:37 +02:00
Tim Ledbetter
c5a4c22fa7 du: Add -x option to not traverse directories across filesystems 2023-10-19 14:41:09 +02:00
Tim Ledbetter
cc5c7d2a29 du: Remove unnecessary is_inside_dir function argument
This value can be computed using the `current_depth` parameter.
2023-10-19 14:41:09 +02:00
Tim Ledbetter
c006ebe5a3 find: Add the -path and -ipath options
These options behave the same way as `-name` and `-iname` but match
the full file path instead of just the basename.
2023-10-18 06:36:34 -04:00
Andrew Kaster
1af3da39fd headless-browser: Load fonts via Core::Resource URIs 2023-10-17 11:02:01 -06:00
Andrew Kaster
74707d151b pdf: Load fonts in debug mode via Core::Resource URIs 2023-10-17 11:02:01 -06:00
Tim Ledbetter
54a28afc13 LibIMAP: Stop parsing immediately on error
This makes the parser more resilient to invalid IMAP messages.

Usages of `Optional` have also been removed where the empty case is
equivalent to an empty object.
2023-10-13 11:12:18 -06:00
Ali Mohammad Pur
aeee98b3a1 AK+Everywhere: Remove the null state of DeprecatedString
This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>

Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
2023-10-13 18:33:21 +03:30
Nico Weber
5c744a9fb0 pdf: Add a --render-repeats=N flag
It calls render() N times instead of just once. Useful for benchmarking.
2023-10-12 08:03:52 +02:00
Andreas Kling
a396bb0c0b LibGfx: Remove indexed palette formats from Bitmap and Painter
Nobody was actually using these formats anymore, and this simplifies
and shrinks the code. :^)
2023-10-12 07:39:05 +02:00
Tim Ledbetter
6f1f0710f8 find: Don't canonicalize path operands
The POSIX specification for `find` says that: "Each path operand shall
be evaluated unaltered as it was provided, including all trailing
<slash> characters". This also matches the behavior of `find` on
FreeBSD and Linux.
2023-10-07 11:37:53 +02:00
Andreas Kling
65717e3b75 LibJS: Inline fast case for Value::to_{boolean,number,numeric,primitive}
These functions all have a very common case that can be dealt with a
very simple inline check, often avoiding the need to call an out-of-line
function. This patch moves the common case to inline functions in a new
ValueInlines.h header (necessary due to header dependency issues..)

8% speed-up on the entire Kraken benchmark :^)
2023-10-07 07:13:52 +02:00
Tim Ledbetter
0068e91aad open: Display a meaningful error if the specified file doesn't exist
Previously, the error given for any non-existent file was:
"Failed to open ':'".
2023-10-06 08:20:28 +02:00
Karol Kosek
f2f98b7938 grep: Hyperlink filenames in tty
As the newly created function has been also applied to printing the
number of matched file lines, file names will now also be colored
with the `--count` option set. :^)
2023-10-06 08:10:00 +02:00
Karol Kosek
db4a654e9f grep: Print filenames when counting lines and path size is less than 2
`grep --count --recursive foo` doesn't specify any file, but we should
show the paths anyway.
2023-10-06 08:10:00 +02:00
Karol Kosek
018dcf570e grep: Return exit code '2' on error 2023-10-06 08:10:00 +02:00
Karol Kosek
5a85449b23 grep: Don't end the program early after failing to grep a file
We should still try to read remaining files.
2023-10-06 08:10:00 +02:00
Karol Kosek
94eb31865a grep: Remove separate stdin handling logic
Previously we had two somewhat duplicated methods: one just for handling
stdin with the standard C API, and the other one used for everything
else with our Core::File class. By using always Core::File, the code
should be now a little bit cleaner.

Additionally, grep will now use the standard input when it finds a '-'
argument (previously it tried to open a file with that name.)
2023-10-06 08:10:00 +02:00
Karol Kosek
e48b9d74ac grep: Add comment describing why we take leading characters from paths 2023-10-06 08:10:00 +02:00
Timothy Flynn
0bc401a1d6 LibTimeZone+Userland: Include Link entries when returning all time zones
We currently only return primary time zones, i.e. time zones that are
not a Link. LibJS will require knowledge of Link entries, and whether
each entry is or is not a Link.
2023-10-05 17:01:02 +02:00
Gurkirat Singh
fb5353e7e2 Utilities: Remove redundant target_link_libraries 2023-10-05 15:19:19 +02:00
kleines Filmröllchen
05af549bad pkg: Parse dependencies as part of the main port entry
The "dependency" lines really belong to the main port entry, it doesn't
make sense logically to represent them separately and handling them
together will also allow easier dependency management later on. This
commit greatly simplifies the port database parsing to facilitate this,
and removes the -d option from the command line. Instead, ports are
listed with their dependencies, if they have any.
2023-10-04 22:28:05 +02:00
kleines Filmröllchen
a5f566c2c6 pkg: Always use correct installed.db
The access() check was on the wrong file previously.
2023-10-04 22:28:05 +02:00
Tim Ledbetter
2c0f6d8c7b find: Ensure the terminating ; is present when using -exec
The program now terminates with an error if the command passed to
`-exec` is not terminated with a semicolon.

This commit also ensures that the argument containing the terminating
semicolon must be 1 byte long. Previously, any argument whose first
byte was a semicolon was treated as a valid terminator.
2023-10-04 09:14:15 +01:00
Tim Ledbetter
8f8354d9a0 find: Add the -ok option
This behaves identically to the `-exec` option but prompts the user
for confirmation before executing the specified command.

A command is executed if a line beginning with 'y' or 'Y' is entered
by the user. This matches the behavior of `find` on Linux and FreeBSD
when using the POSIX locale.
2023-10-04 09:14:15 +01:00
Tim Ledbetter
eaa6304aab Userland: Return empty if ImageDecoder client receives an invalid frame
This simplifies error checking for all the users of the ImageDecoder
client.
2023-10-03 08:33:53 +02:00
Nico Weber
005bdd210a pdf: Add a --dump-outline flag 2023-10-03 07:11:25 +02:00
Tim Ledbetter
e904f69c26 realpath: Add the -q option to suppress error messages 2023-10-02 20:56:38 +02:00
Tim Ledbetter
cbda6e1ff4 realpath: Allow multiple path arguments to be given 2023-10-02 20:56:38 +02:00
Tim Ledbetter
3ee12ffa8f stat: Show the device ID for the given file 2023-10-01 13:34:41 +02:00
Tim Ledbetter
ebb822def9 less: Add the -F option to quit if the input fits on one screen 2023-09-27 20:00:34 +02:00
Tim Ledbetter
938a287d3e ls: Left justify owner and group information in long format 2023-09-27 19:58:17 +02:00
Tim Ledbetter
cb1851f3cc ls: Add the -g option to omit owner information in long format 2023-09-27 19:58:17 +02:00
Tim Ledbetter
d618ef58fb ls: Display results in long format when -n or -o are used 2023-09-27 19:58:17 +02:00
kleines Filmröllchen
d6571f54d8 LibCore: Make MappedFile a Stream
The internal reuse of FixedMemoryStream makes this straightforward.
There alread is one user of the new API, demonstrating the need for this
change beyond what I said out to use it for :^)
2023-09-27 03:22:56 +02:00
kleines Filmröllchen
062e0db46c LibCore: Make MappedFile OwnPtr-based
Since it will become a stream in a little bit, it should behave like all
non-trivial stream classes, who are not primarily intended to have
shared ownership to make closing behavior more predictable. Across all
uses of MappedFile, there is only one use case of shared mapped files in
LibVideo, which now uses the thin SharedMappedFile wrapper.
2023-09-27 03:22:56 +02:00
Tim Ledbetter
09099cc9a3 du: Prevent multiple counting of the same file
Previously, the same file would be counted more than once if its
containing directory was visited multiple times, or there were
multiple hard links pointing to it.

We now keep track of every visited inode to ensure that files aren't
evaluated multiple times. This matches the behavior of `du` on FreeBSD
and Linux.
2023-09-26 21:27:25 +02:00
Tim Ledbetter
ba40526db2 ls: Add the -p option to append a trailing slash to directories
This overrides the `-F` option and vice-versa.
2023-09-26 07:19:02 +02:00
Sam Atkins
34940821f6 Utilities: Use new ArgsParser method for enum values 2023-09-24 23:41:22 +02:00
Tim Ledbetter
01ec695ae3 ls: Add the -S option to sort files by size
This option will override the `-t` option and vice-versa.
2023-09-24 08:22:11 +01:00
Tim Ledbetter
3aa49f268c Userland: Make Window::set_main_widget() non-fallible 2023-09-21 10:20:23 +02:00
Andreas Kling
51caa14381 LibWeb: Remove FrameLoader
This class is no longer used, now that we've moved to navigables.
2023-09-20 18:29:17 +02:00
Tim Ledbetter
a6f6a1afd2 Userland: Prefer non-fallible construction for LibGUI objects 2023-09-18 18:00:45 +02:00
Tim Ledbetter
784ac6b9f2 less: Allow quitting with uppercase 'Q' 2023-09-17 17:10:50 -06:00
Liav A
b6b2c6f3e2 PackageManager: Create /usr/Ports directory when updating the ports list
When updating /usr/Ports/AvailablePorts.md, the file or even the entire
/usr/Ports directory might not exist.
To cope with this, we should be able to create it ourselves. To ensure
we are able to do this, we should unveil both /usr and /usr/Ports.
2023-09-17 16:38:21 -06:00
Liav A
4303965986 PackageManager: Inform the user if AvailablePorts.md doesn't exist
If we need to read from /usr/Ports/AvailablePorts.md, but the file does
not exist, then warn the user in an informative way.
2023-09-17 16:38:21 -06:00
Tim Ledbetter
1bc081398e find: Add -uid option to filter by owning user ID 2023-09-17 15:29:44 -06:00
Tim Ledbetter
d3da8f978e find: Add -gid option to filter by owning group ID 2023-09-17 15:29:44 -06:00
Tim Ledbetter
a95c2ed978 find: Add the -maxdepth and -mindepth options
The `-maxdepth` option limits the number of levels `find` will descend
into the file system for each given starting point.

The `-mindepth` option causes commands not to be evaluated until the
specified depth is reached.
2023-09-17 15:20:49 -06:00
implicitfield
7cb80c67d8 checksum: Add support for BLAKE2b 2023-09-17 16:49:35 +03:30
implicitfield
1b3ad1c721 LibCrypto: Add support for BLAKE2b 2023-09-17 16:49:35 +03:30
Tim Ledbetter
4eb52351b4 less: Add -N option to show line numbers
Co-authored-by: Liav A <liavalb@gmail.com>
2023-09-16 11:07:17 +02:00
Aliaksandr Kalenik
6f8be44c0e LibWeb+WebContent+headless-browser: Support async text tests
Previously, we used `on_load_finish` to determine when the text test
was completed. This method did not allow testing of async functions
because there was no way to indicate that the runner should wait for
the async call to end.

This change introduces a function in the `internals` object that is
intended to be called when the text test execution is completed. The
text test runner will now ignore `on_load_finish` which means a test
will timeout if this new function is never called.

`test(f)` function in `include.js` has been modified to automatically
terminate a test once `load` event is fired on `window`.
new `asyncTest(f)` function has been introduces. `f` receives function
that will terminate a test as a first argument.

Every test is expected to call either `test()` or `asyncTest()` to
complete. If not, it will remain hanging until a timeout occurs.
2023-09-15 08:52:25 +02:00
Tim Ledbetter
c74f7e5f2a Userland: Don't use String::from_utf8() for literal strings 2023-09-15 08:44:52 +02:00
Sam Atkins
e0fe77d012 LibWeb+headless-browser: Replace ref-test manifest with link tags
Each ref test now links to its reference page with a link tag, in the
same format as WPT:

`<link rel="match" href="reference-page.html" />`

The reference pages have all been moved into a separate `reference/` dir
so that we can just treat every file in `ref/` as a test. There's no
filter to only look at .html files, because we also have a .svg file in
there, and there may be other formats we want to use too. But it's not
too hard to add one if we need it.
2023-09-13 08:48:19 +02:00
Jakub Berkop
54e79aa1d9 Kernel+ProfileViewer: Display additional filesystem events 2023-09-09 11:26:51 -06:00
Timothy Flynn
573cbb5ca0 LibJS+LibWeb+WebContent: Stop using ThrowableStringBuilder 2023-09-09 13:03:25 -04:00
Tim Ledbetter
331991f9c4 find: Allow '+' and '-' prefix for -links and -size options
The presence of this prefix denotes that the value being tested is
strictly greater than or less than the given numeric value.
2023-09-09 11:02:18 -06:00
Tim Ledbetter
d277d2e1fb find: Add ! operator to negate the following command 2023-09-09 10:57:17 -06:00
Tim Ledbetter
71ddc33fbf find: Print hyperlinks when standard output is attached to a terminal 2023-09-07 11:52:09 -06:00
Sergey Bugaev
e6cf125535 Utilities: Fix building ntpquery without SO_TIMESTAMP
If SO_TIMESTAMP is unsupported, we won't be able to determine
kernelspace-to-userspace latency. But other than that, things should
still build and work.

(It's a separate question of what "kernelspace-to-userspace latency"
even means on a microkernel system, where the network card drivers, the
network stack, and ntpquery(1) are all running as userspace programs.)

Also, don't fail completely if settting receive timeout fails.
2023-09-06 11:41:16 -06:00
Andreas Kling
1c06111cbd LibJS: Add file & line number to bytecode VM stack traces :^)
This works by adding source start/end offset to every bytecode
instruction. In the future we can make this more efficient by keeping
a map of bytecode ranges to source ranges in the Executable instead,
but let's just get traces working first.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2023-09-02 15:37:53 +02:00
Tim Ledbetter
889e6ab43d find: Add the -empty option
This predicate returns true for empty regular files or directories.
2023-09-01 23:48:44 +02:00
Tim Ledbetter
64bb5652a1 find: Add the -newer, -anewer and -cnewer options
These return true if the last modification time, last access time or
creation time of a file is greater than the given reference file.

If the `-L` option is in use and the given reference file is a
symbolic link then the timestamp of the file pointed to by the
symbolic link will be used.
2023-09-01 21:19:22 +02:00
kleines Filmröllchen
a7c770268f Userland: Migrate to String in notification system 2023-09-01 12:06:08 +02:00
Karol Kosek
90af21aef4 LibIMAP+Mail+test-imap: Let a Promise result type be non-optional
The Empty type was used only when parsing a response failed. The
failures will now go to Promise's error type.
2023-08-31 11:10:09 +02:00
Karol Kosek
55d730bd5c LibIMAP+Mail+test-imap: Make Client requests infailable 2023-08-31 11:10:09 +02:00
Tim Ledbetter
fa0606ea36 find: Explicitly specify type when converting to uid_t
This reduces the risk of unintentional conversion errors.
2023-08-29 14:09:44 -04:00
Tim Ledbetter
bc50b629ee find: Don't allow negative GIDs to be passed to the -group option 2023-08-29 14:09:44 -04:00
kleines Filmröllchen
c853a73ae2 aconv: Override encoder in output metadata
After all, we encoded this file :^)
2023-08-29 10:43:34 +02:00
kleines Filmröllchen
4c9c2104f3 aconv: Copy metadata to output
This requires postponing FLAC header finalization, since FLAC cannot
write metadata after a finalized header.
2023-08-29 10:43:34 +02:00
kleines Filmröllchen
b4b411b8a3 LibAudio: Add a sample count hinting mechanism to audio encoding 2023-08-29 10:43:34 +02:00
Tim Ledbetter
aa7c2f1f0d find: Allow unit suffixes to be used with the -size option
The argument supplied to the `-size` option may now be one of the
following suffixes:

* b: 512-byte blocks. This is the default unit if no suffix is used.
* c: bytes
* w: two-byte words
* k: kibibytes (1024 bytes)
* M: mebibytes (1024 kibibytes)
* G: gibibytes (1024 mebibytes)

Sizes are rounded to the specified unit before comparison. The unit
suffixes are case-sensitive.
2023-08-29 09:08:59 +02:00
Tim Ledbetter
9808f8164f find: Use PosixExtended regex syntax instead of PosixBasic
This is the same syntax used by `grep -E`.
2023-08-28 13:43:43 +03:30
Tim Ledbetter
0a02c7a926 find: Add the -regex and -iregex options
These options match a given regular expression against the whole file
path. `-iregex` is identical to `-regex` except it is case-insensitive.
2023-08-28 11:51:14 +03:30
Liav A
5055883b9f Utilities/ps: Add process start time column in full format mode
Just like on Linux, we can easily print the process creation time. The
format of a printed time is either "hour:minute" if the process started
today, or "short_month_name:day_of_the_month" (for example, "Aug26").
2023-08-27 22:53:22 +02:00
Liav A
751aae77bc Kernel: Rename /sys/kernel/variables => /sys/kernel/conf
The name "variables" is a bit awkward and what the directory entries are
really about is kernel configuration so let's make it clear with the new
name.
2023-08-27 22:50:22 +02:00
Tim Ledbetter
94b247ec3c sort: Allow multi-character separators to be given with the -t option 2023-08-27 15:42:46 -04:00
Tim Ledbetter
e6112446db sort: Add the -z option to split lines on \0 rather than a newline 2023-08-27 15:42:46 -04:00
Tim Ledbetter
edd49c1531 find: Add the -readable, -writable and -executable options 2023-08-27 09:46:11 -04:00
Tim Ledbetter
08cb49c2bd useradd: Simplify uid validation 2023-08-26 19:01:22 -04:00
Tim Ledbetter
8955560801 useradd: Allow group name or number to be used with the -g option 2023-08-26 19:01:22 -04:00
Timothy Flynn
edec5b1d91 Ladybird+LibWebView: Migrate input completions to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
5116e97a9d Ladybird+LibWebView: Migrate tooltip changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
78d9339aa9 Ladybird+LibWebView: Migrate scrolling changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
00fe122b0a Ladybird+LibWebView: Migrate cursor changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
bf464665a7 Ladybird+LibWebView: Migrate layout notification to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn
682a5f9b70 Ladybird+LibWebView: Move APIs which only repaint to LibWebView
We can easily add hooks to notify the browsers of these events if any
implementation-specific handling is needed in the future, but for now,
these only repaint the client, which we can do in ViewImplementation.
2023-08-23 09:59:04 -04:00
Timothy Flynn
ea7e1b5f53 Ladybird+LibWebView: Move most of paint handling to LibWebView
Storing the backup bitmap is the same across Browser and Ladybird. Just
peform that work in LibWebView, and handle only the implementation-
specific nuances within the browsers.
2023-08-23 09:59:04 -04:00
Timothy Flynn
15da77f4c4 Ladybird+LibWebView: Migrate file APIs to LibWebView callbacks
This also sets the default callback to do what every non-Serenity
browser is doing, rather than copy-pasting this callback into every
implementation. The callback is still available for any platform which
might want to override the default behavior. For example, OOPWV now
overrides this callback to use FileSystemAccessClient.
2023-08-23 09:59:04 -04:00
Timothy Flynn
ebdcba8b3b Ladybird+LibWebView: Migrate dialog APIs to LibWebView callbacks 2023-08-23 09:59:04 -04:00
Timothy Flynn
60a468d50b sql: Change the short-name flag for the SQLServer path
The short-name 's' is duplicated by another option.
2023-08-18 16:10:17 -04:00
Daniel Bertalan
70fcbcf54b LibELF+readelf: Add missing constants for dynamic relocations
These should cover all relocation types we can possibly see in an x86_64
or AArch64 final linked ELF image.
2023-08-18 16:20:13 +02:00
Poseydon42
333949894e Userland: Add glsl-compiler utility that prints parsed AST 2023-08-18 15:29:48 +02:00
Tim Ledbetter
f6dd512b65 top: Re-enable non-blocking I/O on stdin
Using blocking I/O would cause updates to stop until a key was pressed.
2023-08-18 11:09:27 +01:00
Nicolas Ramz
0986533c11 Meta+Tests: Add a fuzzer and a test for the ILBM decoder 2023-08-15 18:36:11 +01:00
Aliaksandr Kalenik
0d66a80a0f headless-browser: Add ref tests support
The ref tests runner takes screenshots of both the input page and the
expected page, then compares them. Ref testing allows us to catch
painting bugs, which cannot be detected with the layout and text tests
we already have.

With ref tests, we'll likely want to reuse the same expectation page
for multiple inputs. Therefore, there's a `manifest.json` file that
describes the relationship between inputs and expected outputs.
2023-08-14 07:28:22 +02:00
Shannon Booth
21fe86d235 AK: Port URL::m_query from DeprecatedString to String 2023-08-13 15:03:53 -06:00
Liav A
029160fd27 Utilities: Add zcat
This utility is actually a symlink to the gunzip utility.
The gunzip utility is modified to enable writing to stdout when running
through the zcat symlink, to emulate the same behavior on other OSes.

In addition to that, the gunzip utility is now required on a default
installation as it could be a vital utility under some conditions (for
example, downloading source code in a tar.gz file).
2023-08-13 10:16:03 +01:00
kleines Filmröllchen
bb471451e0 aconv: Time transcode duration
This is a good indicator for encode speed.
2023-08-12 12:25:26 -06:00
kleines Filmröllchen
70f31c89a3 aconv: Support FLAC encoding
The main write loop is refactored so that adding further formats via the
new Encoder interface should be much simpler.
2023-08-12 12:25:26 -06:00
kleines Filmröllchen
ae039977d1 LibAudio: Use Encoder interface for WavWriter
The only real change here is the fallibility of the finalization
function, which makes WavWriter's code quite a bit nicer.
2023-08-12 12:25:26 -06:00
Valtteri Koskivuori
6128e859ac LibIMAP+Mail: Propagate errors from LibIMAP and MailWidget
This lets us bubble up errors from `LibIMAP::Client::send_command()`,
which can happen if the connection hangs or is taking a long time, and
the user closes Mail.
2023-08-12 11:45:52 -06:00
ronak69
0787241cdc Utilities: Fix title formatting in man
`String::repeated()` returns a `ErrorOr<String>`, so wrap it in `TRY()`.

This fixes a glitch in the title formatting (`{}` not removed if
`ErrorOr<String>` is directly passed to `outln()`).
2023-08-12 01:50:49 +02:00
Tim Ledbetter
b073d1dd8c usermod: Make error message less verbose 2023-08-08 15:15:43 +02:00
Tim Ledbetter
0875446b38 usermod: Remove premature root user check
This allows the use of `--help`, for example.
2023-08-08 15:15:43 +02:00
Tim Ledbetter
827e23940a usermod: Don't set the EGID to 0
This is unnecessary, as usermod isn't a SUID binary.
2023-08-08 15:15:43 +02:00
Karol Kosek
55b6e07a0f Userland: Open files for save in write-only mode
WavWriter and the shot utility open files with this mode and never
truncate the files, which might leave some contents of a previous file
during overwriting.
2023-08-08 15:13:43 +02:00
Andreas Kling
2eaa528a0e LibJS: Rip out the AST interpreter :^)
This has been superseded by the bytecode VM, which is both faster
and more capable.
2023-08-08 13:07:13 +02:00
Andreas Kling
e2c8d5859e LibJS: Remove ability to disable bytecode VM 2023-08-08 13:07:13 +02:00
Andreas Kling
99ac34eeae Ladybird+LibWebView+Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling
e7e52f95ec headless-browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling
a75b51de10 js: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling
18c54d8d40 LibJS: Make Cell::initialize() return void
Stop worrying about tiny OOMs.

Work towards #20405
2023-08-08 07:39:11 +02:00
Lucas CHOLLET
3f35ffb648 Userland: Prefer _string over _short_string
As `_string` can't fail anymore (since 3434412), there are no real
benefits to use the short variant in most cases.
2023-08-08 07:37:21 +02:00
Lucas CHOLLET
a5edc9cdfc Userland: Prefer _short_string over String::from_utf8_short_string
This user-defined literal is a strictly equivalent but shorter alias to
`String::from_utf8_short_string`.
2023-08-08 07:37:21 +02:00
Andrew Kaster
391beef707 Ladybird: Move Qt-specific classes and functions to a Qt subdirectory
This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.

As a bonus, remove Qt dependency from WebDriver.
2023-08-07 14:58:04 -06:00
Liav A
ccaa423372 Utilities: Add basic Package manager skeleton utility 2023-08-07 13:24:25 -06:00
Andreas Kling
34344120f2 AK: Make "foo"_string infallible
Stop worrying about tiny OOMs.

Work towards #20405.
2023-08-07 16:03:27 +02:00
Andreas Kling
405187993a LibGUI+LibCore: Move GML property system from LibCore to LibGUI
Since Core::Object properties are really only used by GML now that the
Inspector is long gone, there's no need for these to pollute
Core::Object.

This patch adds a new GUI::Object class to hold properties, and makes
it the new base class of GUI::Window, GUI::Widget and GUI::Layout.
The "instantiate an object by name" mechanism that GML uses is also
hoisted into GUI::Object as well.
2023-08-06 18:09:25 +02:00
Tim Ledbetter
7f99f3bf29 fortune: Use simple formatting when stdout isn't connected to a terminal
This changes the default behavior, so that, by default, color codes,
hyperlinks and additional spacing are only emitted when standard
output is connected to a terminal.

The default coloring behavior can be overridden with the `--color`
option. Valid arguments for this option are: 'always', 'never' and
'auto' (default).
2023-08-06 08:58:00 +02:00
Liav A
29fb3a1a60 Utilities/ls: Add an option to print raw inode numbers
This is only possible if listing an entire directory, because the LibC
readdir function will return the raw inode number in each struct dirent,
therefore allowing to print it as well.
2023-08-05 18:41:01 +02:00
Tim Ledbetter
256084b0b9 top: Disable echo and line buffering on startup
This means we no longer show any characters the user types while top
is running.

Disabling line buffering has the same effect as enabling
non-blocking I/O, but it doesn't crash the terminal when we exit the
program without restoring stdin to its original state. This would
previously happen when a SIGKILL signal was received, for example.
2023-08-05 11:08:16 +02:00
Fabian Dellwing
0003381a71 sed: Keep correct owner and permissions with sed -i 2023-08-04 09:02:31 -06:00
Tim Ledbetter
d0fd925126 watch: Use alternate buffer to display output 2023-08-04 05:25:44 +02:00
Tim Ledbetter
ba1c4bc1d1 watch: Use stdout rather than stderr to display output
Previously, the header was printed to stderr.

This matches the behavior of watch on Linux.
2023-08-04 05:25:44 +02:00
Tim Ledbetter
2f3c41e033 watch: Replace LibC function calls with their LibCore equivalents 2023-08-04 05:25:44 +02:00
Andreas Kling
09eed8eea2 LibWeb+headless-browser: Include paint tree in layout test output
This will give us a more comprehensive look at what actually gets
rendered in the end, and also allows us to catch more behavior changes.
2023-08-03 13:21:26 +02:00
Andrew Kaster
506b03740c Ladybird: Move classes and types into the Ladybird namespace
We were super inconsistent about this, with most "new" classes living in
the Ladybird namespace, while "old" ones were in the global namespace,
or even sitting in the Browser namespace.
2023-08-03 09:55:20 +02:00
Andrew Kaster
b5bfe732d7 Ladybird: Add RequestServer process to optionally replace Qt Networking
LibTLS still can't access many parts of the web, so let's hide this
behind a flag (with all the plumbing that entails).

Hopefully this can encourage folks to improve LibTLS's algorithm support
:^).
2023-08-02 05:44:43 +02:00
Andrew Kaster
5062ba347b Ladybird+LibWebView: Move Lagom code to Ladybird, Qt code to Utilities
Re-organize our helper files here a bit, to make a clearer distinction
between Qt-specific helpers and generic non-serenity helpers.

A future commit will move Lagom specific code from LibSQL to ladybird
as well, so that we can see about future generic apis for spawning
helper procesess.
2023-08-02 05:44:43 +02:00
Shannon Booth
25153703c9 headless-browser: Improve error on failure to open expectation file
Mostly to output the path of the file which failed to open. This is
mostly helpful if you create a test, but forget to 'touch' the
expectation path.
2023-07-31 14:48:24 +02:00
Kemal Zebari
590f0f85e0 nohup: Don't leak fd used to open nohup.out
Since we may redirect stdout, stderr, or both to the file description
referring to the nohup.out file, there is no need to keep the fd that
created that file description around.
2023-07-31 10:47:59 +02:00