| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
entries when repeating
|
| |
|
| |
|
|
|
|
|
|
|
| |
The previous method allowed memory management to interact with signal
handlers, causing occasional crashes on some system.
Instead, use a simple pre-allocated buffer and raw system calls.
|
|
|
|
|
| |
With POSIX_TRAPS set, an ignored signal stays ignored when entering
a subshell.
|
|
|
|
| |
If ENONENT it could be the other argument that doesn't exist, so check.
|
|
|
|
|
| |
This should detect "-o" as non-empty string; "-a" was alrady working.
Update the test.
|
| |
|
|
|
|
|
| |
In "A=$(PWD)" we dont't have the information to correct at the level of the
PWD subcommand, so don't try to do it as this causes a crash.
|
| |
|
| |
|
| |
|
|
|
|
| |
in $compstate[insert]
|
| |
|
|
|
|
| |
Bart apologizes for waiting 7 years to apply this change.
|
| |
|
|
|
|
| |
an exit hook
|
| |
|
| |
|
|
|
|
|
|
|
| |
If "if" had a hard error in the condition, and there was no
else clause, the command status was incorrectly cleared to zero.
Add test.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Changes typeset such that ${newparam-notset} yields "notset" and
"typeset -p newparam" does not show an assignment to the parameter. This
is similar to the default behavior of bash and ksh, with minor differences
in typeset output.
Also add tests for some POSIX incompatibilities plus minor changes for test
harness robustness.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zsh typically runs the final command in a pipeline in the main shell
instead of a subshell. However, POSIX specifies that all commands in a
pipeline run in a subshell, but permits zsh's behavior as an extension.
The default /bin/sh implementations on various Linux distros and the
BSDs always use a subshell for all components of a pipeline.
Since zsh may be used as /bin/sh in some cases (such as macOS Catalina),
it makes sense to have the common sh behavior when emulating sh, so do
that by checking for being the final item of a multi-item pipeline and
creating a subshell in that case.
From the comment above execpline(), we know the following:
last1 is a flag that this command is the last command in a shell that
is about to exit, so we can exec instead of forking. It gets passed
all the way down to execcmd() which actually makes the decision. A 0
is always passed if the command is not the last in the pipeline. […]
If last1 is zero but the command is at the end of a pipeline, we pass
2 down to execcmd().
So there are three cases to consider in this code:
• last1 is 0, which means we are not at the end of a pipeline, in which
case we should not change behavior.
• last1 is 1, which means we are effectively running in a subshell,
because nothing that happens due to the exec is going to affect the
actual shell, since it will have been replaced. So there is nothing
to do here.
• last1 is 2, which means our command is at the end of the pipeline, so
in sh mode we should create a subshell by forking.
input is nonzero if the input to this process is a pipe that we've
opened. At the end of a multi-stage pipeline, it will necessarily be
nonzero.
Note that several of the tests may appear bizarre, since most developers
do not place useless variable assignments directly at the end of a
pipeline. However, as the function tests demonstrate, there are cases
where assignments may occur when a shell function is used at the end of
a command. The remaining assignment tests simply test additional cases,
such as the use of local, that would otherwise be untested.
|
| |
|
| |
|
|
|
|
| |
STDC_HEADERS and TIME_WITH_SYS_TIME are deprecated.
|
|
|
|
| |
"error in flags", identify the location of the parse error.
|
|
|
|
|
| |
Take account of the trailing file type character even when '-d disp'
is given to compadd.
|
|
|
|
|
| |
Now it returns NULL if called with GETKEY_SINGLE_CHAR and next character
is not found. Caller must check the return value.
|
| |
|
|
|
|
|
|
| |
The inconsistency caused test failures where TERM is e.g. rxvt-unicode.
This also makes a couple of bits available in zattr by removing flags
indicating whether to use termcap which is not an attribute as such.
|
| |
|
|
|
|
|
| |
wcsitype(c, IIDENT) should return false for non-ASCII characters
when the POSIX_IDENTIFIERS option is on, not the other way round.
|
|
|
|
|
| |
fc with the -L option should ignore remote entires, rather than
reading them and treating them as an error.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change modifies the zsh binary safety check surrounding execve() so
it can run shell scripts having concatenated binary content. We're using
the same safety check as FreeBSD /bin/sh [1]. POSIX was recently revised
to require this behavior:
"The input file may be of any type, but the initial portion of the
file intended to be parsed according to the shell grammar (XREF to
XSH 2.10.2 Shell Grammar Rules) shall consist of characters and
shall not contain the NUL character. The shell shall not enforce
any line length limits."
"Earlier versions of this standard required that input files to the
shell be text files except that line lengths were unlimited.
However, that was overly restrictive in relation to the fact that
shells can parse a script without a trailing newline, and in
relation to a common practice of concatenating a shell script
ending with an 'exit' or 'exec $command' with a binary data payload
to form a single-file self-extracting archive." [2] [3]
One example use case of such scripts, is the Cosmopolitan C Library [4]
which configuse the GNU Linker to output a polyglot shell+binary format
that runs on Linux / Mac / Windows / FreeBSD / OpenBSD.
[1] https://github.com/freebsd/freebsd-src/commit/9a1cd363318b7e9e70ef6af27d1675b371c16b1a
[2] http://austingroupbugs.net/view.php?id=1250
[3] http://austingroupbugs.net/view.php?id=1226#c4394
[4] https://justine.lol/cosmopolitan/index.html
|
| |
|
| |
|
| |
|