Commit Graph

1360 Commits

Author SHA1 Message Date
Andreas Kling
adabcf24ec Everywhere: Add missing <AK/ByteBuffer.h> includes
All of these files were getting ByteBuffer.h from someone else and then
using it. Let's include it explicitly.
2020-11-15 13:11:21 +01:00
Brendan Coles
d739483ee8 Userland: Tests: Use mkstemp temporary files in tests 2020-11-15 00:50:57 +01:00
Brendan Coles
f8c980a06b Userland: chroot: Add --userspec/-u flag to set uid/gid for chroot 2020-11-14 17:14:30 +01:00
AnotherTest
d3c52cef86 LibCrypto: Implement GCM mode 2020-11-14 10:18:54 +01:00
AnotherTest
2cc867bcba test-crypto: Silence the "creating bytebuffer..." debug 2020-11-14 10:18:54 +01:00
Brendan Coles
664322d34b Userland: Add test-gfx-font for Gfx::Font tests 2020-11-14 10:08:25 +01:00
Nico Weber
5c2e8b6189 Lagom: Add ntpquery to lagom build 2020-11-12 21:21:33 +01:00
Brendan Coles
7a512c4cc4 Userland: env: Add -i / --ignore-environment arg to clear env 2020-11-12 18:01:45 +01:00
Linus Groh
7fc98a96a9 test-js: Add canParseSource() native function
This allows us to check code for syntax errors without relying on
Function(), which can lead to false negatives as certain things are
valid in a function context, but not outside one.
2020-11-12 10:14:57 +01:00
Brendan Coles
549786e89a Userland: Add test for file SUID+SGID bits stripped when modified 2020-11-11 21:27:29 +01:00
Andreas Kling
b413c7ae6a ls: Only append file type indicators when -F or --classify is specified 2020-11-11 20:46:06 +01:00
Andreas Kling
5aafbdc4e8 ls: Add newline after "ls -d" output
Fixes #4030.
2020-11-11 20:36:16 +01:00
Nico Weber
8d9d3c9425 ntpquery: Add a '-a' flag that makes it use adjtime
With this, `ntpquery` can adjust the system time without
making it jump.

A fun activity with this in:

0. Boot
1. Run `su`
2. Run `ntpquery -a` to adjust the time offset after boot
   (usually around a second)
3. Keep running `ntpquery ; adjtime` to see how the offset
   behind NTP and the remaining adjtime both shrink.
   adjtime adjustment is large enough to make the time offset
   go down by a bit, but we currently lose time quickly enough
   that by the time adjtime is done, we've only corrected the
   clock about halfway, and not all the way to zero. Goto 2.

So this isn't all that great yet, but I think it's good enough
to think about turning this into a permanently running service next.
2020-11-10 19:03:08 +01:00
Nico Weber
5fcd34b810 Userland: Add an "adjtime" utility
It's a thin userland wrapper around adjtime(2). It can be used
to view current pending time adjustments, and root can use it to
smoothly adjust the system time.

As far as I can tell, other systems don't have a userland utility
for this, but it seems useful. Useful enough that I'm adding it to
the lagom build so I can use it on my linux box too :)
2020-11-10 19:03:08 +01:00
Brendan Coles
28abfd6290 Userland: ls: Add -d / --directory flag 2020-11-10 18:56:27 +01:00
Linus Groh
518481086b js: Use new string formatting functions 2020-11-10 14:33:48 +01:00
Brendan Coles
3f7b2c83d3 Tests: Add Kernel tests for unveil system call 2020-11-10 14:23:19 +01:00
Brendan Coles
7e0204fb41 Userland: ls: Add -o and -B / --ignore-backups flags
* `-B`, --ignore-backups`: Do not list implied entries ending with ~
* `-o`, In long format, do not show group information
2020-11-10 14:22:49 +01:00
marprok
5fae567008 Userland: Basic statistics for ping
After ping is terminated, the min/avg/max time
as well as information about the number of successful
packets received are printed on the screen.
2020-11-10 12:06:04 +01:00
Brendan Coles
51f49ec73f ls: Add -A flag to show dot files excluding implied . and .. directories 2020-11-10 12:04:12 +01:00
asynts
3b3edbc4d2 AK: Rename new_out to out and new_warn to warn. 2020-11-09 16:21:29 +01:00
Brendan Coles
e7173e946f ls: print inodes in short output format when -i arg is supplied 2020-11-09 07:56:56 +01:00
Nico Weber
7480034942 seq: Check start, step, end for NaN 2020-11-08 21:40:18 +01:00
Linus Groh
5c9d7d8026 js: Limit number of consecutive error trace entries being printed
> function f(){f()}f()
    Uncaught exception: [RuntimeError]: Call stack size limit exceeded
     -> f
     1234 more calls
     -> (global execution context)
    > function a(x){if(x>0){a(x-1)}else{throw Error()}}function b(x){if(x>0){b(x-1)}else{a(5)}}function c(){b(2)}c()
    Uncaught exception: [Error]
     -> a
     5 more calls
     -> b
     -> b
     -> b
     -> c
     -> (global execution context)
2020-11-08 16:51:54 +01:00
Andreas Kling
6e592fb5c3 su: Refuse to run if stdin is not a TTY 2020-11-08 16:16:03 +01:00
Brendan Coles
88307fcb59 ls: Add colored output for set-gid files 2020-11-02 13:09:17 +01:00
Andreas Kling
778011dac6 ping: Account for raw sockets now receiving IPv4 headers 2020-10-31 13:56:21 +01:00
AnotherTest
37c089fb7b LibTLS: (Almost) verify certificate chain against root CA certificates
Also adds a very primitive systemwide ca_certs.ini file.
2020-10-30 23:42:03 +01:00
Andreas Kling
77e9eadd9d Userland+LibC: Add "kill -l" to show all known signal names/numbers 2020-10-29 23:32:18 +01:00
AnotherTest
bed270ca47 Userland: Do not put a trailing space after the resulting pids in pidof 2020-10-29 22:27:24 +01:00
AnotherTest
a935a31ecf Userland: Add an implementation of 'expr'
This implements all expressions except 'match', which errors out when executed.
Closes #1124?
2020-10-29 11:53:01 +01:00
asynts
607931268e CMake: Use CONFIGURE_DEPENDS in existing globs. 2020-10-29 11:52:47 +01:00
Andreas Kling
ffd1e4831e Userland: Make killall accept signal names as well
Use getsignalbyname() to support killall -HUP foo, and such things.
2020-10-29 11:49:47 +01:00
Andreas Kling
ad0295d033 LibC: Move getsignalbyname() helper from Userland/kill into LibC 2020-10-29 11:49:24 +01:00
Andreas Kling
a6b2598fba Userland: Teach "kill" to understand signal names (not just numbers)
You can now do things like "kill -STOP pid" :^)

The getsignalbyname() helper function should probably move to LibC
or somewhere where it can be used by other signal related programs.
2020-10-29 11:45:53 +01:00
Linus Groh
0f5d1f4074 js: Load and save history from/to ~/.js-history
This is super useful when hacking on LibJS and in general :^)
2020-10-26 11:27:54 +01:00
asynts
1254cbbd0b AK: Eradicate calls to warn(). 2020-10-25 18:52:51 +01:00
asynts
a5f5c3fd33 LibC+Tests: Fix broken snprintf test.
`snprintf` returns the number of characters that would have been written
had the buffer been large enough.

It's a common trick to call `snprintf(nullptr, 0, ...)` to measure how
large a buffer has to be.

Thus the return value is not zero but fourteen.
2020-10-25 18:52:51 +01:00
Matthew L. Curry
212aa85a55 Userland/sort: Convert sort to use getline
Sort uses a statically sized buffer. This commit changes that to use getline,
so lines of any size will be handled properly.
2020-10-25 14:37:48 +01:00
Matthew L. Curry
0c2327b5b8 Userland/uniq: Add uniq utility
Add an implementation for uniq. While it will be nice in the future to
make more hardened versions of sort and uniq in the future, this
implementation of uniq is compatible with the current version of sort
and its buffer sizes.

This version supports optional input and output files along with stdin
and stdout.
2020-10-25 14:37:39 +01:00
Linus Groh
82956a08b3 LibCore: Rename File::ShouldCloseFile{Description => Descriptor}
From https://youtu.be/YNSAZIW3EM0?t=1474:

"Hmm... I don't think that name is right! From the perspective of
userspace, this is a file descriptor. File description is what the
kernel internally keeps track of, but as far as userspace is concerned,
he just has a file descriptor. [...] Maybe that name should be changed."

Core::File even has a member of this enum type... called
m_should_close_file_descriptor - so let's just rename it :^)
2020-10-25 13:59:41 +01:00
Andreas Kling
ace15e0043 Userland: Add missing license header to hexdump 2020-10-25 10:22:34 +01:00
Andreas Kling
201d34f6cd Userland: Add a very simple hexdump program :^)
This can definitely be improved, but it does the basic job!
2020-10-25 10:12:03 +01:00
asynts
88bca152c9 AK: Eradicate the uses of out(). 2020-10-24 12:56:25 +02:00
Wesley Moore
5ee7e9ab64 rm: Exit with status 0 if stat fails and force is set 2020-10-23 09:39:30 +02:00
Andreas Kling
46c15276e9 LibWeb: Fix Document construction mishap in <template> element
Ref-counted objects must not be stack allocated. Make DOM::Document's
constructor private to avoid this issue. (I wish we could mark classes
as heap-only..)
2020-10-23 08:33:16 +02:00
AnotherTest
5b72d17ff6 Userland: Make man provide a view_width to `render_for_terminal()'
This makes tables actually show up when rendered through `man'
2020-10-22 17:49:03 +02:00
Tom
6413acd78c AK: Make Utf8View and Utf32View more consistent
This enables use of these classes in templated code.
2020-10-22 15:23:45 +02:00
Andreas Kling
50f8f27ac6 Userland: Run clang-format on tree.cpp 2020-10-20 19:19:30 +02:00
Andreas Kling
633b6fbc48 Userland: Use new format functions in some programs 2020-10-20 18:08:37 +02:00
Lenny Maiorani
d1fe6a0b53
Everywhere: Redundant inline specifier on constexpr functions (#3807)
Problem:
- `constexpr` functions are decorated with the `inline` specifier
  keyword. This is redundant because `constexpr` functions are
  implicitly `inline`.
- [dcl.constexpr], §7.1.5/2 in the C++11 standard): "constexpr
  functions and constexpr constructors are implicitly inline (7.1.2)".

Solution:
- Remove the redundant `inline` keyword.
2020-10-20 18:08:13 +02:00
Linus Groh
ed116636ce test-js: Support test262 parser tests
test-js now has a --test262-parser-tests option. Modules are skipped for
now, current results:

    Test Suites: 1309 failed, 4314 passed, 5623 total
    Tests:       1309 failed, 262 skipped, 4052 passed, 5623 total
    Files:       5361 total
    Time:        ~100ms (Lagom) / 600-800ms (Serenity)

For more info, see: https://github.com/tc39/test262-parser-tests
2020-10-19 11:29:55 +02:00
Linus Groh
3a72a93b9d test-js: Exit with 1 if any test failed 2020-10-19 11:29:55 +02:00
Linus Groh
03b817b130 test-js: Include skipped tests in total test count
The current output is a bit strange:

    Tests:       3 skipped, 979 passed, 979 total

This makes more sense to me:

    Tests:       3 skipped, 979 passed, 982 total
2020-10-19 11:29:55 +02:00
Linus Groh
cce673e7b0 test-js: Add argument for explicit test root directory
Right now test-js has a hardcoded test root directory when running on
Serenity or will get it based on SERENITY_ROOT otherwise. Now it is
also possible to pass a path to the command which will take precedence
over these mechanisms.

This will also be useful for adding test262 support as those files will
not have a default location.
2020-10-19 11:29:55 +02:00
Nico Weber
0658051996 ntpquery: Add some more validation of the response header 2020-10-17 23:19:14 +02:00
Nico Weber
18d88e0eaa ntpquery: For stratum 1 servers, print reference ID in ASCII with -v 2020-10-17 23:19:14 +02:00
Nico Weber
52e3a0f16c ntpquery: Add a comment listing a few more NTP servers 2020-10-17 23:19:14 +02:00
Nico Weber
5f50af3b4f ntpquery: Don't leak local time, and check origin time in reply
This implements the transmit time suggestion in (abandoned?)
draft-ietf-ntp-data-minimization. (The other suggestions were already
implemented as far as I can tell.)
2020-10-17 23:19:14 +02:00
Nico Weber
019788a150 ntpquery: Make a few variable names more descriptive 2020-10-17 23:19:14 +02:00
Matthew L. Curry
a45ba638a7 seq: Add help option
Added a help option to the seq command that gives usage information. Further,
when a user gives an incorrect argument, usage is supplied on stderr.
2020-10-15 13:48:42 +02:00
nooga
7b481a2c73 Userland: Add --loop option for aplay
A tiny feature, useful when listening to your favorite song.
2020-10-15 13:47:42 +02:00
Andreas Kling
7b863330dc LibJS: Cache commonly used FlyStrings in the VM
Roughly 7% of test-js runtime was spent creating FlyStrings from string
literals. This patch frontloads that work and caches all the commonly
used names in LibJS on a CommonPropertyNames struct that hangs off VM.
2020-10-13 23:57:45 +02:00
Matthew L. Curry
909687ddf0 Userland/cp: Disallow copying directories into themselves
This patch causes cp to investigate whether a directory is being copied
into a subdirectory of itself. It uses realpath(3) to ensure that links
do not confound detection.
2020-10-13 18:37:32 +02:00
Matthew L. Curry
5d5c32cec1 Style: Remove uses of NULL, substituting nullptr 2020-10-13 13:52:52 +02:00
Linus Groh
fb13ea2259 js: Print negative zero with minus sign 2020-10-12 20:03:54 +02:00
Linus Groh
f0ba536095 html: Replace InProcessWebView with OutOfProcessWebView 2020-10-08 23:20:52 +02:00
Linus Groh
4ef3a55900 html: Create URL from filename, if any
This makes it possible for the WebView to resolve relative paths in
documents loaded from a file.
2020-10-08 23:20:52 +02:00
Nico Weber
f5af127887 ntpquery: Make output less verbose by default 2020-10-05 23:48:33 +02:00
Linus Groh
e80217a746 LibJS: Unify syntax highlighting
So far we have three different syntax highlighters for LibJS:

- js's Line::Editor stylization
- JS::MarkupGenerator
- GUI::JSSyntaxHighlighter

This not only caused repetition of most token types in each highlighter
but also a lot of inconsistency regarding the styling of certain tokens:

- JSSyntaxHighlighter was considering TokenType::Period to be an
  operator whereas MarkupGenerator categorized it as punctuation.
- MarkupGenerator was considering TokenType::{Break,Case,Continue,
  Default,Switch,With} control keywords whereas JSSyntaxHighlighter just
  disregarded them
- MarkupGenerator considered some future reserved keywords invalid and
  others not. JSSyntaxHighlighter and js disregarded most

Adding a new token type meant adding it to ENUMERATE_JS_TOKENS as well
as each individual highlighter's switch/case construct.

I added a TokenCategory enum, and each TokenType is now associated to a
certain category, which the syntax highlighters then can use for styling
rather than operating on the token type directly. This also makes
changing a token's category everywhere easier, should we need to do that
(e.g. I decided to make TokenType::{Period,QuestionMarkPeriod}
TokenCategory::Operator for now, but we might want to change them to
Punctuation.
2020-10-04 23:41:31 +02:00
Andreas Kling
94b95a4924 LibJS: Remove Interpreter::call()
Just use VM::call() directly everywhere.
2020-10-04 23:08:49 +02:00
asynts
d5ffb51a83 AK: Don't add newline for outf/dbgf/warnf.
In the future all (normal) output should be written by any of the
following functions:

    out    (currently called new_out)
    outln
    dbg    (currently called new_dbg)
    dbgln
    warn   (currently called new_warn)
    warnln

However, there are still a ton of uses of the old out/warn/dbg in the
code base so the new functions are called new_out/new_warn/new_dbg. I am
going to rename them as soon as all the other usages are gone (this
might take a while.)

I also added raw_out/raw_dbg/raw_warn which don't do any escaping,
this should be useful if no formatting is required and if the input
contains tons of curly braces. (I am not entirely sure if this function
will stay, but I am adding it for now.)
2020-10-04 17:04:55 +02:00
Andreas Kling
a007b3c379 LibJS: Move "strict mode" state to the call stack
Each call frame now knows whether it's executing in strict mode.
It's no longer necessary to access the scope stack to find this mode.
2020-10-04 17:03:33 +02:00
Peter Elliott
1b3f9c170c Userland: tar: support extracting gzipped files 2020-10-04 00:16:40 +02:00
Peter Elliott
b7c7c80ee2 Userland: Add tar command 2020-10-04 00:16:40 +02:00
Linus Groh
bcfc6f0c57 Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
Tibor Nagy
422cb50e4e Userland: Fix buffer overflow in unzip
It's not a great idea reading file names into a 4 byte sized buffer.
2020-10-01 21:15:35 +02:00
Andreas Kling
e4bda2e1e7 LibJS: Move Console from Interpreter to GlobalObject
Each JS global object has its own "console", so it makes more sense to
store it in GlobalObject.

We'll need some smartness later to bundle up console messages from all
the different frames that make up a page later, but this works for now.
2020-09-29 21:15:06 +02:00
Andreas Kling
2946a684ef ProtocolServer+LibWeb: Support more detailed HTTP requests
This patch adds the ability for ProtocolServer clients to specify which
HTTP method to use, and also to include an optional HTTP request body.
2020-09-28 11:55:26 +02:00
Benoît Lormeau
f0f6b09acb AK: Remove the ctype adapters and use the actual ctype functions instead
This finally takes care of the kind-of excessive boilerplate code that were the
ctype adapters. On the other hand, I had to link `LibC/ctype.cpp` to the Kernel
(for `AK/JsonParser.cpp` and `AK/Format.cpp`). The previous commit actually makes
sense now: the `string.h` includes in `ctype.{h,cpp}` would require to link more LibC
stuff to the Kernel when it only needs the `_ctype_` array of `ctype.cpp`, and there
wasn't any string stuff used in ctype.
Instead of all this I could have put static derivatives of `is_any_of()` in the
concerned AK files, however that would have meant more boilerplate and workarounds;
so I went for the Kernel approach.
2020-09-27 21:15:25 +02:00
Benoit Lormeau
f158cb27ea LibC: Remove an unneeded string.h include in ctype.h/cpp
And include string.h in the files that actually needed it
2020-09-27 21:15:25 +02:00
AnotherTest
aa65f664a9 LibMarkdown: Take a 'view_width' argument for render_for_terminal()
Some constructs will require the width of the terminal (or a general
'width') to be rendered correctly, such as tables.
2020-09-27 21:14:18 +02:00
Andreas Kling
aaa8b48a4c LibJS: Remove use of Interpreter& in JSONObject code 2020-09-27 20:26:58 +02:00
Andreas Kling
340a115dfe LibJS: Make native function/property callbacks take VM, not Interpreter
More work on decoupling the general runtime from Interpreter. The goal
is becoming clearer. Interpreter should be one possible way to execute
code inside a VM. In the future we might have other ways :^)
2020-09-27 20:26:58 +02:00
Andreas Kling
6861c619c6 LibJS: Move most of Interpreter into VM
This patch moves the exception state, call stack and scope stack from
Interpreter to VM. I'm doing this to help myself discover what the
split between Interpreter and VM should be, by shuffling things around
and seeing what falls where.

With these changes, we no longer have a persistent lexical environment
for the current global object on the Interpreter's call stack. Instead,
we push/pop that environment on Interpreter::run() enter/exit.
Since it should only be used to find the global "this", and not for
variable storage (that goes directly into the global object instead!),
I had to insert some short-circuiting when walking the environment
parent chain during variable lookup.

Note that this is a "stepping stone" commit, not a final design.
2020-09-27 20:26:58 +02:00
Maciej Zygmanowski
dd682168a9 lsof: Separate file name components
In /proc/PID/fds we get not only file name, but also additional information
about file type, state etc. This commit makes `lsof' command separate these
components. When you are filtering files by file name, only actual file name
is checked (not additional data).
2020-09-26 21:23:58 +02:00
Maciej Zygmanowski
2ed0385075 lsof: Allow selecting files by file name 2020-09-26 21:23:58 +02:00
Linus Groh
7d83665635 LibJS+LibGUI+js: Handle UnterminatedRegexLiteral in syntax highlighters 2020-09-25 23:58:42 +02:00
Ben Wiederhake
a2feef17bf Meta+Userland: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Andreas Kling
ed5407a3d7 js: Use VM::exception() instead of Interpreter::exception()
The VM is always there, but we only have an Interpreter while we are
running code.
2020-09-23 21:30:18 +02:00
Andreas Kling
4a8bfcdd1c LibJS: Move the current exception from Interpreter to VM
This will allow us to throw exceptions even when there is no active
interpreter in the VM.
2020-09-22 20:10:20 +02:00
Peter Elliott
7ba7b72736 Userland: Convert passwd(1) to use Core::Account
this fixes the passwd issues discovered in #3296
2020-09-21 20:18:05 +02:00
Peter Elliott
4a834f969f Userland: Switch su over to Core::Account 2020-09-21 20:18:05 +02:00
Andreas Kling
df3ff76815 LibJS: Rename InterpreterScope => InterpreterExecutionScope
To make it a little clearer what this is for. (This is an RAII helper
class for adding and removing an Interpreter to a VM's list of the
currently active (executing code) Interpreters.)
2020-09-21 14:35:12 +02:00
Andreas Kling
b7ce0680dd test-web: Keep the Interpreter on the VM interpreter stack during test 2020-09-21 14:34:40 +02:00
Andreas Kling
1c43442be4 LibJS+Clients: Add JS::VM object, separate Heap from Interpreter
Taking a big step towards a world of multiple global object, this patch
adds a new JS::VM object that houses the JS::Heap.

This means that the Heap moves out of Interpreter, and the same Heap
can now be used by multiple Interpreters, and can also outlive them.

The VM keeps a stack of Interpreter pointers. We push/pop on this
stack when entering/exiting execution with a given Interpreter.
This allows us to make this change without disturbing too much of
the existing code.

There is still a 1-to-1 relationship between Interpreter and the
global object. This will change in the future.

Ultimately, the goal here is to make Interpreter a transient object
that only needs to exist while you execute some code. Getting there
will take a lot more work though. :^)

Note that in LibWeb, the global JS::VM is called main_thread_vm(),
to distinguish it from future worker VM's.
2020-09-20 19:24:44 +02:00
Nico Weber
8212ba467c ntpquery: Use SO_TIMESTAMP to get a more accurate destination_timestamp
We can now see at which time a packet was received by the network
adapter, instead of having to measure user time after receiving
the packet in user space.

This means the destination timestamp is no longer affected by in-kernel
queuing delays, which can be tens of milliseconds when the system
is under load.

It also means that if ntpquery grows a message queue that waits on
replies from several requests, the time used processing one response
won't be incorrectly included in the destination timestamp of the
next response (in case two responses arrive at the network adapter
at roughly the same time).

NTP's calculations work better if send and receive latency are
about equal, and this only removes in-kernel queue delays and
context switch delays for the receiving packet. But the two
latencies aren't very equal anyways because $network. Also, maybe
we can add another API for setting the send time in the outgoing
packet in kernel space right before (or when) hitting the network
adapter and use that here too. So this still seems like progress.
2020-09-17 17:23:01 +02:00
asynts
2229b13c97 Userland: Allow executing binaries from PATH with env.
This is useful for shebangs:

    #!/bin/env Shell
    echo "Hello, World!"
2020-09-16 19:39:17 +02:00
asynts
c577f6e139 Userland: Use find_executable_in_path in which. 2020-09-16 19:39:17 +02:00
asynts
96edcbc27c AK: Lower the requirements for InputStream::eof and rename it.
Consider the following snippet:

    void foo(InputStream& stream) {
        if(!stream.eof()) {
            u8 byte;
            stream >> byte;
        }
    }

There is a very subtle bug in this snippet, for some input streams eof()
might return false even if no more data can be read. In this case an
error flag would be set on the stream.

Until now I've always ensured that this is not the case, but this made
the implementation of eof() unnecessarily complicated.
InputFileStream::eof had to keep a ByteBuffer around just to make this
possible. That meant a ton of unnecessary copies just to get a reliable
eof().

In most cases it isn't actually necessary to have a reliable eof()
implementation.

In most other cases a reliable eof() is avaliable anyways because in
some cases like InputMemoryStream it is very easy to implement.
2020-09-14 20:58:12 +02:00
Linus Groh
e9562e1920 Userland: Add {md5,sha1,sha256,sha512}sum 2020-09-13 11:37:56 +02:00
AnotherTest
bc9f8f5c39 Userland: Add an implementation of printf 2020-09-11 21:41:23 +02:00
asynts
3c03ce0c80 LibCompress: Add unit tests for CanonicalCode. 2020-09-11 16:07:45 +02:00
asynts
4af8eea56f LibCompress: Return Optional from decompress_all method. 2020-09-11 16:07:45 +02:00
asynts
b0ba7a897f Userland: gunzip if filename doesn't end in .gz append it.
This is the behaviour of gzip on my Linux system.
2020-09-11 16:07:45 +02:00
Sergey Bugaev
039e529dbe Userland: Fix a signal race condition
It has been possible for a signal to arrive in between us checking
g_interrupted and exiting - sucessfully, even though we were interrupted.

This way, if a signal arrives before we reset the disposition, we
will reliably check for it later; if it arrives afterwards, it'll
kill us automatically.
2020-09-10 16:00:11 +02:00
Andreas Kling
606f83436d test-js: Catch SIGINFO and dump the current test name + pass/fail/skip
This is pretty handy if the JS tests take a long time to run and you
wonder what they're doing. :^)
2020-09-09 21:10:23 +02:00
Andreas Kling
687aad01be test-js: Add -g option to run a garbage collection on each allocation
This is very slow, but very good at flushing out GC bugs. :^)
2020-09-09 21:10:23 +02:00
Nico Weber
a2a54f459f sleep: Make variable written in signal handler volatile
No difference in practice, but it's tidier and protects us
if we ever use g_interrupted earlier in main -- in that case,
the compiler might chose to keep the variable in a register without
the volatile.

Found by @bugaevc, thanks!
2020-09-09 20:25:19 +02:00
Nico Weber
42153221a5 sleep: On SIGINT, call default SIGINT handler after printing remaining time
With this, hitting ctrl-c twice in `for i in $(seq 10) { sleep 1 }`
terminates the loop as expected (...well, I'd expect it to quit after
just one ctrl-c, but serenity's shell makes a single ctrl-c only
quit the current loop iteration).

Part of #3419.
2020-09-09 12:44:35 +02:00
asynts
9c83d6ff46 Refactor: Replace usages of FixedArray with Array. 2020-09-08 14:01:21 +02:00
Nico Weber
4ac5cc2461 ntpquery: Compute and print delay and offset 2020-09-07 11:22:48 +02:00
Nico Weber
f1a6884a51 ntpquery: Add a -s flag to make it adjust the time 2020-09-06 21:50:55 +02:00
Nico Weber
0736ae4116 ntpquery: Use time.google.com as default NTP server for now
Using a pool.ntp.org server seems nicer and more open-source-y,
but until our pool use is approved, let's put in a default value
that works.

(time.google.com serves smeared time instead of doing leap seconds.
pool.ntp.org doesn't serve smeared time. I intend to implement
client-side leap second smearing since nobody likes jumpy timestamps.
For now, we get this for free.)
2020-09-06 21:50:55 +02:00
Nico Weber
8016b2c546 ntpquery: Record destination timestamp as well 2020-09-06 21:50:55 +02:00
Andreas Kling
bc48181939 Userland: Add missing license headers to "w" and "utmpupdate" 2020-09-06 20:44:16 +02:00
Andreas Kling
4e2ccde85a Userland: Shorten "w" idle time format
Let's just say "123s" for now (instead of "123 sec")
2020-09-06 19:13:52 +02:00
Andreas Kling
6dc5cda50d Userland: Bring back improved "LOGIN@" column in "w"
This actually looks a lot nicer if we slim down the datetime format.
Also remove the "FROM" column which was the one I actually didn't want.
2020-09-06 19:13:00 +02:00
Andreas Kling
c995166c56 utmpupdate: Store the login time in /var/run/utmp as a Unix timestamp
This is obviously nicer and makes it easy for other programs to do what
they want with the timestamp.
2020-09-06 19:08:09 +02:00
Andreas Kling
d531b4fa61 Userland: Show the current foreground process name in "w" output
Add a "WHAT" column that shows which command is currently executing in
each active session. Very neat :^)
2020-09-06 19:05:08 +02:00
Andreas Kling
6d8c4af9c2 LibCore+top: Use pid_t for pgid/pgrp/sid numbers 2020-09-06 19:04:47 +02:00
Andreas Kling
5a934c37cf Userland: Remove "LOGIN@" column from "w" since it's not really useful
Maybe we can bring this back once we have remote logins, or at least
make it optional then. At the moment, it's not very interesting.
2020-09-06 18:59:56 +02:00
Andreas Kling
abce7e7ca2 Userland: Show idle times in "w" output
The idle time is based on the mtime of the session's TTY :^)
2020-09-06 18:58:58 +02:00
Andreas Kling
ae9c5bf216 Userland: Tweak "w" output just slightly 2020-09-06 18:48:00 +02:00
Andreas Kling
8e489b451a Userland: Add a simple 'w' program that shows current terminal sessions
This fetches information from /var/run/utmp and shows the interactive
sessions in a little list. More things can be added here to make it
more interesting. :^)
2020-09-06 16:16:10 +02:00
Andreas Kling
171bfcff36 utmpupdate: Use pledge() and unveil() 2020-09-06 16:14:27 +02:00
Andreas Kling
dcd47655d0 utmpupdate: Add a program for updating /var/run/utmp
To keep track of ongoing terminal sessions, we now have a sort-of
traditional /var/run/utmp file, like other Unix systems.
Unlike other Unix systems however, ours is of course JSON. :^)

The /bin/utmpupdate program is used to update the file, which is
not writable by regular user accounts. This helper program is
set-GID "utmp".
2020-09-06 16:10:27 +02:00
asynts
5d85be7ed4 LibCompress: Add another unit test.
I suspected an error in CircularDuplexStream::read(Bytes, size_t). This
does not appear to be the case, this test case is useful regardless.

The following script was used to generate the test:

    import gzip

    uncompressed = []
    for _ in range(0x100):
        uncompressed.append(1)
    for _ in range(0x7e00):
        uncompressed.append(0)
    for _ in range(0x100):
        uncompressed.append(1)

    compressed = gzip.compress(bytes(uncompressed))
    compressed = ", ".join(f"0x{byte:02x}" for byte in compressed)

    print(f"""\
    TEST_CASE(gzip_decompress_repeat_around_buffer)
    {{
        const u8 compressed[] = {{
            {compressed}
        }};

        u8 uncompressed[0x8011];
        Bytes{{ uncompressed, sizeof(uncompressed) }}.fill(0);
        uncompressed[0x8000] = 1;

        const auto decompressed = Compress::GzipDecompressor::decompress_all({{ compressed, sizeof(compressed) }});

        EXPECT(compare({{ uncompressed, sizeof(uncompressed) }}, decompressed.bytes()));
    }}
    """, end="")
2020-09-06 12:54:45 +02:00
asynts
612c1bc84d Userland: Use Buffered<T> in gunzip. 2020-09-06 12:54:45 +02:00
Andreas Kling
51146e3075 LibGUI: Make the Clipboard API deal in raw byte buffers a bit more
To open up for putting not just text/plain content on the clipboard,
let's make the GUI::Clipboard API a bit more raw-data-friendly. :^)
2020-09-05 16:16:01 +02:00
Ben Wiederhake
c8668e9b7c Meta: Fix wonky copyright headers in Tests 2020-09-05 14:19:38 +02:00
Avery
6fe37cb471 Userland/tt: Use a default value for the test to run
Addresses #3394 which was caused by dereferencing null `test_name`
when no arguments were given to /bin/tt. Additionally, arguments
other than the defined tests now print usage and exit to avoid
running the default test.
2020-09-03 10:08:15 +02:00
AnotherTest
7e72285049 Userland: Allow unquoted 'filename' values in 'pro' 2020-08-31 23:05:58 +02:00
AnotherTest
861ce62e14 Userland: Improve 'ContentDispositionParser' in 'pro'
This patch just applies a suggestion, making the code more readable.
2020-08-31 23:05:58 +02:00
asynts
1c8312fa50 LibCompress: Fix a bug when wrapping around the buffer. 2020-08-31 23:04:55 +02:00
AnotherTest
cb7526fca0 Userland: Make 'pro' capable of guessing a filename
The whole thing with `pro url > filename` was getting annoying, so let's
just have it support Content-Disposition and guessing from the URL.
2020-08-31 09:14:11 +02:00
Nico Weber
d1990281e1 ntpquery: Add routines for converting timeval<->ntp timestamps
Use them to set the transmit timestamp on the outgoing packet and
to print the returned timestamps as ISO 8601 strings.
2020-08-30 17:37:20 +02:00
Nico Weber
73db67e806 Userland: Add an extremely simple NTP client
This only queries a single NTP server, only does a point-to-point
request, doens't do any filtering, doesn't display the response
in any useful format, and is generally very bare-bones.

But maybe, over time it can learn to query more servers, do
filtering, run as a service that keeps state over time to
improve filtering, adjust system time, and maybe learn to
run as an NTP server then.
2020-08-30 17:37:20 +02:00
Sergey Bugaev
3d936d51fd Userland: Fix passing a non-format string to fprintf() 2020-08-30 17:35:27 +02:00
Sergey Bugaev
f808810d00 LibC: Deprecate strcpy(), strncpy(), strcat() and strncat() :^)
And also mark strlcpy() and strlcat() with __attribute__((warn_unused_result)).

Since our code is warning-free, this ensures we never misuse those functions.
(Or are very sure about doing it when turning off the warning for a particular
piece of code.)
2020-08-30 17:35:27 +02:00
Sergey Bugaev
0106647ab8 Tests: Assert the path fits 2020-08-30 17:35:27 +02:00
Sergey Bugaev
852454746e Everywhere: Port to String::copy_characters_to_buffer() 2020-08-30 17:35:27 +02:00
asynts
c288b499aa Userland: add gunzip utility. 2020-08-30 09:56:10 +02:00
asynts
3f1dfc2e97 LibCompress: Implement gzip. 2020-08-30 09:56:10 +02:00
Ben Wiederhake
86e2703123 Tests: Optionally switch off 858081 lines of dbg() in test-js 2020-08-30 09:43:49 +02:00
Andreas Kling
3c73b6d531 ls: Fix issue with too-narrow columns in "ls" output
There was a logic mistake in the code that computes the offset between
columns, forgetting to account for the extra characters after a name.

The comment was accurate, but the code didn't match the comment.
2020-08-28 12:58:05 +02:00
Ben Wiederhake
d063dc1e71 HackStudio: Mark compilation-unit-only functions as static 2020-08-28 11:37:33 +02:00
Nico Weber
88319b188e Userland: Stop passing ignored timezones to gettimeofday 2020-08-28 09:17:01 +02:00
asynts
7c53f14bbc LibCompress: Implement DEFLATE properly.
Now we have an actual stream implementation that can read arbitrary
(dynamic codes aren't supported yet) deflate encoded data. Even if
the blocks are really large.

And all of that happens with a single buffer of 32KiB. DEFLATE is
amazing!
2020-08-26 21:07:53 +02:00
AnotherTest
394e4c04cd LibJS: Add a helper for calling JS::Function's with arguments
The fact that a `MarkedValueList` had to be created was just annoying,
so here's an alternative.
This patchset also removes some (now) unneeded MarkedValueList.h includes.
2020-08-26 08:45:01 +02:00
Luke
694b86a4bf LibDebug: Move everything into the "Debug" namespace 2020-08-25 09:46:06 +02:00
AnotherTest
465d46c665 Meta+Userland: Run the TLS test too
While this _does_ add a point of failure, it'll be a pretty bad day when
google goes down.
And this is unlikely to put a (positive) dent in their incoming
requests, so let's just roll with it until we have our own TLS server.
2020-08-24 09:29:39 +02:00
AnotherTest
c9f902d5de Userland: Add missing HMAC-SHA1 tests 2020-08-24 09:29:39 +02:00
Ben Wiederhake
7a2b5d1328 Tests: Prefer strlcpy over strncpy
Because it looks nicer.
2020-08-24 00:45:03 +02:00
Ben Wiederhake
cb52bfdd27 Userland: Prefer strlcpy over strcpy in ping
This is supposed to serve as a reminder if and when someone decides to make
the 'msg' field configurable.
2020-08-24 00:45:03 +02:00
Ben Wiederhake
5c1a72f0ef Userland: Prefer strlcpy over strncpy in ifconfig, fixes off-by-one
A malicious caller of ifconfig could have caused the ifr_name field to
lack NUL-termination. I don't think this was an actual problem, though, as
the Kernel always forces NUL-termination by overwriting ifr_name's last byte
with NUL.

However, it feels better to do it properly.
2020-08-24 00:45:03 +02:00
Ben Wiederhake
3fc2c4866f LibC: Stub and test strlcpy 2020-08-24 00:45:03 +02:00
Ben Wiederhake
417ca7594b Tests: Remove unused include 2020-08-24 00:45:03 +02:00
Luke
bedd15c340 test-web: Add updates from test-js
These should definitely be deduplicated at some point.
2020-08-23 11:22:47 +02:00
Luke
5877d6713c test-js+test-web: Clear taskbar progress on error/assertion failure
Closes #3240
2020-08-23 11:22:47 +02:00
Ben Wiederhake
4f77ccbda8 LibC+Userland: Prefer snprintf over sprintf
I ignored the sprintf in Userland/cal.cpp because it's too much trouble.
However, this only underlines the need for bounds checking.
2020-08-22 20:55:10 +02:00
Ben Wiederhake
499e953380 LibC: Demonstrate off-by-one in current snprintf
The function whose main selling point is that there always is a
NUL-terminator ... missed the NUL-terminator.
2020-08-22 20:55:10 +02:00
Nico Weber
96891669c3 test-js: Sometimes include more details for failures
LibJS doesn't store stacks for exception objects, so this
only amends test-common.js's __expect() with an optional
`details` function that can produce a more detailed error
message, and it lets test-js.cpp read and print that
error message.  I added the optional details parameter to
a few matchers, most notably toBe() where it now prints
expected and actual value.

It'd be nice to have line numbers of failures, but that
seems hard to do with the current design, and this is already
much better than the current state.
2020-08-22 10:52:40 +02:00
Nico Weber
3fbb02c3cc test-js: Print parse error if test-common.js fails to parse 2020-08-22 10:52:40 +02:00
asynts
aa25fb8875 Userland: Use TestSuite.h in test-compress. 2020-08-22 10:46:56 +02:00
AnotherTest
30554c969c LibLine: Handle interrupts/window size changes internally 2020-08-21 16:10:51 +02:00
asynts
8bbb7e25e6 LibCompress: Turn the DEFLATE implementation into a stream.
Previously, the implementation would produce one Vector<u8> which
would contain the whole decompressed data. That can be a lot and
even exhaust memory.

With these changes it is still necessary to store the whole input data
in one piece (I am working on this next,) but the output can be read
block by block. (That's not optimal either because blocks can be
arbitrarily large, but it's good for now.)
2020-08-20 16:28:31 +02:00
Luke
c2a2552e46 LibWeb: Add more document tests, add comment, text and mixin tests
Also adds a TypeScript definition file for the test runner object.
2020-08-17 22:57:05 +02:00
Andreas Kling
56c3748dcc LibWeb: Rename PageView => InProcessWebView 2020-08-17 18:05:35 +02:00
Andreas Kling
0fecdb7904 disasm: Use make<X86::ELFSymbolProvider> instead of naked new 2020-08-17 13:12:46 +02:00
Brian Gianforcaro
bcbac83a8b Userland: Explicitly ignore number of types read, found by Coverity 2020-08-17 09:17:57 +02:00
Ben Wiederhake
b0aa8115c2 Userland: Provide a misbehaving application
This will be a test case for #2977.
2020-08-17 00:01:13 +02:00
Nico Weber
f025204dfe disasm: For ELF inputs, pass an ELFSymbolProvider to disassembler
This lets disasm output contain the symbol names of call and jump
destinations:

    8048111:	e8 88 38 01 00       	call   805b99e <__cxa_atexit>
    ...
    8048150:	74 15                	je     8048167 <_start+0x4c>

The latter (the symbol of the current function with an offset) is
arguably more distracting than useful because you usually want to look
at the instruction at the absolute offset in this case, but the former
is very nice to have.

For reasons I do not understand, this cuts the time to run
`disasm /bin/id` in half, from ~1s to ~0.5s.
2020-08-16 19:37:58 +02:00
Ben Wiederhake
d33e3b7d8a LibCrypto: Fix random number generation 2020-08-16 16:35:23 +02:00
Ben Wiederhake
2e470a4a47 LibCrypto: Demonstrate that primality and random numbers are broken 2020-08-16 16:35:23 +02:00
Nico Weber
1e2dc736e3 Userland/tt: Switch to MiB 2020-08-16 16:33:28 +02:00
Nico Weber
43a0ffe54d Userland/allocate: Switch to KiB/MiB 2020-08-16 16:33:28 +02:00
Nico Weber
aa97166739 Everywhere: Consolidate human_readable_size() implementations
Let's use the one in AK/NumberFormat.h everywhere.

It has slightly different behavior than some of the copies this
removes, but it's probably nice to have uniform human readable
size outputs across the system.
2020-08-16 16:33:28 +02:00
Nico Weber
430b265cd4 AK: Rename KB, MB, GB to KiB, MiB, GiB
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9".
The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30".

Let's use the correct name, at least in code.

Only changes the name of the constants, no other behavior change.
2020-08-16 16:33:28 +02:00
asynts
fc276946fb Refactor: Use ReadonlyBytes instead of const ReadonlyBytes&. 2020-08-15 21:21:18 +02:00
asynts
fff581cd72 AK: Rename span() to bytes() when appropriate.
I originally defined the bytes() method for the String class, because it
made it obvious that it's a span of bytes instead of span of characters.

This commit makes this more consistent by defining a bytes() method when
the type of the span is known to be u8.

Additionaly, the cast operator to Bytes is overloaded for ByteBuffer and
such.
2020-08-15 21:21:18 +02:00
Linus Groh
2e5c434e22 Misc: Use automatic window positioning in more applications
This is a follow up to #2936 / d3e3b4ae56aa79d9bde12ca1f143dcf116f89a4c.

Affected programs:
- Applications: Browser (Download, View source, Inspect DOM tree, JS
  console), Terminal (Settings)
- Demos: Cube, Eyes, Fire, HelloWorld, LibGfxDemo, WebView,
  WidgetGallery
- DevTools: HackStudio, Inspector, Profiler
- Games: 2048, Minesweeper, Snake, Solitaire
- Userland: test-web

A few have been left out where manual positioning is done on purpose,
e.g. ClipboardManager (to be close to the menu bar) or VisualBuilder (to
preserve alignment of the multiple application windows).
2020-08-15 17:38:19 +02:00
Andreas Kling
bbe2d4a2d9 LibJS+LibWeb: Clear exceptions after call'ing JavaScript functions
Decorated Interpreter::call() with [[nodiscard]] to provoke thinking
about the returned value at each call site. This is definitely not
perfect and we should really start thinking about slimming down the
public-facing LibJS interpreter API.

Fixes #3136.
2020-08-14 17:31:07 +02:00
Nico Weber
19b329ee96 ifconfig: Fix capitalization of "kiB" 2020-08-14 16:09:58 +02:00
Nico Weber
a2b99dd3ea disasm: Print correct offset-relative jumps in ELF file disassembly 2020-08-14 10:29:41 +02:00
Ben Wiederhake
76da9a4a7d Test: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also,
in the case of test-crypto.cpp, I took the liberty to add the prefix 'g_'
to the global event loop.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
0248ddc427 Userland: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Linus Groh
7072806234 Meta: Replace remaining LibM/math.h includes with math.h 2020-08-12 16:18:33 +02:00
Ben Wiederhake
9abac64333 Userland: Make 'tt t' spawn a thread and stand still
This is useful to test SystemMonitor and /proc, because all other multi-threaded
processes tend to be moving targets.
2020-08-12 11:28:45 +02:00
AnotherTest
bc7a149039 LibCrypto+LibTLS+Kernel: Switch the Cipher::Mode interface to use Span
This shaves 2.5 more runtime seconds off 'disasm /bin/id', and makes the
Mode<T> interface a lot more allocation-friendly.
2020-08-11 21:37:10 +02:00
Andreas Kling
9e55162e9b mv: Accept (but ignore) -f
Many scripts seem to use "mv -f", so let's support that.
2020-08-11 20:29:14 +02:00
Andreas Kling
2a765ad062 rm: Implement a basic -f mode 2020-08-11 20:29:14 +02:00
Andreas Kling
015c8d0eb6 Userland: Add a simple dirname(1) utility 2020-08-10 21:20:28 +02:00
Ben Wiederhake
f225321184 Kernel: Demonstrate kill's pid/tid confusion bug 2020-08-10 11:51:45 +02:00
Ben Wiederhake
7ab90e1a13 Kernel: Demonstrate setpgid confusion bug
Technically, this can be 'exploited' to set the pgid of an exploiting process
to a near-arbitrary new pgid. This can cause conflicts when assigning future pgids,
destroys the session-boundary, and might confuse future pgid-to-session lookups.

In practice, I can't come up with a way that this causes actual harm.
2020-08-10 11:51:45 +02:00
Nico Weber
6613a4cb8c disasm: Insert symbol names in disassembly stream
The symbol name insertion scheme is different from objdump -d's.
Compare the output on Build/Userland/id:

* disasm:

        ...
        _start (08048305-0804836b):
        08048305  push ebp
        ...
        08048366  call 0x0000df56

        0804836b  o16 nop
        0804836d  o16 nop
        0804836f  nop

        (deregister_tm_clones (08048370-08048370))

        08048370  mov eax, 0x080643e0
        ...
        _ZN2AK8Utf8ViewC1ERKNS_6StringE (0805d9b2-0805d9b7):
        _ZN2AK8Utf8ViewC2ERKNS_6StringE (0805d9b2-0805d9b7):
        0805d9b2  jmp 0x00014ff2

        0805d9b7  nop

* objdump -d:

        08048305 <_start>:
         8048305:	55                   	push   %ebp
        ...
         8048366:	e8 9b dc 00 00       	call   8056006 <exit>
         804836b:	66 90                	xchg   %ax,%ax
         804836d:	66 90                	xchg   %ax,%ax
         804836f:	90                   	nop

        08048370 <deregister_tm_clones>:
         8048370:	b8 e0 43 06 08       	mov    $0x80643e0,%eax
        ...
        0805d9b2 <_ZN2AK8Utf8ViewC1ERKNS_6StringE>:
         805d9b2:	e9 eb f6 ff ff       	jmp    805d0a2 <_ZN2AK10StringViewC1ERKNS_6StringE>
         805d9b7:	90                   	nop

Differences:

1. disasm can show multiple symbols that cover the same instructions.
   I've only seen this happen for C1/C2 (and D1/D2) ctor/dtor pairs,
   but it could conceivably happen with ICF as well.

2. disasm separates instructions that do not belong to a symbol with
   a newline, so that nop padding isn't shown as part of a function
   when it technically isn't.

3. disasm shows symbols that are skipped (due to having size 0)
   in parenthesis, separated from preceding and following instructions.
2020-08-10 11:48:10 +02:00
Nico Weber
9c136be08b disasm: For ELF files, disassemble .text section
Since disasm is built in lagom, this requires adding LibELF to lagom.
2020-08-09 21:12:54 +02:00
AnotherTest
7ebba7bf3c open: Resolve the realpath before passing it to URL()
...which runs it through LexicalPath.
Fixes #3016.
2020-08-08 11:58:57 +02:00
Linus Groh
d9de0a5007 Userland: Use Core::ArgsParser for 'aplay' 2020-08-06 20:41:13 +02:00
Linus Groh
8f33a44b6c Userland: Use Core::ArgsParser for 'avol' 2020-08-06 20:41:13 +02:00
Linus Groh
9b07defb36 Userland: Use Core::ArgsParser for 'basename' 2020-08-06 20:41:13 +02:00
Linus Groh
14db94f44b Userland: Use Core::ArgsParser for 'chgrp' 2020-08-06 20:41:13 +02:00
Linus Groh
c8d690d840 Userland: Use Core::ArgsParser for 'disasm' 2020-08-06 20:41:13 +02:00
Linus Groh
31a4a2cc2a Userland: Use Core::ArgsParser for 'hostname' 2020-08-06 20:41:13 +02:00
Linus Groh
718a45ef71 Userland: Handle invalid JSON in 'jp' 2020-08-06 20:41:13 +02:00
Linus Groh
f4f3ab0ad9 Userland: Use Core::ArgsParser for 'jp' 2020-08-06 20:41:13 +02:00
Linus Groh
ab1f3551cc Userland: Use Core::ArgsParser for 'md' 2020-08-06 20:41:13 +02:00
Linus Groh
f6369a66b1 Userland: Use Core::ArgsParser for 'modload' 2020-08-06 20:41:13 +02:00
Linus Groh
3cc5ed642e Userland: Use Core::ArgsParser for 'modunload' 2020-08-06 20:41:13 +02:00
Linus Groh
ca799fe4ab Userland: Use Core::ArgsParser for 'ping' 2020-08-06 20:41:13 +02:00
Linus Groh
59942edcc0 Userland: Use Core::ArgsParser for 'pro' 2020-08-06 20:41:13 +02:00
Linus Groh
4565d2d415 Userland: Use Core::ArgsParser for 'purge' 2020-08-06 20:41:13 +02:00
Linus Groh
646f6165e2 Userland: Use Core::ArgsParser for 'realpath' 2020-08-06 20:41:13 +02:00
Linus Groh
7b82334e2f Userland: Use Core::ArgsParser for 'rmdir' 2020-08-06 20:41:13 +02:00
Linus Groh
3298b0318c Userland: Use Core::ArgsParser for 'su' 2020-08-06 20:41:13 +02:00
Linus Groh
d320f7b9d2 Userland: Use Core::ArgsParser for 'tr' 2020-08-06 20:41:13 +02:00
Linus Groh
559ea8e1b5 Userland: Use Core::ArgsParser for 'tt' 2020-08-06 20:41:13 +02:00
Linus Groh
edc5f5b9bb Userland: Use Core::ArgsParser for 'uname' 2020-08-06 20:41:13 +02:00
Linus Groh
4ba23745c0 Userland: Use Core::ArgsParser for 'which' 2020-08-06 20:41:13 +02:00
Linus Groh
cf81d9765c Userland: Use Core::ArgsParser for 'yes' 2020-08-06 20:41:13 +02:00
asynts
b3d1a05261 Refactor: Expose const_cast by removing ByteBuffer::warp(const void*, size_t)
This function did a const_cast internally which made the call side look
"safe". This method is removed completely and call sites are replaced
with ByteBuffer::wrap(const_cast<void*>(data), size) which makes the
behaviour obvious.
2020-08-06 10:33:16 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Brian Gianforcaro
9572c95152 LibTLS + LibCrypto: Suppress unobserved Optoinal<T> return values. 2020-08-05 12:27:15 +02:00
Andreas Kling
984683cf34 Revert "LibM: Always include <math.h> instead of <LibM/math.h>"
This reverts commit dc12cbca41.

Sadly this broke the build due to some confusion about <new>.
Reverting until this can be solved fully.
2020-08-04 21:17:43 +02:00
Andreas Kling
dc12cbca41 LibM: Always include <math.h> instead of <LibM/math.h>
This makes Lagom pick up the host math.h, which is what we want.
2020-08-04 19:06:27 +02:00
Andreas Kling
83a4fbf548 Kernel: Tidy up the syscalls list by reorganizing the enumerator macro 2020-08-04 18:17:16 +02:00
stelar7
98e18d7339 LibCompress: Add LibCompress
For now this only contains DEFLATE, and a very simple Zlib
Eventually GZip, etc. can go here as well.
2020-08-04 11:27:07 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Ben Wiederhake
58240aedd9 Tests: License headers, clang-format, clearer output 2020-08-02 17:15:36 +02:00
Ben Wiederhake
29eceebdbf Tests: Build automatically, fix compilation errors 2020-08-02 17:15:36 +02:00
Ben Wiederhake
2074c9d66d LibC: Add tests for getenv, setenv, putenv 2020-08-01 16:46:04 +02:00
Andreas Kling
3d5abae17b lsof: Fix some minor issues
Correct copyright year, fix a comment and add missing veil lock.
2020-08-01 16:30:19 +02:00
Maciej Zygmanowski
cf78c16afd Userland: Add basic `lsof' command 2020-07-31 18:26:18 +02:00
AnotherTest
b00ffc860b LibCrypto: Do not trim leading zeros in export_data by default
This fixes the issue with the exported data having a leading zero,
causing RSA::encrypt to trim the block down, and ruining the encryption.

Fixes #2691 :^)
2020-07-31 18:25:20 +02:00
Ben Wiederhake
538a3a2579 Userland: Add missing checks for MappedFile.is_valid() 2020-07-31 11:34:06 +02:00
AnotherTest
6df2f8a8cb Userland: Add support for the '-n' flag to 'echo' 2020-07-30 18:47:41 +02:00
stelar7
dad22c5d5a LibCrypto: Add some checksum algorithms
Namely CRC32 and Adler32
2020-07-30 17:08:19 +02:00
Andreas Kling
cc4109c03b LibWeb: Move the HTML parser into HTML/Parser/ 2020-07-28 19:23:18 +02:00
Ben Wiederhake
a296020e03 LibCrypto: Implement and test CTR decryption 2020-07-28 19:10:10 +02:00
Ben Wiederhake
a51cbc2978 LibCrypto: Fix broken CTR mode, implement RFC 3686 Test Vectors 2020-07-28 19:10:10 +02:00
Andreas Kling
c46439f240 LibWeb: Move HTML classes into the Web::HTML namespace 2020-07-28 18:55:48 +02:00
Peter Elliott
99ddbb83e8 Userland: Make su require passwords 2020-07-28 17:07:22 +02:00
Peter Elliott
207fb054e5 Userland: Add passwd utility 2020-07-28 17:07:22 +02:00
Linus Groh
090c031c1a Userland: Fix nc by not memset()'ing the input address char*
We were accidentally calling memset() on "addr" (the input char*), not
"dst_addr" (the target struct sockaddr_in), which was causing a simple
"nc localhost 8000" to crash.

Fixes #2908.
2020-07-28 13:19:22 +02:00
asynts
4709b700bd LibCrypto: Change [XXX]BigInteger::export_data() to use Span. 2020-07-27 19:58:09 +02:00
asynts
abe925e4b0 AK: Change the signature of AK::encode_base64() to use Span. 2020-07-27 19:58:09 +02:00
Andreas Kling
9f752ce1f6 top: Don't print more lines than the terminal can fit 2020-07-27 17:04:47 +02:00
Andreas Kling
b6e29656a1 top: Limit printed process name characters to the available space
It looks much nicer if we don't break the line. You can resize the
terminal if you want to see the full process name.
2020-07-27 17:01:20 +02:00
Andreas Kling
417e3877d7 top: Tweak username column width to accomodate "clipboard" 2020-07-27 16:52:36 +02:00