Commit Graph

1947 Commits

Author SHA1 Message Date
Jilles Tjoelker
6c0c240366 sh: Fix crash due to uninitialized here-document.
If an ; or & token was followed by an EOF token, pending here-documents were
left uninitialized. Execution would crash, either in the main shell process
for literal here-documents or in a child process for expanded
here-documents. In the latter case the problem is hard to detect apart from
the core dumps and log messages.

Side effect: slightly different retries on inputs where EOF is not
persistent.

Note that tools/regression/bin/sh/parser/heredoc6.0 still causes a similar
crash in a child process. The text passed to eval is malformed and should be
rejected.
2010-07-25 22:25:52 +00:00
Gabor Kovesdan
4dc88ebedf Add BSD grep to the base system and make it our default grep.
Deliverables: Small and clean code (1,4 KSLOC vs GNU's 8,5 KSLOC),
              lower memory usage than GNU grep, GNU compatibility,
              BSD license.

TODO:         Performance is somewhat behind GNU grep but it is only
              significant for bigger searches.  The reason is complex, the
              most important factor is that GNU grep uses lots of
              optimizations to improve the speed of the regex library.
              First, we need a modern regex library (practically by adopting
              TRE), add support for GNU-style non-standard regexes and then
              reevalute the performance issues and look for bottlenecks.  In
              the meantime, for those, who need better performance, it is
              possible to build GNU grep by setting WITH_GNU_GREP.

Approved by:            delphij (mentor)
Obtained from:          OpenBSD (http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/grep/),
                        freegrep (http://github.com/howardjp/freegrep)
Sponsored by:           Google SoC 2008
Portbuild tests run by: kris, pav, erwin
Acknowledgements to:    fjoe (as SoC 2008 mentor),
                        everyone who helped in reviewing and testing
2010-07-22 19:11:57 +00:00
Simon L. B. Nielsen
74d53216ac Hook newsyslog regression tests to the Makefile 'build'.
MFC after:	3 weeks
2010-07-22 11:38:48 +00:00
Simon L. B. Nielsen
0f68c374aa Add regression tests for newsyslog. These are far from a complete
test of newsyslog, as they were mainly made to test 'newsyslog -t',
but they do test the basic functionality.

The test 'framework' was based on dds@'s code in
src/tools/regression/bin/mv/.

Note that currently these tests are not fully correct for the
non-timestamp based rotation case, as it seems like newsyslog actually
by default keeps a file too much around.

MFC after:	3 weeks
2010-07-22 11:37:54 +00:00
Ed Schouten
781ad8efe1 Chase LLVM version bump to 2.8. 2010-07-21 08:27:56 +00:00
Jilles Tjoelker
cac4830ce4 sh: Allow a background command consisting solely of redirections.
Example:
  </dev/null &

MFC after:	2 weeks
2010-07-18 12:45:31 +00:00
Ed Maste
5d61e252b4 Use canonical spelling of FreeBSD.org
Submitted by:	Garrett Cooper
2010-07-06 19:43:40 +00:00
Ed Maste
45e6a6a1a5 Switch to my @freebsd.org email address. 2010-07-06 17:00:20 +00:00
Jilles Tjoelker
778c4480f4 sh: Remove comment that the comma operator is missing in arithmetic
expansion.

The comma operator is not listed in POSIX.1-2008 XCU 1.1.2.1 Arithmetic
Precision and Operations (referenced by XCU 2.6.4 Arithmetic Expansion) and
is therefore not required.
2010-07-02 21:31:24 +00:00
Robert Watson
7812ede3ff Add TCP scalability testing wrapper scripts for tcpp.
Sponsored by:	Juniper Networks
MFC after:	1 week
2010-06-22 10:46:57 +00:00
Robert Watson
a34eb060cc Revised tuning advice for tcpp benchmarking: do it in loader.conf, and
tweak more TCP/stack parameters.

Sponsored by:	Juniper Networks
MFC after:	1 week
2010-06-22 10:45:35 +00:00
Brian Somers
5fa77f4fe4 Remove vestiges of 'slip'.
PR:		145648
Submitted by:	alexbestms at wwu dot de and spam at rm-rf dot kiev dot ua
MFC after:	1 week
2010-06-19 09:21:34 +00:00
Alexander Leidinger
e137ba592e Add the ZFS periodic daily scripts to the ZFS part. 2010-06-17 12:37:50 +00:00
Warner Losh
8886dc1652 Allow boot.config to have different values than just -h.
Submitted by:	bsdrp by way of freenas and olivier cochard-labbe
MFC after:	3 days
2010-06-15 23:55:42 +00:00
Warner Losh
358b781628 Allow population of /cfg and /data. Begin the move to making all
slice creation overrideable too, but there's a few problems doing that
for the duplicated partitions (s1 and s2), so just comment that it
needs work.

MFC after:	3 days
2010-06-15 18:18:31 +00:00
Warner Losh
77f9b8a393 Create a make.conf. not needed for runtime, but some ports want to spam it
at compile or install time.

MFC after:	3 days
2010-06-15 18:16:45 +00:00
Warner Losh
d8e85077eb make these convenience functions more convenient by accepting all
args, not just the first.  makes mechanical conversion of old style
more forgiving.

MFC after:	3 days
2010-06-15 18:11:37 +00:00
Ed Schouten
edec9228fa Add Clang to OptionalObsoleteFiles.inc.
This means you can now deinstall Clang by running make delete-old with
WITHOUT_CLANG set.
2010-06-14 19:10:30 +00:00
Ed Schouten
c58a2cf366 Fix typo.
Spotted by:	Garrett Cooper
2010-06-10 06:20:26 +00:00
Ed Schouten
9e303702a0 This should be commented out. 2010-06-09 20:18:18 +00:00
Roman Divacky
2dd5cc396f Add WITHOUT_CLANG file with a description.
Approved by:	ed (mentor)
2010-06-09 20:11:35 +00:00
Matt Jacob
8d7b838eee Add the VHBA package. It is here in tools because it's really a testbed.
Sponsored by:	Panasas
MFC after:	1 month
2010-06-08 22:26:47 +00:00
Robert Watson
698337f653 Rework tcpp output so that it generates a comma-delimited list of values,
optionally with a header if "-h" is passed.  Toast CPU time measurement
in the server for now.  Remove -C and -T, since we now always report
both connections/sec and Gb/sec.

MFC after:	1 week
Sponsored by:	Juniper Networks
2010-06-06 15:27:08 +00:00
Robert Watson
73dd1f4339 Although we currently don't compile in CPU-pinning support by default,
add a -P to enable it if it were.

MFC after:	1 week
Sponsored by:	Juniper Networks
2010-06-05 22:59:37 +00:00
Maxim Konovalov
4a509b9cbf o The typo was intended as it stated in the comment. Revert last.
Spotted by:	dfr
2010-06-04 14:22:49 +00:00
Maxim Konovalov
22fdc015e2 o Makefile BSDfication.
PR:		misc/147461 (with my changes)
Submitted by:	Erik Cederstrand
2010-06-04 08:19:43 +00:00
Maxim Konovalov
1accefb1e1 o Fix typo: .uudef -> .undef.
PR:		misc/147462
Submitted by:	Erik Cederstrand
2010-06-04 08:14:30 +00:00
Brian Somers
9c24af3d15 Fix stuttering sequences and reverse ranges
PR:		123635
Submitted by:	Ulrich Spörlein, uqs at spoerlein dot net
2010-06-02 07:47:29 +00:00
Jilles Tjoelker
5d91007000 sh: Fix a crash if a heredoc was not properly ended and parsing continued.
Example (in interactive mode):
  cat <<EOF && )
The next command typed caused sh to segfault, because the state for the here
document was not reset.

Like parser_temp, this uses the fact that the parser is not re-entered.
2010-05-30 14:20:32 +00:00
Jilles Tjoelker
ba02a307fe sh: Change interaction of command substitution and here documents.
If a command substitution contains a newline token, this no longer starts
here documents of outer commands. This way, we follow POSIX's idea of the
command substitution being a separate script more closely. It also matches
other shells better and is consistent with newline characters in quotes not
starting here documents.

The extension tested in parser/heredoc3.0 ($(cat <<EOF)\ntext\nEOF\n)
continues to be supported.

In particular, this change allows things like
  cat <<EOF && echo `pwd`
(a `` command substitution after a here document)
which formerly silently used an empty file as the here document, because the
EOF of the inner command "pwd" also forced an empty here document.
2010-05-30 14:11:27 +00:00
Jilles Tjoelker
c1564db05d sh: Recognize "--" in . and exec.
Although "--" historically has not been required to be recognized for
certain special builtins that do not take options in POSIX, some other
implementations recognize options for them, requiring scripts to use "--" or
avoid operands starting with "-".

Operands starting with "-" can be avoided with eval by prepending a space,
and cannot occur with break, continue, exit, return and shift as they only
take numbers, nor with times as it does not take operands. With . and exec,
avoiding "-" is not so easy as it may require reimplementing the PATH
search; therefore the current proposal for POSIX is to require recognition
of "--" for them.

We continue to accept other strings starting with "-" as operands to . and
exec, and also "--" if it is alone to . (which would otherwise be invalid
anyway).
2010-05-28 22:40:24 +00:00
Jilles Tjoelker
bc4c1a0670 sh: Add some simple tests for ., exec and return from . script. 2010-05-28 22:08:34 +00:00
Robert Watson
1e4bf1e35f Correct several nits/problems in the unix_close_race regression test.
Submitted by:	Mikolaj Golub <to.my.trociny at gmail.com>
MFC after:	3 days
2010-05-27 15:28:55 +00:00
Robert Watson
07c2a9537e Add unix_close_race, a regresion test to catch ENOTCONN being returned
improperly from one of two instances of close(2) being called
simultaneously on both ends of a connected UNIX domain socket.  The test
tool is slightly tweaked to improve failure modes, and while often does
trigger the problem, doesn't do so consistently due to the nature of the
race.

PR:		kern/144061
Submitted by:	Mikolaj Golub <to.my.trociny@gmail.com>
MFC after:	3 days
2010-05-26 10:46:03 +00:00
Rafal Jaworowski
4f1ca2a872 Introduce a new build knob for Flattened Device Tree support.
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-05-25 15:12:21 +00:00
Jilles Tjoelker
f7b46e74b3 sh: Add some simplistic tests for the wait builtin. 2010-05-23 22:10:20 +00:00
Jung-uk Kim
bea3599d7d Add an option file for WITHOUT_MAN_UTILS to regenerate src.conf(5). 2010-05-20 00:07:21 +00:00
Ulrich Spörlein
62486687ed mdoc: consistently spell our email addresses <foo@FreeBSD.org>
Reviewed by:	ru
2010-05-19 08:57:53 +00:00
Ulrich Spörlein
0afc94c17a mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:07:55 +00:00
Jilles Tjoelker
4710b07ecf sh: Fix pathname expansion with quoted slashes like *\/.
These are git commits 36f0fa8fcbc8c7b2b194addd29100fb40e73e4e9 and
d6d06ff5c2ea0fa44becc5ef4340e5f2f15073e4 in dash.

Because this is the first code I'm importing from dash to expand.c, add the
Herbert Xu copyright notice which is in dash's expand.c.

When pathname expanding *\/, the CTLESC representing the quoted state was
erroneously taken as part of the * pathname component. This CTLESC was then
seen by the pattern matching code as escaping the '\0' terminating the
string.

The code is slightly different because dash converts the CTLESC characters
to backslashes and removes all the other CTL* characters to allow
substituting glob(3).

The effect of the bug was also slightly different from dash (where nothing
matched at all). Because a CTLESC can escape a '\0' in some way, whether
files were included despite the bug depended on memory that should not be
read. In particular, on many machines /*\/ expanded to a strict subset of
what /*/ expanded to.

Example:
  echo /*"/null"

This should print /dev/null, not /*/null.

PR:		bin/146378
Obtained from:	dash
2010-05-11 23:19:28 +00:00
Jilles Tjoelker
58729dbfc4 sh: Add some simple testcases for pathname expansion. 2010-05-11 22:28:55 +00:00
Jilles Tjoelker
cd06f6e065 Fix error in comment. 2010-05-09 17:15:26 +00:00
Jilles Tjoelker
084d796d16 sh: Add some parser tests.
case1.0 tests POSIX requirements and one more for keywords in case
statements. The others test very special cases of command substitution.

These also work on stable/8.
2010-05-09 17:10:50 +00:00
Jilles Tjoelker
4b7fb70199 Generate some tests for sh's case command from the fnmatch tests.
I'm committing the generated files because I don't like a build dependency
for the sh(1) tests, and they are small and will not change much.
2010-05-09 16:15:40 +00:00
Jilles Tjoelker
941af8d6c6 sh: Fix bug in assignment error test.
The test failed if the command returned nonzero exit status, and it really
should return that.
2010-05-09 16:04:32 +00:00
Jilles Tjoelker
e4b50334ec sh: Apply locale vars on builtins, recognize LC_MESSAGES as a locale var.
This allows doing things like LC_ALL=C some_builtin to run a builtin under a
different locale, just like is possible with external programs. The
immediate reason is that this allows making printf(1) a builtin without
breaking things like LC_NUMERIC=C printf '%f\n' 1.2

This change also affects special builtins, as even though the assignment is
persistent, the export is only to the builtin (unless the variable was
already exported).

Note: for this to work for builtins that also exist as external programs
such as /bin/test, the setlocale() call must be under #ifndef SHELL. The
shell will do the setlocale() calls which may not agree with the environment
variables.
2010-05-05 21:48:40 +00:00
Philip Paeps
63a88d586e Fix typo in usage message. Add -n to the list of valid arguments.
MFC after:	1 day
2010-04-30 15:12:30 +00:00
Marius Strobl
b09fefd1f6 Add a TestFloat based test suite for floating-point implementations
currently supporting sparc64. After a `make depend all` there are
three programs; testsoftfloat for testing against the SoftFloat in
src/lib/libc/softfloat for reference purposes, testemufloat for
testing the emulator source in src/lib/libc/sparc64/fpu and testfloat
for testing with the installed libc. Support for other architectures
can be added as needed.

PR:		144900
Submitted by:	Peter Jeremy
2010-04-24 12:11:41 +00:00
Jung-uk Kim
ed9dd82fa2 Adjust a test case and make it more jump optimization neutral for JIT case. 2010-04-23 22:42:49 +00:00
Jilles Tjoelker
e9615a1a0e sh: Add some more tests for ${v#...} and ${v%...}.
These pass on stable/8 as well.
2010-04-23 17:26:49 +00:00