Commit graph

2162 commits

Author SHA1 Message Date
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
Shannon Booth
8751be09f9 AK: Serialize URL hosts with 'concept-host-serializer'
In order to follow spec text to achieve this, we need to change the
underlying representation of a host in AK::URL to deserialized format.
Before this, we were parsing the host and then immediately serializing
it again.

Making that change resulted in a whole bunch of fallout.

After this change, callers can access the serialized data through
this concept-host-serializer. The functional end result of this
change is that IPv6 hosts are now correctly serialized to be
surrounded with '[' and ']'.
2023-07-31 05:18:51 +02:00
Sam Atkins
8d53442187 LibArchive: Extract logic for calculating ZIP statistics 2023-07-30 22:16:40 +01:00
Shannon Booth
dd373eacbc LibDiff+patch: Support multiple patches in a single patch file
Multiple patches may be concatenated in the same patch file, such as git
commits which are changing multiple files at the same time. To handle
this, parse each patch in order in the patch file, and apply each patch
sequentially.

To determine whether we are at the end of a patch (and not just parsing
another hunk) the parser will look for a leading '@@ ' after every hunk.
If that is found, there is another hunk. Otherwise, we must be at the
end of this patch.
2023-07-30 07:47:22 +01:00
Shannon Booth
ddbd77cca1 run-tests: Correct logic for calculating number of skipped/xfail tests
Skipped tests were mistakenly being considered as expected failures.
2023-07-30 07:47:22 +01:00
Shannon Booth
f893e0820f patch: Support creation of a file
Previously patch would always expect the file that it was patching to
exist (even it were empty). If we know that the patch is creating a file
from nothing (i.e has a start line of '0'), then we treat a file that
doesn't exist as if it has no content lines.
2023-07-30 07:47:22 +01:00
Shannon Booth
81df0278b1 patch+LibDiff: Implement 'strip' of filenames when parsing patch
Implement the patch '-p' / '--strip' option, which strips the given
number of leading components from filenames parsed in the patch header.
If not given this option defaults to the basename of that path.
2023-07-29 17:09:09 -06:00
Shannon Booth
4d8a59f34b patch: Implement d, --directory option
When given, patch will chdir into the given directory before processing
the patch file.
2023-07-29 17:09:09 -06:00
Sergey Bugaev
cd4298ae04 Userland: Teach strace(1) to format pledge(2) 2023-07-29 16:51:58 -06:00
Zaggy1024
66c9696687 LibGfx: Add initial ISO BMFF parsing and a utility to print file info
Currently, the `isobmff` utility will only print the media file type
info from the FileTypeBox (major brand and compatible brands), as well
as the names and sizes of top-level boxes.
2023-07-27 12:02:37 +01:00
Andrew Kaster
5028223c37 Meta+Utilities: Make pre-commit checks significantly less verbose
When markdown-check is built, it outputs hundreds of lines of "ignoring
this and that link because reasons". This is extremely not helpful when
trying to figure out exactly which check failed on your commit. Also
remove the timing numbers from lint-ci.sh These are just noise and also
don't help to figure out which pre-commit check failed. Ideally the
output on fail should be "[OK]: Check A" for all the passing checks and
"[FAIL] Check N" with the required context for the failed check.
2023-07-26 06:21:39 -04:00
Tim Ledbetter
ea411774f0 truncate: Clamp file size to 0 when using the -s option
When using the `-s` option to reduce the size of a file, the file size
is now set to zero if the argument given would result in a file
size less than zero.

This matches the behavior of truncate on Linux and FreeBSD.
2023-07-26 08:42:05 +02:00
Tim Ledbetter
8e79afebb9 truncate: Allow size suffixes to be used with the -s option
The base 2 size suffixes: 'K', 'M' and 'G' may now be used when
specifying a file size with the `-s` option.
2023-07-26 08:42:05 +02:00
Tim Ledbetter
fb27702981 truncate: Remove unnecessary includes
These are no longer necessary, as we are now using LibCore syscall
wrappers.
2023-07-26 08:42:05 +02:00
Tim Ledbetter
0ae92cdaa0 truncate: Prefer StringView over DeprecatedString 2023-07-26 08:42:05 +02:00
Andreas Kling
72516ca101 js: Run with the JavaScript bytecode VM by default
The AST interpreter is still available behind a new `--ast` flag.
2023-07-25 20:00:46 +02:00
Andreas Kling
c3e5487f00 headless-browser: Run with the JavaScript bytecode VM by default
The AST interpreter is still available behind a new `--ast` flag.
2023-07-25 20:00:46 +02:00
Nico Weber
4bb29e6ac4 pdf: Add a --debugging-stats flag
Tries to render all pages of a PDF and then produces a report on which
unimplemented things were encountered.

Example, for pdf_reference_1-7.pdf:

    113 times: Rendering of feature not supported: Type0 font not imp...
        on pages: 170 (3x) 217 (2x) 250 (9x) 252 (2x) 329 (6x)...
    21 times: Rendering of feature not supported: unknown color space
        on pages: 489 (4x) 490 (5x) 491 (3x) 492 (5x) 493 (4x)
    4 times: Rendering of feature not supported: CCITTFaxDecode Filte...
        on pages: 494 (4x)

(Actually, rendering crashes for some page in that file at the moment.
This was with a local change to only render the first 800 pages to work
around that. So this is also good for finding crashes.)
2023-07-24 11:00:01 -04:00
Shannon Booth
af60c740e3 LibTest: Add support for xfail JavaScriptTestRunner tests
This is meant to be used in a similar manner to skipping tests, with the
extra advantage that if the test begins passing unexpectedly, the test
will fail.

Being notified of unexpected passes allows for the test to be updated to
the correct expectation.
2023-07-23 07:36:13 +02:00
Andreas Kling
5d6169793a Ladybird+LibWebView: Respawn with same JS interpreter after crash
WebView::ViewImplementation now remembers which JS interpreter it
started with, and uses the same setting if the WebContent process
crashes and we have to spawn a new one.
2023-07-22 08:49:59 -04:00
Tim Ledbetter
6710622bf7 file: Add -b option to omit file name from output 2023-07-21 19:32:43 -04:00
Timothy Flynn
77d7f715e3 LibJS+CI: Remove bytecode optimization passes for now
These passes have not been shown to actually optimize any JS, and tests
have become very flaky with optimizations enabled. Until some measurable
benefit is shown, remove the optimization passes to reduce overhead of
maintaining bytecode operations and to reduce CI churn. The framework
for optimizations will live on in git history, and can be restored once
proven useful.
2023-07-21 19:47:36 +03:30
Tim Ledbetter
73a6f2e9ed ps: Add the -o option to specify a user-defined column format
This option allows the user to change which colums are displayed
by giving comma or space separated list of column format specifiers.

A column format specifier is of the form: `COLUMN_NAME[=COLUMN_TITLE]`.
Where `COLUMN_NAME` is any of: uid, pid, ppid, pgid, sid, state, tty,
or cmd. Specifying a `COLUMN_TITLE` will change the name shown in the
column header.

`COLUMN_TITLE` may be blank. If all given column titles
are blank, the header is omitted.
2023-07-19 11:21:59 +01:00
Tim Ledbetter
cdb15a20ff ps: Select user-specified processes only when the -q option is used
This fixes a logic bug which allowed processes not specified by the
user to be selected when the `-q` option was used. This caused the
program to crash when sorting processes into the correct order.
2023-07-19 11:21:59 +01:00
MacDue
b5658d75f5 Fuzzers: Add a DDS fuzzer 2023-07-19 06:52:06 +02:00
MacDue
581236b24a Fuzzers: Add a TinyVG fuzzer 2023-07-19 06:52:06 +02:00
Shannon Booth
2b46e6f664 Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2023-07-15 16:21:29 +02:00
Shannon Booth
5625ca5cb9 AK: Rename URLParser::parse to URLParser::basic_parse
To make it more clear that this function implements
'concept-basic-url-parser' instead of 'concept-url-parser'.
2023-07-15 09:45:16 +02:00
Lucas CHOLLET
15bd708cfd file: Use the mime-type description provided by LibCore
This allows us to get rid of another mime-type list in the codebase.

To do so, the `get_description_from_mime_type` function is introduced in
this patch.
2023-07-14 17:33:06 +01:00
Nico Weber
e78ea08ed9 pdf: Make --dump-contents print all objects referenced by page too 2023-07-13 20:29:58 +02:00
Shannon Booth
e838b6c8cc patch: Add the beginnings of a patch utility
This is still very bare bones, and there is _much_ more to still
handle. However, this implements enough functionality to parse a single
unified patch read from stdin, and apply it to a file.
2023-07-13 10:29:30 +01:00
Tim Ledbetter
6d2f9f0316 less: Replace LibC calls with their LibCore equivalents 2023-07-13 10:26:13 +02:00
Tim Ledbetter
e0fcfc8a99 less: Ignore SIGINT signals
This matches the behavior of less on Linux and FreeBSD.
2023-07-13 10:26:13 +02:00
Tim Ledbetter
7b0da10dd5 less: Restore original terminal state when SIGTERM is received 2023-07-13 10:26:13 +02:00
Nico Weber
62013f2008 pdf: Minorly tweak a help text 2023-07-13 04:53:59 +02:00
Nico Weber
52ff180ed4 pdf: Add --dump-contents flag
This dumps the /Content stream of a page, which is possibly useful for
debugging.
2023-07-12 18:22:35 -04:00
Nico Weber
16c1a6a447 pdf: Alphabetize options 2023-07-12 18:22:35 -04:00
Sebastian Zaha
88872ca42d LibIPC: Do not leak the Core::File fd by default
This prevents fd leaks when the user of the API forgets to pass
CloseAfterSending to IPC::File. Since we are calling leak_fd in the
constructor, we want it to also take care of closing.
2023-07-12 18:22:18 -04:00
Nico Weber
c3f78d9561 pdf: Add function to render a page of a PDF to a bitmap
Use like so:

    Build/lagom/bin/pdf --render foo.png --page=50 path/to.pdf
2023-07-12 07:54:28 +01:00
Kemal Zebari
20c59a143c Utilites: Implement nohup
This snapshot implements the nohup command-line utility.
2023-07-12 10:11:24 +03:30
Nico Weber
c781686198 pdf: Add a --password option for encrypted PDFs 2023-07-12 06:28:15 +02:00
Nico Weber
f418605ec7 pdf: Print PDF version; tweak output 2023-07-11 13:49:17 -04:00
Valtteri Koskivuori
f2ce47e3a1 Userland: Sync file utility descriptions with LibCore
Added descriptions for the following formats: icc, bzip2, SerenityOS
Spreadsheet, svg, tiff, targa, css, csv, html, plaintext, webm
2023-07-11 17:48:57 +01:00
Valtteri Koskivuori
2c6b156803 Userland: Teach the file utility about zip files
It now shows a short description with a file and directory counts, and
the total content size uncompressed.
2023-07-11 17:48:57 +01:00
Tim Ledbetter
4e7e878606 ps: Add --ppid option to filter by parent PID 2023-07-11 13:02:08 +01:00
Tim Ledbetter
d3c5ae0860 ps: Add -t option to filter by TTY 2023-07-11 13:02:08 +01:00
Tim Ledbetter
aeb87d6e78 ps: Allow multiple filtering options to be used simultaneously
Previously, it was assumed that only one filtering option, such as
`-u` or `-p` would be used at a time. With this PR, processes are now
shown if they match any of the specified filters.
2023-07-11 13:02:08 +01:00
Tim Ledbetter
a758e27153 ps: Disallow using -q with any other filtering options
This matches the behavior of `ps` on Linux.
2023-07-11 13:02:08 +01:00
Nico Weber
c8e0db5061 pdf: Print info dict metadata if present 2023-07-10 17:49:07 +01:00
Caoimhe
9204a60397 zip: Move away from DeprecatedString 2023-07-08 13:14:50 +01:00
Caoimhe
f222028f79 zip: Use the helpers in ZipOutputStream for adding files 2023-07-08 13:14:50 +01:00
Timothy Flynn
c911781c21 Everywhere: Remove needless trailing semi-colons after functions
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Sebastian Zaha
d77986f01c headless-browser: Ensure IPC::File is closed after sending
On systems with the default ulimit for open files <= 256 (default
on some systems) the LibWeb tests were crashing because the
input file handles are not closed in headless-browser.
2023-07-08 06:11:08 +02:00
Shannon Booth
84b187e375 diff: Only output a unified/context header if there is a diff 2023-07-06 13:22:37 +02:00
kleines Filmröllchen
d7a2b5e65b markdown-check: Allow generating a manpage link graph
Using the cross-page links, we can generate a directed graph showing the
topology of which pages refer to other pages. This is not just for fun:
the links show how often a page is linked (since links are not
deduplicated on purpose), which pairs of pages only have links in one
direction (where a link in the other direction may be useful), which
groups of closely-interlinked pages exist, and which pages have few or
no links to other pages.

The EXTRA_MARKDOWN_CHECK_ARGS argument to the check-markdown script can
be used to inject the -g flag for generating the graph on all manpages.
2023-07-05 16:15:42 +01:00
kleines Filmröllchen
a9053618a8 LibManual: Allow directly obtaining any page's main section number
This has previously been incorrectly handled in a variety of
applications, e.g. subsections were not accounted for.
2023-07-05 16:15:42 +01:00
Shannon Booth
c57658fffa diff: Allow configurable context for unified and context diffs
Add the options '-C','--context' and '-U','--unified', which can be used
to ask diff to write a diff in that format with a given number of
context lines surrounding the diff.
2023-07-05 10:26:48 +01:00
Liav A
83ebd1882f Utilities: Add the memstat utility
This small utility is something we probably needed for a very long
time - a way to print memory statistics in an elegant manner.

This utility opens /sys/kernel/memstat, reads it and decode the values
into human readable entries, possibly even into human-readable sizes.
2023-07-05 08:34:51 +02:00
Liav A
b74cb569ec Utilities/allocate: Modernize the code a bit
Use LibCore ArgsParser to parse the parameters instead of using the raw
strings from the argv (Main::Arguments) array.

Also, use indicative names for variables in the code so the utility code
is more understandable.
2023-07-05 08:34:51 +02:00
MacDue
ff402b1b42 file: Add a description for the image/tinyvg mime type 2023-07-04 12:04:32 +02:00