Commit Graph

13107 Commits

Author SHA1 Message Date
Nico Weber
62f615f0f4 UsespaceEmulator: Fix minor bugs in recvfrom() interception
* Pass the correct source address for copying tine addr_length.
  Previously, this was broken when addr_length was non-nullptr.

* Copy min(sizeof(address), address_length) bytes into address,
  instead of sizeof(address), which might be larger than the
  user buffer.

* Use sockaddr_storage instead of sockaddr_un. In practice they're
  both the same size, but this is what sockaddr_storage is for.

With this (in particular, the first fix), `ue /bin/ntpquery`
actually gets past the recvfrom() call :^)
2020-09-15 23:29:51 +02:00
Nico Weber
f0018aca1d UserspaceEmulator: Intercept sendto()
With this, `ue /bin/ntpquery` can be used to test sendto() and
recvfrom() in ue. (It eventually hits an unimplemented FILD_RM64,
but not before doing emulated network i/o and printing response
details.)
2020-09-15 23:29:51 +02:00
Andreas Kling
e2f32b8f9d LibCore: Make Core::Object properties more dynamic
Instead of everyone overriding save_to() and set_property() and doing
a pretty asymmetric job of implementing the various properties, let's
add a bit of structure here.

Object properties are now represented by a Core::Property. Properties
are registered with a getter and setter (optional) in constructors.
I've added some convenience macros for creating and registering
properties, but this does still feel a bit bulky. We'll have to
iterate on this and see where it goes.
2020-09-15 21:46:26 +02:00
Itamar
1e96e46a81 HackStudio: Refresh the Git widget state on file save 2020-09-15 21:43:29 +02:00
Itamar
d1eedd0e9f HackStudio: View unstaged diffs in files with DiffViewer 2020-09-15 21:43:29 +02:00
Itamar
ba11082b4b HackStudio: Add functionality to GitRepo object
Added functionality for:
- Original files contents (without the current changes)
- Unstaged diffs
- Checking whether a file is tracked
2020-09-15 21:43:29 +02:00
Itamar
8306a84967 HackStudio: Add DiffViewer widget
This widget presents a diff in a nice graphical way, side by side.
2020-09-15 21:43:29 +02:00
Itamar
11440fa78f LibDiff: Add library for working with diffs
LibDiff currently contains functionality for parsing diffs in the
"unified format" and for a generating simple diff that contains only
additions.
2020-09-15 21:43:29 +02:00
Itamar
7c70183f3f HackStudio: Make the actions tab visible when using the form editor
Previously, the strucutre of the HackStudio widgets made it so the
actions tab would be hidden when the "edit mode" was something other
than EditMode::Text (for example, when using the form editor).
2020-09-15 21:43:29 +02:00
Itamar
dac7db830a HackStudio: Fix "Add new Editor" action 2020-09-15 21:43:29 +02:00
Itamar
f300b81648 HackStudio: Add "commit" and "refresh" actions to Git widget 2020-09-15 21:43:29 +02:00
Itamar
435c6c6f96 HackStudio: Add basic Git integration
This adds a "Git" tab to Hackstudio.
Currently has support for staging and unstaging files.
2020-09-15 21:43:29 +02:00
Itamar
7b66469ab3 LibCore: Add command() utility functions
Add utility functions for executing commands and getting their output.
2020-09-15 21:43:29 +02:00
Itamar
e5ceec8621 Ports: Add default .gitconfig for Git port
This stops git from asking us to configure a username and email when we
try to commit.
2020-09-15 21:43:29 +02:00
pkotzbach
82696078b0 LibGUI: Fix to ComboBox fields activation 2020-09-15 20:37:13 +02:00
AnotherTest
3a8109d1e0 Shell: Add some sections on the manpage about `match' 2020-09-15 20:36:59 +02:00
AnotherTest
4f223793c0 Shell: Add some tests for 'match' 2020-09-15 20:36:59 +02:00
AnotherTest
4c6f7846b4 Shell: Add 'match' expressions
This commit adds an equivalent to the sh 'case' construct, except it's
much more pleasing to look at and write:
```sh
match "$something" {
    p1 { echo "p1!" }
    p2 { echo "p2!" }
    *  { echo "string catch-all!" }
}
```
is the equivalent of:
```sh
case $something in
    p1)
        echo "p1!"
        ;;
    p2)
        echo "p2!"
        ;;
    *)
        echo "catch-all!"
        ;;
esac
```

Since our shell does not treat lists as strings, matching lists is also
possible:

```sh
match (1foo 2foo foo3) {
    (?foo 2* *) { echo wowzers! }
    (* * *) { echo 3-element list catch-all }
}
```
2020-09-15 20:36:59 +02:00
AnotherTest
53b85bcdd0 Shell: Make Parser::expect() revert the offset when matching fails 2020-09-15 20:36:59 +02:00
AnotherTest
afe0ae586c Shell: Make Node::resolve_as_list(nullptr) resolve to a 'pure' repr
'pure' as in "not requiring a shell", similar to
JS::Value::to_string_without_side_effects().
2020-09-15 20:36:59 +02:00
asynts
206dcd84a6 FileSystem: Use OutputMemoryStream instead of BufferStream. 2020-09-15 20:36:45 +02:00
asynts
c8ed882b8e AK: Add OutputMemoryStream::fill_to_end. 2020-09-15 20:36:45 +02:00
asynts
83d0803861 AK: Re-add OutputMemoryStream for static buffers only. 2020-09-15 20:36:45 +02:00
asynts
f18e927827 AK: Remove OutputMemoryStream for DuplexMemoryStream.
OutputMemoryStream was originally a proxy for DuplexMemoryStream that
did not expose any reading API.

Now I need to add another class that is like OutputMemoryStream but only
for static buffers. My first idea was to make OutputMemoryStream do that
too, but I think it's much better to have a distinct class for that.

I originally wanted to call that class FixedOutputMemoryStream but that
name is really cumbersome and it's a bit unintuitive because
InputMemoryStream is already reading from a fixed buffer.

So let's just use DuplexMemoryStream instead of OutputMemoryStream for
any dynamic stuff and create a new OutputMemoryStream for static
buffers.
2020-09-15 20:36:45 +02:00
Nico Weber
c9a3a5b488 Kernel: Use Userspace<> for sys$writev 2020-09-15 20:20:38 +02:00
Nico Weber
e1c54b8a0f LibLine: Implement ctrl-del: It does the same thing as alt-d, delete-word 2020-09-15 09:45:13 +02:00
Nico Weber
5198eb7c1c LibVT: Use xterm modifier scheme for tilde keys too 2020-09-15 09:45:13 +02:00
Nico Weber
d7539cf497 LibLine: Support Alt + Arrow left/right
It does the same thing as Ctrl + Arrow left/right: Wordwise movement.
2020-09-15 09:45:13 +02:00
Nico Weber
83c07be794 LibVT+LibLine: Use 1;mods CSI parameters for ctrl/alt/shift-arrow keys
xterms send a bitmask (+ 1) in the 2nd CSI parameter if "special"
keys (arrow keys, pgup/down, etc) are sent with modifiers held down.

Serenity's Terminal used to send ^[[O, which is a nonexistent
escape sequence and a misread of VT100's ^[O (ie the '[' is
replaced by 'O'). Since the xterm scheme also supports shift
and alt modifiers, switch to that.

More flexible, and makes ctrl-left/right and alt-left/right work
in SerenityOS's bash port.

Also do this for page up/down.

No behavior change for SerenityOS's Shell.
2020-09-15 09:45:13 +02:00
Nico Weber
2fe127d96f LibLine: Parse CSI parameters and immediates
No behavior change, but it makes it easy to handle
page up and page down if we wanted to make them do something
in libline.
2020-09-15 09:45:13 +02:00
Tom
365fa05a82 Kernel: Handle safe_memcpy/safe_memset/safe_strnlen faults in irq handlers
Fix gracefully failing these calls if used within IRQ handlers. If we're
handling IRQs, we need to handle these failures first, because we can't
really resolve page faults in a meaningful way. But if we know that it
was one of these functions that failed, then we can gracefully handle
the situation.

This solves a crash where the Scheduler attempts to produce backtraces
in the timer irq, some of which cause faults.

Fixes #3492
2020-09-14 21:18:59 +02:00
Andreas Kling
95964e7cbe Meta: Add Paul Scharnofske to the contributors list :^) 2020-09-14 21:17:47 +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
pkotzbach
8a21c528ad
LibGUI: Minor consistency cleanup in AbstractView::set_cursor() (#3478) 2020-09-14 20:55:07 +02:00
Andreas Kling
2b17d980cf Meta: Include .json files in the Qt Creator refresh script 2020-09-14 19:55:18 +02:00
Andreas Kling
d67b421628 Browser: Move the basic Tab UI skeleton to JSON GUI 2020-09-14 19:55:17 +02:00
Andreas Kling
1307f7292c Browser: Set tab text alignment from JSON GUI 2020-09-14 19:55:17 +02:00
Andreas Kling
e78cf6c590 LibGfx+LibGUI: Allow setting tab text alignment with set_property() 2020-09-14 19:55:17 +02:00
Andreas Kling
856f683dc9 Browser: Generate the main browser window UI from JSON :^) 2020-09-14 19:55:17 +02:00
Andreas Kling
3355a3e179 LibGUI: Add TabWidget::set_property() and handle some properties 2020-09-14 19:55:17 +02:00
AnotherTest
cd0ddf27f3 Shell: Allow builtins and functions as conditions for 'if' 2020-09-14 17:40:18 +02:00
AnotherTest
2b867ff555 Shell: Complete named function parameters inside the function body 2020-09-14 17:40:18 +02:00
AnotherTest
b4da45ab76 Shell: Add documentation for functions 2020-09-14 17:40:18 +02:00
AnotherTest
b7661dee46 Shell: Add some tests for functions 2020-09-14 17:40:18 +02:00
AnotherTest
d1550ea64f Shell: Add support for functions
This implementation does not have support for 'return' yet.
2020-09-14 17:40:18 +02:00
AnotherTest
519aa2048a Shell: Use a subshell instead of explicitly calling a shell binary in a test
This commit fixes a FIXME in a test, as we have subshells now.
2020-09-14 17:40:18 +02:00
AnotherTest
0b57cdff82 Shell: Add support for $0,$1,... 2020-09-14 17:40:18 +02:00
Andreas Kling
2f97590409 Meta: Make the text-to-cpp-string thingy pass shellcheck 2020-09-14 16:33:53 +02:00
Andreas Kling
22b03dd11b LibGUI: Add registration for GUI::TabWidget 2020-09-14 16:23:39 +02:00
Andreas Kling
f67c876df0 Build+TextEditor: Add a compile_json_gui() CMake helper
This makes it easier to include JSON GUI declarations in any app. :^)
2020-09-14 16:16:36 +02:00