Commit Graph

2192 Commits

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