Commit graph

1028 commits

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