Commit Graph

1284 Commits

Author SHA1 Message Date
Liav A
c85f81bc9d Utilities/lsblk: Remove Interface Type column
We are going to remove this slice of data from the SysFS later on, so
lsblk must not try to read it.
2022-08-14 01:09:03 +01:00
Andreas Kling
50d951aea2 LibJS: Let Shape store a Realm instead of a GlobalObject
This is a cautious first step towards being able to create JS objects
before a global object has been instantiated.
2022-08-05 12:42:46 +02:00
Andreas Kling
69a45adfbe LibWeb: Remove page_did_set_document_in_top_level_browsing_context()
This PageClient callback was never used for anything.
2022-08-05 12:42:46 +02:00
networkException
2cdc7c4ca0 wallpaper: Add pledge promises 2022-08-02 04:04:08 +00:00
networkException
85b133d47f Utilities+Base: Rename pape utility to wallpaper 2022-08-02 04:04:08 +00:00
Andreas Kling
548081ea23 Userland+Base: Make the window titlebar font configurable separately
Instead of defaulting to "bold variant of the system default font",
let's allow the user to set any font they want as the titlebar font.
2022-08-01 10:29:53 +02:00
Liav A
aea3213d51 Utilities/lsusb: Allow the utility to work without existing USB IDs file
In case we failed to open /res/usb.ids or the user requested to not use
that file, we simply don't try to resolve the USB IDs and print them
without any identification.
2022-07-28 04:28:25 -07:00
MacDue
281e46e8b3 grep: Fix out of bounds StringView indexing
This is another case of out of bounds indexing exposed by 13406b8.
2022-07-27 22:51:54 +00:00
Undefine
97cc33ca47 Everywhere: Make the codebase more architecture aware 2022-07-27 21:46:42 +00:00
MacDue
9d0dccaa3f less: Fix out of bounds StringView indexing
This fixes indexing the StringView before knowing if the index
is valid. This did not crash until the changes from 13406b8
which added runtime checks for StringView indexing.
2022-07-27 05:34:41 -07:00
Tim Schumacher
25e6ad8d3e chown: Implement recursion 2022-07-25 23:52:46 +01:00
Tim Schumacher
7b7c9a2194 chown: Add support for multiple file paths 2022-07-25 23:52:46 +01:00
Tim Schumacher
864221cb02 ln: Implement correct handling of directories as link targets 2022-07-25 22:21:01 +01:00
Tim Schumacher
26d4a44a0f ln: Rework to use LibCore syscall wrappers 2022-07-25 22:21:01 +01:00
Tim Schumacher
a031b7a174 chmod: Implement the --recursive flag 2022-07-25 15:32:46 +02:00
Tim Schumacher
0329a644f8 chmod: Port to ArgsParser 2022-07-25 15:32:46 +02:00
Tim Schumacher
480ba792e3 du: Consolidate all "do not print" conditions
All of these conditions should make du just not report the file size
individually, but it should still count them into the grand total.

In the case of the `--threshold` option, this was actually implemented
incorrectly before, as it would report size 0 for files that did not
match the threshold.
2022-07-24 13:32:51 +01:00
Tim Schumacher
e4cdc7f685 du: Only use unmodified file sizes internally
This keeps us from repeatedly applying the block size calculation on
already processed values.
2022-07-24 13:32:51 +01:00
Tim Schumacher
9af302920a du: Use 64-bit integers when handling file sizes or related values
We may very well dip into files larger than 4G at some point, so 32-bit
values are not enough, and the 64-bit sized `off_t` doesn't fully make
sense either, as it features negative values.

Instead, switch to the explicit type of `u64` everywhere, which is the
same size on all platforms and is unsigned. The exception to this is
the threshold, which needs to be signed instead of unsigned.
2022-07-24 13:32:51 +01:00
Tim Schumacher
c1ab29b73c du: Fix a typo in the --exclude-from option 2022-07-24 13:32:51 +01:00
Tim Schumacher
6b270f7d01 du: Don't stop descending even if the maximum depth is reached
The `--max-depth` option only controls until which depth individual file
sizes are printed, it does not stop the utility from traversing that
branch further (as the file sizes would be wrong otherwise).

Restructure the program to track the current depth, and return early if
the current depth is higher than the maximum allowed depth, which skips
all parts of the logic that are concerned with user output.
2022-07-24 13:32:51 +01:00
Itamar
db11cfa2c5 Utilities+LibELF: Temporary promises for dynamic linker in "pledge"
This adds a "temporary promises for the dynamic-linker" flag ('-d')
to the "pledge" utility.

Example usage:
pledge -d -p "stdio rpath" id

Without the '-d' flag, id would crash because the dynamic linker
requires 'prot_exec'.

When this flag is used and the program to be run is dynamically linked,
"pledge" adds promises that are required by the dynamic linker
to the promise set provided by the user.

The dynamic linker will later "give up" the pledge promises it no
longer requires.
2022-07-21 16:40:11 +02:00
Tim Schumacher
d270c57022 du: Implement the 1k block size short option 2022-07-21 16:37:04 +02:00
Tim Schumacher
220a50111a du: Invert apparent-size behaviour
The apparent size is what `stat` says what we use. The non-apparent size
is the blocks that we actually use on-disk.
2022-07-21 16:37:04 +02:00
Tim Schumacher
d2d6e7835e du: Implement custom block sizes 2022-07-21 16:37:04 +02:00
Tim Schumacher
c938321731 du: Replace home-grown block-based size calculation with ceil_div 2022-07-21 16:37:04 +02:00
Ali Mohammad Pur
4387ad9fc6 js: Don't pass error strings as the format argument to outln()
This fixes a crash when the error contains '{}', or an invalid format
string.
2022-07-20 21:25:59 +01:00
kleines Filmröllchen
3f59356c79 LibAudio: Rename ConnectionFromClient to ConnectionToServer
The automatic nomenclature change for IPC sockets got this one wrong.
2022-07-19 11:17:45 +01:00
Liav A
a70e1a0340 Utilities: Remove the edid-dump utility
This short-lived utility was essential when we had to use the ioctl
interface to fetch the EDID from a DisplayConnector, but now that we can
simply read it from SysFS, this utility is no longer needed and can be
removed.
2022-07-19 11:02:37 +01:00
Liav A
cb900006b9 Utilities/lspci: Don't unveil /res/pci.ids if not asked to resolve IDs
I tested the grub image under VirtualBox and it appeared that the image
didn't have pci.ids file included in the /res directory. In that case it
would be expected that lspci can still function correctly if the -n
parameter is passed, but then the unveil syscall failed because the file
didn't exist.

To cope with this, we should allow lspci to work without the pci.ids
file being present at the filesystem, so let's not unveil this file if
the -n parameter is passed.
2022-07-19 11:02:25 +01:00
Tim Schumacher
5870484d1a LibC: Remove the LibPthread interface target 2022-07-19 11:00:35 +01:00
DexesTTP
686c15149e headless-browser: Simplify the arguments used to select resources
We can just infer the favicon, fonts and palette from the location of
the /res folder, no need to ask each of the resources one by one.
2022-07-19 08:02:52 +01:00
DexesTTP
9e5af374d0 headless-browser: Split the setters for the screen and the viewport rect
These two represent different things, and should be handled by different
methods.
2022-07-19 08:02:52 +01:00
DexesTTP
9c431ede7a headless-browser: Use port 443 as default for HTTPS requests 2022-07-19 08:02:52 +01:00
Liav A
a660040806 Userland: Introduce the lsblk utility to show list of storage devices 2022-07-15 12:29:23 +02:00
Andreas Kling
ed9b2a85ed Utilities: Add "pledge" utility for launching a sandboxed command
This new command allows you to run any command with an initial set
of pledge promises.

Note that dynamically linked executables won't be able to bootstrap
without at least "stdio rpath prot_exec".

Inspired by http://justine.lol/pledge/ :^)
2022-07-14 23:27:19 +02:00
Tim Schumacher
bb0feebddc cp: Implement the granular --preserve flag 2022-07-14 00:24:24 +01:00
Tim Schumacher
69e0b8dbb7 LibCore: Make copying permissions, ownership and timestamps combineable 2022-07-14 00:24:24 +01:00
Tim Schumacher
3d51642037 LibCore: Replace the ArgsParser option argument setting with an enum
Replacement conditions for `requires_argument` have been chosen based
on what would be most convenient for implementing an eventual optional
argument mode.
2022-07-14 00:24:24 +01:00
Timothy Flynn
33698b9615 LibJS+js: Parse new constructor options from Intl.NumberFormat V3
This contains minimal changes to parse newly added and modified options
from the Intl.NumberFormat V3 proposal, while maintaining main spec
behavior in Intl.NumberFormat.prototype.format. The parsed options are
reflected only in Intl.NumberFormat.prototype.resolvedOptions and the js
REPL.
2022-07-13 19:22:26 +01:00
sin-ack
604aac531c AK+Userland+Tests: Remove URL(char const*) constructor
The StringView(char const*) constructor is being removed, and there was
only a few users of this left, which are also cleaned up in this commit.
2022-07-12 23:11:35 +02:00
sin-ack
fbc771efe9 Everywhere: Use default StringView constructor over nullptr
While null StringViews are just as bad, these prevent the removal of
StringView(char const*) as that constructor accepts a nullptr.

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
c8585b77d2 Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
e5f09ea170 Everywhere: Split Error::from_string_literal and Error::from_string_view
Error::from_string_literal now takes direct char const*s, while
Error::from_string_view does what Error::from_string_literal used to do:
taking StringViews. This change will remove the need to insert `sv`
after error strings when returning string literal errors once
StringView(char const*) is removed.

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
c70f45ff44 Everywhere: Explicitly specify the size in StringView constructors
This commit moves the length calculations out to be directly on the
StringView users. This is an important step towards the goal of removing
StringView(char const*), as it moves the responsibility of calculating
the size of the string to the user of the StringView (which will prevent
naive uses causing OOB access).
2022-07-12 23:11:35 +02:00
sin-ack
a3eeeaa6a1 Userland: Remove erroneous String -> char* -> StringView conversions
These were accidental (or leftover) uses of String::characters() to
construct StringViews through its StringView(char const*) constructor.
Since this constructor is due to be removed, this will no longer work.
Plus this prevents strlen from being run on these strings unnecessarily.
2022-07-12 23:11:35 +02:00
sin-ack
60f6bc902b Userland: Convert command line arguments to String/StringView
StringView was used where possible. Some utilities still use libc
functions which expect null-terminated strings, so String objects were
used there instead.
2022-07-12 23:11:35 +02:00
Linus Groh
79fb149b36 js: Add missing built-in functions to help() output 2022-07-10 01:11:52 +02:00
Linus Groh
3c845b0ea4 js: Remove load() built-in function
This is no longer needed now that we have ES modules.
2022-07-10 01:11:52 +02:00