Commit graph

2141 commits

Author SHA1 Message Date
Tim Ledbetter
e86dd1cc89 usermod: Return error if -L and -U options are used simultaneously 2023-06-26 19:31:09 +02:00
Tim Ledbetter
ba34931620 strings: Don't bail immediately on error
Previously, strings would exit immediately if there was an error
changing file ownership. We now print an error to stderr and
continue when an error occurs.
2023-06-26 19:28:42 +02:00
Tim Ledbetter
c723101728 strings: Add -o option as an alias for -t o 2023-06-26 19:28:42 +02:00
Tim Ledbetter
a2fb0768ff strings: Add commonly used long option names for -n and -t 2023-06-26 19:28:42 +02:00
Tim Ledbetter
ab1e8a7b91 strings: Replace the -p option with the more commonly used -f
Previously, the `-p` option printed the path of the file being
processed before any strings for that file. The `-f` prints the file
path before each string . This matches the behavior of strings on
Linux and FreeBSD.
2023-06-26 19:28:42 +02:00
Tim Ledbetter
6aa87e2119 env: Add -u option to unset environment variables 2023-06-26 19:27:45 +02:00
Shannon Booth
ee92378b80 LibDiff: Make Diff::from_text fallible 2023-06-26 19:26:34 +02:00
Shannon Booth
84e8ff34a2 diff: Use StringView instead of DeprecatedString 2023-06-26 19:26:34 +02:00
Tim Ledbetter
96fecc434c chgrp: Add support for multiple file paths 2023-06-26 19:26:20 +02:00
kleines Filmröllchen
03fac609ee AudioServer+Userland: Separate audio IPC into normal client and manager
This is a sensible separation of concerns that mirrors the WindowServer
IPC split. On the one hand, there is the "normal" audio interface, used
for clients that play audio, which is the primary service of
AudioServer. On the other hand, there is the management interface,
which, like the WindowManager endpoint, provides higher-level control
over clients and the server itself.

The reasoning for this split are manifold, as mentioned we are mirroring
the WindowServer split. Another indication to the sensibility of the
split is that no single audio client used the APIs of both interfaces.
Also, useless audio queues are no longer created for managing clients
(since those don't even exist, just like there's no window backing
bitmap for window managing clients), eliminating any bugs that may occur
there as they have in the past.

Implementation-wise, we just move all the APIs and implementations from
the old AudioServer into the AudioManagerServer (and respective clients,
of course). There is one point of duplication, namely the hardware
sample rate. This will be fixed in combination with per-client sample
rate, eliminating client-side resampling and the related update bugs.
For now, we keep one legacy API to simplify the transition.

The new AudioManagerServer also gains a hardware sample rate change
callback to have exact symmetry on the main server parameters (getter,
setter, and callback).
2023-06-25 00:16:44 +02:00
Shannon Booth
f2881f4662 headless-browser: Use Diff::write_normal to output hunks
Saving a bunch of code :^)

The "Hunk:" text is preserved as there is no real need for the browser
test harness to be producing valid patch files.
2023-06-24 18:34:08 +02:00
Shannon Booth
2b56aefaed diff: Use Diff::write_normal to output hunks
Saving a bunch of code :^)
2023-06-24 18:34:08 +02:00
Shannon Booth
312de21498 diff: Remove "Hunk:" text from output
While this is a useful piece of information it means that diff is
producing hunks that are not of a valid normal diff format. This breaks
the ability to redirect the output of diff to a file to generate a
patch.
2023-06-24 18:34:08 +02:00
Tim Ledbetter
702054dcbc wc: Add -L option to show the length of the longest line
If more than one file is specified on the command line and the `-L`
option is used, the totals field will show the longest line
encountered; it is not a sum like the other values.
2023-06-23 06:24:33 +02:00
Tim Ledbetter
e259c3b38a dirname: Add support for multiple paths 2023-06-22 17:26:51 -04:00
Tim Ledbetter
828caf12a6 dirname: Add -z option for null terminated output 2023-06-22 17:26:51 -04:00
Tim Ledbetter
c1c35f4f59 mkdir: Add -v option to print a message for each created directory 2023-06-22 22:35:30 +02:00
Tim Ledbetter
925ea4e854 mkdir: Replace LibC function calls with LibCore equivalents 2023-06-22 22:35:30 +02:00
Jelle Raaijmakers
56da2c5db6 aconv: Remove usage of ancient Core::DeprecatedFile
That'll teach me for merging without waiting for CI :^)
2023-06-22 21:53:00 +02:00
kleines Filmröllchen
57b3858fbc Utilities: Add aconv for converting between audio formats
The intention for this utility is to eventually become a general-purpose
multimedia conversion tool like ffmpeg (except probably not with as many
supported formats, stream mappings and filters). For now, we can not
write any video format so the added complexity is not necessary at the
moment.
2023-06-22 21:45:54 +02:00
Andreas Kling
6537ed8fff LibJS/Bytecode: Simplify Bytecode::Interpreter lifetime model
The JS::VM now owns the one Bytecode::Interpreter. We no longer have
multiple bytecode interpreters, and there is no concept of a "current"
bytecode interpreter.

If you ask for VM::bytecode_interpreter_if_exists(), it will return null
if we're not running the program in "bytecode enabled" mode.

If you ask for VM::bytecode_interpreter(), it will return a bytecode
interpreter in all modes. This is used for situations where even the AST
interpreter switches to bytecode mode (generators, etc.)
2023-06-22 21:16:17 +02:00
Lucas CHOLLET
b7c30f3096 image: Support JPEG as an output format 2023-06-22 21:13:04 +02:00
Tim Ledbetter
e3ade95d24 pro: Change the download speed reporting interval to 1000 ms
This gives a good balance between update frequency and readability.
2023-06-22 06:46:48 +02:00
Tim Ledbetter
35169ef640 pro: Ensure that progress reporting intervals are respected
The `report_time_in_ms` and `speed_update_time_in_ms` variables
weren't previously being respected. This was causing the progress
display to update too frequently, making it difficult to read.
2023-06-22 06:46:48 +02:00
Optimoos
4ed7456486 Ping: Add TTL config option and value to output
This change adds the TTL value of the inbound packet to the output of
the userland ping program, bringing it more in line with other common
ping utilities. It also adds the (optional) -t option to configure the
TTL of the outgoing packet if desired.
2023-06-22 00:14:56 +02:00
Tim Ledbetter
16fcbe555e touch: Don't bail immediately on error
Previously, touch would exit immediately if there was an error
changing file permissions. We now print an error to stderr and
continue when an error occurs.
2023-06-22 00:09:26 +02:00
Fabian Dellwing
a14dc9b569 sed: Fix unveil error for every run
`FileSystem::absolute_path()` does `stat` the file, this commit runs
all `absolute_path` calls before touching the veil to make sure this
works as intended.
2023-06-21 06:53:29 -04:00
Tim Ledbetter
09787dbf27 groupadd: Add -U option for adding members to a new group 2023-06-21 12:27:46 +02:00
Andreas Kling
a0b4987e92 headless-browser: Paint while running layout tests (but discard results)
If we don't paint, SVG-as-image documents don't get laid out, and so
have 0x0 size throughout.

This change is also generally nice, as it makes the painting code run
on all the layout tests, increasing coverage. :^)
2023-06-20 11:34:09 +02:00
Fabian Dellwing
79d3942012 sed: Allows the usage of escaped delimiters
This allows us to parse the sed script `s/\//S/g` successful.
2023-06-20 10:47:02 +02:00
kleines Filmröllchen
2e4bb2941d Utilities: Add pixelflut, a Pixelflut protocol client
For the meme and for GPN.
2023-06-20 00:22:03 +02:00
Tim Ledbetter
cba46a2d64 rmdir: Add -v option to list each directory as it is removed 2023-06-19 22:52:15 +02:00
Tim Ledbetter
307dc00ee0 rmdir: Add -p option to remove all directories in each given path 2023-06-19 22:52:15 +02:00
Tim Ledbetter
b471ddfa73 groupdel: Ensure the veil is closed after required files are unveiled 2023-06-19 18:56:36 +02:00
Tim Ledbetter
d89e23d63e ping: Don't call exit() from within closing_statistics()
This improves readability slightly, as it isn't immediately obvious
that calling this function terminates the program.
2023-06-19 06:15:40 +02:00
Tim Ledbetter
e74324ad34 ping: Don't wait before displaying closing statistics
Previously, we would wait for the ping interval after the last ping
before displaying the closing statistics. We now display the closing
statistics and exit as soon as the required number of pings has been
performed.
2023-06-19 06:15:40 +02:00
Tim Ledbetter
834dc3747c ping: Avoid overflow for large interval values
Previously `usleep()` was being used, which takes a 32-bit integer
number of microseconds as a parameter. This caused an overflow for
intervals larger than 4294 seconds. We now use `clock_nanosleep()`
instead and ensure the user cannot specify a value larger than
`UINT32_MAX` seconds.
2023-06-19 06:15:40 +02:00
Tim Ledbetter
907e0b9e1d chown: Don't bail immediately on error
Previously, chown would exit immediately if there was an error
changing file ownership. We now print an error to stderr and
continue when an error occurs.
2023-06-19 06:14:02 +02:00
Tim Ledbetter
1a17e08f87 Everywhere: Correctly report progress of downloads larger than 4GiB
This commit changes the variables used to represent the size and
progress of downloads from u32 to u64. This allows `pro` and
`Browser` to report the total size and progress of a download
correctly for downloads larger than 4GiB.
2023-06-19 06:13:19 +02:00
Tim Ledbetter
0cea1a3baf chmod: Don't bail immediately on error
Previously, chmod would exit immediately if there was an error
changing file permissions. We now print an error to stderr and
continue when an error occurs.
2023-06-18 20:34:04 +02:00
Ben Wiederhake
0184fc5e43 Everywhere: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes 2023-06-18 08:47:51 +01:00
Andreas Kling
9c568282dc Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM
This required quite a bit of plumbing, but now you can run

    ladybird --use-bytecode
2023-06-17 14:16:45 +02:00
tgsm
c30775522e LibCompress/Gzip: Replace usage of DeprecatedString 2023-06-17 06:44:16 +02:00
Andreas Kling
58478d572f headless-browser: Bump test timeout from 5s to 15s
We're seeing occasional timeouts on the very first test when running
on CI. Let's try giving it more time to see if it goes away. :^)
2023-06-16 17:43:14 +02:00
Andreas Kling
d063f35afd LibJS/Bytecode: Leave GlobalDeclarationInstantiation in C++
Don't try to implement this AO in bytecode. Instead, the bytecode
Interpreter class now has a run() API with the same inputs as the AST
interpreter. It sets up the necessary environments etc, including
invoking the GlobalDeclarationInstantiation AO.
2023-06-16 08:40:45 +02:00
Tim Ledbetter
17fe2c4822 pkill: Add -O option to filter processes by age
This option allows the user to specify a number of seconds. Only
processes older than the given number of seconds are killed.
2023-06-16 07:22:45 +02:00
Tim Ledbetter
aa79a4ed9a pkill: Add -o option to kill the oldest matching process only 2023-06-16 07:22:45 +02:00
Tim Ledbetter
519893d31f pkill: Add -n option to kill the newest matching process only 2023-06-16 07:22:45 +02:00
Tim Ledbetter
0621a83cb4 pkill: Allow signal names to be used with the -s option 2023-06-16 07:22:45 +02:00
Tim Ledbetter
0d71db6721 pkill: Initialize display_number_of_matches to false
This ensures the number of matches is not displayed when the `-c`
option is not specified.
2023-06-16 07:22:45 +02:00
Romain Chardiny
dc65a2f2b8 unzip: Add option to list files of an archive 2023-06-15 21:01:51 +01:00
Valtteri Koskivuori
94bcb5bea8 Userland: Propagate errors from file detail providers in file utility
They already return ErrorOr<T>, so we can just use TRY() instead of
manually checking for errors.
2023-06-14 11:18:22 -04:00
Valtteri Koskivuori
e56098f734 LibCore+Userland: Remove uses of DeprecatedString in file utility
Mainly replacing DeprecatedString with StringView, since the actual mime
type and description texts are just static strings anyway.
2023-06-14 11:18:22 -04:00
Nico Weber
0db8ac7465 image: Add a --move-alpha-to-rgb flag
I didn't put this as a method on Bitmap since it doesn't seem generally
useful.  Easy to move the impl over to Bitmap in the future if we want
to use it elsewhere.
2023-06-14 08:30:06 +02:00
Nico Weber
ca35b5d767 image: Add a --strip-alpha flag
It can be used to look at an input image without its alpha channel.
2023-06-14 08:30:06 +02:00
Hendiadyoin1
02c4b69f16 cal: Don't pretend ConfigServer returns a StringView 2023-06-13 01:49:02 +02:00
Andreas Kling
b86ca27692 headless-browser: Improve output for failing tests a bit
- Colorize the "Test failed" part when stdout is a TTY
- Add missing newlines in the output
2023-06-12 11:52:58 +02:00
Tim Ledbetter
1e21e95a1b pkill: Add --ignore-case as an alias for the -i option 2023-06-10 07:35:52 +02:00
Tim Ledbetter
69b6c6f62c pkill: Add -x option to only select exact matches 2023-06-10 07:35:52 +02:00
Tim Ledbetter
a253be6abf pkill: Add -U option to filter matches by UID or login name 2023-06-10 07:35:52 +02:00
Tim Ledbetter
caa7edff92 pkill: Add -c option to print the number of matches 2023-06-10 07:35:52 +02:00
Tim Ledbetter
6753cf8b20 pkill: Print errors when killing a process to stderr 2023-06-10 07:35:52 +02:00
Oskar Skog
edd847798a man: Use /bin/Shell as shell in non-POSIX mode
This fixes an issue where man breaks if you symlink `sh` to a different
shell because:
1: The target of the symlink isn't `unveil`ed.
2: The option `--skip--shellrc` isn't understood by other shells while
   at the same time being required for Shell when invoked in POSIX
   compatibility mode.

This also restores the shell used by man to the non-POSIX mode as before
beaae6b420.
2023-06-10 07:14:08 +02:00
Tim Ledbetter
b863332415 pgrep: Add -O option to filter processes by age
This option allows the user to specify a number of seconds. Only
processes older than the given number of seconds are selected.
2023-06-10 07:13:25 +02:00
Tim Ledbetter
d03aaddb55 pgrep: Add -o option to display the oldest matching process only 2023-06-10 07:13:25 +02:00
Tim Ledbetter
47b530fa71 pgrep: Add -n option to display the newest matching process only 2023-06-10 07:13:25 +02:00
Lucas CHOLLET
aa8b8ddd57 nl: Don't output a new line on empty file 2023-06-09 17:24:59 +02:00
Lucas CHOLLET
bccd12f297 nl: Use the Stream API instead of a FILE * 2023-06-09 17:24:59 +02:00
Lucas CHOLLET
14826ced68 cut: Use the Stream API instead of a FILE * 2023-06-09 17:24:59 +02:00
Lucas CHOLLET
9ab8200b89 wc: Use the Stream API instead of a FILE * 2023-06-09 17:24:59 +02:00
implicitfield
71b184accf Meta+Lagom: Enable CMAKE_BUILD_WITH_INSTALL_RPATH
On macOS, CMake incorrectly tries to add and/or remove rpaths from files
that it has already processed when it performs installation. Setting the
rpaths during the build process ensures that they are only set once, and
as a bonus, makes installation slightly more performant.

Fixes #10055.
2023-06-08 17:59:53 +02:00
Monroe Clinton
ff970e9295 mknod: Add option for specifying file permissions 2023-06-07 01:01:58 +02:00
Monroe Clinton
704d289851 mknod: Use ArgsParser for argument parsing 2023-06-07 01:01:58 +02:00
Karol Kosek
c0be5bc070 dd: Print elapsed time and write speed after copying 2023-06-07 00:45:26 +02:00
Karol Kosek
4020892945 dd: Make status=noxfer still print some statistics 2023-06-07 00:45:26 +02:00
Karol Kosek
2f6c99dce5 dd: Show statistics also after receiving an interrupt signal 2023-06-07 00:45:26 +02:00
Tim Ledbetter
f0edf00dc0 kill: Parse multi-digit signal numbers correctly 2023-06-07 00:24:09 +02:00
Tim Ledbetter
78fbe28070 kill: Don't show SIGINVAL or SIGCANCEL in the signal list 2023-06-07 00:24:09 +02:00
Tim Ledbetter
2ffdd3e7c1 kill: Don't parse SIGINVAL as signal 0 2023-06-07 00:24:09 +02:00
Tim Ledbetter
c1b3b4d6d8 kill: Replace LibC kill call with LibCore equivalent 2023-06-07 00:24:09 +02:00
Ben Wiederhake
f20d04726a LibFileSystem+Everything: Remove resolve_executable_from_environment 2023-06-06 23:46:36 +02:00
CanadaHonk
2cd4f135f0 js: Add --use-test262-global option
Add --use-test262-global option to expose the test262 global object
instead of normal script object.
2023-06-06 12:09:10 +02:00
CanadaHonk
31a7dabf02 js: Add --disable-debug-output option
Added option to disable debug output (eg unhandled Promise rejections)
to the JS repl.
2023-06-06 00:07:20 +02:00
Liav A
b40b1c8d93 Kernel+Userland: Ensure proper unveil permissions before using rm/rmdir
When deleting a directory, the rmdir syscall should fail if the path was
unveiled without the 'c' permission. This matches the same behavior that
OpenBSD enforces when doing this kind of operation.

When deleting a file, the unlink syscall should fail if the path was
unveiled without the 'w' permission, to ensure that userspace is aware
of the possibility of removing a file only when the path was unveiled as
writable.

When using the userdel utility, we now unveil that directory path with
the unveil 'c' permission so removal of an account home directory is
done properly.
2023-06-02 17:53:55 +02:00
Daniel Bertalan
e77ce26ff1 run-tests: Unlink coredumps in self-test mode
This ensures that the RAM does not fill up with already processed
coredumps when many tests crash (as is the case on AArch64). We only
do this in self-test mode so as to avoid racing CrashDaemon.
2023-06-01 09:04:20 +02:00
Tim Ledbetter
f5da6d61b4 pgrep: Add -x option to only select exact matches 2023-05-31 06:04:48 +02:00
Tim Ledbetter
821bf5e071 pgrep: Add -U option to filter matches by UID or login name 2023-05-31 06:04:48 +02:00
Tim Ledbetter
cb6a2d60d3 pgrep: Add -l option to list the process name as well as its pid 2023-05-31 06:04:48 +02:00
Tim Ledbetter
ad851706ab pgrep: Add -c option to show the number of matches 2023-05-31 06:04:48 +02:00
Tim Ledbetter
f95e6ee849 pgrep: Add --ignore-case as an alias for the -i option 2023-05-31 06:04:48 +02:00
Tim Ledbetter
8706c88370 pgrep: Return 1 rather than 0 if there are no matches
This matches the behavior of `pgrep` on Linux.
2023-05-31 06:04:48 +02:00
Tim Ledbetter
cd08870a64 killall: Continue killing processes if kill() call fails 2023-05-31 06:00:45 +02:00
Tim Ledbetter
d97614a31e killall: Don't parse SIGINVAL as signal 0 2023-05-31 06:00:45 +02:00
Tim Ledbetter
4934a1b702 killall: Prefer StringView over DeprecatedString 2023-05-31 06:00:45 +02:00
Tim Ledbetter
269310268d watch: Avoid overflow for large interval values
Previously `usleep()` was being used, which was being passed a 32-bit
signed integer as a parameter. This caused an overflow for intervals
larger than 2147 seconds.
2023-05-29 14:11:49 +02:00
Ben Wiederhake
ffc52b35fc userdel: Removal of files does not require creation rights 2023-05-29 13:45:01 +02:00
Andreas Kling
549260d311 headless-browser: Disable content filtering when running tests
URL filtering was taking up a huge amount of time when burning through
the tests. We're not gonna have a bunch of ads to block in our local
tests, so let's just turn it off when running them.
2023-05-28 22:03:57 +02:00
Andreas Kling
ad6027433d headless-browser: Print a diff when a test failure occurs
This will make it a lot easier to understand what went wrong, especially
when the failure occurs on CI but not at home.

And of course, use LibDiff to generate the diff! :^)
2023-05-28 22:03:57 +02:00
Andreas Kling
097b5e4803 WebContent+headless-browser: Use document.body.innerText for text tests
This should be less fickle than the "select all & copy selected text"
trick we were doing earlier.
2023-05-28 22:03:57 +02:00
Daniel Bertalan
4ff30a7302 LibTest: Use the 16 standard ANSI colors in status output
Neither Azure Pipelines' log viewer, nor macOS Terminal.app support full
24-bit RGB color codes, causing the text output to be displayed
incorrectly. Fix this by using one of the 16 standard colors.

Most terminal emulators use a relatively dark shade for red by default,
as seen in the "ANSI escape code" Wikipedia article, so change the
foreground color to white to preserve contrast.
2023-05-28 06:31:59 -07:00
Andreas Kling
f5bf53bc99 LibWasm: Create AK::StackInfo once per AbstractMachine
This makes test-wasm about 20% faster on my Linux machine :^)
2023-05-28 13:20:56 +02:00
Andreas Kling
6c81b90e5a headless-browser: Call fflush() between tests when running on TTY
This allows us to see the full test name without getting cut off by
stdio buffering. :^)
2023-05-28 08:03:52 +02:00
Andreas Kling
f7eb8eed34 Ladybird: Run all layout & text tests in the same process
Instead of starting a new headless-browser for every layout & text test,
headless-browser now gets a mode where it runs all the tests in a single
process.

This is massively faster on my machine, taking a full LibWeb test run
from 14 seconds to less than 1 second. Hopefully it will be a similarly
awesome improvement on CI where it has been soaking up more and more
time lately. :^)
2023-05-27 21:28:05 +02:00
Andreas Kling
3389eed59c headless-browser: Add a --dump-text mode for simplified run & dump tests
This dumps the text content of the page (via a cheesy "select all" +
"get selected text" maneuver) :^)
2023-05-27 14:03:49 +02:00
kleines Filmröllchen
effcd080ca Userland: Remove remaining users of Duration::now_realtime()
This is a clear sign that they want to use a UnixDateTime instead.

This also adds support for placing durations and date times into SQL
databases via their millisecond offset to UTC.
2023-05-24 23:18:07 +02:00
kleines Filmröllchen
82c681e44b LibTimeZone+Userland: Change timezone functions to use UnixDateTime
This incurs a whole host of changes in, among others, JavaScript Intl
and Date.
2023-05-24 23:18:07 +02:00
kleines Filmröllchen
939600d2d4 Kernel: Use UnixDateTime wherever applicable
"Wherever applicable" = most places, actually :^), especially for
networking and filesystem timestamps.

This includes changes to unzip, which uses DOSPackedTime, since that is
changed for the FAT file systems.
2023-05-24 23:18:07 +02:00
kleines Filmröllchen
213025f210 AK: Rename Time to Duration
That's what this class really is; in fact that's what the first line of
the comment says it is.

This commit does not rename the main files, since those will contain
other time-related classes in a little bit.
2023-05-24 23:18:07 +02:00
Nico Weber
5934c4ebfb image: Add --no-output flag to omit output writing
This is useful for timing just decoder performance.

(It'd be nice to add a `-t` flag that prints timings for all
the different phases, but for now just disabling writing is
sufficient for me.)
2023-05-24 16:01:09 +02:00
Nico Weber
32ad77b8c7 image: Remove no-longer-needed comment
The future is now, and Bitmap::load_from_file() can't do the things that
`image` now does.
2023-05-24 16:01:09 +02:00
Nico Weber
6f2e62ba2a Utilities: Use elapsed_milliseconds() instead of elapsed()
No behavior change.
2023-05-24 15:50:43 +02:00
Tim Ledbetter
72e1e38fb8 Utilities/w: Add -h option to optionally hide the header 2023-05-24 05:55:44 +02:00
Tim Ledbetter
9596346528 Utilities/w: Add the ability to filter by username 2023-05-24 05:55:44 +02:00
Tim Ledbetter
d2ec82d4f9 Utilities/w: Display the TTY pseudo name in the "TTY" column
This matches the format used by `ps`.

If we cannot determine the TTY
pseudo name we fall back to the full device name, as shown previously.
2023-05-24 05:55:44 +02:00
Tim Ledbetter
2dbc7e4fff Utilities/w: Convert TTY string from /var/run/utmp to TTY pseudo name
Previously, we were comparing the "tty" value from
`/sys/kernel/processes` to the TTY value from
`/var/run/utmp` directly.  This caused the "WHAT" column to always show
"N/A", because the former is the TTY pseudo name, while the latter is
the full device name.
2023-05-24 05:55:44 +02:00
Tim Ledbetter
826894a89c Utilities/w: Port to String 2023-05-24 05:55:44 +02:00
Tim Ledbetter
72c5c3ac77 Utilities/w: Replace LibC function calls with modern equivalents 2023-05-24 05:55:44 +02:00
Tim Schumacher
0f2b6345c6 test-fuzz: Add all the missing fuzzers 2023-05-23 06:11:33 +02:00
Tim Schumacher
faa08ef1a1 test-fuzz: Don't include all fuzzers into the same .cpp file
Instead, use the approach from BuggieBox to compile in the .cpp files
separately.
2023-05-23 06:11:33 +02:00
Tim Ledbetter
f3a6da580f du: Continue enumerating directories on error
Previously, the program would exit if a directory couldn't be read. We
now write an error message to stderr and continue.
2023-05-23 01:45:10 +02:00
Tim Ledbetter
abdca9b766 du: Print to stderr rather than stdout when directory can't be read 2023-05-23 01:45:10 +02:00
Karol Kosek
d1328639b4 mkfifo: Don't rely on global errno
Core::System::mkfifo() doesn't rely on POSIX's mkfifo() and sends the
syscall directly to our system. This means that the and errno doesn't
get updated which ultimately caused the program to display an incorrect
message 'mkfifo: Success (not an error)'.
2023-05-22 10:24:08 +02:00
Ben Wiederhake
6055eed5a5 xml: Prefer LibFileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
9e755ccfef wasm: Prefer LibFileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
666e312693 userdel: Prefer LibFileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
e935cb9f09 unzip: Prefer File over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
8afd09b423 shot: Prefer LibFileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
487ec64a78 run-tests: Prefer LibFileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
6e08f860f8 open: Prefer LibFileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
34eb797013 markdown-check: Prefer LibFileSystem and String over Deprecated* 2023-05-21 07:50:52 +02:00
Ben Wiederhake
0420e12dad headless-browser: Prefer FileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake
f43f83512e Meta: Also run markdown-check on markdown files in each Port subdir 2023-05-21 07:50:09 +02:00
Tim Ledbetter
7ad212ff63 tail: Count lines correctly when file ends with two or more newlines
Previously, an extra line would be displayed when a file ended in more
than one newline.
2023-05-21 07:49:43 +02:00
Tim Ledbetter
daa9812cea tail: Don't skip the last line if it doesn't end in a newline 2023-05-21 07:49:43 +02:00
Tim Ledbetter
51b91af60b tail: Don't read past EOF when reading from a seekable stream
Previously, using tail to read from a file would fail, as we would
seek to the end of the file then try to read a byte from that
position.
2023-05-21 07:49:43 +02:00
Ben Wiederhake
58ea30f85a aplay: Determine absolute path before raising the veil
This was a regression introduced in 25d2828e, #18807. In that commit, I
forgot to investigate why the order of operations was so "weird", so I
added a comment this time to prevent future regressions.
2023-05-19 22:42:02 +02:00
Ben Wiederhake
c2d26ec541 usermod: Prefer FileSystem over DeprecatedFile 2023-05-19 21:12:15 +02:00
Ben Wiederhake
54b3f90e47 mv: Prefer FileSystem over DeprecatedFile 2023-05-19 21:12:15 +02:00
Ben Wiederhake
02fa97a13f cp: Prefer FileSystem over DeprecatedFile 2023-05-19 21:12:15 +02:00
Ben Wiederhake
6c9383ce89 install: Prefer FileSystem over DeprecatedFile 2023-05-19 21:12:15 +02:00
Tim Ledbetter
12d6845c4e shuf: Add -r option to allow output lines to be repeated
This commit also modifies the behavior of the `-z` option, so that a
'\0' character now delimits output lines, as well as input lines. This
matches the behavior of the GNU coreutils and FreeBSD implementations
of shuf.
2023-05-18 21:06:37 -06:00
Liav A
0bbd9040ef Kernel+Userland: Split bind-mounting and re-mounting from mount syscall
These 2 are an actual separate types of syscalls, so let's stop using
special flags for bind mounting or re-mounting and instead let userspace
calling directly for this kind of actions.
2023-05-17 23:39:15 -06:00
Timothy Flynn
6970f1b6c1 Browser+Ladybird+LibWebView: Handle trivial content APIs in LibWebView
The goal here is to reduce the amount of WebContent client APIs that are
duplicated across every ViewImplementation. Across our three browsers,
we currently:

    Ladybird - Mix some AK::Function callbacks and Qt signals to notify
    tabs of WebContent events.

    Browser - Use only AK::Function callbacks.

    headless-browser - Drop most events on the floor.

Instead, let's only use AK::Function callbacks across all three browsers
to propagate events to tabs. This allows us to invoke those callbacks
directly from LibWebView instead of all three browsers needing to define
a trivial `if (callback) callback();` override of a LibWebView virtual
function. For headless-browser, we can simply not set these callbacks.

As a first pass, this only converts WebContent events that are trivial
to this approach. That is, events that were simply passed onto the tab
or handled without much fuss.
2023-05-17 19:47:05 +02:00
Timothy Flynn
2d51b8c286 Browser+Ladybird+LibWebView: Virtualize computing content/widget points
This will allow moving some copy-pasted functionality from web view
implementations to the base LibWebView class.
2023-05-17 19:47:05 +02:00
Tim Schumacher
083e61c36b tar: Wire up compressing .tar files with LZMA 2023-05-17 09:08:53 +02:00
Jelle Raaijmakers
e6935cbaaf lsirq: Restore enumeration of interrupt line
This was broken by changes to `JsonObject::get_deprecated_string`.
2023-05-17 06:42:21 +02:00
Tim Ledbetter
58e75be199 ping: Add -i option to specify the time to wait between packets 2023-05-16 12:56:11 +02:00
Tim Ledbetter
755bd4d3c2 ping: Add -q option to specify quiet mode
Quiet mode suppresses all output except the statistics shown before
the program exits.
2023-05-16 12:56:11 +02:00
Sam Atkins
be71ccb690 ps: Add -u option, to list processes associated with specified users 2023-05-16 12:54:18 +02:00
Sam Atkins
cf998bc082 ps: Perform filtering step before the output loop
Previously we did some of the filtering before the loop, and some inside
it, which made things awkward to reason about. This also lets us avoid
generating a TTY string for each process unless there's a column for it.
2023-05-16 12:54:18 +02:00
Sam Atkins
3aff3c610a ps: Add -p option, and distinguish it from -q 2023-05-16 12:54:18 +02:00
Sam Atkins
45c429853a ps: Allow -q option multiple times, and separated by spaces or commas
Several differences here:
- Passing `-q` multiple times will add them together, instead of the
  last one overwriting the previous ones.
- `-q` PIDs can be separated by commas as well as spaces.
- We check that the PIDs are integers while parsing the arguments,
  instead of later on.

The "parse a list of things as an option" is extracted into a helper
function, because we're going to want the same logic for `-g`, `-G`,
`-p`, `-t`, `-u`, and `-U`.
2023-05-16 12:54:18 +02:00
Sam Atkins
a6e701a67b ps: Add the -a option, to list all processes associated with terminals 2023-05-16 12:54:18 +02:00
Sam Atkins
afb55d9fd8 ps: Add the -A option
This is identical to our existing `-e` option, but both are required by
POSIX.
2023-05-16 12:54:18 +02:00
Sam Atkins
02ee93d6c9 ps: Use Optional for column indices, instead of -1 meaning "not present" 2023-05-16 12:54:18 +02:00
Sam Atkins
e6f7b828c3 ps: Ensure columns capacity in advance
Also use unchecked_append() in a couple of other places where we can.
2023-05-16 12:54:18 +02:00
Sam Atkins
2b02c58cd3 ps: Migrate from DeprecatedString to String 2023-05-16 12:54:18 +02:00
Sam Atkins
61552415a3 ps: Use Core::System::fstat() 2023-05-16 12:54:18 +02:00
Tim Ledbetter
5a9a27cea0 pgrep: Add -d option to specify a pid delimiter
This is useful for commands which expect a comma-separated list of
pids.
2023-05-16 12:49:15 +02:00
Timothy Flynn
d8f03dda08 Browser+LibWeb+WebContent: Broadcast video element context menu requests
This just sets up the IPC to notify the browser process of context menu
requests on video elements. The IPC contains a few pieces of information
about the state of the video element.
2023-05-16 12:48:39 +02:00
Andreas Kling
85c542ab00 Ladybird+LibWebView: Move backing store management code to LibWebView
This lets us share this code on all platforms, and makes resizing the
window much faster on SerenityOS as well. :^)
2023-05-15 12:13:34 +02:00
Andreas Kling
def37e65f3 Ladybird+LibWebView: Remember the size of the last paint
This will allow us to change the size of the backing store bitmap
without conflating the size of the bitmap and the size of the paint.
2023-05-15 10:04:29 +02:00
Tim Ledbetter
fac6c6c554 pidof: Add -S option to specify a pid separator
This is useful for commands which expect a comma-separated list of
pids.
2023-05-15 06:57:44 +02:00
Tim Ledbetter
8be7b16c42 pidof: Use ArgsParser to validate arguments
The built in functionality of ArgsParser is now used to validate the
options given. All options are now grouped into a struct.
2023-05-15 06:57:44 +02:00
Ben Wiederhake
317cdc32ad readlink: Prefer FileSystem::readlink over DeprecatedFile 2023-05-15 06:50:43 +02:00
Ben Wiederhake
17a1e2eed1 ls: Migrate away from DeprecatedFile
Note that since many low-level bare C APIs are used, null-terminated
strings are still necessary in many places, which sadly required the
addition of many DeprecatedStrings.
2023-05-14 15:44:39 -06:00
Ben Wiederhake
b65d49669a test-imap: Prefer Core::File over DeprecatedFile 2023-05-14 15:42:57 -06:00
Fabian Dellwing
639aee037f Userland+Meta: Add new helper program for network settings
This little program allows us to take the NetworkSettings app away
from being an elevated GUI app.

It receives a JsonObject on STDIN and writes it to the global
Network configuration file.

If the write was successfull it will apply the changes.
2023-05-13 17:59:37 -06:00
Ben Wiederhake
77f021f5f1 pledge: Prefer FileSystem over DeprecatedFile 2023-05-13 17:06:42 +02:00
Ben Wiederhake
8c2cdb7bc7 which: Prefer FileSystem over DeprecatedFile 2023-05-13 17:06:42 +02:00
Tim Ledbetter
d04968fee4 test-pthread: Check for correct return value from sem_trywait()
At some point `sem_trywait()` changed from returning an error code on
failure to returning -1 and setting the errno. Update test-pthread to
expect this behavior.
2023-05-13 17:05:59 +02:00
Tim Ledbetter
56301688e4 top: Add -p option to filter by pid
The -p option can now be used to only monitor processes with the
specified pids. Pids are given as a comma-separated list. This option
may be used multiple times.
2023-05-13 17:05:05 +02:00
Ben Wiederhake
ce11db72e8 tar: Convert from DeprecatedFile to Core::File and FileSystem 2023-05-13 17:04:05 +02:00
Ben Wiederhake
25d2828ef5 aplay: Prefer FileSystem over DeprecatedFile 2023-05-13 17:04:05 +02:00
Ben Wiederhake
951b77e04d abench: Prefer FileSystem over DeprecatedFile 2023-05-13 17:04:05 +02:00
Sam Atkins
6a21bbb5b2 errno: Remove usage of DeprecatedString 2023-05-11 16:33:18 +02:00
Sam Atkins
23dd16febe errno: Look up errors by name as well as number
eg, `errno enotsup` now shows the description and number for ENOTSUP.
2023-05-11 16:33:18 +02:00
Sam Atkins
a22a6c371e errno: Include error code names in output
And align the output nicely while we're at it. :^)
2023-05-11 16:33:18 +02:00
Lucas CHOLLET
d4d3c3f262 LibGfx/PortableFormat+image: Make encode take a Stream
As we directly write to the stream, we don't need to store a copy of the
entire image in memory. However, writing to a stream is heavier on the
CPU than to a ByteBuffer. This commit unfortunately makes `add_pixels`
two times slower.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET
8c34959b53 AK: Add the Input word to input-only buffered streams
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET
2a91245a96 image: Initialize strip_color_profile with a default value 2023-05-09 11:18:46 +02:00
martinfalisse
c719a542c5 LibWeb: Add --layout-test-mode flag to HeadlessBrowser
The `layout-test-mode` flag changes the font to be SerenitySans as this
is the font used for layout tests for cross-platform compatibility of
tests.
2023-05-08 14:47:52 +02:00
Fabian Dellwing
589d2d50f5 netstat: Fix fallback value for pid field 2023-05-07 11:55:58 +02:00
Fabian Dellwing
2cd59df443 netstat: Add -e argument
This adds information about the user owning the process to our netstat
output. We do not fully match the behaviour of Linux as we don't show
an inode information.
2023-05-07 11:55:58 +02:00
Fabian Dellwing
34d699b678 netstat: Fix in/out bytes not showing
Some change in our JsonObject API broke the logic here. We now read
the correct type from the JsonObject and convert it to a string ourself.
2023-05-07 11:55:58 +02:00
Fabian Dellwing
2efdac9441 netstat: Fix port numbers not showing
Some change in our JsonObject API broke the logic here. We now read
the correct type from the JsonObject and convert it to a string ourself.
2023-05-07 11:55:58 +02:00
Ben Wiederhake
36ff6187f6 Everywhere: Change spelling of 'behaviour' to 'behavior'
"The official project language is American English […]."
5d2e915623/CONTRIBUTING.md (L30)

Here's a short statistic of the occurrences of the word "behavio(u)r":

$ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n
      2 BEHAVIOR
     24 Behaviour
     32 behaviour
    407 Behavior
    992 behavior

Therefore, it is clear that "behaviour" (56 occurrences) should be
regarded a typo, and "behavior" (1401 occurrences) should be preferred.

Note that The occurrences in LibJS are intentionally NOT changed,
because there are taken verbatim from the specification. Hence:

$ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n
      2 BEHAVIOR
     10 behaviour
     24 Behaviour
    407 Behavior
   1014 behavior
2023-05-07 01:05:09 +02:00
Nico Weber
40e839fd7e image: Add a --frame-index option 2023-05-06 21:17:18 +02:00
Lucas CHOLLET
1a97382305 LibGUI: Make Application's construction fallible
The pattern to construct `Application` was to use the `try_create`
method from the `C_OBJECT` macro. While being safe from an OOM
perspective, this method doesn't propagate errors from the constructor.
This patch make `Application` use the `C_OBJECT_ABSTRACT` and manually
define a `create` method that can bubble up errors from the
construction stage.

This commit also removes the ability to use `argc` and `argv` to
create an `Application`, only `Main`'s `Arguments` can be used.

From a user point of view, the patch renames `try_create` => `create`,
hence the huge number of modified files.
2023-05-05 16:41:21 +01:00
kleines Filmröllchen
5ebc741594 sed: Implement in-place file editing
This implements the '-i' flag in the GNU version, without suffix
support.
2023-05-05 02:15:43 +03:30
kleines Filmröllchen
34f8147385 sed: Correctly unveil all paths
- The veil was never closed.
- unveil() only works with absolute paths.
- Files from the regular input list weren't unveiled.
2023-05-05 02:15:43 +03:30
Nico Weber
926c0d8676 ICC+image: Add conversion between color spaces for images :^)
For now, only for color spaces that are supported by Profile::to_pcs()
and Profile::from_pcs(), which currently means that all matrix profiles
(but not LUT profiles) in the source color space work, and that
matrix profiles with parametric curves in the destination color
space work.

This adds Profile::convert_image(Bitmap, source_profile), and
adds a `--convert-to-color-profile file.icc` flag to `image`.

It only takes a file path, so to use it with the built-in
sRGB profile, you have to write it to a file first:

% Build/lagom/icc -n sRGB --reencode-to serenity-sRGB.icc

`image` by default writes the source image's color profile
to the output image, and most image viewers display images
looking at the profile.

For example, take `Seven_Coloured_Pencils_(rg-switch_sRGB).jpg`
from https://commons.wikimedia.org/wiki/User:Colin/BrowserTest.

It looks normal in image viewers because they apply the unusual
profile embedded in the profile. But if you run

% Build/lagom/image -o huh.png --strip-color-profile \
    'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'

and then look at huh.png, you can see how the image's colors
look like when interpreted as sRGB (which is the color space
PNG data is in if the PNG doesn't store an embedded profile).

If you now run

% Build/lagom/image -o wow.png \
    --convert-to-color-profile serenity-sRGB.icc --strip-color-profile \
    'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'

this will convert that image to sRGB, but then not write
the profile to the output image (verify with `Build/lagom/icc wow.png`).
It will look correct in image viewers, since they display PNGs without
an embedded color profile as sRGB.

(This works because 'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'
contains a matrix profile, and Serenity's built-in sRGB profile
uses a matrix profile with a parametric curve.)
2023-05-03 15:05:13 +02:00
PrestonLTaylor
5563ebab5a profile: Prevent crash when -p is supplied a non-integer value
Instead of crashing we give a helpful warning message to the user.

This also removes a fixme! :^)
2023-05-03 09:57:43 +02:00
PrestonLTaylor
6811ab9c3b profile: Add -a to warning message when -e, -d, -w xor -f is not set
-a and -p both require only one of the flags.
We will inform the user of this for both -a and -p <PID>.
2023-05-03 09:57:43 +02:00
Fabian Dellwing
006d2e6508 nc: Fix overflow in port and local_port argument 2023-04-30 21:12:46 +03:30
Nico Weber
3a5d20d82b icc: Add a --measure flag that prints color difference in profile
If --measure is passed, icc prints the color pairs with the smallest
and largest perceptual difference between them.

Converting 254 * 254 * 254 * 4 = 65 Million colors from sRGB to LAB
and then computing 254 * 254 * 254 * 3 = 49 Million DeltaEs between
them takes a while. On my laptop, it takes 17s to run. So there's
a small progress display.
2023-04-30 05:57:20 +02:00
Ali Mohammad Pur
7e6341587b AK+Everywhere: Disallow Error::from_string_view(FooString)
That pattern seems to show up a lot in code written by people that
aren't intimately familiar with the lifetime model of Error and Strings.
This commit makes the compiler detect it and present a more helpful
diagnostic than "garbage string at runtime".
2023-04-28 05:55:20 +02:00
Lucas CHOLLET
50b5528746 LibCore+file: Factorize code to detect mime-type from bytes of a file
This is always nice to factorize code, but even better when it contains
magic numbers.
2023-04-27 07:29:49 +02:00
Fabian Dellwing
8c1dacecba nc: Add -n option to suppress name resolution 2023-04-26 12:33:25 -06:00
Fabian Dellwing
7cfa108fad nc: Add -p option
With this change we support the well-known and shorter way to
create a listener on all interfaces:

`nc -lvp 1337`

instead of:

`nc -lv 0.0.0.0 1337`
2023-04-26 12:33:25 -06:00