| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
1. Avoid a cd back into ${.CURDIR} to run mkbuiltins when we know make
will first cd into ${.OBJDIR}. Keep the cwd to what make sets it to.
2. Don't tell mkbuiltins where to write to (= ${.OBJDIR}), but where to
get sources from (= ${.CURDIR}). This to compensate for point 1.
This fixes a problem with bmake's mk files that optimize ${.OBJDIR} to
expand to "." after changing cwd, not taking into account that the
target is pretty much undoing that and not getting the full path to the
object tree anymore.
|
|
|
|
| |
The read builtin no longer does things with termios.
|
| |
|
|
|
|
|
|
|
| |
quotation. Also make sure we have the same amount of columns in each row as
the number of columns we specify in the head arguments.
Reviewed by: brueffer
|
|
|
|
|
| |
Reported by: Kristof Provost
MFC after: 1 week
|
|
|
|
|
|
|
| |
Disussed with: gavin
No objection from: doc
Approved by: joel
MFC after: 3 days
|
| |
|
|
|
|
| |
Reported by: lme
|
|
|
|
|
|
|
| |
A possible consequence of this bug was a memory leak if SIGINT arrived
during a 'set' command (listing variables).
MFC after: 1 week
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This uses vfork() for simple commands and command substitutions containing a
single simple command, invoking an external program under certain conditions
(no redirections or variable assignments, non-interactive shell, no job
control). These restrictions limit the amount of code executed in a vforked
child.
There is a large speedup (for example 35%) in microbenchmarks. The
difference in buildkernel is smaller (for example 0.5%) but still
statistically significant. See
http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html
for some numbers.
The use of vfork() can be disabled by setting a variable named
SH_DISABLE_VFORK.
|
| |
|
|
|
|
|
|
| |
In the first command of a 'for', $? should be the exit status of the last
pipeline (command substitution in the word list or command before 'for'),
not always 0.
|
|
|
|
| |
MFC after: 1 week
|
|
|
|
|
|
|
|
|
|
|
| |
Before this fix, only the first statement of the trap was executed if
evalskip was set. This is for example the case when:
o "-e" is set for this shell
o a trap is set on EXIT
o a function returns 1 and causes the script to abort
Reviewed by: jilles
MFC after: 2 weeks
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also, rework evalcase() to not evaluate any tree. Instead, return the
NCLISTFALLTHRU node and handle it in evaltree().
Fixed bugs:
* If a ;& list with non-zero exit status is followed by an empty ;; or final
list, the exit status of the case command should be equal to the exit
status of the ;& list, not 0.
* An empty ;& case should not reset $?.
|
|
|
|
|
|
|
| |
* If no pattern is matched, POSIX says the exit status shall be 0 (even if
there are command substitutions).
* If a pattern is matched and there are no command substitutions, the first
command should see the $? from before the case command, not always 0.
|
|
|
|
| |
PR: bin/161756
|
|
|
|
| |
MFC after: 1 week
|
|
|
|
|
|
|
|
| |
The errno message display added in r222292 did not take attempting to
cd to a non-directory or something that cannot be stat()ed into account.
PR: bin/164070
MFC after: 10 days
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
This improves performance for globs where a slash or another component
follows a component with metacharacters by eliminating unnecessary attempts
to open directories that are not.
|
| |
|
|
|
|
|
|
|
|
|
| |
This is not necessary: errors are already caught in evalbackcmd() and
forcelocal handles changes to variables.
Note that this depends on r223024.
MFC after: 4 weeks
|
| |
|
|
|
|
|
|
|
| |
Free expanded case text before executing commands.
Remove impossible evalskip checks (expanding an argument cannot set
evalskip anymore since $(break) and the like are properly executed in a
subshell environment).
|
|
|
|
| |
Note that only assigning the decimal value 1 resets getopts, as before.
|
|
|
|
| |
With i386 base gcc and i386 base clang, arith_yacc.o remains unchanged.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Because sh executes commands in subshell environments without forking in
more and more cases (particularly from 8.0 on), it makes sense to describe
subshell environments more precisely using ideas from POSIX, together with
some FreeBSD-specific items.
In particular, the hash and times builtins may not behave as if their state
is copied for a subshell environment while leaving the parent shell
environment unchanged.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Shell patterns are also for ${var#pat} and the like.
* An '!' by itself will not trigger pathname generation so do not call it a
meta-character, even though it has a special meaning directly after an
'['.
* Character ranges are locale-dependent.
* A '^' will complement a character class like '!' but is non-standard.
MFC after: 1 week
|
|
|
|
|
| |
Suggested by: netchild
Reviewed by: gjb
|
| |
|
|
|
|
| |
It expands the arguments in the parent shell process, which is incorrect.
|
|
|
|
|
|
|
|
|
|
| |
POSIX requires a -h option to sh and set, to locate and remember utilities
invoked by functions as they are defined. Given that this
locate-and-remember process is optional elsewhere, it seems safe enough to
make this option do nothing.
POSIX does not specify a long name for this option. Follow ksh in calling it
"trackall".
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replacing ;; with the new control operator ;& will cause the next list to be
executed as well without checking its pattern, continuing until a list ends
with ;; or until the end of the case statement. This is like omitting
"break" in a C "switch" statement.
The sequence ;& was formerly invalid.
This feature is proposed for the next POSIX issue in Austin Group issue
#449.
|
|
|
|
| |
This ensures the output of these commands is valid shell input.
|
|
|
|
|
|
|
|
|
|
| |
The eval special builtin now runs the code with EV_EXIT if it was run
with EV_EXIT itself.
In particular, this eliminates one fork when a command substitution contains
an eval command that ends with an external program or a subshell.
This is similar to what r220978 did for functions.
|
|
|
|
|
| |
Example:
case x in [[:alpha:]]) echo yes ;; esac
|
|
|
|
|
|
| |
Have mkbuiltins write the prototypes for the *cmd functions to builtins.h
instead of builtins.c and include builtins.h in more .c files instead of
duplicating prototypes for *cmd functions in other headers.
|
|
|
|
|
|
|
|
|
|
|
| |
In optimized command substitution, save and restore any variables changed by
expansions (${var=value} and $((var=assigned))), instead of trying to
determine if an expansion may cause such changes.
If $! is referenced in optimized command substitution, do not cause jobs to
be remembered longer.
This fixes $(jobs $!) again, simplifies the man page and shortens the code.
|
|
|
|
|
|
|
|
| |
When I added UTF-8 support in r221646, the LC_COLLATE-based ordering broke
because of sign extension of char.
Because of libc restrictions, this does not work for UTF-8. For UTF-8
locales, ranges always use character code order.
|
|
|
|
|
|
|
|
|
|
| |
In most cases, login shells are started from the home directory, but not in
all, such as xterm -ls.
This commit depends on r222957 for read_profile() performing parameter
expansion.
PR: bin/50569
|
|
|
|
|
|
| |
This is required by POSIX, and allows things like ENV=\$HOME/.shrc.
Note that tilde expansion is explicitly not performed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function name expandstr() and the general idea of doing this kind of
expansion by treating the text as a here document without end marker is from
dash.
All variants of parameter expansion and arithmetic expansion also work (the
latter is not required by POSIX but it does not take extra code and many
other shells also allow it).
Command substitution is prevented because I think it causes too much code to
be re-entered (for example creating an unbounded recursion of trace lines).
Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would
be quite useful.
|
|
|
|
| |
PR: bin/41410
|
|
|
|
| |
Avoid "<nosuchfile>: cannot open <nosuchfile>: ...".
|