Commit Graph

1996 Commits

Author SHA1 Message Date
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