Commit Graph

2114 Commits

Author SHA1 Message Date
Giorgos Keramidas
574fe75809 tests: sort & fix includes, remove -include from CFLAGS of acct tests
- Sort the includes of pack.c, moving sys/*.h files near the top.
- Add a couple of missing #include lines, and remove the need for
  custom -include options in the CFLAGS of the test Makefile.
- Remove the ad-hoc 'all' target, but keep its 'regress' bits for
  testing.
- Convert the ad-hoc 'clean' target to proper CLEANFILES stuff,
  so that the normal bsd.prog.mk machinery can clean up.
- Use `make -V .OBJDIR' to detect the place where 'pack' lives,
  so that regress.t works both with and without 'make obj'.

Reviewed by:	uqs
MFC after:	1 week
2011-01-06 20:05:24 +00:00
Jilles Tjoelker
e23a66ac83 sh: Do not call exitshell() from evalcommand() unless evalcommand() forked
itself.

This ensures that certain traps caused by builtins are executed.
2011-01-05 23:17:29 +00:00
Warner Losh
72e8d583cd Update gateworks exclusion list to match latest tree. 2011-01-03 20:32:08 +00:00
Warner Losh
3664e10e59 Bump the media size from approx 600MB to approx 750MB. The great
hob-nailed tennis shoe of progress demands it!

Submitted by:	phk
2011-01-03 19:32:54 +00:00
Warner Losh
1e430919eb Put in the other half of the SRCCONF patch.
Submitted by:	phk
2011-01-03 19:30:47 +00:00
Jilles Tjoelker
be25acf4a5 sh: Test that exit $? replaces the original exit status in an EXIT trap. 2011-01-01 15:25:15 +00:00
Jilles Tjoelker
850460c0f1 sh: Check readonly status for assignments on regular builtins.
An error message is written, the builtin is not executed, nonzero exit
status is returned but the shell does not abort.

This was already checked for special builtins and external commands, with
the same consequences except that the shell aborts for special builtins.

Obtained from:	NetBSD
2011-01-01 13:26:18 +00:00
Jilles Tjoelker
09683f46b9 sh: Check if dup2 for redirection from/to a file succeeds.
A failure (e.g. caused by ulimit -n being set very low) is a redirection
error.

Example:
  ulimit -n 9; exec 9<.
2010-12-31 18:20:17 +00:00
Jilles Tjoelker
11535bdf04 sh: Avoid side effects from builtins in optimized command substitution.
Change the criterion for builtins to be safe to execute in the same process
in optimized command substitution from a blacklist of only cd, . and eval to
a whitelist.

This avoids clobbering the main shell environment such as by $(exit 4) and
$(set -x).

The builtins jobid, jobs, times and trap can still show information not
available in a child process; this is deliberately permitted. (Changing
traps is not.)

For some builtins, whether they are safe depends on the arguments passed to
them. Some of these are always considered unsafe to keep things simple; this
only harms efficiency a little in the rare case they are used alone in a
command substitution.
2010-12-30 22:33:55 +00:00
Jilles Tjoelker
b0aecb3d03 sh: Add two tests for special cases in command substitution that already
work in stable/8.
2010-12-30 15:04:59 +00:00
Jilles Tjoelker
acd7984f96 sh: Don't do optimized command substitution if expansions have side effects.
Before considering to execute a command substitution in the same process,
check if any of the expansions may have a side effect; if so, execute it in
a new process just like happens if it is not a single simple command.

Although the check happens at run time, it is a static check that does not
depend on current state. It is triggered by:
- expanding $! (which may cause the job to be remembered)
- ${var=value} default value assignment
- assignment operators in arithmetic
- parameter substitutions in arithmetic except ${#param}, $$, $# and $?
- command substitutions in arithmetic

This means that $((v+1)) does not prevent optimized command substitution,
whereas $(($v+1)) does, because $v might expand to something containing
assignment operators.

Scripts should not depend on these exact details for correctness. It is also
imaginable to have the shell fork if and when a side effect is encountered
or to create a new temporary namespace for variables.

Due to the $! change, the construct $(jobs $!) no longer works. The value of
$! should be stored in a variable outside command substitution first.
2010-12-28 21:27:08 +00:00
Jilles Tjoelker
f3c2011efb sh: Add test for optimized command substitution.
This test verifies that certain expansions without side effects do not
cause the command substitution to be executed in a child process.

This is not a correctness requirement, but it involves a nontrivial amount
of code and it would be unfortunate if it stopped working.
2010-12-28 14:58:08 +00:00
Jilles Tjoelker
45b71cd16e sh: Make expansion errors in optimized command substitution non-fatal.
Command substitutions consisting of a single simple command are executed in
the main shell process but this should be invisible apart from performance
and very few exceptions such as $(trap).
2010-12-28 13:28:24 +00:00
Jilles Tjoelker
a355eb9e1a sh: Add a testcase for cmdsubst errors that already works properly.
If a command substitution consists of one special builtin and there is a
redirection error, this should not abort the outer shell.
It was fixed in r201366 by ignoring special builtin properties for command
substitutions consisting of one builtin.
2010-12-27 23:56:03 +00:00
Ed Maste
f8e809686a Restore two commented-out tests from plus-minus1.0 to a new file.
These two cases pass on -CURRENT but fail on stable/8.

Reviewed by:	jilles
2010-12-27 15:57:41 +00:00
Ed Maste
65db095da0 Remove commented-out test that's covered in plus-minus2.0 anyway.
Discussed with: jilles
2010-12-26 23:19:16 +00:00
Jilles Tjoelker
6a6760db7f sh: Make warnings in the printf builtin non-fatal, like in the program.
The #define for warnx now behaves much like the libc function (except that
it uses sh command name and output).

Also, it now uses C99 __VA_ARGS__ so there is no need for three different
macros for 0, 1 or 2 parameters.
2010-12-20 23:06:57 +00:00
Jilles Tjoelker
79357531c8 sh: arith: Disallow decimal constants starting with 0 (containing 8 or 9).
Constants in arithmetic starting with 0 should be octal only.

This avoids the following highly puzzling result:
  $ echo $((018-017))
  3
by making it an error instead.
2010-12-18 23:03:51 +00:00
Jilles Tjoelker
fa0951d63a sh: Fix corruption of command substitutions with special chars after newline
The CTLESC byte to protect a special character was output before instead of
after a newline directly preceding the special character.

The special handling of newlines is because command substitutions discard
all trailing newlines.
2010-12-16 23:28:20 +00:00
Edward Tomasz Napierala
ccbd595076 Recognize NFSv4 ACL semantics and run proper regression test. 2010-12-13 18:59:55 +00:00
Jilles Tjoelker
2a3de776bf sh: Fix some tests that used sh instead of ${SH}
so they tested the wrong sh.

This was caused because these tests were committed after the sh -> ${SH}
change but were created before.
2010-12-12 21:18:16 +00:00
Jilles Tjoelker
63f6e7ba56 sh: Add a test for r216387 (long arithmetic expression in here document). 2010-12-12 16:56:16 +00:00
Edward Tomasz Napierala
552c039da9 Add regression test for new NFSv4 ACL semantics, verified with ZFSv28.
Note that to run it, you need not only ZFSv28, but also a modified setfacl(1),
which is not in the tree yet.
2010-12-12 13:04:30 +00:00
Pawel Jakub Dawidek
76423e6e3c Allow to specify path to a file we want to test with sendfile(2).
This allows to specify selected file system and not only /tmp/.
2010-12-11 16:06:52 +00:00
Jilles Tjoelker
1c95cbaf9b printf: Test that the "--" option terminator works. 2010-12-08 22:54:18 +00:00
David Schultz
443a48f0a1 Work around gcc constant folding bugs. 2010-12-06 00:19:56 +00:00
David Schultz
cf37ce3724 signbit() returns nonzero for negative arguments, but we shouldn't assume
that it always returns the same nonzero value.
2010-12-06 00:02:49 +00:00
David Schultz
4a09b0df94 Fix some warnings. 2010-12-05 23:50:49 +00:00
David Schultz
18c5bc2279 Add regression tests for logarithmic functions in the math library. 2010-12-05 22:18:35 +00:00
Ulrich Spörlein
d180d7efa2 Document two more ways to find duplicates in the obsolete file list.
Remove the only duplicate found by the optional files check. Fix typos,
while here.

Suggested by:	netchild
2010-12-04 11:40:40 +00:00
Konstantin Belousov
b010326013 Extend the unix gc regression test to cover the case of r216150.
Requested and reviewed by:	rwatson
MFC after:	1 week
2010-12-03 16:17:53 +00:00
Warner Losh
6daeae43a6 o Mount the device async when we're doing the copy.
o Create a sparse file instead of a fully zerod one.  This trades the
  possibiltiy of running out of space during the build for the speed
  gain not having do write all those zeros...

Submitted by:	n_hibma
2010-12-03 07:39:29 +00:00
Warner Losh
62a49e2109 _WITHOUT_SRCCONF has too much baggage. Instead, use the simpler
SRCCONF=/dev/null.
2010-12-03 07:33:43 +00:00
David Schultz
ee7d7a769c Add some basic regression tests for nearbyint(). 2010-12-03 00:44:31 +00:00
Jilles Tjoelker
95787f5dc0 sh: Make the test for cd/pwd with long pathnames more useful:
* Use $(getconf PATH_MAX /) to make sure we actually exercise the hard part
* Delete our test area even if the test fails
2010-11-28 22:49:58 +00:00
Poul-Henning Kamp
6c7e719d84 Don't checksum distfiles twice if they match the first time. 2010-11-23 21:21:56 +00:00
Poul-Henning Kamp
f095bbd631 Optimize the ports recurser a bit more. 2010-11-23 20:47:39 +00:00
Poul-Henning Kamp
c4779c39ab Improve the ports-dependency resolver by truncating the recursion if
we already did the target port, and by leaving behind a /tmp/_.plist.dot
which documents which ports pulled in what other ports.
2010-11-23 20:28:21 +00:00
Jilles Tjoelker
4fadeef03f sh: Add a test that manipulates various long strings.
It is quite effective at detecting mistakes in memalloc.c and code using it.

It is somewhat slow, but some of the patches in my queue improve it.
2010-11-19 22:25:32 +00:00
Jilles Tjoelker
440bbebcc9 sh: Add another simple test for the wait builtin. 2010-11-19 21:15:06 +00:00
George V. Neville-Neil
b751664f7f Fix an error in our results printing. 2010-11-16 20:39:52 +00:00
Oleksandr Tymoshenko
fe5ddba7a9 Add optional files controlled by WITH_GPIO knob
Submitted by:	Alexander Best <arundel@freebsd.org>
2010-11-14 22:14:36 +00:00
Rebecca Cran
97f9dcf763 lib32 is installed on powerpc64 too. 2010-11-14 19:37:07 +00:00
Rebecca Cran
60db6c3233 libatm_p.a, libkeycap_p.a and libmytinfo_p.a are already in ObsoleteFiles.inc.
liblwres.so.10 has been replaced by liblwres.so.50.

Reported by: arundel
2010-11-14 17:24:15 +00:00
George V. Neville-Neil
e162ea60d4 Add a queue to hold packets while we await an ARP reply.
When a fast machine first brings up some non TCP networking program
it is quite possible that we will drop packets due to the fact that
only one packet can be held per ARP entry.  This leads to packets
being missed when a program starts or restarts if the ARP data is
not currently in the ARP cache.

This code adds a new sysctl, net.link.ether.inet.maxhold, which defines
a system wide maximum number of packets to be held in each ARP entry.
Up to maxhold packets are queued until an ARP reply is received or
the ARP times out.  The default setting is the old value of 1
which has been part of the BSD networking code since time
immemorial.

Expose the time we hold an incomplete ARP entry by adding
the sysctl net.link.ether.inet.wait, which defaults to 20
seconds, the value used when the new ARP code was added..

Reviewed by:	bz, rpaulo
MFC after: 3 weeks
2010-11-12 22:03:02 +00:00
Warner Losh
fe5c39573b Insulate the nanobsd build from the current system by opting out of
the SRCCONF processing.

Noted by: gcopper@
2010-11-10 06:24:16 +00:00
Warner Losh
7d0b395d1a Build make.conf when the world is not selected to build, but the
kernel is.

PR:		151696
Submitted by:	lev@
2010-11-10 00:56:44 +00:00
Warner Losh
4a8a8af722 Document NANO_CFGDIR and NANO_DATADIR
Submitted by:	n_hibma@
2010-11-10 00:39:42 +00:00
Xin LI
65a1c46588 Hide 460.chkportsum in MK_PKGTOOLS != no case.
Submitted by:	Alex Kozlov <spam rm-rf kiev ua>
MFC after:	2 weeks
2010-11-09 18:46:44 +00:00
Jilles Tjoelker
47fdf870a7 test: Move tests to tools/regression/bin/test.
Convert the tests to the perl prove format.
Remove obsolete TEST.README (results of an old TEST.sh for some old Unices)
and TEST.csh (old tests without correct values, far less complete than
TEST.sh).

MFC after:	1 week
2010-11-08 23:15:10 +00:00