Commit Graph

294 Commits

Author SHA1 Message Date
itohy 362c3e31c9 The builtin . (dot) command no longer sees the current working directory
even if the specified file is not in the PATH.
This change enforces security and makes it conform to POSIX.

Closes PR #6794.
I thought Christos committed this but not appeared yet. :)

The setstackmark()/popstackmark() pair in dotcmd(), used for freeing
stack storage possibly allocated by find_dot_file(), is redundant for now
since dotcmd() is surrounded by another pair in evalcommand().
This redundancy, however, may help future modifications
(suggested by Christos).
1999-02-02 15:49:52 +00:00
kleink f71d010d24 Add support for the export and readonly -p option. 1999-01-28 18:11:50 +00:00
mycroft 1fbf0781c6 Patches from Tor Egge (via Havard Eidnes) to fix various bugs in field
splitting and combining.
(Note: Some of this are not strictly bugs, but differences between traditional
Bourne shell and POSIX.)
1999-01-25 14:20:56 +00:00
christos e1849b79b1 PR/6213: Urban Boquist: /bin/sh does not handle a trapped signal correctly
The problem was that system calls got restarted after a signal,
	 instead of returning EINTR. Thus the read builtin, had no way to
	 know that a signal occured that could change the course of execution.
	 Since the code has sprinkled checks for EINTR all over the place,
	 it is supposed to work properly with non restartable syscalls.
	 The fix is to use siginterrupt(signo, 1), before setting a signal
	 handler, to make sure that system calls don't get restarted.
1999-01-18 16:18:04 +00:00
garbled f33f4be925 Massive fixup:
Rewrite man page in mandoc format rather than nasty man format.
Fix a ton of parsing errors, and generate proper .Xr's.
document all known environment variables.
suggest ksh rather than bash.

The last two fix PR #1966.  Wheee!

Somebody with access to the POSIX spec needs to go in here, and document
our adherence, or lack thereof.
1999-01-11 19:34:53 +00:00
msaitoh 576a5fdc92 fix some bugs 1998-11-17 14:16:32 +00:00
garbled b4e6f9c37a Modify to better document getopts. This fixes PR# 704. Much thanks to
Christos for helping me out with this.
1998-10-29 23:23:36 +00:00
ross 7fc1302b5d The recent cross-compile changes broke the build of x_sh. Properly use
${.IMPSRC} instead of the broken ${.CURDIR}/thing.c.
1998-10-08 00:29:38 +00:00
itohy ef88b5d2bd Fixed memory leak on old style command substitution
such as  sh -c 'echo `echo foo`' .
The memory allocated with ckmalloc() at
parser.c:1349:readtoken1() (search for "done:" label)
was never freed.

I changed this to use 'string stack' framework of Ash.
Note that a string on string stack is properly freed on
exception and end of command parsing, and no explicit free
or signal handlings required.
See TOUR for an overview, and memalloc.[ch] for details
of string stack.
1998-09-26 20:56:33 +00:00
christos 26e51b35ac include <stdlib.h> to get the prototype for free() 1998-09-26 19:28:12 +00:00
itohy cc484b787f The return value of setmode(3) is a pointer to malloc()'ed area
and must be freed to avoid memory leaks if called repeatedly.
The leaks occured on symbolic umask command, such as "umask go-w",
which is undocumented.
1998-09-24 17:49:48 +00:00
wrstuden 1037acbf7e We don't generate .o's anymore for helper programs, so don't CLEANFILES them. 1998-09-12 18:58:41 +00:00
wrstuden d10063d5c7 Patch to make sh cross-compile right. mksyntax reports unsigned char for
powerpc, and signed for m68k & i386.
1998-09-12 18:55:07 +00:00
mycroft ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
mycroft 9dc385beb1 Delint. 1998-07-28 05:31:22 +00:00
christos d06f150426 PR/5848: David Holland: Use PIPE_BUF instead of hardcoding 4k 1998-07-27 17:12:45 +00:00
mycroft 5dd823ab5d const poisoning. 1998-07-26 19:44:12 +00:00
ross 69228f8bd8 Small edit to n1>&n2 description. 1998-07-04 06:52:07 +00:00
ross ac875dda03 Fix a set of bugs where a cd of a relative pathname or a cd through a
symbolic link would not set PWD.
1998-05-21 16:50:40 +00:00
christos efee39278b Simplify interface for general use. 1998-05-20 01:36:14 +00:00
christos f792cdd756 Cast is*() args to unsigned chars in case the ctype macros are implemented
using arrays.
1998-05-20 00:32:05 +00:00
christos 96133865eb cast pid's to longs for OS's where this is the case. 1998-05-20 00:31:11 +00:00
christos 338ea4cec8 fix bug where if moving in history during a multi-line event, the
append to history event would end up in the last event where the history
was moved to instead of the multi-line event; reported by Mycroft
1998-05-20 00:29:26 +00:00
christos 3d8b8b2ed2 Fix dangling else warning. 1998-05-20 00:27:56 +00:00
christos 3ebdac1759 Portability fixes for a non flex based lexical analyzer. 1998-05-18 22:50:20 +00:00
christos c6e03280d4 Need stdlib.h 1998-05-18 22:48:53 +00:00
christos d2ded939ef PR/5315: Dan Winship: options parsing code should print errors to stderr. 1998-05-02 18:04:09 +00:00
cgd 2072394059 move OBJS depenency on built headers to after include of bsd.prog.mk, so
that things are built in the right order on 'make cleandir && make' (i.e.
so that the headers are properly built).
1998-04-19 05:22:08 +00:00
lukem d6c354cb4b * remove CFLAGS+=-w for powerpc (added in 1.26):
- it was in the wrong place
	- makefiles shouldn't override CFLAGS; only CPPFLAGS and COPTS
	- christos fixed unsigned char stuff in 1.33 which should
	  remove the need for -w anyway
* move .include <bsd.prog.mk> to EOF
1998-04-13 12:06:48 +00:00
tv 482063559a .y.c <sys.mk> rule fixes. Don't create a y.tab.h file unless asked for,
and use smarter creation of the header file.
1998-04-09 00:32:31 +00:00
fair 667e4d4cd1 fix default PATH to be <paths.h> _PATH_DEFPATH 1998-04-07 21:15:33 +00:00
fair 618cca243b Change a few things to reference /usr/include/paths.h instead of local
references. Fixing the default PATH is a bit more effort.
1998-04-07 10:16:04 +00:00
veego 7f307512f9 Another try to make this work again. Lets hope that the we don't need a 4th
fix for it.
1998-03-30 12:06:48 +00:00
mrg 6e35073fed make this work again when . is not in $PATH 1998-03-30 10:07:16 +00:00
christos 0328c41456 Pr/5221: Jason Thorpe: Simplify sh Makefile, so that builts from other
directories work.
1998-03-29 09:27:40 +00:00
mrg a26bae1e08 - change "extern" variables into int's
- remove extern'd variables not actually referenced
- don't use char as an array index
1998-03-29 04:41:43 +00:00
christos 04784d87fa Fix the VSTRIMRIGHT* bugs... The problem was not the string length computation,
but lack of '\0' termination. Factor this segment out as common code too, while
I am there.
1998-03-23 18:21:02 +00:00
christos 19e7771baa off by one error in ${%%} 1998-03-10 19:11:07 +00:00
christos 7cfc52b208 PR/5001: Tom Yu: cd ./ does not work. 1998-02-17 02:57:16 +00:00
christos ce0d4f06a6 Previous fix broke $var quoting. Try again differently :-) 1998-02-17 00:16:16 +00:00
christos d8a1d3710c Re-enabled EXP_RECORD 1998-02-05 08:34:49 +00:00
christos f7c8df6d68 Fix bug introduced by EXP_RECORD, where in case there was a variable expansion
involved in the `for' list, the list was recorded twice, leading to incorrect
argument expansion.
Introduce ifsfree() function that free's the IFS region list, GC'ing duplicated
code.
1998-02-05 08:32:00 +00:00
thorpej b65b5cae9e Sigh, have to cast pointer diffs to long. 1998-02-04 23:49:25 +00:00
thorpej a40a144d00 Fix printf formats so they work on the Alpha. 1998-02-04 20:10:16 +00:00
mikel a235399817 back out last change until christos fixes EXP_RECORD; PR 4932 1998-02-04 06:25:55 +00:00
christos 5a36c00160 PR/4851: Benjamin Lorenz: In the "for <var> in <args>" construct <args>
was not marked as a region to be handled by ifsbreakup. Add EXP_RECORD
to indicate that the argument string needs to be recorded.
1998-01-31 12:45:06 +00:00
christos 2b259b0600 - Add gcc attributes to printf like functions
- Fix format strings to be const
- Fix buffer length to be size_t
- Add %p format
- Avoid code duplication in varargs/stdarg cases
1998-01-31 12:37:55 +00:00
christos 7faabd5800 Include our local includes after the system's ones. 1998-01-31 12:36:16 +00:00
christos 71868e12e2 Fix printf format. 1998-01-31 12:34:12 +00:00
christos e3f5fb922f BSD4_4 is a standard symbol in <sys/param.h>; make sure that files
that need this defined, include <sys/param.h> and don't define it in
the Makefile. Add a comment to that effect.
1998-01-21 10:47:37 +00:00