Commit Graph

1247 Commits

Author SHA1 Message Date
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
kleines Filmröllchen
69218b92a5 LibCore+Userland: Use StringViews when calling Core::System::open
For some reason we used raw char pointers sometimes, which caused at
least one heap buffer overflow detected in fuzzing.
2022-07-09 09:25:20 +01:00
Maciej
20430ffeae route: Support removing entries with unknown gateway 2022-07-09 09:22:25 +01:00
Tim Schumacher
5efa8e507b Kernel: Implement an axallowed mount option
Similar to `W^X` and `wxallowed`, this allows for anonymous executable
mappings.
2022-07-08 22:27:38 +00:00
Tim Schumacher
80705a72bd mount: Allow extending fstab via drop-in files in fstab.d 2022-07-08 12:42:23 +02:00
Tim Schumacher
e04155475d mount: Separate mounting by line into a new function 2022-07-08 12:42:23 +02:00
Linus Groh
028a6b90b1 LibJS: Revert partial resizable ArrayBuffer implementation
This is a manual but clean revert of all commits from #12595.

Adding a partial implementation of the resizable ArrayBuffer proposal
without implementing all the updates to TypedArray infrastructure that
is also covered by the spec introduced a bunch of crashes, so we
decided to revert it for now until a full implementation is completed.
2022-07-06 15:52:57 +02:00
DexesTTP
7ceeb74535 AK: Use an enum instead of a bool for String::replace(all_occurences)
This commit has no behavior changes.

In particular, this does not fix any of the wrong uses of the previous
default parameter (which used to be 'false', meaning "only replace the
first occurence in the string"). It simply replaces the default uses by
String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
2022-07-06 11:12:45 +02:00
Tim Schumacher
8a671154c3 unzip: Remove the arbitrary file size limit
Not being able to map the file chunk-by-chunk feels like a deficit of
MappedFile and/or LibArchive, so it's weird that `unzip` is enforcing
this size limit, and an especially arbitary one at that.

Since "replace one error message with another error message" is the best
possible outcome here, and making the user pass a useless flag in cases
where it may not even be needed is the worst, let's just remove that
file size limit.

However, the `FIXME` about mapping files partially is left in because
this is something that we definitely want to take a look at in the
future.
2022-07-02 11:12:49 +04:30
Linus Groh
8b9f5b0286 js: Implement pretty-printing of WeakRef objects 2022-07-01 00:13:21 +01:00
Linus Groh
dee8e53773 js: Implement pretty-printing of WeakSet objects 2022-07-01 00:13:21 +01:00
Linus Groh
28e184e5cc js: Implement pretty-printing of WeakMap objects 2022-07-01 00:13:21 +01:00
Linus Groh
18f27c2e64 js: Fix pretty-printing of primitive wrapper objects
Currently, they print `[Type] <already printed Object 0x...>` as, for
some reason, we were simply trying to print the object again.
2022-07-01 00:13:21 +01:00
Linus Groh
c6cd784d4e js: Prefix global variables with 'g_'
This makes it much clearer that they are, in fact, global variables.
Also avoids name shadowing issues, especially with 'vm'.
2022-07-01 00:13:21 +01:00
Linus Groh
c87e01dcfd js: Fix a couple of const correctness issues 2022-07-01 00:13:21 +01:00
Linus Groh
098310f425 js: Move static_cast responsibility out of the pretty-print functions
This is something the caller should do.
2022-07-01 00:13:21 +01:00
Idan Horowitz
b910183351 js: Implement pretty-printing of Intl.DurationFormat 2022-07-01 01:00:05 +03:00
Kenneth Myhra
fbe22af86e Everywhere: Use my fairly new and shiny serenityos.org email :^) 2022-06-30 15:59:42 +01:00
Tim Schumacher
93488d6d5a pls: Implement support for --preserve-env 2022-06-28 19:09:23 +01:00
Tim Schumacher
38677f63c6 pls: Don't rely on getenv to find TERM
This allows us to skip storing the actual backing data in a separate
`Vector`, as we know that we are working with `environ`-backed storage
here.

Also, while the logic is currently very similar to what `getenv` does
internally, this allows us to eventually implement custom environment
variable filters while remaining linear in run time.
2022-06-28 19:09:23 +01:00
Maciej
4fbe43f282 ln: Fix typo in arguments argument 2022-06-28 09:20:30 +01:00
Lucas CHOLLET
662711fa26 Browser+LibWeb+WebContent: Allow Browser to load local files
To achieve this goal:
 - The Browser unveils "/tmp/portal/filesystemaccess"
 - Pass the page through LoadRequest => ResourceLoader
 - ResourceLoader requests a file to the FileSystemAccessServer via IPC
 - OutOfProcessWebView handles it and sends a file descriptor back to
 the Page.
2022-06-27 20:22:15 +01:00
Paweł Łukasik
a0ffdeb58a Keymap: Fix switching selected keymap
Previously keymap did switching of the selected keymap twice when the
command was executed. First set it to the first keymap on the list and
later, if present, to the chosen one.

Currently the switching to the first keymap on the list is done only
when the selection is not present or it's not on the list of keymaps.
2022-06-16 14:58:43 +01:00
Andreas Kling
a786b374b6 Utilities: Remove ddate joke program 2022-06-15 17:15:04 +02:00
Matthias Zimmerman
c10d48b72c AK/ByteBuffer+Everywhere: Handle errors in ByteBuffer::slice() 2022-06-13 15:38:51 +01:00
Linus Groh
857c3501df js: Add a loadINI() function for loading INI files :^)
This works the same way as loadJSON, except it loads INI files and
always returns an object.
2022-06-06 20:14:28 +01:00
Tim Schumacher
87da3e0004 tar: Implement support for GNU longname headers 2022-06-06 20:12:30 +01:00
Idan Horowitz
610afb21ac js: Create throw completions instead of raw error values on SyntaxError
This ensures that js's error printing logic is used instead of the
generic value printing logic, which then lets eshost correctly parse
thrown SyntaxErrors using the normal LibJS exception format.
2022-06-03 17:17:54 +01:00
Jesse Buhagiar
a88e3bde18 lsusb: Add -v flag to lsusb :^)
We can now get a more verbose print out from `lsusb` that spits out all
of the devices descriptors :^)
2022-06-02 13:14:29 +02:00
DexesTTP
a2161d8eb7 Utilities: Add networking to headless-browser
With this, the headless browser can now connect to the web.

Thanks a lot to Ali and Sin-ack for their help with this!

Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
Co-authored-by: sin-ack <sin-ack@users.noreply.github.com>
2022-05-29 23:00:04 +01:00
DexesTTP
f9d4c0ecbc Utilities: Add image decoding to headless-browser
With this, the headless browser can now decode images on its own!
2022-05-29 23:00:04 +01:00
DexesTTP
355e74cf65 Utilities: Add a simple headless-browser
This utility creates a 'screenshot' of the given page after a
few seconds of loading.
2022-05-29 23:00:04 +01:00
Linus Groh
bf5caf254f lscpu: Show size of L1 data/instruction, L2, and L3 CPU caches 2022-05-29 15:23:57 +02:00
Liav A
58b46d9e37 Utilities: Add edid-dump program to dump EDID from Display connectors 2022-05-27 22:27:44 +01:00
Maciej
7fba41321e netstat: Stop needing LookupServer for parsing arguments
Previously the netstat utility crashed when LookupServer wasn't running
because it tried to unveil nonexistent /tmp/portal/lookup socket. This
commit fixes that.
2022-05-26 21:49:52 +01:00
brapru
1297f81ddf route: Add the flags column 2022-05-26 16:33:10 +02:00
Andrew Kaster
ca42da23c2 Meta+Userland: Add jakt as an optional Lagom Tool
We can now use ENABLE_JAKT to pull jakt as a host tool and use it to
pre-process .jakt files into .cpp files for use in serenity applications
2022-05-23 23:05:45 +02:00
Ariel Don
a2c34554cd touch: Support custom timestamps
Previously, `touch` remained limited to creating files and updating
their current access and modifications time to the current time. It's
now capable of accepting two different timestamp formats with flags `-d`
and `-t` and referencing timestamps of other files with flag `-r`.

`touch` can also update only the last access time with `-a`, only the
last access time with `-m`, or update both as usual. `touch` updates
both left unspecified.

With `-c`, `touch` does not create a file if it doesn't already exist.
2022-05-21 18:15:00 +02:00