#
272461 |
|
02-Oct-2014 |
gjb |
Copy stable/10@r272459 to releng/10.1 as part of the 10.1-RELEASE process.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
264168 |
|
05-Apr-2014 |
jilles |
MFC r263195: sh: Add some consts.
|
#
262951 |
|
09-Mar-2014 |
jmmv |
Sync sh(1) in stable/10 to head.
This is a MFC of all the commits listed below.
My original goal of this change was to only merge the move of the tests from tools/regression/bin/ into the new layout (which include tests for sh(1) and other tools as well). However, doing so is tricky due to the ongoing work in sh(1) and, especially, the many changes to its tests since stable/10 was first branched.
Merging everything is the simplest way to achieve this goal and, as a bonus point, we get various fixes and miscellaneous improvements into the branch.
Per jilles' suggestion, I'm avoiding the merge of a couple of changes (r256850 and r257506) that required depending kernel changes. I'm also avoiding very recent changes that have not had a long enough time to be validated in current.
This is "make tinderbox" clean.
r256735 sh: Remove one syscall when waiting for a foreground job. r257399 sh: Allow trapping SIGINT/SIGQUIT after ignore because of '&'. r257504 sh: Reorder union node to reduce its size on 64-bit platforms. r257920 sh: Add a test case for would-be assignments that are not due to quoting. r257929 sh: Properly quote alias output from command -v. r258489 sh: Add tests for the </dev/null implicit in a background command. r258533 sh: Add more tests for the </dev/null implicit in a background command. r258535 sh: Make <&0 disable the </dev/null implicit in a background command. r258776 sh: Prefer memcpy() to strcpy() in most cases. Remove the scopy macro. r259047 sh: Split set -x output into a separate function. r259210 Migrate tools/regression/bin/ tests to the new layout. r259844 sh: Remove an unused variable. r259846 sh: Initialize OPTIND=1 even if it came from the environment. r259874 sh: Simplify code related to PPID variable. r259946 sh: Don't check input for non-whitespace if history is disabled. r260246 sh(1): Discourage use of -e. r260506 Run the sh(1) and test(1) tests as unprivileged. r260586 Mark the bin/pax tests as requiring perl. r260634 Use TAP_TESTS_PERL to register the legacy_test in bin/pax. r260635 Replace hand-crafted Kyuafiles with automatic generation. r260654 sh: Remove SIGWINCH handler and just check for resize before every read. r261121 sh: Add test for nested alias. r261125 sh: Solve the alias recursion problem in a less hackish way. r261141 sh: Do not depend on parse/execute split in new alias test. r261160 sh: Add tests for alias names after another alias. r261192 sh: Allow aliases to force alias substitution on the following word. r262533 sh: Make expari() static. r262565 sh: Do not corrupt internal representation if LINENO inner expansion fails. r262697 sh: Simplify expari().
Reviewed by: jilles
|
#
256281 |
|
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation
|
#
255157 |
|
02-Sep-2013 |
jilles |
sh: Fix race condition with signals and wait or set -T.
The change in r238888 was incomplete. It was still possible for a trapped signal to arrive before the shell went to sleep (sigsuspend()) because a check was missing or because the signal arrived before in_waitcmd was set.
On SMP, this bug sometimes caused the builtins/wait4.0 test to take 1 second to execute; it then might or might not fail. On UP, the test almost always failed.
|
#
254767 |
|
24-Aug-2013 |
jilles |
sh: Do not prematurely discard stopped jobs in a wait builtin.
If a job is specified to 'wait', wait for it to complete. Formerly, in interactive mode, the job was deleted if it stopped.
If no jobs are specified in interactive mode, 'wait' still waits for all jobs to complete or stop.
In non-interactive mode, WUNTRACED is not passed to wait3() so stopped jobs are not detected.
PR: bin/181435
|
#
254413 |
|
16-Aug-2013 |
jilles |
sh: Recognize "--" as end of options in bg/fg/jobid builtins.
|
#
253658 |
|
25-Jul-2013 |
jilles |
sh: Remove #define MKINIT.
MKINIT only served for the removed mkinit. Many variables can be static now.
|
#
251430 |
|
05-Jun-2013 |
jilles |
sh: Return status 127 for unknown jobs in wait builtin.
This is required by POSIX, at least for pids that are not known child processes.
Other problems with job specifications still cause wait to abort with exit status 2.
PR: 176916
|
#
251429 |
|
05-Jun-2013 |
jilles |
sh: Allow multiple operands in wait builtin.
This is only part of the PR; the behaviour for unknown/invalid pids/jobs remains unchanged (aborts the builtin with status 2).
PR: 176916 Submitted by: Vadim Goncharov
|
#
250267 |
|
05-May-2013 |
jilles |
sh: Use O_CLOEXEC and F_DUPFD_CLOEXEC instead of separate fcntl() call.
|
#
249984 |
|
27-Apr-2013 |
jilles |
sh: Don't consider jobs -s/-p as reporting the status of jobs.
This ensures that something like j=$(jobs -p) does not prevent any status from being written to the terminal.
|
#
248980 |
|
01-Apr-2013 |
jilles |
sh: Fix various compiler warnings.
It now passes WARNS=7 with clang on i386.
GCC 4.2.1 does not understand setjmp() properly so will always trigger -Wuninitialized. I will not add the volatile keywords to suppress this.
|
#
248349 |
|
15-Mar-2013 |
jilles |
sh: Recognize "--" and explicitly reject options in wait builtin.
If syntactically invalid job identifiers are to be taken as jobs that exited with status 127, this should not apply to options, so that we can add options later if need be.
|
#
247206 |
|
23-Feb-2013 |
jilles |
sh: If a SIGINT or SIGQUIT interrupts "wait", return status 128+sig.
|
#
246495 |
|
07-Feb-2013 |
delphij |
Catch TRACE parameters up with r238888. This change is only needed when debugging is enabled.
|
#
246162 |
|
31-Jan-2013 |
jilles |
sh: Show negated commands (!) in jobs output.
|
#
244682 |
|
25-Dec-2012 |
jilles |
sh: Prefer strsignal() to accessing sys_siglist directly.
Accessing sys_siglist directly requires rtld to copy it from libc to the sh executable's BSS. Also, strsignal() will put in the signal number for unknown signals (FreeBSD-specific) so we need not do that ourselves.
Unfortunately, there is no function for sys_signame.
|
#
240541 |
|
15-Sep-2012 |
jilles |
sh: Prefer internal nextopt() to libc getopt().
This reduces code duplication and code size.
/usr/bin/printf is not affected.
Side effect: different error messages when certain builtins are passed invalid options.
|
#
238888 |
|
29-Jul-2012 |
jilles |
sh: Fix EINTR race condition in "wait" and "set -T" using sigsuspend().
When waiting for child processes using "wait" or if "set -T" is in effect, a signal interrupts the wait. Make sure there is no window where the signal handler may be invoked (setting a flag) just before going to sleep.
There is a similar race condition in the shell language, but scripts can avoid it by exiting from the trap handler or enforcing synchronization using a fifo.
If SIGCHLD is not trapped, a signal handler must be installed for it. Only install this handler for the duration of the wait to avoid triggering unexpected [EINTR] errors elsewhere.
Note that for some reason only SIGINT and SIGQUIT interrupt a "wait" command. This remains the case.
|
#
238867 |
|
28-Jul-2012 |
jilles |
sh: Do not ask for stopped/continued processes if we do not need them rather than retrying wait3 if they happen.
|
#
238866 |
|
28-Jul-2012 |
jilles |
sh: Inline waitproc() into its only caller.
|
#
238865 |
|
28-Jul-2012 |
jilles |
sh: Track continued jobs (even if not continued by bg or fg).
This uses wait3's WCONTINUED flag.
There is no message for this. The change is visible in "jobs" or if the job stops again.
|
#
238470 |
|
15-Jul-2012 |
jilles |
sh: Remove unused variable in_dowait.
|
#
233792 |
|
02-Apr-2012 |
jilles |
sh: Fix build with -DDEBUG=2.
Reported by: Kristof Provost MFC after: 1 week
|
#
230998 |
|
04-Feb-2012 |
jilles |
sh: Use vfork in a few common cases.
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.
|
#
230530 |
|
25-Jan-2012 |
charnier |
Add prototypes, ANSIfy functions definitions to reduce WARNS=6 output.
|
#
223060 |
|
13-Jun-2011 |
jilles |
sh: Fix duplicate prototypes for builtins.
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.
|
#
223024 |
|
12-Jun-2011 |
jilles |
sh: Save/restore changed variables in optimized command substitution.
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.
|
#
222684 |
|
04-Jun-2011 |
jilles |
sh: Reduce more needless differences between error messages.
|
#
218306 |
|
04-Feb-2011 |
jilles |
sh: Remove special code for shell scripts without magic number.
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.
|
#
218105 |
|
30-Jan-2011 |
jilles |
sh: Send messages about signals to stderr.
This is required by POSIX and seems to make more sense.
See also r217557.
|
#
217557 |
|
18-Jan-2011 |
jilles |
sh: Fix signal messages being sent to the wrong file sometimes.
When a foreground job exits on a signal, a message is printed to stdout about this. The buffer was not flushed after this which could result in the message being written to the wrong file if the next command was a builtin and had stdout redirected.
Example: sh -c 'kill -9 $$'; : > foo; echo FOO:; cat foo
Reported by: gcooper MFC after: 1 week
|
#
216629 |
|
21-Dec-2010 |
jilles |
sh: Add kill builtin.
This allows specifying a %job (which is equivalent to the corresponding process group).
Additionally, it improves reliability of kill from sh in high-load situations and ensures "kill" finds the correct utility regardless of PATH, as required by POSIX (unless the undocumented %builtin mechanism is used).
Side effect: fatal errors (any error other than kill(2) failure) now return exit status 2 instead of 1. (This is consistent with other sh builtins, but not in NetBSD.)
Code size increases about 1K on i386.
Obtained from: NetBSD
|
#
216400 |
|
12-Dec-2010 |
jilles |
sh: Various simplifications to jobs.c: * Prefer kill(-X) to killpg(X). * Remove some dead code. * No additional SIGINT is needed if int_pending() is already true.
No functional change is intended.
|
#
216246 |
|
06-Dec-2010 |
jilles |
sh: Improve internal-representation-to-text code to avoid binary output.
The code to translate the internal representation to text did not know about various additions to the internal representation since the original ash and therefore wrote binary stuff to the terminal.
The code is used in the jobs command and similar output.
Note that the output is far from complete and mostly serves for recognition purposes.
|
#
216220 |
|
05-Dec-2010 |
jilles |
sh: POSIX says there should not be a space between Done and (exitstatus).
(On the other hand, (core dumped) does need a space and so does [1] +.)
|
#
216217 |
|
05-Dec-2010 |
jilles |
sh: Improve jobs output of pipelines.
If describing the status of a pipeline, write all elements of the pipeline and show the status of the last process (which would also end up in $?). Only write one report per job, not one for every process that exits.
To keep some earlier behaviour, if any process started by the shell in a foreground job terminates because of a signal, write a message about the signal (at most one message per job, however).
Also, do not write messages about signals in the wait builtin in non-interactive shells. Only true foreground jobs now write such messages (for example, "Terminated").
|
#
216208 |
|
05-Dec-2010 |
jilles |
sh: Avoid marking a job as done before it is fully created.
In r208489, I added code to reap zombies when forking new processes, to limit the amount of zombies. However, this can lead to marking a job as done or stopped if it consists of multiple processes and the first process ends very quickly. Fix this by only checking for zombies before forking the first process of a job and not marking any jobs without processes as done or stopped.
|
#
216199 |
|
05-Dec-2010 |
jilles |
sh: jobs -p: Do not ask the kernel for the pgid.
The getpgid() call will fail if the first process in the job has already terminated, resulting in output of "-1".
The pgid of a job is always the pid of the first process in the job and other code already relies on this.
|
#
213925 |
|
16-Oct-2010 |
jilles |
sh: Use <stddef.h> rather than <sys/stddef.h>.
<sys/stddef.h> is only for the kernel and conflicts with <stddef.h>.
|
#
213811 |
|
13-Oct-2010 |
obrien |
In the spirit of r90111, depend on c89 and remove the "STATIC" macro and its usage.
|
#
213775 |
|
13-Oct-2010 |
jhb |
Make DEBUG traces 64-bit clean: - Use %t to print ptrdiff_t values. - Cast a ptrdiff_t value explicitly to int for a field width specifier.
While here, sort includes.
Submitted by: Garrett Cooper
|
#
213760 |
|
13-Oct-2010 |
obrien |
Consistently use "STATIC" for all functions in order to be able to set breakpoints with in a debugger. And use naked "static" for variables.
Noticed by: bde
|
#
209600 |
|
29-Jun-2010 |
jilles |
sh: Forget about terminated background processes sooner.
Unless $! has been referenced for a particular job or $! still contains that job's pid, forget about it after it has terminated. If $! has been referenced, remember the job until the wait builtin has reported its completion (either with the pid as parameter or without parameters).
In interactive mode, jobs are forgotten after termination has been reported, which happens before primary prompts and through the jobs builtin. Even then, though, remember a job if $! has been referenced.
This is similar to what is suggested by POSIX and should fix most memory leaks (which also tend to cause sh to use more CPU time) with long running scripts that start background jobs.
Caveats: * Repeatedly referencing $! without ever doing 'wait', like while :; do foo & echo started foo: $!; sleep 60; done will still use a lot of memory and CPU time in the long run. * The jobs and jobid builtins do not cause a job to be remembered for longer like expanding $! does.
PR: bin/55346
|
#
208881 |
|
06-Jun-2010 |
jilles |
sh: Pass through SIGINT from a child if interactive and job control is enabled.
This already worked if without job control.
In either case, this depends on it that a process that terminates due to SIGINT exits on it (so not with status 1, or worse, 0).
Example: sleep 5; echo continued This does not print "continued" any more if sleep is aborted via ctrl+c.
MFC after: 1 month
|
#
208489 |
|
24-May-2010 |
jilles |
sh: Reap any zombies before forking for a background command.
This prevents accumulating huge amounts of zombies if a script executes many background commands but no external commands or subshells.
Note that zombies will not be reaped during long calculations (within the shell process) or read builtins, but those actions do not create more zombies.
The terminated background commands will also still be remembered by the shell.
PR: bin/55346
|
#
201053 |
|
27-Dec-2009 |
jilles |
sh: Various warning fixes (from WARNS=6 NO_WERROR=1): - const - initializations to silence -Wuninitialized (it was safe anyway) - remove nested extern declarations - rename "index" locals to "idx"
|
#
200998 |
|
25-Dec-2009 |
jilles |
sh: Do not run callers' exception handlers in subshells.
Reset the exception handler in the child to main's.
This avoids inappropriate double cleanups or shell duplication when the exception is caught, such as 'fc' and future 'command eval' and 'command .'.
|
#
199629 |
|
21-Nov-2009 |
jilles |
sh: Some changes to stderr flushing: * increase buffer size from 100 to 256 bytes * remove implied flush from out2str(), in particular this avoids unnecessary flushing in the middle of a -x tracing line * rename dprintf() to out2fmt_flush(), make it flush out2 and use this function in various places where flushing is desired after an error message
|
#
163085 |
|
07-Oct-2006 |
stefanf |
Add the POSIX option -p to the jobs builtin command. It prints the PID of the process leader for each job. Now the last specified option for the output format (-l, -p or -s) wins, previously -s trumped -l.
PR: 99926 Submitted by: Ed Schouten and novel (patches modified by me)
|
#
155301 |
|
04-Feb-2006 |
schweikh |
Remove some white space at EOL.
|
#
153417 |
|
14-Dec-2005 |
maxim |
o Now when SIG_IGN signal action for SIGCHLD reap zombies automatically it is possible wait4(2) returns -1 and sets errno = ECHILD if there were forked children. A user can set such signal handler e.g. via ``trap "" 20'', see a PR for the test case. Deal with this case and mark a job as JOBDONE.
PR: bin/90334 Submitted by: bde MFC after: 4 weeks
|
#
149802 |
|
05-Sep-2005 |
stefanf |
Print pointers with %p rather than casting them to long.
|
#
138312 |
|
02-Dec-2004 |
maxim |
o Terminate an endless loop sh -T goes into in dowait() around waitproc().
XXX from Tor: "The shell can also go into a similar loop if the child was killed by signal 127, since the shell would believe the child to have only stopped (WIFSTOPPED() macro returns nonzero value). Disallowing signals 127 and 128 will fix that problem." See kern/19402 for details.
PR: bin/66242 Submitted by: tegge Analysis and testcase by: demon MFC after: 3 weeks
|
#
127958 |
|
06-Apr-2004 |
markm |
Remove clause 3 from the UCB licenses.
OK'ed by: imp, core
|
#
125501 |
|
05-Feb-2004 |
cracauer |
Commit fix sent by Tor Egge <Tor.Egge@cvsup.no.freebsd.org>
Only use return value from system call if system call succeeded.
Tested with `make world` and some of my own scripts.
This should be MFCed soon. While /bin/sh is hard to test the fix is obviously correct and can be assumed not to break something else (famous last words...).
|
#
125155 |
|
28-Jan-2004 |
njl |
Use sys_nsig instead of NSIG for the length of the signal arrays. This is important if we add new signals later. From DragonflyBSD: jobs.c:1.4, trap.c:1.3.
Obtained from: DragonflyBSD
|
#
117261 |
|
05-Jul-2003 |
dds |
Changes following CScout analysis:
- 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
|
#
112341 |
|
17-Mar-2003 |
tjr |
Flush the output buffers before forking a child process to avoid the child process writing data that the parent should have written.
PR: 50051 MFC after: 2 weeks
|
#
109927 |
|
27-Jan-2003 |
tjr |
Ensure that the TTY file descriptor is greater than or equal to 10 so that it doesn't interfere with the user's redirections.
PR: 47136 MFC after: 1 week
|
#
109627 |
|
21-Jan-2003 |
tjr |
Make this compile with DEBUG defined now that WARNS=0 has been removed from the Makefile: - Print pointers with %p instead of %x. - Include missing headers to get prototypes.
Noticed by: benno
|
#
107846 |
|
13-Dec-2002 |
tjr |
When job control is disabled, never show the job id when reporting the status of a background process that has terminated because of a signal.
|
#
104275 |
|
01-Oct-2002 |
mux |
Use the %t format modifier to print differences between pointers. This fixes two format warnings on 64 bits archs which are fatal now that WFORMAT=0 has been removed.
It doesn't fully fix the sh(1) build on 64 bits platforms though, there is still some quad_t issues that need to be fixed.
Tested on: i386, sparc64
|
#
103223 |
|
11-Sep-2002 |
nectar |
Correct a usage of fnctl that could not be right and results in a no-op. I assume it was meant that the close-on-exec flag be set here.
|
#
102351 |
|
24-Aug-2002 |
tjr |
Don't show the process ID of background jobs that have terminated, for consistency with ksh.
|
#
102051 |
|
18-Aug-2002 |
tjr |
Avoid accessing the current job's process table in the child part of forkshell() after it has been freed. This caused mysterious behaviour when anything but the first command in a pipeline tried to access the terminal when the `junk' malloc() option was enabled (which is the default).
|
#
102007 |
|
17-Aug-2002 |
tjr |
Show job control ID, command text, etc. when foreground processes are suspended. This is a followup to rev. 1.51.
MFC after: 1 week
|
#
100663 |
|
25-Jul-2002 |
tjr |
Set opterr to zero to avoid duplicate warnings from getopt(3) for unknown options.
|
#
100351 |
|
19-Jul-2002 |
tjr |
Remove broken and incomplete support for old releases of System V, don't support system that implement getcwd(3) with a pipe to /bin/pwd.
|
#
100308 |
|
18-Jul-2002 |
tjr |
Avoid using ints or shorts to store process id's, use pid_t instead. The pgrp member of struct job was declared as a short and could not store every possible process group ID value, the rest of them were benign because pid_t happens to be an int.
|
#
100305 |
|
18-Jul-2002 |
tjr |
Make the message that is printed when the foreground process is terminated by a signal the same as pdksh/bash/sh before rev. 1.34.
|
#
99762 |
|
11-Jul-2002 |
tjr |
Don't assume the shell's controlling terminal is attached to file descriptor 2. Instead, open /dev/tty. This problem stopped commands in subshells from being executed correctly if standard error was redirected.
PR: 36671 Obtained from: NetBSD (but simplified)
|
#
99761 |
|
11-Jul-2002 |
tjr |
Remove support for the "old" tty driver by unifdef -UOLD_TTY_DRIVER; many other parts of the shell are no longer compatible with this, and it makes jobs.c quite cluttered with #ifdef's.
|
#
99760 |
|
11-Jul-2002 |
tjr |
When growing the job table, don't relocate the jobmru pointer if it's NULL.
|
#
99634 |
|
09-Jul-2002 |
tjr |
Print out commands with NTOFD/NFROMFD redirections that close the descriptors (">&-" or similar) correctly in the jobs(1) command.
|
#
99110 |
|
30-Jun-2002 |
obrien |
Consistently use FBSDID
|
#
98464 |
|
20-Jun-2002 |
jmallett |
Remove two unused variables.
|
#
97822 |
|
04-Jun-2002 |
tjr |
Display job status correctly when a pipeline is suspended.
|
#
97820 |
|
04-Jun-2002 |
tjr |
Describe finished jobs as "Done", not "Exit" (SUSv3)
|
#
97819 |
|
04-Jun-2002 |
tjr |
Don't output `state' and `current' fields for processes that aren't leaders in -l option to jobs(1).
|
#
97816 |
|
04-Jun-2002 |
tjr |
Correct minor spacing problem in output of jobs -l for pipelines.
|
#
97688 |
|
31-May-2002 |
tjr |
Support the remaining job ID formats required by SUSv3: %+ (current job, same as %%), %- (previous job), %?str (job with "str" in its command name).
|
#
97669 |
|
31-May-2002 |
tjr |
Add -s (output PID's only) and -l (show PID's) options to the jobs(1) builtin. Modify the output format to match what SUSv3 requires.
|
#
97664 |
|
31-May-2002 |
tjr |
#if JOBS around a job control-related statement to allow compilation with job control disabled.
|
#
97663 |
|
31-May-2002 |
tjr |
Break the code to display status info for one job out from showjobs() into showjob(), use it inside dowait() to display status info for consistency, and in a format closer to what the standard requires.
|
#
97660 |
|
31-May-2002 |
tjr |
Move job to front of most recently used job list when bg'd or fg'd.
|
#
97659 |
|
31-May-2002 |
tjr |
Instead of keeping just the jobid of the most recently bg'd or fg'd job, keep a linked list of the jobs, most recently used first. This is required to support the idea of `previous job', and to allow the jobs fg and bg default to be correct according to POSIX.
|
#
96933 |
|
19-May-2002 |
tjr |
Make the fg and bg commands give the output required by SUSv3. fg outputs the name of the command, bg outputs the name of the command and the job id.
|
#
96922 |
|
19-May-2002 |
tjr |
Implement the -C (-o noclobber) option, which prevents existing regular files from being overwritten by shell redirection.
|
#
90111 |
|
02-Feb-2002 |
imp |
o __P has been reoved 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) { ...
|
#
72086 |
|
06-Feb-2001 |
cracauer |
Fix child's SIGSTOP behaviour in scripts.
When a child is receiving SIGSTOP, eval continues with the next command. While that is correct for the interactive case (Control-Z and you get the prompt back), it is wrong for a shellscript, which just continues with the next command, never again waiting for the stopped child. Noted when childs from cronjobs were stopped, just to make more processes (by wosch).
The fix is not to return from a job wait when the wait returned for a stopped child while in non-interactive mode. This bahaviour seems to be what bash2 and ksh implement. I tested for correct behaviour for finnaly killing the child with and without forgrounding it first. When not foregrouding before killing, the shell continues with the script, which is what the other shells do as well.
Reviewed by: Silence on -current
|
#
69793 |
|
09-Dec-2000 |
obrien |
Add `_PATH_DEVZERO'. Use _PATH_* where where possible.
|
#
66612 |
|
03-Oct-2000 |
brian |
Implement the <> redirection operator.
|
#
59436 |
|
20-Apr-2000 |
cracauer |
Fix warnings, some of them serious because sh violated name spaces reserved by the header files it includes.
mkinit.c still produces C code with redundant declarations, although they are more harmless since they automatically derived from the right places.
|
#
53891 |
|
29-Nov-1999 |
cracauer |
Include strerror(errno) in error messages after failed system calls. Fix a warning.
|
#
50471 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
46684 |
|
08-May-1999 |
kris |
Various spelling/formatting changes.
Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
|
#
45916 |
|
21-Apr-1999 |
cracauer |
Next approach to make loops in interactive interruptable.
PR: bin/9173
|
#
38950 |
|
08-Sep-1998 |
cracauer |
If traps are set, they are now executed even when a signal-blocking foreground child is running. Formerly, traps were exceuted after the next child exit.
The enables the user to put a breaking wrapper around a blocking application: (trap 'echo trap ; exit 1' 2; ./pestyblocker; echo -n)
The "echo -n" after the child call is needed to prevent sh from optimizing the trap-executing shell away. I'm working on this.
|
#
38536 |
|
25-Aug-1998 |
cracauer |
Improve bookkeeping of in_waitcmd and style fixes. Submitted by: Bruce Evans
|
#
38521 |
|
24-Aug-1998 |
cracauer |
Do not exit on SIGINT in non-interactive shells, fixes PR 1206, i.e. this makes emacs usable from system(3). Programs called from shellscripts are now required to exit with proper signal status. That means, they have to kill themself. Exiting with faked numerical exit code is not sufficient.
Exit with proper signal status if script exits on signal.
Make the wait builtin interruptable, both with and without traps set.
Use volatile sig_atomic_t where (and only where) appropriate.
(Almost) fix printing of newlines on SIGINT.
Make traps setable from trap handlers. This is needed for shellscripts that catch SIGINT for cleanup work but intend to exit on it, hance have to kill themself from a trap handler. I.e. mkdep.
While I'm at it, make it -Wall clean. -Wall is not enabled in Makefile, since vararg warnx() macro calls in usr.bin/printf/printf.c are not -Wall-able. PR: 1206 Obtained from: Basic SIGINT fix from Bruce Evans
|
#
36150 |
|
18-May-1998 |
charnier |
Add rcsid. Spelling.
|
#
33142 |
|
06-Feb-1998 |
cracauer |
Back out my previous attempt to fix SIGINT/SIGTERM behaviour
|
#
33138 |
|
06-Feb-1998 |
cracauer |
Fix handling of SIGINT/SIGQUIT for foreground subprocesses. Most urgent need is when you run sh around a program that intentionally uses SIGQUIT/SIGINT for asynchronous events, i.e. $EDITOR started from system(2), like many mailers do. This fixes PR bin/1206 and possibly bin/4241.
The solution committed has been tested for a large number of possible cases (see recent discussion on cvs-committers). I completed a make world, made sure 'make world' is interruptable and used the changed /bin/sh as a login shell all day, including job control and using SIGQUIT-catching programs (to write this message :-).
PR: bin/1206 Reviewed by: discussion on cvs-commiters
|
#
31666 |
|
10-Dec-1997 |
eivind |
Remove simultaneous include of <sys/param.h> and <sys/types.h>. Reorder includes to be alphabetical some places since I already was in here.
|
#
28346 |
|
18-Aug-1997 |
steve |
Make all status values an integral type and use pid_t when referring to process IDs.
|
#
26104 |
|
24-May-1997 |
steve |
Make sh(1) less aware of the bit fields returned by wait by using the WIF* macros in sys/wait.h.
PR: bin/3668 Submitted by: dholland@eecs.harvard.edu
|
#
25905 |
|
18-May-1997 |
steve |
Use the __unused attribute where warranted.
|
#
25222 |
|
28-Apr-1997 |
steve |
Nuke register keyword usage and #if -> #ifdef.
Obtained from: NetBSD
|
#
22988 |
|
22-Feb-1997 |
peter |
Revert $FreeBSD$ to $Id$
|
#
21673 |
|
14-Jan-1997 |
jkh |
Make the long-awaited change from $Id$ to $FreeBSD$
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.
|
#
21352 |
|
05-Jan-1997 |
steve |
Fix a problem that caused some foreground pipelines to die with:
tcsetpgrp failed, errno=1
Discovered and Reviewed by: joerg
|
#
20425 |
|
14-Dec-1996 |
steve |
Merge in NetBSD mods and -Wall cleaning.
Obtained from: NetBSD, me
|
#
18954 |
|
16-Oct-1996 |
steve |
Benign | --> || correction.
|
#
18018 |
|
03-Sep-1996 |
peter |
Fix for PR#1287. This makes sh behave sensibly in case statements in the face of aliases. Note, bash doesn't do aliases while running scripts, but "real" ksh does..
Also: Reduce redundant .Nm macros in (unused) bltin/echo.1 nuke error2, it's hardly used. More -Wall cleanups dont do certain history operations if NO_HISTORY defined handle quad_t's from resource limits
Submitted by: Steve Price <sprice@hiwaay.net> (minor tweaks by me)
|
#
18016 |
|
03-Sep-1996 |
peter |
Misc cleanups and fixes from Bruce: - don't put \n on error() calls, error adds it already. - don't prepend "ulimit" on error() calls in miscbltin.c. - getopt typo on ulimit -p -> -u conversion - get/setrlimit() calls were not being error checked
ulimit formatting cleanup from me, use same wording as bash on Bruce's suggestion. Add ulimit arg to output on Joerg's suggestion.
|
#
17987 |
|
01-Sep-1996 |
peter |
Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a 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
|
#
10934 |
|
21-Sep-1995 |
bde |
Fix relocation of job table.
while { sleep 1 & wait; } do echo 1; done
corrupted the job table every 4th iteration.
|
#
8855 |
|
29-May-1995 |
rgrimes |
Remove trailing whitespace.
Reviewed by: phk
|
#
3044 |
|
24-Sep-1994 |
dg |
Added $Id$
|
#
1557 |
|
26-May-1994 |
rgrimes |
This commit was generated by cvs2svn to compensate for changes in r1556, which included commits to RCS files with non-trunk default branches.
|
#
1556 |
|
26-May-1994 |
rgrimes |
BSD 4.4 Lite bin Sources
|