Commit graph

22643 commits

Author SHA1 Message Date
brapru 4c0c4f3102 Utilities: Validate user with Core::Account in userdel
Previously the remove home directory option never actually removed the
user's home directory because it was not properly unveiled. By
validating the user with Core::Account, we can identify the user's home
directory earlier in the program and unveil as necessary.

Additionally, by identifying if the user does not exist much earlier in
the program, this elimates depending on getpwent to validate the user
and creating unneccessary temp files.
2021-06-24 17:33:14 +04:30
Andreas Kling bc1930e0e0 LibJS: Fix clang-tidy warnings in AST.h
- Add/remove `move()` as suggested.
- Add missing `explicit` on single-parameter constructors.
2021-06-24 13:38:21 +02:00
Andreas Kling 0eeb7f67a7 LibJS: Don't use m_ prefix for argument name in ScriptFunction 2021-06-24 13:29:25 +02:00
Andreas Kling ce2747692d LibJS: Remove unused DeclarativeEnvironmentRecord::type()
Nothing was using this, and we now have separate classes for the
different types of environment records instead.
2021-06-24 13:28:15 +02:00
Andreas Kling 0cd65b55bd LibJS: Add ObjectEnvironmentRecord.[[IsWithEnvironment]] field
This is true for environments created by `with` statements, and false
for other (global) object environments.

Also add the WithBaseObject abstract operation while we're here.
2021-06-24 13:26:00 +02:00
Jamie Mansfield 3f8857cd21 Games: Add Spider
Scoring is designed to mimic Microsoft's implementation - starting at
500, decreasing by 1 every move, and increasing by 100 for every full
stack.

Fixes GH-5319.
2021-06-24 10:32:53 +02:00
Jamie Mansfield b7e806e15e LibCards: Support non-alternating colour patience games
This introduces a new MovementType concept to LibCards, starting the
process to allow other patience games to be implemented using it - that
differ more substantially from Klondike in logic.

This is currently used for two purposes: 1. to verify that the
'grabbed' stack of cards is valid* (sequential and correct colours) and
2. to allow 'grabbed' stacks to be pushed onto same-colour,
either-colour, or alternating-colour stacks

* Klondike doesn't need this logic, as per how the game works any
  'grabbed' selection is guaranteed to be valid.
2021-06-24 10:32:53 +02:00
Max Wipfli 84c0f98fb2 Kernel: Reimplement the dbgputch and dbgputstr syscalls
This rewrites the dbgputch and dbgputstr system calls as wrappers of
kstdio.h.

This fixes a bug where only the Kernel's debug output was also sent to
a serial debugger, while the userspace's debug output was only sent to
the Bochs debugger.

This also fixes a bug where debug output from one process would
sometimes "interrupt" the debug output from another process in the
middle of a line.
2021-06-24 10:29:09 +02:00
Max Wipfli 67067904f5 Kernel: Add dbgputch() to kstdio.h
This adds a dbgputch() alongside dbgputstr() in kstdio.h. The function
already existed as the static function debugger_out(). It has now been
exposed to users of kstdio.h.
2021-06-24 10:29:09 +02:00
Gunnar Beutner 441d6dcdf9 Kernel: Fix compiling TmpFSInode::write_bytes on x86_64 2021-06-24 09:27:13 +02:00
Gunnar Beutner 15e25a8c1f AK: Fix building Ptr32 on x86_64 2021-06-24 09:27:13 +02:00
Gunnar Beutner 1ae7d68885 LibSymbolication: Fix incorrect argument type for symbolicate() 2021-06-24 09:27:13 +02:00
Gunnar Beutner 38fca26f54 Kernel: Add stubs for missing x86_64 functionality
This adds just enough stubs to make the kernel compile on x86_64. Obviously
it won't do anything useful - in fact it won't even attempt to boot because
Multiboot doesn't support ELF64 binaries - but it gets those compiler errors
out of the way so more progress can be made getting all the missing
functionality in place.
2021-06-24 09:27:13 +02:00
Gunnar Beutner f2eb759901 Profiler: Use u32 when constructing InstructionData
When constructing values of the InstructionData type we assume that
the event_count field is a size_t while it actually is a u32. On x86_64
this fails because those are different types.
2021-06-24 09:27:13 +02:00
Gunnar Beutner dc3cc7368b Kernel: Don't use function-level static variables
When building the kernel for x86_64 the compiler injects calls to
__cxa_guard_acquire which depends on a bunch of pthread functions
we don't have in the kernel.
2021-06-24 09:27:13 +02:00
Gunnar Beutner 6600835802 Tests: Disable kernel and LibC tests for x86_64
Some of the tests assume 32-bit addresses, so let's disable them for now.
2021-06-24 09:27:13 +02:00
Gunnar Beutner c9a8dfa1bf Userland: Add more TODO()s for arch-specific code
This enables building more of the userspace applications for x86_64.
2021-06-24 09:27:13 +02:00
Sam Atkins f2d6cac692
Solitaire: Maybe fix rare crash from completing a game with TAB (#8217)
The crash happens very rarely and is hard to reproduce so it is
hard to know for certain, but I am confident this fixes it.

I previously delayed the start of the game-over animation by one
frame, but neglected to check m_start_game_over_animation_next_frame
wasn't set. This means multiple calls to start_game_over_animation()
on the same frame (or rather, before the first timer_event) would
each call Object::start_timer(). Now that we do check the flag,
that should no longer be possible.

Fixes #8122.
2021-06-24 09:25:01 +02:00
Jan de Visser bd5a04fffe LibSQL: Reduce run time of TestSqlDatabase
Scanning tables is a linear process using pointers in the table's
tuples, and does not involve more 'stochastic' code paths like index
traversals. Therefore the 1000 and 10000 row tests were basically
overkill and added nothing we can't find out with less rows.
2021-06-24 09:23:14 +02:00
Max Wipfli b3c3b78b01 Tests: Reduce runtime of TestCharacterTypes
This declares all test cases which compare function outputs over the
entire Unicode range as `BENCHMARK_CASE`, to avoid them being run by CI.
This reduces runtime of TestCharacterTypes (without benchmarks) by about
one third.
2021-06-24 09:16:28 +02:00
Gunnar Beutner ac650d2362 Userland: Remove dummy IPC methods
They're not used anywhere and are unnecessary boilerplate code. So let's
remove them and update IPCCompiler to allow for empty endpoint
declarations.
2021-06-24 00:38:58 +02:00
Hendiadyoin1 62f9377656 Kernel: Move special sections into Sections.h
This also removes a lot of CPU.h includes infavor for Sections.h
2021-06-24 00:38:23 +02:00
Hendiadyoin1 925be2758e Kernel: Remove unused CPU.h includes
In most cases we did not need it at all, in other, we only needed one
header from it
2021-06-24 00:38:23 +02:00
Hendiadyoin1 553ea3036d Kernel: Remove PAGE_SIZE from CPU.h
We have that information in LibC, lets use that instead
2021-06-24 00:38:23 +02:00
Hendiadyoin1 7ca3d413f7 Kernel: Pull apart CPU.h
This does not add any functional changes
2021-06-24 00:38:23 +02:00
Hendiadyoin1 37253ebcae LibELF: Fix missing include
A few files are expecting that someone brings PAGE_SIZE from possibly
the Kernel with them
2021-06-24 00:38:23 +02:00
Jan de Visser 5c4890411b LibSQL: Make lexer and parser more standard SQL compliant
SQL was standardized before there was consensus on sane language syntax
constructs had evolved. The language is mostly case-insensitive, with
unquoted text converted to upper case. Identifiers can include lower
case characters and other 'special' characters by enclosing the
identifier with double quotes. A double quote is escaped by doubling it.
Likewise, a single quote in a literal string is escaped by doubling it.

All this means that the strategy used in the lexer, where a token's
value is a StringView 'window' on the source string, does not work,
because the value needs to be massaged before being handed to the
parser. Therefore a token now has a String containing its value. Given
the limited lifetime of a token, this is acceptable overhead.

Not doing this means that for example quote removal and double quote
escaping would need to be done in the parser or in AST node
construction, which would spread lexing basically all over the place.
Which would be suboptimal.

There was some impact on the sql utility and SyntaxHighlighter component
which was addressed by storing the token's end position together with
the start position in order to properly highlight it.

Finally, reviewing the tests for parsing numeric literals revealed an
inconsistency in which tokens we accept or reject: `1a` is accepted but
`1e` is rejected. Related to this is the fate of `0x`. Added a FIXME
reminding us to address this.
2021-06-24 00:36:53 +02:00
Jan de Visser 4198f7e1af LibSQL: Move Lexer and Parser machinery to AST directory
The SQL engine is expected to be a fairly sizeable piece of software.
Therefore we're starting to restructure the codebase for growth.
2021-06-24 00:36:53 +02:00
Federico Guerinoni e0f1c237d2 HackStudio: Make TODO entries clickable
Now you can click a TODO entry to set focus on that position of that
file.
2021-06-23 19:00:11 +01:00
Federico Guerinoni 935c7b2f4b HackStudio: Add TODO entries widget 2021-06-23 19:00:11 +01:00
Federico Guerinoni 26a7356e90 LanguageServers: Add function to collect TODO entries in a document 2021-06-23 19:00:11 +01:00
Federico Guerinoni c397e030f4 LibCpp: Add function for retrieving TODO comments from the parser
Now `get_todo_entries` collects all TODO found within a comment
statement.
2021-06-23 19:00:11 +01:00
Ali Mohammad Pur fcef84c461 LibVT: Rewrap the terminal history along with the normal buffer 2021-06-23 19:04:08 +02:00
Ali Mohammad Pur 4bf14715a1 LibLine: Recalculate the origin on resize 2021-06-23 19:04:08 +02:00
Ali Mohammad Pur 2f2b7814d1 LibVT+Terminal: Implement line wrapping
This commit implements line wrapping in the terminal, and tries its best
to move the cursor to the "correct" position.
2021-06-23 19:04:08 +02:00
Ali Mohammad Pur 424965954f LibVT: Keep track of the 'true' line endings 2021-06-23 19:04:08 +02:00
Ali Mohammad Pur c38fafbf4e AK: Make {min,max,clamp}(T, U) work when U can be implicitly cast to T
It was really annoying to `static_cast` the arguments to be the same
type, so instead of doing that, just convert the second one to the first
one, and let the compiler warn about sign differences and truncation.
2021-06-23 19:04:08 +02:00
Aatos Majava 3b2a528b33 LibTextCodec: Add Turkish (aka ISO-8859-9, Windows-1254) encoding 2021-06-23 16:32:47 +01:00
Gunnar Beutner 21ee0ad6fc LibVT: Don't crash when clicking outside of the terminal's buffer area
When resizing a terminal window the number of columns may change.
Previously we assumed that this also affects lines which were in the
terminal's buffer while that is not necessarily true.
2021-06-23 16:26:40 +02:00
Linus Groh c503a28e19 LibJS: Make AggregateError inherit from Error
This is our way of implementing the [[ErrorData]] internal slot, which
is being used in Object.prototype.toString().
2021-06-23 13:59:17 +01:00
Linus Groh 0e8cbfb7b5 LibJS: Fix AggregateError's class_name() 2021-06-23 13:55:43 +01:00
Andreas Kling 15faa13c95 LibJS: Add spec links to a bunch of the environment record methods 2021-06-23 13:25:57 +02:00
Andreas Kling cf34313fad LibJS: Remove no-longer-needed environment record shape
We had a cached shape for environment records to make instantiating
them fast. Now that environment records don't inherit from JS::Object,
we can just get rid of this. :^)
2021-06-23 13:08:40 +02:00
Andreas Kling 9ccc2f6c4d LibJS: Make EnvironmentRecord inherit directly from Cell
Previously, EnvironmentRecord was a JS::Object. This was done because
GlobalObject inherited from EnvironmentRecord. Now that this is no
longer the case, we can simplify things by making EnvironmentRecord
inherit from Cell directly.

This also removes the need for environment records to have a shape,
which was awkward. This will be removed in the following patch.
2021-06-23 13:08:27 +02:00
Gunnar Beutner 7a87e920f2 HexEditor: Change name for unsaved files to 'Untitled' 2021-06-23 13:08:14 +02:00
Gunnar Beutner b246221eac HexEditor: Prompt the user to save changes when opening a file 2021-06-23 13:08:14 +02:00
coderdreams 5edc0d11b0 Tests: Enable AK/TestJSON back
now that tests run on their respective directories
2021-06-23 13:07:40 +02:00
Andreas Kling f1e1d9dd74 LibJS: Add EnvironmentRecord::global_object()
Our environment records are currently weird in that they inherit from
Object, but don't have a connection to the global object.

I'd like to remove this inheritance, and the first step is giving them
their own pointer to the global object.
2021-06-23 12:50:26 +02:00
Andreas Kling 9d49a5478a LibJS: Start implementing spec-compliant variable bindings
This patch adds the concept of variable bindings to the various
environment record classes. The bindings are not yet hooked up to
anything, this is just fleshing out all the operations.

Most of this is following the spec exactly, but in a few cases we are
missing the requisite abstract operations to do the exact right thing.
I've added FIXME's in those cases where I noticed it.
2021-06-23 12:50:21 +02:00
Anonymous 2822da8c8f LibJS: Correct behaviour of direct vs. indirect eval
eval only has direct access to the local scope when accessed through
the name eval. This includes locals named eval, because of course it
does.
2021-06-23 09:38:33 +01:00