| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
These are called "shell procedures" in the source.
If execve() failed with [ENOEXEC], the shell would reinitialize itself
and execute the program as a script. This requires a fair amount of code
which is not frequently used (most scripts have a #! magic number).
Therefore just execute a new instance of sh (_PATH_BSHELL) to run the
script.
|
|
|
|
|
|
|
|
| |
A failure (e.g. caused by ulimit -n being set very low) is a redirection
error.
Example:
ulimit -n 9; exec 9<.
|
|
|
|
|
|
| |
A failure (usually caused by FD not being open) is a redirection error.
Exp-run done by: pav (with some other sh(1) changes)
|
|
|
|
| |
and its usage.
|
|
|
|
|
|
| |
breakpoints with in a debugger. And use naked "static" for variables.
Noticed by: bde
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Redirecting fds that were not open before kept two copies of the
redirected file.
sh -c '{ :; } 7>/dev/null; fstat -p $$; true'
(both fd 7 and 10 remained open)
- File descriptors used to restore things after redirection were not
set close-on-exec, instead they were explicitly closed before executing
a program normally and before executing a shell procedure. The latter
must remain but the former is replaced by close-on-exec.
sh -c 'exec 7</; { exec fstat -p $$; } 7>/dev/null; true'
(fd 10 remained open)
The examples above are simpler than the testsuite because I do not want to
use fstat or procstat in the testsuite.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* exception handlers are now run with interrupts disabled, which avoids
many race conditions
* fix some cases where SIGINT only aborts one command and continues the
script, in particular if a SIGINT causes an EINTR error which trumped the
interrupt.
Example:
sh -c 'echo < /some/fifo; echo This should not be printed'
The fifo should not have writers. When pressing ctrl+c to abort the open,
the shell used to continue with the next command.
Example:
sh -c '/bin/echo < /some/fifo; echo This should not be printed'
Similar. Note, however, that this particular case did not and does not work
in interactive mode with job control enabled.
|
|
|
|
|
|
|
|
|
|
| |
Formerly, it was possible for the file to be created between the check if it
existed and the open; the contents would then be lost.
Because this must use O_EXCL, noclobber > will not create a file through a
symlink anymore. This agrees with behaviour of other shells.
Approved by: ed (mentor) (implicit)
|
|
|
|
| |
OK'ed by: imp, core
|
|
|
|
|
|
|
| |
should slightly reduce the number of system calls in critical portions of
the shell, and select a more efficient path through the fdalloc code.
Reviewed by: bde
|
|
|
|
|
|
|
|
|
|
|
| |
- Removed dead declarations
- Made objects that should have been declared as static, static.
The changes use STATIC instead of static, following the existing
convention in the rest of the code.
Approved by: schweikh (mentor)
MFC after: 2 weeks
|
| |
|
|
|
|
| |
errmsg() and its table of error messages.
|
| |
|
|
|
|
|
|
|
| |
This was broken by rev. 1.16.
PR: 40334
MFC after: 1 week
|
| |
|
|
|
|
| |
files from being overwritten by shell redirection.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
o Change
int
foo() {
...
to
int
foo(void)
{
...
|
|
|
|
|
|
|
|
| |
original attempt of the fix. And yes, this time I've tried to build
world with it and it succeeded.
Submitted by: Tor Egge
MFC after: 1 week
|
| |
|
|
|
|
|
|
| |
to get it MFCed in time for release 4.5.
MFC after: 2 weeks
|
| |
|
|
|
|
| |
Fix a warning.
|
| |
|
| |
|
|
|
|
|
|
| |
keyword usage.
Obtained from: NetBSD
|
| |
|
|
|
|
|
|
|
|
| |
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.
|
|
|
|
| |
Obtained from: NetBSD, me
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
merge of parallel duplicate work by Steve Price and myself. :-]
There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.
This closes a pile of /bin/sh PR's, but not all of them..
Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
|
|
|
|
|
|
|
| |
o fix brokeness for 1>&5 redirection, where `5' was an invalid file
descriptor, but no error message has been generated
o fix brokeness for redirect to/from myself case
|
|
|
|
| |
Reviewed by: phk
|
| |
|
|
|