The NetBSD Project

CVS log for src/bin/sh/input.c

[BACK] Up to [cvs.NetBSD.org] / src / bin / sh

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.76: download - view: text, markup, annotated - select for diffs
Mon Oct 14 08:15:43 2024 UTC (4 months ago) by kre
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +2 -2 lines

Apologies for that commit message ... it should have been the same
as for revision 1.124 of Makefile (and as below).

(This change changes nothing).

Reject nul characters in shell input.

At the request of Thomas Klausner (wiz@) copy an idea from OpenBSD,
and have the shell simply reject any (sh) input containing a \0 (nul)
character.   Previously nul characters were simply ignored (removed
from the input before it was examined in any other way).

Note this affects data read by the shell itself only, and has no
impact on other utilities, including those that are built into
the shell (so 'read' can still use -d '' to process output using
\0 as the record separator).

While I have tested that this works, there are so many places
where a nul might appear, that I cannot possibly test them all
(or even imagine all the possible places), so if this change
causes any problems, let me know (if from a script, send me the
script).

To undo this change, simply comment out (or delete) the line
	CPPFLAGS+= -DREJECT_NULS
from the Makefile, and build again.   Eventually if this causes
no problems, that option (conditional compilation) will probably
just go away, and this change would be permanent.

While the conditional compilation (on or off) persists, the
NETBSD_SHELL variable value will contain the word REJECT_NULLS
so you can easily verify if you are running a shell with this
included or not.

No pullups planned.

Revision 1.75: download - view: text, markup, annotated - select for diffs
Mon Oct 14 08:11:57 2024 UTC (4 months ago) by kre
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +11 -3 lines
#	$NetBSD: Makefile,v 1.123 2023/10/19 04:27:24 mrg Exp $
#	@(#)Makefile	8.4 (Berkeley) 5/5/95

.include <bsd.own.mk>

PROG=	sh
SHSRCS=	alias.c arith_token.c arithmetic.c cd.c echo.c error.c eval.c exec.c \
	expand.c histedit.c input.c jobs.c mail.c main.c memalloc.c \
	miscbltin.c mystring.c options.c parser.c redir.c show.c trap.c \
	output.c var.c test.c kill.c syntax.c
GENSRCS=builtins.c init.c nodes.c
GENHDRS=builtins.h nodes.h token.h nodenames.h optinit.h
SRCS=	${SHSRCS} ${GENSRCS}

DPSRCS+=${GENHDRS}

LDADD+=	-ledit -lterminfo
DPADD+=	${LIBEDIT} ${LIBTERMINFO}

# Environment for scripts executed during build.
SCRIPT_ENV= \
	AWK=${TOOL_AWK:Q} \
	MKTEMP=${TOOL_MKTEMP:Q} \
	SED=${TOOL_SED:Q}

CPPFLAGS+=-DSHELL -I. -I${.CURDIR} -I${NETBSDSRCDIR}/lib/libedit
CPPFLAGS+= -DUSE_LRAND48
CPPFLAGS+= -DREJECT_NULS

#XXX: For testing only.
#CPPFLAGS+=-DDEBUG=1
#COPTS+=-g
#CFLAGS+=-funsigned-char
#TARGET_CHARFLAG?= -DTARGET_CHAR="unsigned char" -funsigned-char

# Reproducible build parameters ... export into sh for NETBSD_SHELL setting
.if ${MKREPRO_TIMESTAMP:Uno} != "no"
BUILD_DATE!=	${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%Y%m%d%H%M%S"
# These are (should be) equivalent, but the 2nd is easier to understand
#CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:C/([^0]0?)(00)*$/\1/}Z"'
CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:S/00$//:S/00$//:S/00$//}Z"'
.endif

.ifdef SMALLPROG
CPPFLAGS+=-DSMALL
.endif
.ifdef TINYPROG
CPPFLAGS+=-DTINY
.else
SRCS+=printf.c
.endif

.PATH:	${.CURDIR}/bltin ${NETBSDSRCDIR}/bin/test \
	${NETBSDSRCDIR}/usr.bin/printf \
	${NETBSDSRCDIR}/bin/kill

CLEANFILES+= ${GENSRCS} ${GENHDRS} sh.html1
CLEANFILES+= trace.*

token.h: mktokens
	${_MKTARGET_CREATE}
	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC}

.ORDER: builtins.h builtins.c
builtins.h builtins.c: mkbuiltins shell.h builtins.def
	${_MKTARGET_CREATE}
	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} ${.OBJDIR}
	[ -f builtins.h ]

init.c: mkinit.sh ${SHSRCS}
	${_MKTARGET_CREATE}
	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC}

.ORDER: nodes.h nodes.c
nodes.c nodes.h: mknodes.sh nodetypes nodes.c.pat
	${_MKTARGET_CREATE}
	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} ${.OBJDIR}
	[ -f nodes.h ]

nodenames.h: mknodenames.sh nodes.h
	${_MKTARGET_CREATE}
	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}

optinit.h: mkoptions.sh option.list
	${_MKTARGET_CREATE}
	${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} ${.TARGET} ${.OBJDIR}

.if ${USETOOLS} == "yes"
NBCOMPATLIB=   -L${TOOLDIR}/lib -lnbcompat
.endif

SUBDIR.roff+=USD.doc

COPTS.printf.c = -Wno-format-nonliteral
COPTS.jobs.c = -Wno-format-nonliteral
COPTS.var.c = -Wno-format-nonliteral

# XXXGCC12 - only on some targets
COPTS.parser.c+=	${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 12:? -Wno-error=clobbered :}

.include <bsd.prog.mk>
.include <bsd.subdir.mk>

${OBJS}: Makefile

Revision 1.74: download - view: text, markup, annotated - select for diffs
Sat Aug 3 03:05:58 2024 UTC (6 months, 1 week ago) by kre
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +3 -3 lines
Change the "string" argument to evalstring() and setinputstring()
from being "char *" to being "const char *".

This is needed for a forthcoming change which needs to pass a const char *
to evalstring (and through it to setinputstring) and be assured that
nothing will alter the characters in the string supplied.

This is (aside from the additional compile time protection provided)
a no-op change, all evalstring() does with its string is pass it to
setinputstring() and all that does with it is determine its length
(strlen() which expects a const char *) and assign the string pointer
to parsenextc which is already a const char * - there never has been
any reason for these two functions to not include the "const" in
the arg declaration -- except that when originally written (early
1990's) I suspect "const" either didn't exist at all, or wasn't
supported by relevant compilers.

NFCI.   Most probably (though I didn't check) no binary change at all.

Revision 1.73: download - view: text, markup, annotated - select for diffs
Sat Jul 13 13:43:58 2024 UTC (7 months ago) by kre
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +6 -2 lines
Implement the HISTFILE and HISTAPPEND variables.

See the (newly updated) sh(1) for details.
Also add the -z option to fc (clear history).

None of this exists in SMALL shells.

Revision 1.71.2.1: download - view: text, markup, annotated - select for diffs
Tue Apr 6 17:52:03 2021 UTC (3 years, 10 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE
Diff to: previous 1.71: preferred, colored; next MAIN 1.72: preferred, colored
Changes since revision 1.71: +14 -3 lines
Pull up following revision(s) (requested by kre in ticket #1242):

	bin/sh/input.c: revision 1.72
	bin/sh/exec.c: revision 1.55

PR bin/55979

This fixes the MSAN detected reference to an unitialised variable
(an unitialised field in a struct) which happens when a command is
not found after a PATH search.
Aside from skipping some known to be going to fail exec*() calls
in some cases, the setting of the relevant field is irrelevant,
so this problem makes no practical difference to the shell, or any
shell script.

XXX (maybe) pullup -9


PR bin/55979

Correctly handle (ie: ignore completely) \0 chars (nuls) in the
shell command input stream (script, dot file, or stdin).
Previously nul chars were ignored correctly in the line in which
they occurred, but would cause trailing chars of that line to reappear
as the start of the following line.   If there was just one \0 skipped,
this would generally result in an extra \n in the sh input, which in
most cases has no effect.   With multiple \0's in a single line, more
of the end of that line was duplicated into the following one.  This
usually manifested as a weird "command not found" error.

Note that any \0 chars in the sh input make the script non-conforming,
so fixing this is not crucial (no \0's should really ever be seen) but
it was an obvious bug in the code, which was attempting to ignore nul
chars (as do many other shells), so let it be fixed.

XXX pullup -9

Revision 1.72: download - view: text, markup, annotated - select for diffs
Tue Feb 16 15:30:26 2021 UTC (3 years, 11 months ago) by kre
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, netbsd-10-base, netbsd-10-1-RELEASE, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +14 -3 lines
PR bin/55979

Correctly handle (ie: ignore completely) \0 chars (nuls) in the
shell command input stream (script, dot file, or stdin).

Previously nul chars were ignored correctly in the line in which
they occurred, but would cause trailing chars of that line to reappear
as the start of the following line.   If there was just one \0 skipped,
this would generally result in an extra \n in the sh input, which in
most cases has no effect.   With multiple \0's in a single line, more
of the end of that line was duplicated into the following one.  This
usually manifested as a weird "command not found" error.

Note that any \0 chars in the sh input make the script non-conforming,
so fixing this is not crucial (no \0's should really ever be seen) but
it was an obvious bug in the code, which was attempting to ignore nul
chars (as do many other shells), so let it be fixed.

XXX pullup -9

Revision 1.62.4.3: download - view: text, markup, annotated - select for diffs
Tue Apr 21 19:37:34 2020 UTC (4 years, 9 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.62.4.2: preferred, colored; branchpoint 1.62: preferred, colored; next MAIN 1.63: preferred, colored
Changes since revision 1.62.4.2: +2 -2 lines
Ooops, restore accidently removed files from merge mishap

Revision 1.62.4.2
Tue Apr 21 18:41:06 2020 UTC (4 years, 9 months ago) by martin
Branches: phil-wifi
FILE REMOVED
Changes since revision 1.62.4.1: +2 -2 lines
Sync with HEAD

Revision 1.62.4.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 21:41:03 2019 UTC (5 years, 8 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +82 -23 lines
Sync with HEAD

Revision 1.71: download - view: text, markup, annotated - select for diffs
Sat Feb 9 09:20:47 2019 UTC (6 years ago) by kre
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, is-mlppp-base, is-mlppp
Branch point for: netbsd-9
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +17 -17 lines

KNF - white space changes, indent using tabs not spaces.   NFC.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Sat Feb 9 03:35:55 2019 UTC (6 years ago) by kre
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +5 -3 lines

INTON / INTOFF audit and cleanup.

No visible differences expected - there is a remote chance that
some internal lossage may no longer occur in interactive shells
that receive SIGINT (untrapped) at inopportune times, but you would
have had to have been very unlucky to have ever suffered from that.

Revision 1.62.2.3: download - view: text, markup, annotated - select for diffs
Fri Jan 18 08:48:24 2019 UTC (6 years ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.62.2.2: preferred, colored; branchpoint 1.62: preferred, colored; next MAIN 1.63: preferred, colored
Changes since revision 1.62.2.2: +13 -6 lines
Synch with HEAD

Revision 1.69: download - view: text, markup, annotated - select for diffs
Wed Jan 16 07:14:17 2019 UTC (6 years ago) by kre
Branches: MAIN
CVS tags: pgoyette-compat-20190127, pgoyette-compat-20190118
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +5 -5 lines

Redo 1.65 in a simpler way.   This is the bit rot avoidance code
that is #if 0'd and (still) has never been compiled (most likely
never will be.)

While here, in the same uncompiled code, deal with line number
counting.   Whether this is correct depends upon how this code
is used, and as it never is (and never has been since line numbers
first started being counted), this is somewhat speculative, but
it seems likely to be the correct way to handle things.

NFC (this code is still all #if 0).

Revision 1.68: download - view: text, markup, annotated - select for diffs
Tue Jan 15 14:23:56 2019 UTC (6 years, 1 month ago) by kre
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +3 -4 lines

Don't use quoteflag when deciding if the word after an alias
should be looked up as a potential following alias - if the first
expands to a string that ends with a space (any space, quoted or
not) then the next word is to be treated as an alias candidate.
(POSIX was to specify only unquoted spaces, but is now going to
leave that unspecified, and the "any space" version turns out to
be more useful.

And besides, the quoteflag test didn't work properly, and would
have been very messy to fix ... if in a word (as if we have a
quoted space) it means that the word has been quoted, which meant
that quoted spaces were correctly detected, but it outside a word,
it just means that the previous word was quoted, so it would sometimes
reject alias lookup on the next word in cases where it is unquestioned
it should be done.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Wed Jan 9 11:09:16 2019 UTC (6 years, 1 month ago) by kre
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +3 -3 lines

Correct an (old) typo in a comment.   NFC - it is just a comment.

Revision 1.66: download - view: text, markup, annotated - select for diffs
Wed Jan 9 11:08:09 2019 UTC (6 years, 1 month ago) by kre
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +8 -4 lines

Fix the code taken from FreeBSD 2 revisions back, which fixed
aliases, to actually do what it was supposed to do, and not just
come close by accident.   (How broken this was, while still seeming
to work perfectly most of the time was truly amazing!)

This corrects the behaviour of an alias defined with a blank char
as the last of its value, to correctly do an alias lookup on the
word that follows the alias.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Wed Jan 9 11:04:54 2019 UTC (6 years, 1 month ago) by kre
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +6 -2 lines

Update some dead (#if 0'd) code that is never called to
cope with the changes made in the previous revision, in an
attempt to avoid bit rot.

Untested (uncompiled) - though it should work.

NFC: this change doesn't get compiled, let alone used.

Revision 1.62.2.2: download - view: text, markup, annotated - select for diffs
Wed Dec 26 14:01:03 2018 UTC (6 years, 1 month ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.62.2.1: preferred, colored; branchpoint 1.62: preferred, colored
Changes since revision 1.62.2.1: +16 -5 lines
Sync with HEAD, resolve a few conflicts

Revision 1.64: download - view: text, markup, annotated - select for diffs
Mon Dec 3 06:40:26 2018 UTC (6 years, 2 months ago) by kre
Branches: MAIN
CVS tags: pgoyette-compat-1226
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +16 -5 lines
Revamp aliases - as dumb an idea as they are, if we're going
to have them, they should work as documented, not cause core
dumps, reference after free, incorrect replacements, failing
to implement alias after alias, ...

The big comment that ended:
	  This is a good idea ------- ***NOT***
and the hack it was describing are gone.

Note that most of this was from original CVS version 1.1
code (ie: came from the original import, even before 4.4-Lite
was merged.   That is, May 1994.  And no-one in 24.5 years
noticed (or at least complained about)  all the bugs (or at
least, most of them)).

With these changes, aliases ought to work (if you can call it
that) as they are expected to by POSIX.   Now if only we could
get POSIX to delete them (or make them optional)...

Changes partly inspired by similar changes made by FreeBSD,
(as was the previous change to alias.c, forgot ack in commit
log for that one, apologies) but done a little differently,
and perhaps with a slightly better outcome.

Revision 1.62.2.1: download - view: text, markup, annotated - select for diffs
Thu Sep 6 06:51:32 2018 UTC (6 years, 5 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +41 -2 lines
Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.63: download - view: text, markup, annotated - select for diffs
Sun Aug 19 23:50:27 2018 UTC (6 years, 5 months ago) by kre
Branches: MAIN
CVS tags: pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +41 -2 lines
PR bin/48875 (is related, and ameliorated, but not exactly "fixed")

Import a whole set of tree evaluation enhancements from FreeBSD.

With these, before forking, the shell predicts (often) when all it will
have to do after forking (in the parent) is wait for the child and then
exit with the status from the child, and in such a case simply does not
fork, but rather allows the child to take over the parent's role.

This turns out to handle the particular test case from PR bin/48875 in
such a way that it works as hoped, rather than as it did (the delay there
was caused by an extra copy of the shell hanging around waiting for the
background child to complete ... and keeping the command substitution
stdout open, so the "real" parent had to wait in case more output appeared).

As part of doing this, redirection processing for compound commands gets
moved out of evalsubshell() and into a new evalredir(), which allows us
to properly handle errors occurring while performing those redirects,
and not mishandle (as in simply forget) fd's which had been moved out
of the way temporarily.

evaltree() has its degree of recursion reduced by making it loop to
handle the subsequent operation: that is instead of (for any binop
like ';' '&&' (etc)) where it used to
	evaltree(node->left);
	evaltree(node->right);
	return;
it now does (kind of)
	next = node;
	while ((node = next) != NULL) {
		next = NULL;

		if (node is a binary op) {
			evaltree(node->left);
			if appropriate /* if && test for success, etc */
				next = node->right;
			continue;
		}
		/* similar for loops, etc */
	}
which can be a good saving, as while the left side (now) tends to be
(usually) a simple (or simpleish) command, the right side can be many
commands (in a command sequence like a; b; c; d; ...  the node at the
top of the tree will now have "a" as its left node, and the tree for
b; c; d; ... as its right node - until now everything was evaluated
recursively so it made no difference, and the tree was constructed
the other way).

if/while/... statements are done similarly, recurse to evaluate the
condition, then if the (or one of the) body parts is to be evaluated,
set next to that, and loop (previously it recursed).

There is more to do in this area (particularly in the way that case
statements are processed - we can avoid recursion there as well) but
that can wait for another day.

While doing all of this we keep much better track of when the shell is
just going to exit once the current tree is evaluated (with a new
predicate at_eof() to tell us that we have, for sure, reached the end
of the input stream, that is, this shell will, for certain, not be reading
more command input) and use that info to avoid unneeded forks.   For that
we also need another new predicate (have_traps()) to determine of there
are any caught traps which might occur - if there are, we need to remain
to (potentially) handle them, so these optimisations will not occur (to
make the issue in PR 48875 appear again, run the same code, but with a
trap set to execute some code when a signal (or EXIT) occurs - note that
the trap must be set in the appropriate level of sub-shell to have this
effect, any caught traps are cleared in a subshell whenever one is created).

There is still work to be done to handle traps properly, whatever
weirdness they do (some of which is related to some of this.)

These changes do not need man page updates, but 48875 does - an update
to sh.1 will be forthcoming once it is decided what it should say...

Once again, all the heavy lifting for this set of changes comes directly
(with thanks) from the FreeBSD shell.

XXX pullup-8 (but not very soon)

Revision 1.62: download - view: text, markup, annotated - select for diffs
Sat Aug 19 21:13:11 2017 UTC (7 years, 5 months ago) by kre
Branches: MAIN
CVS tags: phil-wifi-base, pgoyette-compat-base, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: phil-wifi, pgoyette-compat
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +3 -3 lines

NFC - DEBUG mode change only - add some sanity to a debug printf format string

Revision 1.56.2.2: download - view: text, markup, annotated - select for diffs
Wed Aug 9 05:35:18 2017 UTC (7 years, 6 months ago) by snj
Branches: netbsd-8
CVS tags: netbsd-8-3-RELEASE, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek
Diff to: previous 1.56.2.1: preferred, colored; branchpoint 1.56: preferred, colored; next MAIN 1.57: preferred, colored
Changes since revision 1.56.2.1: +5 -4 lines
Pull up following revision(s) (requested by kre in ticket #199):
	bin/sh/input.c: revision 1.61
	bin/sh/parser.c: revision 1.143
PR bin/52458
Avoid mangling history when editing is enabled, and the prompt contains a \n
Also, allow empty input lines into history when they are being appended to
a previous (partial) command (but not when they would just make an empty entry)
.
For all the gory details, see the PR.
Note nothing here actually makes prompts containing \n work correctly
when editing is enabled, that's a libedit issue, which will be addressed
some other time.

Revision 1.61: download - view: text, markup, annotated - select for diffs
Sat Aug 5 11:33:05 2017 UTC (7 years, 6 months ago) by kre
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +5 -4 lines

PR bin/52458

Avoid mangling history when editing is enabled, and the prompt contains a \n

Also, allow empty input lines into history when they are being appended to
a previous (partial) command (but not when they would just make an empty entry).

For all the gory details, see the PR.

Note nothing here actually makes prompts containing \n work correctly
when editing is enabled, that's a libedit issue, which will be addressed
some other time.

Revision 1.56.2.1: download - view: text, markup, annotated - select for diffs
Sun Jul 23 14:58:14 2017 UTC (7 years, 6 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +74 -15 lines
Pull up following revision(s) (requested by kre in ticket #103):
	bin/kill/kill.c: 1.28
	bin/sh/Makefile: 1.111-1.113
	bin/sh/arith_token.c: 1.5
	bin/sh/arith_tokens.h: 1.2
	bin/sh/arithmetic.c: 1.3
	bin/sh/arithmetic.h: 1.2
	bin/sh/bltin/bltin.h: 1.15
	bin/sh/cd.c: 1.49-1.50
	bin/sh/error.c: 1.40
	bin/sh/eval.c: 1.142-1.151
	bin/sh/exec.c: 1.49-1.51
	bin/sh/exec.h: 1.26
	bin/sh/expand.c: 1.113-1.119
	bin/sh/expand.h: 1.23
	bin/sh/histedit.c: 1.49-1.52
	bin/sh/input.c: 1.57-1.60
	bin/sh/input.h: 1.19-1.20
	bin/sh/jobs.c: 1.86-1.87
	bin/sh/main.c: 1.71-1.72
	bin/sh/memalloc.c: 1.30
	bin/sh/memalloc.h: 1.17
	bin/sh/mknodenames.sh: 1.4
	bin/sh/mkoptions.sh: 1.3-1.4
	bin/sh/myhistedit.h: 1.12-1.13
	bin/sh/nodetypes: 1.16-1.18
	bin/sh/option.list: 1.3-1.5
	bin/sh/parser.c: 1.133-1.141
	bin/sh/parser.h: 1.22-1.23
	bin/sh/redir.c: 1.58
	bin/sh/redir.h: 1.24
	bin/sh/sh.1: 1.149-1.159
	bin/sh/shell.h: 1.24
	bin/sh/show.c: 1.43-1.47
	bin/sh/show.h: 1.11
	bin/sh/syntax.c: 1.4
	bin/sh/syntax.h: 1.8
	bin/sh/trap.c: 1.41
	bin/sh/var.c: 1.56-1.65
	bin/sh/var.h: 1.29-1.35
An initial attempt at implementing LINENO to meet the specs.
Aside from one problem (not too hard to fix if it was ever needed) this version
does about as well as most other shell implementations when expanding
$((LINENO)) and better for ${LINENO} as it retains the "LINENO hack" for the
latter, and that is very accurate.
Unfortunately that means that ${LINENO} and $((LINENO)) do not always produce
the same value when used on the same line (a defect that other shells do not
share - aside from the FreeBSD sh as it is today, where only the LINENO hack
exists and so (like for us before this commit) $((LINENO)) is always either
0, or at least whatever value was last set, perhaps by
	LINENO=${LINENO}
which does actually work ... for that one line...)
This could be corrected by simply removing the LINENO hack (look for the string
LINENO in parser.c) in which case ${LINENO} and $((LINENO)) would give the
same (not perfectly accurate) values, as do most other shells.
POSIX requires that LINENO be set before each command, and this implementation
does that fairly literally - except that we only bother before the commands
which actually expand words (for, case and simple commands).   Unfortunately
this forgot that expansions also occur in redirects, and the other compound
commands can also have redirects, so if a redirect on one of the other compound
commands wants to use the value of $((LINENO)) as a part of a generated file
name, then it will get an incorrect value.  This is the "one problem" above.
(Because the LINENO hack is still enabled, using ${LINENO} works.)
This could be fixed, but as this version of the LINENO implementation is just
for reference purposes (it will be superseded within minutes by a better one)
I won't bother.  However should anyone else decide that this is a better choice
(it is probably a smaller implementation, in terms of code & data space then
the replacement, but also I would expect, slower, and definitely less accurate)
this defect is something to bear in mind, and fix.
This version retains the *BSD historical practice that line numbers in functions
(all functions) count from 1 from the start of the function, and elsewhere,
start from 1 from where the shell started reading the input file/stream in
question.  In an "eval" expression the line number starts at the line of the
"eval" (and then increases if the input is a multi-line string).
Note: this version is not documented (beyond as much as LINENO was before)
hence this slightly longer than usual commit message.
A better LINENO implementation.   This version deletes (well, #if 0's out)
the LINENO hack, and uses the LINENO var for both ${LINENO} and $((LINENO)).
(Code to invert the LINENO hack when required, like when de-compiling the
execution tree to provide the "jobs" command strings, is still included,
that can be deleted when the LINENO hack is completely removed - look for
refs to VSLINENO throughout the code.  The var funclinno in parser.c can
also be removed, it is used only for the LINENO hack.)
This version produces accurate results: $((LINENO)) was made as accurate
as the LINENO hack made ${LINENO} which is very good.  That's why the
LINENO hack is not yet completely removed, so it can be easily re-enabled.
If you can tell the difference when it is in use, or not in use, then
something has broken (or I managed to miss a case somewhere.)
The way that LINENO works is documented in its own (new) section in the
man page, so nothing more about that, or the new options, etc, here.
This version introduces the possibility of having a "reference" function
associated with a variable, which gets called whenever the value of the
variable is required (that's what implements LINENO).  There is just
one function pointer however, so any particular variable gets at most
one of the set function (as used for PATH, etc) or the reference function.
The VFUNCREF bit in the var flags indicates which func the variable in
question uses (if any - the func ptr, as before, can be NULL).
I would not call the results of this perfect yet, but it is close.
Unbreak (at least) i386 build .... I have no idea why this built for me on
amd64 (problem was missing prototype for snprintf witout <stdio.h>)
While here, add some (DEBUG mode only) tracing that proved useful in
solving another problem.
Set the line number before expanding args, not after.   As the line_number
would have usually been set earlier, this change is mostly an effective
no-op, but it is better this way (just in case) - not observed to have
caused any problems.
Undo some over agressive fixes for a (pre-commit) bug that did not
need these changes to be fixed - and these cause problems in another
absurd use case.   Either of these issues is unlikely to be seen by
anyone who isn't an idiot masochist...
PR bin/52280
removescapes_nl in expari() even when not quoted,
CRTNONL's appear regardless of quoting (unlike CTLESC).
New sentence, new line. Whitespace.
Improve the (new) LINENO section, markup changes (with thanks to wiz@ for
assistace) and some better wording in a few placed.
I am an idiot...  revert the previous unintended commit.
Remove some left over baggage from the LINENO v1 implementation that
didn't get removed with v2, and should have.   This would have had
(I think, without having tested it) one very minor effect on the way
LINENO worked in the v2 implementation, but my guess is it would have
taken a long time before anyone noticed...
Correct spelling in comments of DEBUG only code...
(Perhaps) temporary fix to pkgtools (cwrappers) build (configure).
Expanding  `` containing \ \n sequences looks to have been giving
problems.   I don't think this is the correct fix, but it will do
no worse harm than (perhaps) incorrectly calculating LINENO in this
kind of (rare) circumstance.   I'll look and see if there should be
a better fix later.
s/volatile/const/ -- wonderful how opposites attract like this.
NFC (normal use) - DEBUG only change, when showing empty arg list don't
omit terminating \n.
Free stack memory in a couple of obscure cases where it wasn't
being done (one in probably dead code that is never compiled, the other
in a very rare error case.)   Since it is stack memory it wasn't lost
in any case, just held longer than needed.
Many internal memory management type fixes.
PR bin/52302   (core dump with interactive shell, here doc and error
on same line) is fixed.   (An old bug.)
echo "$( echo x; for a in $( seq 1000 ); do printf '%s\n'; done; echo y )"
consistently prints 1002 lines (x, 1000 empty ones, then y) as it should
(And you don't want to know what it did before, or why.) (Another old one.)
(Recently added) Problems with ~ expansion fixed (mem management related).
Proper fix for the cwrappers configure problem (which includes the quick
fix that was done earlier, but extends upon that to be correct). (This was
another newly added problem.)
And the really devious (and rare) old bug - if STACKSTRNUL() needs to
allocate a new buffer in which to store the \0, calculate the size of
the string space remaining correctly, unlike when SPUTC() grows the
buffer, there is no actual data being stored in the STACKSTRNUL()
case - the string space remaining was calculated as one byte too few.
That would be harmless, unless the next buffer also filled, in which
case it was assumed that it was really full, not one byte less, meaning
one junk char (a nul, or anything) was being copied into the next (even
bigger buffer) corrupting the data.
Consistent use of stalloc() to allocate a new block of (stack) memory,
and grabstackstr() to claim a block of (stack) memory that had already
been occupied but not claimed as in use.  Since grabstackstr is implemented
as just a call to stalloc() this is a no-op change in practice, but makes
it much easier to comprehend what is really happening.  Previous code
sometimes used stalloc() when the use case was really for grabstackstr().
Change grabstackstr() to actually use the arg passed to it, instead of
(not much better than) guessing how much space to claim,
More care when using unstalloc()/ungrabstackstr() to return space, and in
particular when the stack must be returned to its previous state, rather than
just returning no-longer needed space, neither of those work.  They also don't
work properly if there have been (really, even might have been) any stack mem
allocations since the last stalloc()/grabstackstr().   (If we know there
cannot have been then the alloc/release sequence is kind of pointless.)
To work correctly in general we must use setstackmark()/popstackmark() so
do that when needed.  Have those also save/restore the top of stack string
space remaining.
	[Aside: for those reading this, the "stack" mentioned is not
	in any way related to the thing used for maintaining the C
	function call state, ie: the "stack segment" of the program,
	but the shell's internal memory management strategy.]
More comments to better explain what is happening in some cases.
Also cleaned up some hopelessly broken DEBUG mode data that were
recently added (no effect on anyone but the poor semi-human attempting
to make sense of it...).
User visible changes:
Proper counting of line numbers when a here document is delimited
by a multi-line end-delimiter, as in
	cat << 'REALLY
	END'
	here doc line 1
	here doc line 2
	REALLY
	END
(which is an obscure case, but nothing says should not work.)  The \n
in the end-delimiter of the here doc (the last one) was not incrementing
the line number, which from that point on in the script would be 1 too
low (or more, for end-delimiters with more than one \n in them.)
With tilde expansion:
	unset HOME; echo ~
changed to return getpwuid(getuid())->pw_home instead of failing (returning ~)
POSIX says this is unspecified, which makes it difficult for a script to
compensate for being run without HOME set (as in env -i sh script), so
while not able to be used portably, this seems like a useful extension
(and is implemented the same way by some other shells).
Further, with
	HOME=; printf %s ~
we now write nothing (which is required by POSIX - which requires ~ to
expand to the value of $HOME if it is set) previously if $HOME (in this
case) or a user's directory in the passwd file (for ~user) were a null
STRING, We failed the ~ expansion and left behind '~' or '~user'.
Changed the long name for the -L option from lineno_fn_relative
to local_lineno as the latter seemed to be marginally more popular,
and perhaps more importantly, is the same length as the peviously
existing quietprofile option, which means the man page indentation
for the list of options can return to (about) what it was before...
(That is, less indented, which means more data/line, which means less
lines of man page - a good thing!)
Cosmetic changes to variable flags - make their values more suited
to my delicate sensibilities...  (NFC).
Arrange not to barf (ever) if some turkey makes _ readonly.  Do this
by adding a VNOERROR flag that causes errors in var setting to be
ignored (intended use is only for internal shell var setting, like of "_").
(nb: invalid var name errors ignore this flag, but those should never
occur on a var set by the shell itself.)
From FreeBSD: don't simply discard memory if a variable is not set for
any reason (including because it is readonly) if the var's value had
been malloc'd.  Free it instead...
NFC - DEBUG changes, update this to new TRACE method.
KNF - white space and comment formatting.
NFC - DEBUG mode only change - convert this to the new TRACE() format.
NFC - DEBUG mode only change - complete a change made earlier (marking
the line number when included in the trace line tag to show whether it
comes from the parser, or the elsewhere as they tend to be quite different).
Initially only one case was changed, while I pondered whether I liked it
or not.  Now it is all done...   Also when there is a line tag at all,
always include the root/sub-shell indicator character, not only when the
pid is included.
NFC: DEBUG related comment change - catch up with reality.
NFC: DEBUG mode only change.  Fix botched cleanup of one TRACE().
"b" more forgiving when sorting options to allow reasonable (and intended)
flexibility in option.list format.   Changes nothing for current option.list.
Now that excessive use of STACKSTRNUL has served its purpose (well, accidental
purpose) in exposing the bug in its implementation, go back to not using
it when not needed for DEBUG TRACE purposes.   This change should have no
practical effect on either a DEBUG shell (where the STACKSTRNUL() calls
remain) or a non DEBUG shell where they are not needed.
Correct the initial line number used for processing -c arg strings.
(It was inheriting the value from end of profile file processing) - I didn't
notice before as I usually test with empty or no profile files to avoid
complications.   Trivial change which should have very limited impact.
Fix from FreeBSD (applied there in July 2008...)
Don't dump core with input like sh -c 'x=; echo >&$x' - that is where
the word after a >& or <& redirect expands to nothing at all.
Another fix from FreeBSD (this one from April 2009).
When processing a string (as in eval, trap, or sh -c) don't allow
trailing \n's to destroy the exit status of the last command executed.
That is:
	sh -c 'false
	'
	echo $?
should produce 1, not 0.
It is amazing what nonsense appears to work sometimes... (all my nonsense too!)
Two bugs here, one benign because of the way the script is used.
The other hidden by NetBSD's sort being stable, and the data not really
requiring sorting at all...
So as it happens these fixes change nothing, but they are needed anyway.
(The contents of the generated file are only used in DEBUG shells, so
this is really even less important than it seems.)
Another ancient (highly improbable) bug bites the dust.   This one
caused by incorrect macro usage (ie: using the wrong one) which has
been in the sources since version 1.1 (ie: forever).
Like the previous (STACKSTRNUL) bug, the probability of this one
actually occurring has been infinitesimal but the LINENO code increases
that to infinitesimal and a smidgen... (or a few, depending upon usage).
Still, apparently that was enough, Kamil Rytarowski discovered that the
zsh configure script (damn competition!) managed to trigger this problem.
source .editrc after we initialize so that commands persist!
Make arg parsing in kill POSIX compatible with POSIX (XBD 2.12) by
parsing the way getopt(3) would, if only it could handle the (required)
-signumber and -signame options.  This adds two "features" to kill,
-ssigname and -lstatus now work (ie: one word with all of the '-', the
option letter, and its value) and "--" also now works (kill -- -pid1 pid2
will not attempt to send the pid1 signal to pid2, but rather SIGTERM
to the pid1 process group and pid2).  It is still the case that (apart
from --) at most 1 option is permitted (-l, -s, -signame, or -signumber.)
Note that we now have an ambiguity, -sname might mean "-s name" or
send the signal "sname" - if one of those turns out to be valid, that
will be accepted, otherwise the error message will indicate that "sname"
is not a valid signal name, not that "name" is not.   Keeping the "-s"
and signal name as separate words avoids this issue.
Also caution: should someone be weird enough to define a new signal
name (as in the part after SIG) which is almost the same name as an
existing name that starts with 'S' by adding an extra 'S' prepended
(eg: adding a SIGSSYS) then the ambiguity problem becomes much worse.
In that case "kill -ssys" will be resolved in favour of the "-s"
flag being used (the more modern syntax) and would send a SIGSYS, rather
that a SIGSSYS.    So don't do that.
While here, switch to using signalname(3) (bye bye NSIG, et. al.), add
some constipation, and show a little pride in formatting the signal names
for "kill -l" (and in the usage when appropriate -- same routine.)   Respect
COLUMNS (POSIX XBD 8.3) as primary specification of the width (terminal width,
not number of columns to print) for kill -l, a very small value for COLUMNS
will cause kill -l output to list signals one per line, a very large
value will cause them all to be listed on one line.) (eg: "COLUMNS=1 kill -l")
TODO: the signal printing for "trap -l" and that for "kill -l"
should be switched to use a common routine (for the sh builtin versions.)
All changes of relevance here are to bin/kill - the (minor) changes to bin/sh
are only to properly expose the builtin version of getenv(3) so the builtin
version of kill can use it (ie: make its prototype available.)
Properly support EDITRC - use it as (naming) the file when setting
up libedit, and re-do the config whenever EDITRC is set.
Get rid of workarounds for ancient groff html backend.
Simplify macro usage.
Make one example more like a real world possibility (it still isn't, but
is closer) - though the actual content is irrelevant to the point being made.
Add literal prompt support this allows one to do:
CA="$(printf '\1')"
PS1="${CA}$(tput bold)${CA}\$${CA}$(tput sgr0)${CA} "
Now libedit supports embedded mode switch sequence, improve sh
support for them (adds PSlit variable to set the magic character).
NFC: DEBUG only change - provide an externally visible (to the DEBUG sh
internals) interface to one of the internal (private to trace code) functions
Include redirections in trace output from "set -x"
Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic
expansions, and if enabled by the promptcmds option, command substitutions.)
Implement a bunch of new shell environment variables. many mostly useful
in prompts when expanded at prompt time, but all available for general use.
Many of the new ones are not available in SMALL shells (they work as normal
if assigned, but the shell does not set or use them - and there is no magic
in a SMALL shell (usually for install media.))
Omnibus manual update for prompt expansions and new variables.  Throw in
some random cleanups as a bonus.
Correct a markup typo (why did I not see this before the prev commit??)
Sort options (our default is 0..9AaBbZz).
Fix markup problems and a typo.
Make $- list flags in the same order they appear in sh(1)
Do a better job of detecting the error in pkgsrc/devel/libbson-1.6.3's
configure script, ie: $(( which is intended to be a sub-shell in a
command substitution, but is an arith subst instead, it needs to be
written $( ( to do as intended.   Instead of just blindly carrying on to
find the missing )) somewhere, anywhere, give up as soon as we have seen
an unbalanced ')' that isn't immediately followed by another ')' which
in a valid arith subst it always would be.
While here, there has been a comment in the code for quite a while noting a
difference in the standard between the text descr & grammar when it comes to
the syntax of case statements.   Add more comments to explain why parsing it
as we do is in fact definitely the correct way (ie: the grammar wins arguments
like this...).
DEBUG and white space changes only.   Convert TRACE() calls for DEBUg mode
to the new style.   NFC (when not debugging sh).
Mostly DEBUG and white space changes.   Convert DEEBUG TRACE() calls to
the new format.   Also #if 0 a function definition that is used nowhere.
While here, change the function of pushfile() slightly - it now sets
the buf pointer in the top (new) input descriptor to NULL, instead of
simply leaving it - code that needs a buffer always (before and after)
must malloc() one and assign it after the call.  But code which does not
(which will be reading from a string or similar) now does not have to
explicitly set it to NULL (cleaner interface.)   NFC intended (or observed.)
DEBUG changes: convert DEBUG TRACE() calls to new format.
ALso, cause exec failures to always cause the shell to exit with
status 126 or 127, whatever the cause.  127 is intended for lookup
failures (and is used that way), 126 is used for anything else that
goes wrong (as in several other shells.)  We no longer use 2 (more easily
confused with an exit status of the command exec'd) for shell exec failures.
DEBUG only changes.  Convert the TRACE() calls in the remaining files
that still used it to the new format.   NFC.
Fix a reference after free (and consequent nonsense diagnostic for
attempts to set readonly variables) I added in 1.60 by incompletely
copying the FreeBSD fix for the lost memory issue.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Wed Jul 5 19:54:21 2017 UTC (7 years, 7 months ago) by kre
Branches: MAIN
CVS tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +40 -19 lines

Mostly DEBUG and white space changes.   Convert DEEBUG TRACE() calls to
the new format.   Also #if 0 a function definition that is used nowhere.
While here, change the function of pushfile() slightly - it now sets
the buf pointer in the top (new) input descriptor to NULL, instead of
simply leaving it - code that needs a buffer always (before and after)
must malloc() one and assign it after the call.  But code which does not
(which will be reading from a string or similar) now does not have to
explicitly set it to NULL (cleaner interface.)   NFC intended (or observed.)

Revision 1.59: download - view: text, markup, annotated - select for diffs
Fri Jun 30 23:02:56 2017 UTC (7 years, 7 months ago) by kre
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +38 -3 lines

Implement PS1, PS2 and PS4 expansions (variable expansions, arithmetic
expansions, and if enabled by the promptcmds option, command substitutions.)

Revision 1.58: download - view: text, markup, annotated - select for diffs
Wed Jun 7 05:08:32 2017 UTC (7 years, 8 months ago) by kre
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +6 -3 lines
A better LINENO implementation.   This version deletes (well, #if 0's out)
the LINENO hack, and uses the LINENO var for both ${LINENO} and $((LINENO)).
(Code to invert the LINENO hack when required, like when de-compiling the
execution tree to provide the "jobs" command strings, is still included,
that can be deleted when the LINENO hack is completely removed - look for
refs to VSLINENO throughout the code.  The var funclinno in parser.c can
also be removed, it is used only for the LINENO hack.)

This version produces accurate results: $((LINENO)) was made as accurate
as the LINENO hack made ${LINENO} which is very good.  That's why the
LINENO hack is not yet completely removed, so it can be easily re-enabled.
If you can tell the difference when it is in use, or not in use, then
something has broken (or I managed to miss a case somewhere.)

The way that LINENO works is documented in its own (new) section in the
man page, so nothing more about that, or the new options, etc, here.

This version introduces the possibility of having a "reference" function
associated with a variable, which gets called whenever the value of the
variable is required (that's what implements LINENO).  There is just
one function pointer however, so any particular variable gets at most
one of the set function (as used for PATH, etc) or the reference function.
The VFUNCREF bit in the var flags indicates which func the variable in
question uses (if any - the func ptr, as before, can be NULL).

I would not call the results of this perfect yet, but it is close.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Wed Jun 7 04:44:17 2017 UTC (7 years, 8 months ago) by kre
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +4 -4 lines
An initial attempt at implementing LINENO to meet the specs.

Aside from one problem (not too hard to fix if it was ever needed) this version
does about as well as most other shell implementations when expanding
$((LINENO)) and better for ${LINENO} as it retains the "LINENO hack" for the
latter, and that is very accurate.

Unfortunately that means that ${LINENO} and $((LINENO)) do not always produce
the same value when used on the same line (a defect that other shells do not
share - aside from the FreeBSD sh as it is today, where only the LINENO hack
exists and so (like for us before this commit) $((LINENO)) is always either
0, or at least whatever value was last set, perhaps by
	LINENO=${LINENO}
which does actually work ... for that one line...)

This could be corrected by simply removing the LINENO hack (look for the string
LINENO in parser.c) in which case ${LINENO} and $((LINENO)) would give the
same (not perfectly accurate) values, as do most other shells.

POSIX requires that LINENO be set before each command, and this implementation
does that fairly literally - except that we only bother before the commands
which actually expand words (for, case and simple commands).   Unfortunately
this forgot that expansions also occur in redirects, and the other compound
commands can also have redirects, so if a redirect on one of the other compound
commands wants to use the value of $((LINENO)) as a part of a generated file
name, then it will get an incorrect value.  This is the "one problem" above.
(Because the LINENO hack is still enabled, using ${LINENO} works.)

This could be fixed, but as this version of the LINENO implementation is just
for reference purposes (it will be superseded within minutes by a better one)
I won't bother.  However should anyone else decide that this is a better choice
(it is probably a smaller implementation, in terms of code & data space then
the replacement, but also I would expect, slower, and definitely less accurate)
this defect is something to bear in mind, and fix.

This version retains the *BSD historical practice that line numbers in functions
(all functions) count from 1 from the start of the function, and elsewhere,
start from 1 from where the shell started reading the input file/stream in
question.  In an "eval" expression the line number starts at the line of the
"eval" (and then increases if the input is a multi-line string).

Note: this version is not documented (beyond as much as LINENO was before)
hence this slightly longer than usual commit message.

Revision 1.51.6.2: download - view: text, markup, annotated - select for diffs
Thu May 11 02:58:28 2017 UTC (7 years, 9 months ago) by pgoyette
Branches: prg-localcount2
Diff to: previous 1.51.6.1: preferred, colored; branchpoint 1.51: preferred, colored; next MAIN 1.52: preferred, colored
Changes since revision 1.51.6.1: +12 -10 lines
Sync with HEAD

Revision 1.56: download - view: text, markup, annotated - select for diffs
Wed May 3 06:20:12 2017 UTC (7 years, 9 months ago) by kre
Branches: MAIN
CVS tags: prg-localcount2-base3, prg-localcount2-base2, netbsd-8-base
Branch point for: netbsd-8
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +3 -3 lines

Another fix from FreeBSD.   I'm not sure how to trigger the problem
fixed (there might be no way) - but it "feels right"!

When popping an (exhausted) input string off the input stack, allow
for the possibility that the previous string might also just happened
to have run out of steam as well, so keep poppin' along until we
run out of pop, or find something to consume.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Wed May 3 04:51:04 2017 UTC (7 years, 9 months ago) by kre
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +9 -7 lines

Deal with \newline line continuations more correctly.
They can occur anywhere (*anywhere*) not only where it
happens to be convenient to the parser...

This fix from FreeBSD (thanks again folks).

To make this work, pushstring()'s signature needed to change to allow a
const char * as its string arg, which meant sprinkling some const other
places for a brighter appearance (and handling fallout).

All this because I wanted to see what number would come from

echo $\
{\
L\
I\
N\
E\
N\
O\
}

and was surprised at the result!    That works now...

The bug would also affect stuff like

true &\
& false

and all kinds of other uses where the \newline occurred in the
"wrong" place.

An ATF test for sh syntax is coming... (sometime.)

Revision 1.54: download - view: text, markup, annotated - select for diffs
Wed May 3 04:13:53 2017 UTC (7 years, 9 months ago) by kre
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +3 -3 lines

Fix idiot typos in previous (this is not the advertised :next commit")
Same typo - two different places.   Ugh!

Revision 1.53: download - view: text, markup, annotated - select for diffs
Wed May 3 04:11:30 2017 UTC (7 years, 9 months ago) by kre
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +5 -5 lines

NFC: Change prototype of pushstring() to give a real type for the 3rd
arg (struct alias *) rather than using void * and then casting it
when used.   For callers, the arg either is a struct alias *, or is NULL,
so nothing to adjust there.

NB: This change untested by itself, it was going to be a part of the next
change (coming in a few minutes) but is logically unrelated, so ...

Revision 1.51.6.1: download - view: text, markup, annotated - select for diffs
Tue May 2 03:19:14 2017 UTC (7 years, 9 months ago) by pgoyette
Branches: prg-localcount2
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +24 -5 lines
Sync with HEAD - tag prg-localcount2-base1

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sat Apr 29 15:14:28 2017 UTC (7 years, 9 months ago) by kre
Branches: MAIN
CVS tags: prg-localcount2-base1
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +24 -5 lines

Keep track of which file descriptors the shell is using for its
own purposes, and move them elsewhere whenever a user redirection
happens to pick the same number.   With this we can move the shell
file descriptors back to lower values (be slightly kinder to the kernel)
since we can no longer clash.   (Also get rid of a little old unneeded code.)

This also completes the fdflags command, which no longer permits access
to (by way or either obtaining, or changing) the shell's internal fds.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Wed Jun 1 05:11:52 2016 UTC (8 years, 8 months ago) by kre
Branches: MAIN
CVS tags: prg-localcount2-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: prg-localcount2
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +6 -3 lines

PR bin/51207   Only check for ELF bnaries in regular files.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Sat May 7 20:06:30 2016 UTC (8 years, 9 months ago) by kre
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +8 -4 lines

PR bin/51119 - don't leak FDs in unusual error cases.   OK christos@

Revision 1.49: download - view: text, markup, annotated - select for diffs
Mon May 2 01:46:31 2016 UTC (8 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +8 -9 lines
Fix handing of user file descriptors outside the 0..9 range.
Also, move (most of) the shell's internal use fd's to much
higher values (depending upon what ulimit -n allows) so they
are less likely to clash with user supplied fd numbers.  A future
patch will (hopefully) avoid this problem completely by dynamically
moving the shell's internal fds around as needed. (From kre@)

Revision 1.48: download - view: text, markup, annotated - select for diffs
Sun Mar 27 14:34:46 2016 UTC (8 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +3 -2 lines
General KNF and source code cleanups, avoid scattering the
magic string " \t\n" all over the place, slightly improved
syntax error messages, restructured some of the code for
clarity, don't allow IFS to be imported through the environment,
and remove the (never) conditionally compiled ATTY option.
Apart from one or two syntax error messages, and ignoring IFS
if present in the environment, this is intended to have no
user visible changes. (from kre@)

Revision 1.47: download - view: text, markup, annotated - select for diffs
Mon Jan 4 03:00:24 2016 UTC (9 years, 1 month ago) by christos
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +3 -3 lines
Don't leak redirected rescriptors to exec'ed processes. This is what ksh
does, but bash does not. For example:

    $ cat test1
    #!/bin/sh
    exec 6> out
    echo "test" >&6
    sh ./test2
    exec 6>&-
    $ cat test2
    echo "test2" >&6
    $ ./test1
    ./test2: 6: Bad file descriptor

This fixes by side effect the problem of the rc system leaking file descriptors
7 and 8 to all starting daemons:

    $ fstat -p 1359
    USER     CMD          PID   FD MOUNT       INUM MODE         SZ|DV R/W
    root     powerd      1359   wd /              2 drwxr-xr-x     512 r
    root     powerd      1359    0 /          63029 crw-rw-rw-    null rw
    root     powerd      1359    1 /          63029 crw-rw-rw-    null rw
    root     powerd      1359    2 /          63029 crw-rw-rw-    null rw
    root     powerd      1359    3* kqueue pending 0
    root     powerd      1359    4 /          64463 crw-r-----   power r
    root     powerd      1359    7 flags 0x80034<ISTTY,MPSAFE,LOCKSWORK,CLEAN>
    root     powerd      1359    8 flags 0x80034<ISTTY,MPSAFE,LOCKSWORK,CLEAN>
    root     powerd      1359    9* pipe 0xfffffe815d7bfdc0 -> 0x0 w

Note fd=7,8 pointing to the revoked pty from the parent rc process.

Revision 1.45.2.1: download - view: text, markup, annotated - select for diffs
Tue Aug 19 23:45:11 2014 UTC (10 years, 5 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.45: preferred, colored; next MAIN 1.46: preferred, colored
Changes since revision 1.45: +8 -2 lines
Rebase to HEAD as of a few days ago.

Revision 1.44.4.2: download - view: text, markup, annotated - select for diffs
Thu May 22 11:26:23 2014 UTC (10 years, 8 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.44.4.1: preferred, colored; branchpoint 1.44: preferred, colored; next MAIN 1.45: preferred, colored
Changes since revision 1.44.4.1: +8 -2 lines
sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.46: download - view: text, markup, annotated - select for diffs
Wed Oct 30 08:38:40 2013 UTC (11 years, 3 months ago) by mrg
Branches: MAIN
CVS tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +8 -2 lines
#ifdef a variable decl/setting with it's use.

Revision 1.44.4.1: download - view: text, markup, annotated - select for diffs
Tue Apr 17 00:01:38 2012 UTC (12 years, 10 months ago) by yamt
Branches: yamt-pagecache
CVS tags: yamt-pagecache-tag8
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +3 -2 lines
sync with head

Revision 1.45: download - view: text, markup, annotated - select for diffs
Wed Mar 28 20:11:25 2012 UTC (12 years, 10 months ago) by christos
Branches: MAIN
CVS tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900, agc-symver-base, agc-symver
Branch point for: tls-maxphys
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +3 -2 lines
include <limits.h> for CHAR_MIN/CHAR_MAX

Revision 1.43.2.1: download - view: text, markup, annotated - select for diffs
Sat Mar 5 15:08:31 2011 UTC (13 years, 11 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.43: preferred, colored; next MAIN 1.44: preferred, colored
Changes since revision 1.43: +3 -3 lines
Sync with HEAD

Revision 1.44: download - view: text, markup, annotated - select for diffs
Thu Feb 17 15:13:49 2011 UTC (13 years, 11 months ago) by pooka
Branches: MAIN
CVS tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase
Branch point for: yamt-pagecache
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +3 -3 lines
Tell copyfd if the caller wants the exact tofd to just fd >= tofd.
Fixes "echo foo > /rump/bar" in a rump hijacked shell.

reviewed by christos

Revision 1.43: download - view: text, markup, annotated - select for diffs
Mon Aug 30 06:27:14 2010 UTC (14 years, 5 months ago) by christos
Branches: MAIN
CVS tags: matt-mips64-premerge-20101231, bouyer-quota2-base
Branch point for: bouyer-quota2
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +4 -4 lines
dprintf is claimed by posix.

Revision 1.41.4.1: download - view: text, markup, annotated - select for diffs
Wed May 13 19:15:51 2009 UTC (15 years, 9 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.41: preferred, colored; next MAIN 1.42: preferred, colored
Changes since revision 1.41: +3 -3 lines
Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

Revision 1.42: download - view: text, markup, annotated - select for diffs
Tue Mar 10 21:21:11 2009 UTC (15 years, 11 months ago) by roy
Branches: MAIN
CVS tags: matt-premerge-20091211, jym-xensuspend-nbase, jym-xensuspend-base
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +3 -3 lines
el_gets now sets el_len to -1 on error so we can distinguish
between a NULL string and an error.
This fixes sh from exiting with libedit now allowing EINTR to return.
We may need to expand this to an errno check in the future.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Thu Oct 16 14:36:40 2008 UTC (16 years, 4 months ago) by dholland
Branches: MAIN
CVS tags: netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-base2
Branch point for: jym-xensuspend
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +2 -4 lines
Use "extern" properly for referencing globals defined in other modules.
Now builds cleanly with -warn-common.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Thu Feb 15 12:02:59 2007 UTC (18 years ago) by rillig
Branches: MAIN
CVS tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, mjf-devfs2-base, mjf-devfs2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +18 -2 lines
Since interpreting ELF binaries as shell scripts is not very useful, and
since the current error message is less than helpful, improve it.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Thu Aug 7 09:05:32 2003 UTC (21 years, 6 months ago) by agc
Branches: MAIN
CVS tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, abandoned-netbsd-4-base, abandoned-netbsd-4
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +3 -7 lines
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Thu May 15 13:26:45 2003 UTC (21 years, 9 months ago) by dsl
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +9 -10 lines
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.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Sun Nov 24 22:35:40 2002 UTC (22 years, 2 months ago) by christos
Branches: MAIN
CVS tags: fvdl_fs64_base
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +40 -35 lines
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...)

Revision 1.36: download - view: text, markup, annotated - select for diffs
Fri Sep 27 18:56:52 2002 UTC (22 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +15 -3 lines
VFork()ing shell: From elric@netbsd.org:
Plus my changes:
	- walking process group fix in foregrounding a job.
	- reset of process group in parent shell if interrupted before the wait.
	- move INTON lower in the dowait so that the job structure is
	  consistent.
	- error check all setpgid(), tcsetpgrp() calls.
	- eliminate unneeded strpgid() call.
	- check that we don't belong in the process group before we try to
	  set it.

Revision 1.35.2.1: download - view: text, markup, annotated - select for diffs
Wed Mar 27 20:37:36 2002 UTC (22 years, 10 months ago) by elric
Branches: ELRICshvfork
Diff to: previous 1.35: preferred, colored; next MAIN 1.36: preferred, colored
Changes since revision 1.35: +15 -3 lines
Doing the vfork work on ash on a branch to try to shake out the
problems before I expose everyone to them.  This checkin represents
a merge of the prior work, which I backed out a while ago, to the
HEAD only and does not incorporate any additional bugfixes.  The
additional bugfixes and code-cleanup will occur in later checkins.

For reference the patches that were used are:
cvs diff -kk -r1.51 -r1.55 eval.c  | patch
cvs diff -kk -r1.27 -r1.28 exec.c  | patch
cvs diff -kk -r1.15 -r1.16 exec.h  | patch
cvs diff -kk -r1.32 -r1.33 input.c | patch
cvs diff -kk -r1.10 -r1.11 input.h | patch
cvs diff -kk -r1.32 -r1.35 jobs.c  | patch
cvs diff -kk -r1.9  -r1.11 jobs.h  | patch
cvs diff -kk -r1.36 -r1.37 main.c  | patch
cvs diff -kk -r1.20 -r1.21 redir.c | patch
cvs diff -kk -r1.10 -r1.11 redir.h | patch
cvs diff -kk -r1.10 -r1.12 shell.h | patch
cvs diff -kk -r1.22 -r1.23 trap.c  | patch
cvs diff -kk -r1.12 -r1.13 trap.h  | patch
cvs diff -kk -r1.23 -r1.24 var.c   | patch
cvs diff -kk -r1.16 -r1.17 var.h   | patch

All other changes were simply the resolution of the resulting
conflicts, which occured only in the merge of jobs.c.

Begins to address PR: bin/5475

Revision 1.35: download - view: text, markup, annotated - select for diffs
Sun Feb 4 19:52:06 2001 UTC (24 years ago) by christos
Branches: MAIN
CVS tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6, ELRICshvfork-base
Branch point for: ELRICshvfork
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +5 -6 lines
remove redundant declarations and nexted externs.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Mon May 22 10:18:47 2000 UTC (24 years, 8 months ago) by elric
Branches: MAIN
CVS tags: netbsd-1-5-base, netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA, netbsd-1-5-ALPHA2, netbsd-1-5, minoura-xpg4dl-base, minoura-xpg4dl
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +1 -13 lines
Back out previous vfork changes.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Sat May 13 20:50:14 2000 UTC (24 years, 9 months ago) by elric
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +15 -3 lines
Now we use vfork(2) instead of fork(2) when we can.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Fri Jul 9 03:05:50 1999 UTC (25 years, 7 months ago) by christos
Branches: MAIN
CVS tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, comdex-fall-1999-base, comdex-fall-1999
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +7 -6 lines
compile with WARNS = 2

Revision 1.31: download - view: text, markup, annotated - select for diffs
Wed May 20 01:36:14 1998 UTC (26 years, 9 months ago) by christos
Branches: MAIN
CVS tags: netbsd-1-4-base, netbsd-1-4-RELEASE, netbsd-1-4-PATCH003, netbsd-1-4-PATCH002, netbsd-1-4-PATCH001, netbsd-1-4
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +4 -18 lines
Simplify interface for general use.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Wed May 20 00:30:20 1998 UTC (26 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +18 -4 lines
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

Revision 1.28.2.1: download - view: text, markup, annotated - select for diffs
Fri May 8 06:01:03 1998 UTC (26 years, 9 months ago) by mycroft
Branches: netbsd-1-3
CVS tags: netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002
Diff to: previous 1.28: preferred, colored; next MAIN 1.29: preferred, colored
Changes since revision 1.28: +2 -3 lines
Sync with trunk, per request of christos.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sun Mar 29 04:41:44 1998 UTC (26 years, 10 months ago) by mrg
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +2 -3 lines
- change "extern" variables into int's
- remove extern'd variables not actually referenced
- don't use char as an array index

Revision 1.28: download - view: text, markup, annotated - select for diffs
Tue Oct 14 15:06:45 1997 UTC (27 years, 4 months ago) by christos
Branches: MAIN
CVS tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH001, netbsd-1-3-BETA
Branch point for: netbsd-1-3
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +5 -3 lines
PR/4257: Jaromir Dolecek: Update for libedit interface change.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Fri Jul 4 21:02:03 1997 UTC (27 years, 7 months ago) by christos
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +3 -2 lines
Fix compiler warnings.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Fri Apr 11 23:00:40 1997 UTC (27 years, 10 months ago) by christos
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +5 -5 lines
Rename pread to preadfd

Revision 1.25: download - view: text, markup, annotated - select for diffs
Fri Mar 14 01:42:22 1997 UTC (27 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +4 -4 lines
NO_HISTORY->SMALL

Revision 1.24: download - view: text, markup, annotated - select for diffs
Thu Mar 13 21:57:33 1997 UTC (27 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +6 -4 lines
Fix problems with -DNO_HISTORY

Revision 1.23: download - view: text, markup, annotated - select for diffs
Thu Mar 13 20:07:49 1997 UTC (27 years, 11 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +3 -2 lines
Set input files to close-on-exec mode.

Revision 1.19.4.1: download - view: text, markup, annotated - select for diffs
Sun Jan 26 04:57:21 1997 UTC (28 years ago) by rat
Branches: netbsd-1-2
CVS tags: netbsd-1-2-PATCH001
Diff to: previous 1.19: preferred, colored; next MAIN 1.20: preferred, colored
Changes since revision 1.19: +5 -6 lines
Update /bin/sh from trunk per request of Christos Zoulas.  Fixes
many bugs.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Sat Jan 11 02:04:34 1997 UTC (28 years, 1 month ago) by tls
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +3 -3 lines
kill 'register'

Revision 1.21: download - view: text, markup, annotated - select for diffs
Sat Nov 2 18:26:03 1996 UTC (28 years, 3 months ago) by christos
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +2 -3 lines
Fix problems that gcc -Wall found (from Todd Miller, OpenBSD)

Revision 1.20: download - view: text, markup, annotated - select for diffs
Wed Oct 16 15:45:08 1996 UTC (28 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +4 -4 lines
PR/2808: Remove trailing whitespace (from FreeBSD)

Revision 1.19: download - view: text, markup, annotated - select for diffs
Thu Oct 19 04:14:37 1995 UTC (29 years, 4 months ago) by christos
Branches: MAIN
CVS tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-BETA
Branch point for: netbsd-1-2
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +4 -2 lines
- fix PR1620, -DNO_HISTORY did not work.
- restore parsing state after parsing old style command substitution.
  The ';' in '`echo z;`' broke the following:
	for i in 1; do
		cat > /dev/tty << __EOF__
		`echo z;`
		__EOF__
	done

cVS: Enter Log.  Lines beginning with `CVS: ' are removed automatically

Revision 1.18: download - view: text, markup, annotated - select for diffs
Fri Oct 6 21:38:18 1995 UTC (29 years, 4 months ago) by christos
Branches: MAIN
CVS tags: netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +3 -3 lines
fixed previous booboo that broke command line editing input.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Tue Sep 26 13:25:19 1995 UTC (29 years, 4 months ago) by christos
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +107 -80 lines
- Fix -v flag, so that it works properly when the shell reads from scripts.
- Bad style to fix my own PR, but I'd like to commit the parallel make
  changes soon, and this is a necessary prerequisite.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Fri Jun 9 01:53:54 1995 UTC (29 years, 8 months ago) by christos
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +3 -3 lines
Changed so that 'PATH=newpath command' works, instead of looking at the
old path. Synced input.c with vangogh.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Wed Jun 7 16:28:03 1995 UTC (29 years, 8 months ago) by cgd
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +3 -2 lines
needs string.h

Revision 1.14: download - view: text, markup, annotated - select for diffs
Thu May 11 21:29:15 1995 UTC (29 years, 9 months ago) by christos
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +11 -32 lines
Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Tue Mar 21 09:09:13 1995 UTC (29 years, 11 months ago) by cgd
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +7 -2 lines
convert to new RCS id conventions.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Fri Dec 23 13:24:10 1994 UTC (30 years, 1 month ago) by cgd
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +2 -1 lines
pull prototypes into scope for string functions.

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun Dec 4 07:12:14 1994 UTC (30 years, 2 months ago) by cgd
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +15 -5 lines
from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch
some of the worst style errors.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sat Jun 11 16:11:59 1994 UTC (30 years, 8 months ago) by mycroft
Branches: MAIN
CVS tags: netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +2 -1 lines
Add RCS ids.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Wed Jun 8 19:26:51 1994 UTC (30 years, 8 months ago) by jtc
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +1 -1 lines
Fix from Christos for when NO_HISTORY is defined

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sat May 21 01:42:32 1994 UTC (30 years, 9 months ago) by cgd
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +4 -0 lines
a few more things to omit when NO_HISTORY defined.  from noel@cs.oberlin.edu

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat May 14 22:20:17 1994 UTC (30 years, 9 months ago) by cgd
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +8 -0 lines
add back in support for building w/o obj dir.  also, add NO_HISTORY
define, which (if you invoke mkbuiltins properly) gets you a sh w/o
history of command line editing (for floppy sh).

Revision 1.6: download - view: text, markup, annotated - select for diffs
Thu May 12 17:03:41 1994 UTC (30 years, 9 months ago) by jtc
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +2 -1 lines
Include appropriate header files to bring function prototypes into scope.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed May 11 17:10:01 1994 UTC (30 years, 9 months ago) by jtc
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +121 -29 lines
sync with 4.4lite

Revision 1.1.1.2 (vendor branch): download - view: text, markup, annotated - select for diffs
Wed May 11 17:01:54 1994 UTC (30 years, 9 months ago) by jtc
Branches: WFJ-920714, CSRG
CVS tags: lite-1
Diff to: previous 1.1.1.1: preferred, colored
Changes since revision 1.1.1.1: +121 -28 lines
44lite code

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sun Aug 1 18:58:15 1993 UTC (31 years, 6 months ago) by mycroft
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +2 -2 lines
Add RCS identifiers.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Mar 23 00:28:07 1993 UTC (31 years, 11 months ago) by cgd
Branches: MAIN
CVS tags: netbsd-alpha-1, netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9, netbsd-0-8
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +1 -1 lines
changed "Id" to "Header" for rcsids

Revision 1.2: download - view: text, markup, annotated - select for diffs
Mon Mar 22 08:04:00 1993 UTC (31 years, 11 months ago) by cgd
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +1 -0 lines
added rcs ids to all files

Revision 1.1.1.1 (vendor branch): download - view: text, markup, annotated - select for diffs
Sun Mar 21 09:45:37 1993 UTC (31 years, 11 months ago) by cgd
Branches: WFJ-920714, CSRG
CVS tags: patchkit-0-2-2, WFJ-386bsd-01
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +0 -0 lines
initial import of 386bsd-0.1 sources

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sun Mar 21 09:45:37 1993 UTC (31 years, 11 months ago) by cgd
Branches: MAIN
Initial revision

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>