Commit Graph

658 Commits

Author SHA1 Message Date
rumble 2174dda221 Handle asprintf failing to allocate. 2006-03-17 14:43:11 +00:00
aymeric d5d0c11532 Make the -s flag of fc work correctly. Ensure that only one command is specified
and ensure that we break out of the loop after executing it.
With the previous code, because the re-executed command was added to the
history, it would think that it still had to execute it, leading to an infinite
loop.

The last thing which differs from ksh is that we get the "fc -s " command into
the history, but this is actually rather a feature in my humble opinion.

To test:
$ echo hello
$ fc -s ec
<infinite loop or correct behaviour>
2006-03-06 00:09:22 +00:00
garbled 6ac601d8c4 Add error printing for ENAMETOOLONG. Partially addresses PR bin/13850 .
The actual bug mentioned in that PR no longer exists, but it does cause:
~~~~~: error 63
Which this fix cleans up.
2006-01-02 19:10:33 +00:00
dsl ea2078818f TOG require that 'set +o' output the options in a form suitable for
restoring them - make it so.
2005-12-13 17:44:18 +00:00
dsl e60beff86b Don't change the name of the directory we are going to 'cd' to just because
we decide to remove a leading "./" when deciding whether to print the name.
Stops 'cd .//tmp' ending up the same as 'cd /tmp'.
Fixes PR/30735
2005-11-26 21:44:43 +00:00
christos 8d6ffce2ad PR/31548: Alexander Rigbo: $PWD not set when shell starts up, before pwd
or cd get executed.
2005-10-10 21:14:42 +00:00
christos c05266af8a fix setmode error handling. 2005-10-01 20:23:54 +00:00
tv 964f98e703 Make slightly more portable without extra conditionals needed:
- Use getpgrp() rather than getpgid(0).
  (getpgrp() is already used elsewhere in this same file.)

- Use waitpid(-1, a, b) rather than wait3(a, b, NULL).
2005-09-30 18:57:55 +00:00
wiz 2ea3362a10 In mdoc, use .Pp for new paragraphs, not .br. 2005-09-10 22:09:43 +00:00
dsl 8c772bc707 Don't apply CDPATH if the the first component of the target is "." or "..".
Fixes PR/30973 and applies the principle of least surprise.
Update documentation to match (including date).
(matches behaviour of pdksh - if not it's documentation)
2005-08-20 21:07:42 +00:00
wiz 980a2652ee Aspell, fix an Xref, drop trailing whitespace. 2005-07-15 22:33:48 +00:00
christos 0df4f0ca31 Only do certain actions when we are trully interactive, not just when we
are connected to a tty:
	1. enable editor
	2. print directory on directory change.
	3. print job messages
2005-07-15 17:49:43 +00:00
christos b0d51313b4 If we have a script and we are interactive, set interactive to 2. This
allows us to run scripts with -i without printing the prompt like the
other shells do.
2005-07-15 17:46:54 +00:00
christos e996b4625d Allow trap to work on ignored signals when the shell is interactive. 2005-07-15 17:23:48 +00:00
christos ab760d2891 make setsig() return sig_t 2005-07-11 02:37:31 +00:00
christos 3564ac65d4 Don't hard ignore signals that were ignored by our environment, because
when we try to set a trap on them it will not work. Also while I am here:
1. don't change the action status if the signal system call failed.
2. don't try to sigignore it if signal failed.
3. clear the signal mask in case our parent blocked it for us.
2005-07-11 02:37:05 +00:00
christos 6310b59691 sprinkle a little const, and now everything compiles with WARNS=3 2005-06-26 19:10:48 +00:00
christos b61c2197f1 Revert part of the previous commit. We cannot fix the problem by not waiting.
The problem is that the subshell code is not doing redirections properly.
2005-06-23 23:05:29 +00:00
christos 306d33d145 Don't wait for a background job in a subshell when we are set to EV_EXIT.
While I am here, call forkshell() explicitly FORK_FOO flags instead of
depending in FORK_FG == 0 and FORK_BG == 1.
2005-06-22 23:32:45 +00:00
lukem 5166671bc3 appease gcc -Wuninitialized 2005-06-01 15:41:19 +00:00
lukem 50cde64b47 Mark temp_path volatile so that it won't get clobbered after longjmp.
(Also appeases gcc -Wuninitialized.)
2005-06-01 15:38:32 +00:00
wiz 24bf3d8ac3 Whitespace and punctuation fixes. 2005-05-24 00:03:52 +00:00
christos c3b8cf7d21 Only add the function when we initialize. Restore the binding of tab to
ed-insert if tabcomplete is cleared.
2005-05-09 11:35:19 +00:00
dsl 82537bf8e8 If 'set -o tabcomplete' it set, then bind <tab> to the libedit filename
completion function.
Note that the libedit code will probably want fine-tuning!
While editing the man page, add a note that non-whitespace IFS chars are
terminators and can generate null arguments.
2005-05-07 19:52:17 +00:00
dsl 3acd9704cb A rather better fix for treating $((x)) as equivalent to $(($x)) provided
that $x has a numeric value - which is what posix/sus needs.
2005-03-21 22:37:09 +00:00
dsl a65ddf9664 Back out previous, amongst other things it breaks $((0x10)) 2005-03-21 20:10:29 +00:00
dsl b747d738fa Treat $((x)) as equivalent to $(($x)) - posix seems to require this now. 2005-03-20 21:39:11 +00:00
dsl aecb1ce456 Add 'continue' as body of empty loop. 2005-03-20 21:38:17 +00:00
dsl 328c436518 Check quoting before merging ifs regions.
sh -c 'set -- a; x="b c"; set -- "$@"$x'
now correctly gives $1=ab, $2=c
2005-03-19 16:38:27 +00:00
dsl 2078d2c0ca Don't merge ifs regions with different quoting requirements 2005-03-19 15:02:58 +00:00
dsl 4803d37f2b Fix the way the 'read' builtin processes IFS. In particular:
- IFS whitespace is now processes correctly,
- Trailing non-whitespace IFS characters are added to the last variable
  iff a subsequent variable would have been assigned a non-null string.
Now passes the 'read' tests in http://www.research.att.com/~gsf/public/ifs.sh
2005-03-19 14:22:50 +00:00
dsl 8693718ba1 Fix printing of invalid commandname after certain types of errors on builtins.
Fixes bug bin/29410 in head.
All of /bin/sh needs pulling up into 2.0
2005-03-02 20:57:31 +00:00
dsl f712e70aee expbackq() was incorrectly backing up a temporary buffer when removing \n
from the end of output of commands inside $(...) substitutions.
If the program output is n*128+1 bytes long (ending in a \n) then the code
checks buf[-1] for another \n - looking an uninitialised stack.
On a big-endian system an integer of value 10 will satisfy this (unlikely
on little endian) and can happen depending on the last code path to use
a lot of stack!
This caused the problem with newvers.sh on sparc64 after ', 2005' was
added to the date list.
Fixed PR/28852
2005-02-14 20:46:26 +00:00
perry 3fa24d7834 remove obsolete register declarations 2005-02-06 04:43:43 +00:00
christos 2a32d39ed6 PR/28940: David Laight: /bin/sh doesn't quote the output of trap. 2005-01-11 19:38:57 +00:00
christos 027df12dd8 Pass WARNS=3 2004-10-30 19:29:27 +00:00
enami 87aaf3d70d Fix a bug introduced by previous commit. It breaks export command
with multiple arguments if one of them are already set.  Fix PR#27155
and probably PR#27143.
2004-10-06 10:23:43 +00:00
dsl 5f9b910124 Save the length of each variable in the name table so that we can
compare the lengths and then use memcmp() in the search code.
Speeds up one of my scripts by a facter of 2.
Increase the size of the variable hash table.
Cuts down time for script to execute from 60 seconds to 10.
Move variable search into a new function to hide the implementation
from most of the code, new version is slightly smaller than old.
2004-10-02 12:16:53 +00:00
seb cf788c3115 Add new builtin `wordexp' to support wordexp(3).
From FreeBSD.
Provided in PR lib/26123.
Approved by kleink@.
2004-07-13 15:05:59 +00:00
christos 5dd9099216 PR/25699: David Laight: sh(1) hangs opening a named pipe as stdin for
background process
This happens because we vfork, and then open a named pipe with O_RDONLY
and block in the child. We avoid this, by opening the file with O_NONBLOCK,
and then reset it if we are vforked. XXX: this is an ugly fix.
2004-07-08 03:57:33 +00:00
mycroft 1ccdf5daeb Make "set -e" once again provide the behavior documented in the man page,
which was unnecessarily changed in revision 1.50 while fixing other bugs.
That is, exit the shell if the last command in a || or && compound statement
is not short-circuited, and exits with a false status.  I.e., the following
will cause the shell to exit:

  set -e
  false || false

While this is not the prescribed behavior in SUSv3, it is what our man page
documents, and it is what all of the following implementations do:

  NetBSD /bin/ksh (pdksh)
  bash
  zsh
  Solaris 9 /bin/sh
  Solaris 9 /usr/xpg4/bin/sh
  Solaris 9 /usr/bin/ksh
  Tru64 /bin/sh
  HP/UX 11 /bin/sh

The "standard" seems to be wrong in this instance.
2004-06-30 09:32:38 +00:00
dsl 60bb0d96f3 Fix treatment of ' inside a 'here document' with a quoted EOF marker.
Fixes a breakage from the previous version.
2004-06-27 10:27:57 +00:00
dsl c6cbc16d26 Correctly apply IFS to unquoted text in ${x-text}.
Fixes PR/26058 and the 'for i in ${x-a b c}; do ...' and ${x-'a b' c}.
I can't find a PR for the latter problem.
Regression test goind in shortly.
2004-06-26 22:09:49 +00:00
dsl 97e8f81436 Remove a broken optimistion that crept in earlier today. 2004-06-26 20:48:44 +00:00
dsl 8e940884ca Kill a diagnostic I accidentally left in. 2004-06-26 14:21:29 +00:00
dsl e4a2a056d2 No functional changes (intended).
Rename some variables, add some comments, and restructure a little.
In preparation for fixing "set ${x-a b c}" and friends.
2004-06-26 14:09:58 +00:00
dsl 39cf7788fc Use shell variables to get '(' and '\' inside shell substitution patterns.
Solves problems with different shells having differntly buggy parsers
(and the standard probably allowing random behaviour).
Should fix bin/25938
2004-06-15 23:09:54 +00:00
dsl c6e67e3bf2 Change '\0' to 0 so that the SVR4 'echo' doesn't convert it to a null byte.
Fixes bin/25938
2004-06-15 22:57:27 +00:00
christos cf19966782 Undo previous fix, breaks:
#!/bin/sh
echo ${1+"$@"}
./sh.new foo.sh a b c
a b c b c
I'll revisit this when I have some more time.
2004-06-09 12:17:36 +00:00
christos fc5d411571 "for i in ${x-a b c}; do echo $i; done" should print "a\nb\nc\n" not "a b c\n"
like other shells do. mark the expansion for ifs splitting. XXX: linux has a
very complicated fix for this. I wonder why.
2004-06-08 03:29:51 +00:00
christos 95a737969b don't include the printf builtin if we are SMALL; saves 10K. 2004-06-06 07:03:11 +00:00
hubertf c784286d1a Fix typo: and the -> and then 2004-06-03 19:54:37 +00:00
dsl 00a6315e86 Ensure that fd 0, 1 and 2 are not used for the local end of pipelines.
Fixes PR bin/25395
2004-04-30 06:27:59 +00:00
wiz d8dd84fc16 Fix typo noted by Patrick Welche. 2004-04-23 13:28:15 +00:00
lukem 778dabc229 Correct the description of sbsize; it is parsed in bytes not kbytes. 2004-04-19 01:36:32 +00:00
wiz 8e5ab2cd61 Bump date for previous. 2004-04-17 15:42:42 +00:00
christos 6acf809e53 understand rlimit sbsize 2004-04-17 15:40:12 +00:00
dsl f0177aeba6 Put a syntax.c under CVS instead of building if with the mksyntax program.
Kill mksyntax.c - no longer possible to get the 'wrong sort of chars'.
/bin/sh now has no helper binaries.
syntax.c uses C99 initialisers, run time initialisation could be used
for systems where the compiler doesn't support them.
I've used some #defines to help make this possible - but writing the code
starts making it rather messy.
2004-01-17 17:38:12 +00:00
dsl 9cd22030d1 Put syntax.h under CVS instead of having it generated by mksyntax.
Use CHAR_MIN (from limits.h) to determine whether target char are signed
or unsigned - the syntax tables will not be indexed properly.
Rip out all the stuff from mksyntax.c that wrote syntax.h.
syntax.c can stiff be generated incorrectly...
2004-01-17 15:40:09 +00:00
dsl 1fe487ae6e Replace mkinit.c with mkinit.sh
Build mksyntax directly from mksyntax.c so that the -DTARGET_CHAR=xxx
is applied when it is build.
OTOH mksyntax is broken as it tries to determine properties of the
target system by running code on the build system.
2004-01-17 11:47:30 +00:00
dsl df348483d0 Replace the C program mknodes.c with a shell script mknodes.sh
(mkinit and mksyntax may also die soon...)
2004-01-16 23:24:38 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
wiz 4eb81d63b4 Fix example added in previous. 2003-12-21 11:16:23 +00:00
jdolecek 9927abce5e add a note to Short-Circuit operators section about the somewhat
nonintuitive evaluation in case there is both || and && specified
pointed out in bin/23814 by VaX#n8
2003-12-21 08:40:29 +00:00
jdolecek 30651d6b04 minor optimization in evalvar()
change sent in bin/23813 by VaX#n8
2003-12-21 08:32:39 +00:00
heas 8e58476bbd correct 2 typos 2003-12-18 15:52:31 +00:00
christos 08f1ceee65 PR/23786: Robert Nestor: wait command returns the wrong status code. This
seems to be an off-by-one error, since njobs is decremented before we use
it. I hope this does not break the vfork case!
2003-12-18 00:56:05 +00:00
dsl 7983f217c9 Generate command line when SMALL is defined and make buffer full sized.
All the code has been present for a while, and the memory cost is (about)
180 bytes per process.
Fixes PR bin/23545
2003-11-27 21:16:14 +00:00
lukem e606e2dcb2 Improve how various "simple" host tools are built and invoked. 2003-11-16 14:14:18 +00:00
dsl 296844fe72 Posix requires that 'pwd -P' reset the shells saved cwd value - so a
subsequent 'pwd -L' will report the same value.
Update man page to be a closer match to reality.
2003-11-14 20:00:28 +00:00
dsl c0cf1d6b30 This seems to need stdlib.h to get a prototype for abort(). 2003-11-14 10:46:13 +00:00
dsl edecd89511 Add '\n' to "fork failed" trace messages. 2003-11-14 10:27:10 +00:00
dsl df5bd11fb9 Validate the arguments to 'pwd'. Treat -L and -P as per pwd(1).
Note that 'pwd -L' and 'pwd -P' almost always report the same answer as
the shell detects when 'cd' follows a symlink and discards its cached 'pwd'
2003-10-30 09:40:26 +00:00
wiz 6a22b79c1a passwd(5), not passwd(4). From Igor Sobrado in PR 23278. 2003-10-27 08:23:40 +00:00
wiz 4580c6ac21 Do not xref alias(1) since that points to csh(1).
Noted by Igor Sobrado in PR 23278, fixed following a suggestion by Greg A. Woods.
2003-10-27 08:22:21 +00:00
lukem 7568eb663a skip a leading `-' on the arg0 name when calling el_init() 2003-10-27 06:19:29 +00:00
lukem 130ab7336b Rework how MAKEVERBOSE operates:
*	Don't bother prefixing commands with a line of  ${_MKCMD}\
	and instead rely upon "make -s".  This is less intrusive on
	all the Makefiles than the former.  Idea from David Laight.

    *	Rename the variables use to print messages.  The scheme now is:
	    _MKMSG_FOO		Run  _MKMSG 'foo'
	    _MKTARGET_FOO	Run  _MKMSG_FOO ${.TARGET}
	From discussion with Alistair Crooks.
2003-10-21 10:01:19 +00:00
christos 1bbc81a501 Let libedit handle signals so we resize properly. I might change my mind
later on that.
2003-10-19 19:13:21 +00:00
lukem ddff99b7f4 rework to use the newer _MKMSGCREATE (et al) macros 2003-10-19 04:45:01 +00:00
lukem 1e840c4d40 Ensure that $TERM is set in the real environment before calling el_init(3)
when executing "set -o (emacs|vi)".   Fixes [bin/23175] from me.
2003-10-19 01:55:05 +00:00
lukem a9d371700c improve MAKEVERBOSE message for HOST_LINKed tools 2003-10-19 00:43:02 +00:00
lukem 29e7d09b65 Support MAKEVERBOSE (XXX: mksyntax is noisy when MAKEVERBOSE=0).
Use DPSRCS appropriately.
2003-10-19 00:35:26 +00:00
lukem 51b9502fb1 Link the host tools against tools/compat -lnbcompat since someone decided to
use strlcpy() and snprintf() in the host tools...

Should fix part of [toolchain/22504], and build problems on other
platforms that don't have strlcpy() or snprintf()...
2003-10-18 07:58:35 +00:00
dsl b17e1b5c12 Fix 'set "*" b; case "* b" in "$@") ...' and 'set "*"; case 1 in "${#1}") ...'
Which got broken by the previous fix.
2003-09-22 12:17:24 +00:00
jmmv 4c79e7620f Drop equal signs from rule definitions; they cause problems with "bison -y". 2003-09-17 17:33:36 +00:00
christos 4dcb41ae2c PR/22640: Paul Jarc: sh mishandles positional parameters in case. Fixed
from FreeBSD PR 56147.
2003-09-17 16:01:19 +00:00
jmmv 0ec085e737 Add 'trace' to CLEANFILES, generated when debug is enabled. 2003-09-14 12:11:10 +00:00
jmmv af90286087 Fix crash when DEBUG=2, by opening the log file ASAP. Reviewed by simonb@. 2003-09-14 12:09:29 +00:00
jmmv aba1ca99ae Include strings.h, needed for index's prototype. 2003-08-26 18:14:24 +00:00
jmmv 6d82007582 Use '\0' instead of NULL in two checks (we are not checking for a pointer
value).  While here, add a missing whitespace.
2003-08-26 18:13:25 +00:00
jmmv 5199a59afa s/FD_SETFD/F_SETFD/ 2003-08-26 18:12:33 +00:00
jmmv 534b18e585 Move an assignment that was using a variable out of scope to fix a build
problem on !NetBSD.
2003-08-25 20:08:12 +00:00
itojun 59a105b48a remove \r (agc, are you using MS-DOS?) 2003-08-22 14:21:12 +00:00
agc 3538d2653b Move 4 more files from UCB 4 clause to 3 clause licence.
Thanks to Julio Merino for pointing them out.
2003-08-22 11:22:23 +00:00
christos e9a8269bb0 remove clause 3 2003-08-21 17:57:53 +00:00
agc b5b2954259 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-07 09:05:01 +00:00
itojun a69cd45b93 use bounded string op 2003-07-13 08:31:13 +00:00
wiz 5127f8f2c1 Quote some punctuation. 2003-06-27 09:11:12 +00:00
dsl a9fc176e82 Don't close any script files if vfork is set.
If a fork() is done later in order to feed a 'here' document into a pipe
then it is possible that one end of the pipe might get closed.
2003-05-15 13:26:45 +00:00
dsl 49e6852272 Fix problems with parallel makes. 2003-05-15 10:13:36 +00:00
dsl 6285ef062c Use echo instead of cat to add prologue to builtins.[ch]
Under some circumstances the headers got overwritten.
2003-05-15 10:11:01 +00:00
christos dd61e68e1f Use ${HOST_SH} 2003-05-08 13:03:19 +00:00
wiz f0b76593e4 Drop trailing space. 2003-05-06 08:33:08 +00:00
dsl 534ba36ad4 Recognise octal and hexadecimal constants in expressions.
- as required by SUSv3
2003-05-06 08:10:42 +00:00
gmcgarry 5e5ffccb2b ANSIify. 2003-05-04 06:36:50 +00:00
gmcgarry f8d2e9e189 Add new builtin 'inputrc' which allows keybindings to be redefined
for the current shell.  From Arne H Juul in PR#10097.
2003-05-04 01:05:24 +00:00
gmcgarry 62bb6faae3 Expand documentation of emacs and vi modes. From
Jeremy C. Reed in PR#14578.
2003-05-02 09:00:14 +00:00
itojun e6a384fc32 %d is 12 chars, not 10 chars. hinted by deraadt 2003-04-15 07:40:56 +00:00
zuntum 1a2ec1a713 add missing parenthesis 2003-04-12 16:39:19 +00:00
kristerw 7fee304b15 Change "if" to "if and only if" per discussion in PR 20794. 2003-03-22 11:37:49 +00:00
lukem c61fa8df18 If building as a CRUNCHEDPROG, use "lex -L" and "yacc -l" to suppress #line
generation.  This may solve [bin/20637].
2003-03-10 17:58:21 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
wiz 4cc7cdbc5c New sentence, new line; bump date for last change. 2003-02-12 18:58:50 +00:00
gmcgarry 8a0ced42ec Introduce LANG environment variable and Xref to nls(7).
Comment out the statement: "We expect POSIX conformance
by the time 4.4BSD is released."
2003-02-12 02:55:14 +00:00
dsl 51d94f2156 Fix bin/20185 - builtin called from function of same name mustn't be hashed.
Make 'hash' only report utilities that are not builtins (posix), the
non-posix 'hash -v' will report everything.
(agreed by christos)
2003-02-04 08:51:30 +00:00
dsl 0871280204 Parse end of line comments correctly
(approved by christos)
2003-02-02 21:10:45 +00:00
christos 66b9125762 - use FD_CLOEXEC properly
- move ttyfd to a high fd
suggested by Tim Robbins at FreeBSD.
2003-01-27 12:54:08 +00:00
wiz 6ce643e53c Fix indentation of continuation of first line in SYNOPSIS. 2003-01-23 18:32:07 +00:00
agc 53ed48f326 Make this build on platforms where size_t != int, i.e. sparc, arm, ppc, ... 2003-01-23 14:58:07 +00:00
rafal 0923f4be26 Make this build again. 2003-01-23 03:33:16 +00:00
wiz e254f6a849 More markup, more commas, less typos. 2003-01-22 22:05:45 +00:00
dsl e314f958bd Support command -p, -v and -V as posix
Stop temporary PATH assigments messing up hash table
Fix sh -c -e "echo $0 $*" -a x (as posix)
(agreed by christos)
2003-01-22 20:36:03 +00:00
kleink b3df6303a9 Rename `sigset' locals to avoid symbol shadowing warning. 2003-01-16 09:38:37 +00:00
christos 51457e8842 Make sure that UPEOF is compared to the right type on the left hand
side. Sometimes it was compared to int, which was -1 on EOF, and on
unsigned char machines UPEOF was (unsigned char)-1. This worked
by chance because isalpha((unsigned char)-1) returns false usually,
but it does not when the locale is invalid!
2003-01-12 20:26:53 +00:00
christos a17201f05e allow this to be compiled with unsigned-chars. 2003-01-09 13:57:26 +00:00
wiz 617b132aac Spell output with two ts. 2003-01-04 23:43:02 +00:00
uebayasi 80a4544dcd trap '' SIGINT -> trap '' INT. 2002-12-28 05:08:27 +00:00
kleink 9273e5b038 Another it's -> its. 2002-12-19 18:04:41 +00:00
uebayasi 60ad876a43 `` [n1]>&n2 Duplicate standard output (or n1) _TO_ n2.'' 2002-12-12 11:50:40 +00:00
christos aa0e549885 PR/19453: Christopher Richards: Call setlocale() in /bin/sh 2002-12-11 19:12:18 +00:00
agc 1aafd1a470 Include <stdio.h> to get the prototype for sprintf(3) - macppc needs this. 2002-11-25 21:55:58 +00:00
agc ea1d615943 Make this compile on some of the more esoteric architectures (e.g. those
which are not i386)
2002-11-25 12:13:03 +00:00
christos c02b3bbdf4 Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
  (so I could unset -e PS1 before running the test shell...)
2002-11-24 22:35:38 +00:00
wrstuden 5b0a9938fd Use signed char to replace int8_t, not just char. Should fix macppc
cross-build problems introduced in rev 1.59.

Pointed out by Valeriy E. Ushakov uwe at ptc dot spbu dot ru on
tech-toolchain.
2002-10-31 17:14:46 +00:00
christos dde7426849 From David Laight
> The wrong process is aborting when variable assignment fails
> in the vfork path.  So the following command fails to execute
> the second echo (shown here with the correct output).
>
> $ (readonly r; r= /bin/echo a; echo b)
> r: is read only
> b
>
> fix: defer the mklocal() to the child shell.
2002-10-23 19:46:34 +00:00
christos f3dfd6e686 From David Laight:
> Also 'jobs' fails in a non-interactive shell.
> In showjobs(), the code that puts the process back into its
> own process group should only be run if the shell is actually
> doing job control - eg if 'mflag' is set.
2002-10-23 19:46:06 +00:00
christos 6166cc6e93 Fix interrupt problam from David Laight
$ /fred # non existant command
$ ^C # stops working

He says:
    Ok the extra INTOFF is the one in exverror().
    In almost all cases this doesn't matter because the longjmp()s
    all end up in main() and the FORCEINTON call sorts it out
    for the next command.
    (There are a significant number of INTON/OFF mismatches through
    the error paths...)

    In any case the above failure can be 'fixed' by changing 2 (I think
    they are both needed) INTON calls to FORCEINTON within evalcommand.
    The following patch seems to work:

We should really look in the code and fix the INTON->INTOFF pairs.
2002-10-23 13:25:24 +00:00
lukem e490a5c798 don't compile in `-h' as a synonym for the command that the argument is for.
this fix is hokey, but works as well as the previous solution for -j.
2002-10-15 04:15:58 +00:00
christos 1ce87c4b29 - it is wrong to put inton/intoff arount ckmalloc(), because the code
around it is the one that does this.
- whitespace fixes.
2002-10-07 14:26:49 +00:00
christos 202746f803 explain what's breaking with alignments > 16, but no fix yet. 2002-10-07 14:26:08 +00:00
christos b9d3050e20 Rename ALIGN to SHELL_ALIGN and simplify macro so that it does not have side
effects, and add double to it, so that it aligns doubles correctly too. This
is just a workaround to fix the sparc64 problem where ALIGN() is now defined
in some include file to be 16 instead of 8. Thanks to martin for debugging this.
2002-10-04 13:15:51 +00:00
wiz 1da66f1f4c filesystem -> file system, automaticly -> automatically. 2002-10-02 10:01:46 +00:00
wiz 2e6e2165c0 Use more mdoc, particularly to get rid of some \*[Lt] and \*[Gt]. 2002-10-01 15:06:31 +00:00
mycroft 6092f7d52b Revert the previous for now. This is truly gross. 2002-09-28 03:15:43 +00:00
mycroft 7973b7a0ac Remove the duplicate setpgid() in forkparent(). The real bug was freeing the
job structure in the child and referencing freed memory.
2002-09-28 03:08:00 +00:00
christos 4783843fdc Revert previous change. No need to save rootshell. It is only affecting
the non-vfork case. Having said that, it would be nice if pipelines of
simple commands were vforked too. Right now they are not.
Explain that setpgid() might fail because we are doing it both in the
parent and the child case, because we don't know which one will come
first.
Suspending a pipeline prints %1 Suspended n times where n is the number
of processes, but that was there before. It is easy to fix, but I'll
leave the code alone for now.
2002-09-28 01:25:01 +00:00
christos 6f48233483 Deal with rootshell not being maintained correctly in the vfork() case.
Propagate isroot, throughout the eval process and maintain it properly.
Fixes sleep 10 | cat^C not exiting because sleep and cat ended up in
their own process groups, because wasroot was always true in the children.
2002-09-27 22:56:24 +00:00
mycroft d84d36165d Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}()
screw with them now, only their callers.
2002-09-27 21:32:24 +00:00
christos ad1e7bca30 off by one in nprocs. 2002-09-27 21:04:08 +00:00
christos 35975338b0 Put back charles' fixes from -r1.60 2002-09-27 20:24:36 +00:00