Commit Graph

226 Commits

Author SHA1 Message Date
AnotherTest
e3ec759f97 Shell: Make history range values larger than u32 a syntax error
Found by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29792&sort=reported&q=serenity
2021-02-03 10:14:32 +01:00
AnotherTest
37bfaf4e7c Shell: Do not bail on signaled if condition
Fixes #5119
2021-01-26 21:19:22 +01:00
asynts
eea72b9b5c Everywhere: Hook up remaining debug macros to Debug.h. 2021-01-25 09:47:36 +01:00
asynts
acdcf59a33 Everywhere: Remove unnecessary debug comments.
It would be tempting to uncomment these statements, but that won't work
with the new changes.

This was done with the following commands:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-25 09:47:36 +01:00
AnotherTest
4981b30ea5 Shell: Run the command's next chain even when it's empty 2021-01-23 08:28:58 +01:00
AnotherTest
be94a4ffa6 Shell: Block on the existing event loop instead of pushing a new one
This patch makes `Shell::block_on_job()` pump the event loop while the
job it's waiting for hasn't finished.
As this no longer pushes new event loops, it has the effect of
flattening the stack as well.
Fixes #4976.
2021-01-23 08:28:58 +01:00
AnotherTest
2bd77bc93b Shell: Make the parser read consecutive sequences without recursing
This fixes (the easy) part of #4976.
2021-01-23 08:28:58 +01:00
asynts
fb8d3635d9 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-22 22:14:30 +01:00
Linus Groh
421587c15c Everywhere: Fix typos 2021-01-22 18:41:29 +01:00
AnotherTest
cb29dca029 Shell: Don't spam perror() on kill_job()
That function is allowed to be given a dead job, so don't bother with
perror()
2021-01-19 08:19:43 +01:00
AnotherTest
86f50aa74e Shell: Make tests use PASS/FAIL instead of exit codes
There's no guarantee that the last executed command will have a zero
exit code, and so the shell exit code may or may not be zero, even if
all the tests pass.
Also changes the `test || echo fail && exit` to
`if not test { echo fail && exit }`, since that's nicer-looking.
2021-01-19 08:19:43 +01:00
AnotherTest
5ec139e728 Shell: Make 'if' expressions return the unevaluated value of blocks
This makes it possible to actually put them in a sequence and cast them
to commands.
2021-01-19 08:19:43 +01:00
AnotherTest
50473003be Shell: Add a not builtin
`not` just takes a command, runs it, then negates its exit code (0->1,
non-zero->0).
2021-01-19 08:19:43 +01:00
AnotherTest
2843526513 Shell: Mark control structures to be executed in the current process 2021-01-19 08:19:43 +01:00
AnotherTest
1c78d12f1c Shell: Implement for_each_entry() for syntactic list nodes
This allows correct iteration over nested lists.
Also store values to variables without resolving them, to delay the
resolution step as much as possible (this helps with storing nested
lists in variables).
2021-01-19 08:19:43 +01:00
AnotherTest
fc7a06af9d Shell: Consider numbers as word characters too
Otherwise `foobar2` wouldn't be a valid identifier
2021-01-19 08:19:43 +01:00
AnotherTest
8cfda86a45 Shell: Actually return the exit code of the file when running a file 2021-01-19 08:19:43 +01:00
AnotherTest
cd6e5c064b Shell: Add a builtin that parses its sole argument and dumps its AST
Pretty useful for debugging.
2021-01-19 08:19:43 +01:00
AnotherTest
5b79d0d1a3 Shell: Allow newlines between else and if's closing brace
This is more flexible and intuitive. Fixes #4992.
2021-01-18 08:56:34 +01:00
Nick Vella
fdc9b3c5a0 Shell: use exit code 127 on command not found 2021-01-16 09:05:01 +01:00
Nick Vella
1d11b62ca4 Shell: return the exit code of a '-c' command execution 2021-01-16 09:05:01 +01:00
AnotherTest
c1b4e86004 Shell: Add formatter for history events 2021-01-15 19:13:03 +01:00
AnotherTest
239472ba69 Shell: Add (basic) support for history event designators
Closes #4888
2021-01-15 19:13:03 +01:00
Andreas Kling
1a08ac72ad LibC+Everywhere: Remove open_with_path_length() in favor of open()
This API was a mostly gratuitous deviation from POSIX that gave up some
portability in exchange for avoiding the occasional strlen().

I don't think that was actually achieving anything valuable, so let's
just chill out and have the same open() API as everyone else. :^)
2021-01-12 23:34:01 +01:00
AnotherTest
a90905c54c Shell: Use lstat instead of access to check if glob target exists
Fixes #4905
2021-01-12 16:23:26 +01:00
Andreas Kling
c4e2fd8123 Shell: Move to Userland/Shell/ 2021-01-12 12:04:07 +01:00