Commit Graph

2449 Commits

Author SHA1 Message Date
delphij
fbf06de861 Accept == as an alias of = which is a popular GNU extension.
This is intentionally undocumented for now since it's not part
of any standard.

MFC after:	1 month
2011-02-27 12:28:06 +00:00
dim
c80ac9d286 Vendor import of llvm trunk r126547:
http://llvm.org/svn/llvm-project/llvm/trunk@126547
2011-02-26 22:03:50 +00:00
gabor
1abf4d85cf - Add two more iconv-related files, which were left out from previous commit
Approved by:	delphij (mentor)
2011-02-25 00:10:26 +00:00
gabor
c91ab1769b Add the BSD-licensed Citrus iconv to the base system with default off
setting. It can be built by setting the WITH_ICONV knob. While this
knob is unset, the library part, the binaries, the header file and
the metadata files will not be built or installed so it makes no impact
on the system if left turned off.

This work is based on the iconv implementation in NetBSD but a great
number of improvements and feature additions have been included:

- Some utilities have been added. There is a conversion table generator,
  which can compare conversion tables to reference data generated by
  GNU libiconv. This helps ensuring conversion compatibility.
- UTF-16 surrogate support and some endianness issues have been fixed.
- The rather chaotic Makefiles to build metadata have been refactored
  and cleaned up, now it is easy to read and it is also easier to add
  support for new encodings.
- A bunch of new encodings and encoding aliases have been added.
- Support for 1->2, 1->3 and 1->4 mappings, which is needed for
  transliterating with flying accents as GNU does, like "u.
- Lots of warnings have been fixed, the major part of the code is
  now WARNS=6 clean.
- New section 1 and section 5 manual pages have been added.
- Some GNU-specific calls have been implemented:
  iconvlist(), iconvctl(), iconv_canonicalize(), iconv_open_into()
- Support for GNU's //IGNORE suffix has been added.
- The "-" argument for stdin is now recognized in iconv(1) as per POSIX.
- The Big5 conversion module has been fixed.
- The iconv.h header files is supposed to be compatible with the
  GNU version, i.e. sources should build with base iconv.h and
  GNU libiconv. It also includes a macro magic to deal with the
  char ** and const char ** incompatibility.
- GNU compatibility: "" or "char" means the current local
  encoding in use
- Various cleanups and style(9) fixes.

Approved by:	delphij (mentor)
Obtained from:	The NetBSD Project
Sponsored by:	Google Summer of Code 2009
2011-02-25 00:04:39 +00:00
uqs
7917c9d175 The default for FDT has changed, rename the flag/options file. 2011-02-22 08:20:12 +00:00
uqs
433f0177d0 Flesh out WITHOUT_GROFF support to DTRT.
A full featured groff is required during buildworld, so build it always
and don't rely on it being present on the host system.

vgrind(1) is tightly coupled to a roff processor and will not be
built/installed when groff is disabled. Also much of the roff'ed
documentation under share/doc will not be built/installed when
WITHOUT_GROFF is defined.

Reviewed by:	ru (partial)
2011-02-22 08:13:49 +00:00
uqs
39bd167d32 Teach tools/install.sh the -d directory mode.
Sync up with flags understood by install(1) [1], and make install(1)'s
usage output not hide the clearly documented -M flag.

PR:		misc/154739 [1]
Submitted by:	arundel
2011-02-22 08:07:17 +00:00
miwi
a8ca1e2aac - Fix QA issues
PR:		misc/146687
Submitted by:	Garrett Cooper <gcooper@FreeBSD.org>
Approved by:	rwatson (mentor)
2011-02-22 05:13:26 +00:00
jilles
9a5bced8a3 sh: Add some tests for omitting whitespace whereever possible. 2011-02-20 17:28:58 +00:00
jilles
80cf1ce894 sh: Split off some special behaviour into separate tests.
This allows some other shells to pass the tests for basic behaviour.
2011-02-20 14:18:58 +00:00
dim
cbb70ce070 Vendor import of llvm trunk r126079:
http://llvm.org/svn/llvm-project/llvm/trunk@126079
2011-02-20 12:57:14 +00:00
jilles
63238d2066 sh: Do not use "local" in the test runner as POSIX and ksh93 do not have it. 2011-02-19 13:23:13 +00:00
jilles
8ee6aec361 sh: Make execution/fork1.0 work even if the basename of ${SH} is not "sh". 2011-02-19 13:22:18 +00:00
jilles
e1012e9afb sh: Test that the read builtin passes through all byte values
except NUL, newline and backslash.

This also passes on stable/8.
2011-02-18 20:51:13 +00:00
jilles
d7565a2cae sh: Unset some more locale vars in two tests that may cause them to break. 2011-02-18 20:37:09 +00:00
delphij
604a3120c0 Add a helper script that detects which partition we are on and update the
other.

MFC after:	1 month
Obtained from:	FreeNAS
Sponsored by:	iXsystems, Inc.
2011-02-18 19:07:16 +00:00
phk
faa5e8a94a Improve the check for ports which have gone missing, and just ignore
them.  We want a run to perform as much work as possible before it
gives up.
2011-02-17 08:54:22 +00:00
adrian
bcdbd0e561 * add in new EEPROM fields from later revisions
* add in printing futureBase
2011-02-13 13:11:00 +00:00
jilles
2fb0603686 sh: Detect dividing the smallest integer by -1.
This overflows and on some architectures such as amd64 it generates SIGFPE.
Generate an error on all architectures.
2011-02-12 23:44:05 +00:00
imp
32d5960531 Add 'generic' flash images. This is for projects producing generic
images that are of a certain size.  The geometery is bogus, but that
doesn't matter since the new packet mode onviates the need to get the
geometry right.
2011-02-10 23:36:39 +00:00
jilles
3b911f3790 sh: Add tests for new features in arithmetic. 2011-02-08 23:23:55 +00:00
jilles
3cc91012bd sh: Weaken some tests to allow /rescue/sh to pass everything.
/rescue/sh has a different _PATH_STDPATH which affects command -p.
2011-02-05 23:00:24 +00:00
jilles
ff6aee65ce sh: Fix two things about {(...)} <redir:
* In {(...) <redir1;} <redir2, do not drop redir1.
* Maintain the difference between (...) <redir and {(...)} <redir:
  In (...) <redir, the redirection is performed in the child, while in
  {(...)} <redir it should be performed in the parent (like {(...); :;}
  <redir)
2011-02-05 15:02:19 +00:00
jilles
852a80acf7 sh: Forget all cached command locations on any PATH change.
POSIX requires this and it is simpler than the previous code that remembered
command locations when appending directories to PATH.

In particular,
  PATH=$PATH
is no longer a no-op but discards all cached command locations.
2011-02-05 14:01:46 +00:00
jilles
a81357fbe9 sh: Do not try to execute binary files as scripts.
If execve() returns an [ENOEXEC] error, check if the file is binary before
trying to execute it using sh. A file is considered binary if at least one
of the first 256 bytes is '\0'.

In particular, trying to execute ELF binaries for the wrong architecture now
fails with an "Exec format error" message instead of syntax errors and
potentially strange results.
2011-02-05 12:54:59 +00:00
jilles
0bf07f466d sh: Add test for shell script without '#!'. 2011-02-02 22:03:18 +00:00
jilles
8605caacbf sh: Send messages about signals to stderr.
This is required by POSIX and seems to make more sense.

See also r217557.
2011-01-30 22:57:52 +00:00
adrian
375973917a Keep this in sync with the ar5212 power rate table size.
This doesn't yet know about the 802.11n radios or rates.
2011-01-29 04:34:30 +00:00
jilles
15823a2b44 sh: Add test for EXIT trap in command substitution.
This is not really realistic but is an opposition to $(trap).
2011-01-27 23:08:20 +00:00
adrian
2c2f5e9804 Fix this tool to use the updated (corrected) v4k eeprom definition introduced in a previous commit. 2011-01-25 05:35:43 +00:00
adrian
35e45d31de Add a simple tool to print the contents of a v4k EEPROM dump. 2011-01-24 06:46:03 +00:00
adrian
0b1c3acfac Add a new tool which takes a text hexdump of the current EEPROM contents. 2011-01-22 23:44:56 +00:00
adrian
c37d4f349a Patch the athstats code/Makefile to cross-compile correctly. 2011-01-22 23:37:42 +00:00
adrian
36a97a6dce Add in a new tool which prints a formatted v14 eeprom from an eeprom
hexdump.

This is a part replacement of the old athprom code, which tries
to both fetch and print the contents of an eeprom dump.

A tool to generate hexdumps from a running system will follow shortly.
2011-01-21 03:14:08 +00:00
adrian
70a71f576d Remove an un-needed trailing / after OBJDIR.
Nitpicked by: juli
2011-01-21 02:56:59 +00:00
adrian
93b64d585f Make the existing ath tools build again.
* add missing includes to quieten warnings
* fix an inline function decl to have a return type
* since .h files are created during the build (opt_ah.h, ah_osdep.h)
  which modify the behaviour of the HAL include/source files,
  include OBJDIR in the path so the #include's work.

The tools should now build when the directory is added to LOCAL_DIRS
during a make buildworld.
2011-01-21 02:53:32 +00:00
phk
efe3ac5af0 Make sure the PKGDIR exists before we move stuff into it. 2011-01-18 21:36:51 +00:00
jilles
460d7b088e sh: Fix signal messages being sent to the wrong file sometimes.
When a foreground job exits on a signal, a message is printed to stdout
about this. The buffer was not flushed after this which could result in the
message being written to the wrong file if the next command was a builtin
and had stdout redirected.

Example:
  sh -c 'kill -9 $$'; : > foo; echo FOO:; cat foo

Reported by:	gcooper
MFC after:	1 week
2011-01-18 21:18:31 +00:00
jilles
3967e15d57 sh: If exit is used without args from a trap action, exit on the signal.
This is useful so that it is easier to exit on a signal than to reset the
trap to default and resend the signal. It matches ksh93. POSIX says that
'exit' without args from a trap action uses the exit status from the last
command before the trap, which is different from 'exit $?' and matches this
if the previous command is assumed to have exited on the signal.

If the signal is SIGSTOP, SIGTSTP, SIGTTIN or SIGTTOU, or if the default
action for the signal is to ignore it, a normal _exit(2) is done with exit
status 128+signal_number.
2011-01-16 13:56:41 +00:00
jilles
31120cf045 sh: Fix some things about -- in trap:
* Make 'trap --' do the same as 'trap' instead of nothing.
* Make '--' stop option processing (note that '-' action is not an option).

Side effect: The error message for an unknown option is different.
2011-01-15 21:09:00 +00:00
keramida
4813d86278 regression/date: unset all LC_xxx vars and set LANG/LC_ALL
When running with a custom locale setup, it's easy to confuse the
date regression tests and cause them to fail, e.g. when LANG='C'
but LC_ALL='el_GR.UTF-8'.  Set LC_ALL to 'C', which overrides all
other LC_xxx options, to avoid this sort of problem.

Reviewed by:	uqs, edwin
2011-01-09 22:05:09 +00:00
jilles
2a782244a9 sh: Remove special %builtin PATH entry.
All builtins are now always found before a PATH search.

Most ash derivatives have an undocumented feature where the presence of an
entry "%builtin" in $PATH will cause builtins to be checked at that point of
the PATH search, rather than before looking at any directories as documented
in the man page (very old versions do document this feature).

I am removing this feature from sh, as it complicates the code, may violate
expectations (for example, /usr/bin/alias is very close to a forkbomb with
PATH=/usr/bin:%builtin, only /usr/bin/builtin not being another link saves
it) and appears to be unused (all the %builtin google code search finds is
in some sort of ash source code).

Note that aliases and functions took and take precedence above builtins.
Because aliases work on a lexical level they can only ever be overridden on
a lexical level (quoting or preceding 'builtin' or 'command'). Allowing
override of functions via PATH does not really fit in the model of sh and it
would work differently from %builtin if implemented.

Note: POSIX says special builtins are found before functions. We comply to
this because we do not allow functions with the same name as a special
builtin.

Silence from:	freebsd-hackers@ (message sent 20101225)
Discussed with:	dougb
2011-01-09 21:07:30 +00:00
jilles
3a61afec3c sh: Make exit without parameters from EXIT trap POSIX-compliant.
It should use the original exit status, just like falling off the
end of the trap handler.

Outside an EXIT trap, 'exit' is still equivalent to 'exit $?'.
2011-01-08 23:08:13 +00:00
jilles
25806c21fc sh: Add simple test for 'exit' without parameters. 2011-01-08 23:00:38 +00:00
jilles
742083bfc4 sed: Add test for r217133 (-i race).
PR:		bin/153261
MFC after:	2 weeks
2011-01-08 00:06:22 +00:00
keramida
406dbc36d2 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
3c4cff0f35 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
imp
75e493953d Update gateworks exclusion list to match latest tree. 2011-01-03 20:32:08 +00:00
imp
62e5f15bd0 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
imp
339b108495 Put in the other half of the SRCCONF patch.
Submitted by:	phk
2011-01-03 19:30:47 +00:00
jilles
3487ce2142 sh: Test that exit $? replaces the original exit status in an EXIT trap. 2011-01-01 15:25:15 +00:00
jilles
9391068711 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
e3df947be8 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
ca3118f4ca 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
fb3385d473 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
74d9b02bb0 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
076a6add84 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
713ef02a1f 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
812e01538d 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
emaste
081f34e7e9 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
emaste
bc01bda63e Remove commented-out test that's covered in plus-minus2.0 anyway.
Discussed with: jilles
2010-12-26 23:19:16 +00:00
jilles
ccc4611f77 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
84941f8297 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
da5b058d1d 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
trasz
a928bab70b Recognize NFSv4 ACL semantics and run proper regression test. 2010-12-13 18:59:55 +00:00
jilles
aed1bf9f01 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
955b676ba9 sh: Add a test for r216387 (long arithmetic expression in here document). 2010-12-12 16:56:16 +00:00
trasz
df80d2ec05 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
pjd
4bcdb20a60 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
b69863b7fd printf: Test that the "--" option terminator works. 2010-12-08 22:54:18 +00:00
das
c0634c2105 Work around gcc constant folding bugs. 2010-12-06 00:19:56 +00:00
das
812571675e 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
das
c1efcc0baa Fix some warnings. 2010-12-05 23:50:49 +00:00
das
e63325a777 Add regression tests for logarithmic functions in the math library. 2010-12-05 22:18:35 +00:00
uqs
27a502627f 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
kib
38cca03fdd 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
imp
2314de61b5 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
imp
52bedd6250 _WITHOUT_SRCCONF has too much baggage. Instead, use the simpler
SRCCONF=/dev/null.
2010-12-03 07:33:43 +00:00
das
ac10040980 Add some basic regression tests for nearbyint(). 2010-12-03 00:44:31 +00:00
jilles
a3f372978c 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
phk
d30712dbd5 Don't checksum distfiles twice if they match the first time. 2010-11-23 21:21:56 +00:00
phk
92ac246b47 Optimize the ports recurser a bit more. 2010-11-23 20:47:39 +00:00
phk
95f9248b6e 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
b37eae53ee 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
30e8287182 sh: Add another simple test for the wait builtin. 2010-11-19 21:15:06 +00:00
gnn
22828c5963 Fix an error in our results printing. 2010-11-16 20:39:52 +00:00
gonzo
ca4a476430 Add optional files controlled by WITH_GPIO knob
Submitted by:	Alexander Best <arundel@freebsd.org>
2010-11-14 22:14:36 +00:00
brucec
e3018c2449 lib32 is installed on powerpc64 too. 2010-11-14 19:37:07 +00:00
brucec
f1bbcabe40 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
gnn
c3225b5eaa 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
imp
875749fff1 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
imp
f9cb90fe52 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
imp
a1d9094a61 Document NANO_CFGDIR and NANO_DATADIR
Submitted by:	n_hibma@
2010-11-10 00:39:42 +00:00
delphij
c98c4f39f2 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
1d77e31425 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
n_hibma
ffd0f29be4 - Set -x flag when executing customisation scripts to aid in debugging them.
- Use KERNCONFDIR with KERNCONF instead of copying the kernel config into the source tree
  so included kernel configs work.
- Put more stuff in the _.bk/_.ik log file, not just make statements.
- Add the kernel config name to the pprint during kernel installation.
- Add NANO_MODULES providing a list of modules to build and install.

Reviewed by:	imp
MFC after:	2 weeks
2010-11-07 21:57:57 +00:00
trasz
92c07638be Remove useless comment. 2010-11-07 17:33:04 +00:00
jilles
9b70c12cad sh: Add simple tests for printf.
These are not meant as a replacement for tools/regression/usr.bin/printf/*
but to detect errors specific to making it a shell builtin.
2010-11-05 21:47:58 +00:00
jilles
000173def6 sh: Fix some issues with aliases and case, by importing dash checkkwd code.
This moves the function of the noaliases variable into the checkkwd
variable. This way it is properly reset on errors and aliases can be used
normally in the commands for each case (the case labels recognize the
keyword esac but no aliases).

The new code is clearer as well.

Obtained from:	dash
2010-11-02 23:44:29 +00:00
jilles
f98d5a366d sh: Detect various additional errors in the parser.
Apart from detecting breakage earlier or at all, this also fixes a segfault
in the testsuite. The "handling" of the breakage left an invalid internal
representation in some cases.

Examples:
  echo a; do echo b
  echo `) echo a`
  echo `date; do do do`

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-29 21:06:57 +00:00
jilles
aaa3347e35 sh: Fix some issues with CTL* bytes and ${var#pat}.
subevalvar() incorrectly assumed that CTLESC bytes were present iff the
expansion was quoted. However, they are present iff various processing such
as word splitting is to be done later on.

Example:
  v=@$e@$e@$e@
  y="${v##*"$e"}"
  echo "$y"
failed if $e contained the magic CTLESC byte.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-29 19:34:57 +00:00
jilles
28ad180ab4 sh: Do IFS splitting on word in ${v+word} and ${v-word}.
The code is inspired by NetBSD sh somewhat, but different because we
preserve the old Almquist/Bourne/Korn ability to have an unquoted part in a
quoted ${v+word}. For example, "${v-"*"}" expands to $v as a single field if
v is set, but generates filenames otherwise.

Note that this is the only place where we split text literally from the
script (the similar ${v=word} assigns to v and then expands $v). The parser
must now add additional markers to allow the expansion code to know whether
arbitrary characters in substitutions are quoted.

Example:
  for i in ${$+a b c}; do echo $i; done

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-29 13:42:18 +00:00
jilles
6f54496b16 sh: Only accept a '}' inside ${v+-=?...} if double-quote state matches.
If double-quote state does not match, treat the '}' literally.

This ensures double-quote state remains the same before and after a
${v+-=?...} which helps with expand.c.

It makes things like
  ${foo+"\${bar}"}
which I have seen in the wild work as expected.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-28 22:34:49 +00:00
jilles
8e66c8e658 sh: Make double-quotes quote a '}' inside ${v#...} and ${v%...}.
Exp-run done by:	pav (with some other sh(1) changes)
PR:			bin/57554
2010-10-28 21:51:14 +00:00
jilles
58038d3e9e sh: Do not allow overriding a special builtin with a function.
This is a syntax error.

POSIX does not say explicitly whether defining a function with the same name
as a special builtin is allowed, but it does say that it is impossible to
call such a function.

A special builtin can still be overridden with an alias.

This commit is part of a set of changes that will ensure that when
something looks like a special builtin to the parser, it is one. (Not the
other way around, as it remains possible to call a special builtin named
by a variable or other substitution.)

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 22:03:21 +00:00
jilles
e5f0dbf76c sh: Make sure defined functions can actually be called.
Add some conservative checks on function names:
- Disallow expansions or quoting characters; these can only be called via
  strange control characters
- Disallow '/'; these functions cannot be called anyway, as exec.c assumes
  they are pathnames
- Make the CTL* bytes work properly in function names.

These are syntax errors.

POSIX does not require us to support more than names (letters, digits and
underscores, not starting with a digit), but I do not want to restrict it
that much at this time.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 20:45:13 +00:00
jilles
c487e17b8f sh: Check whether dup2 was successful for >&FD and <&FD.
A failure (usually caused by FD not being open) is a redirection error.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 20:09:49 +00:00
jilles
a2f958382a sh: Add a test trying to close a descriptor that is not open.
In stable/8 and older, this fails. Some of the redirection changes in head
have fixed it.
2010-10-24 19:56:34 +00:00
jilles
ba204fa87e sh: Change ! within a pipeline to start a new pipeline instead.
This is how ksh93 treats ! within a pipeline and makes the ! in
  a | ! b | c
negate the exit status of the pipeline, as if it were
  a | { ! b | c; }

Side effect: something like
  f() ! a
is now a syntax error, because a function definition takes a command,
not a pipeline.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 17:06:49 +00:00
jilles
dfb434120d sh: Add some testcases for alias expansion. 2010-10-24 16:55:17 +00:00
rwatson
0f77c58470 Add microbenchmark for create/unlink of a zero-byte file.
Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-24 09:14:21 +00:00
rwatson
a60a1a68ae Validate syscall_timing test names before starting to provide earlier
feedback regarding user error.

Provide default loop and timing settings.

Add a new test that just times pread() without the open()/close().

Mark tests requiring a path argument so we can provide better feedback
to the user than EFAULT on (null).

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-22 11:22:19 +00:00
rwatson
d52ae23cf4 Universally use uintmax_t in syscall_timing; rearrange arithmetic to
suffer fewer rounding errors with smaller numbers; fix argc validation
so multiple tests run on a single command line.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 21:08:12 +00:00
rwatson
118814a9ac Add Cambridge/Google tag since the copyright has been updated.
MFC after:	2 weeks
2010-10-21 19:03:24 +00:00
rwatson
b5a4b9e70d Further syscall_timing improvements: allow an arbitrary "path" string
argument to be passed on the command line, allowing file-related tests
to be pointed at wherever desired.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 19:01:59 +00:00
rwatson
5fd895cb36 Fix bug in recent syscall_timing change: measure the number of iterations
each loop, rather than once up front.  The distinction is unimportant
when doing a fix iteration count, but when using a timer, it should vary.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 17:35:08 +00:00
rwatson
01d9f43c8f Further enhancements to syscall_timing:
- Use getopt rather than hand-parsed arguments
- Allow iterations to be specified and/or a new number of seconds bound
  on the number of iterations
- Fix printout of timer resolution
- Add new tests, such as TCP and UDP socket creation, and open/read/close
  of /dev/zero and /dev/null.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 17:27:39 +00:00
rwatson
5da57c7fdf Improve the structure and implementation of the syscall_timing
microbenchmark suite:

- Use common benchmark_start/benchmark_stop routines to simplify
  individual benchmarks.
- Add a central table of tests with names, where new tests can be
  hooked in easily.
- Add new benchmarks for dup, shm_open, shm_open + fstat, fork,
  vfork, vfork + exec, chroot, setuid.
- Accept a number of loops, not just a number of iterations.
- Report results more usefully in a table.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 16:08:31 +00:00
jilles
22560ed4e7 sh: Allow running 'prove' from tools/regression/bin/sh again
without needing to set special environment variables, testing the 'sh' from
PATH.
2010-10-15 20:01:35 +00:00
obrien
6b87db6229 Embellish this testcase a little bit to be more clear what the output is
and why.  The first case is correct usage which has but one correct output.
The 2nd and 3rd cases are incorrect usage in which the exact output is
not standardized and various shells give various allowable output.
2010-10-14 23:28:31 +00:00
obrien
0402932766 Do not assume in growstackstr() that a "precious" character will be
immediately written into the stack after the call.  Instead let the caller
manage the "space left".

Previously, growstackstr()'s assumption causes problems with STACKSTRNUL()
where we want to be able to turn a stack into a C string, and later
pretend the NUL is not there.

This fixes a bug in STACKSTRNUL() (that grew the stack) where:
1. STADJUST() called after a STACKSTRNUL() results in an improper adjust.
   This can be seen in ${var%pattern} and ${var%%pattern} evaluation.
2. Memory leak in STPUTC() called after a STACKSTRNUL().

Reviewed by:	jilles
2010-10-13 23:29:09 +00:00
obrien
5289908373 Allow one to regression test 'sh' changes without having to install
a potentially bad /bin/sh first.
2010-10-12 18:20:38 +00:00
obrien
5d3cd8d3f0 Correct regression test to not show a false positive when run as root. 2010-10-11 23:24:57 +00:00
markm
b0968fd172 Don't blow away /bin/rmail symlink if we are keeping mailwrapper.
Mailwrapper can provide a perfectly good rmail with other
mailers.
2010-10-08 17:42:09 +00:00
pluknet
012f7d390e Clean up tools in tools/tools/netrate.
- tcpconnect incorrectly uses err() in usage() with errx() semantics [1]
  That produces dirty error message:
  tcpconnect: usage: tcpconnect [ip]: Unknown error: 0
- 64-bit aware fixes in printf() usage [2]
o   netrate/juggle: time_t has arch-dependent size
o   netrate/tcpconnect: don't assume %ll has always 64bit.

PR:		146088 [1], 146086 [2] (modified)
Approved by:	kib (mentor)
MFC after:	1 week
2010-10-08 14:31:49 +00:00
netchild
030e361d63 Add some missing files to optionally delete.
Submitted by:	Paul B Mahol <onemda@gmail.com>
2010-10-06 07:49:28 +00:00
gonzo
44073c254f - Add WITH_GPIO entry to src.conf(5) man page 2010-10-05 22:26:01 +00:00
gnn
056173e66d Change the output of mctest to give a summary of the results instead
of printing a long list.

Add a default base port, and default mulitcast address to the
runner script.

Add support for specifying a different local and remote interface
in the runner script.

MFC after:	1 week
2010-10-01 14:36:36 +00:00
mr
8f2998a3e2 - simplify by using one build script
- use label for mounting
- use GENERIC kernel
- create empty Pkg directory
2010-10-01 10:34:35 +00:00
jilles
26abe50bf1 tr: Fix '[=]=]' equivalence class.
A closing bracket immediately after '[=' should not be treated as special.

Different from the submitted patch, a string ending with '[=' does not cause
access beyond the terminating '\0'.

PR:		bin/150384
Submitted by:	Richard Lowe
MFC after:	2 weeks
2010-09-29 22:24:18 +00:00
pjd
0d99f2e43e Correct message.
Pointed out by:	jhb
MFC after:	2 weeks
2010-09-27 21:10:37 +00:00
pjd
c9b8dcdf95 Add some regression tests for newly added -J and -j options.
MFC after:	2 weeks
2010-09-25 17:41:02 +00:00
pjd
38c5ef9efb Don't hardcode md0 in message, use $md instead.
Reported by:	Ronald Klop <ronald-freebsd8@klop.yi.org>
2010-09-25 15:37:41 +00:00
trasz
4e92896d30 Don't leave zombies behind. 2010-09-25 14:54:31 +00:00
trasz
e3c17d43f8 Add a shell script to generate a test script for trivial ACLs. 2010-09-25 14:33:35 +00:00
pjd
7c38e78a3b Update regression tests after AES-XTS addition.
MFC after:	2 weeks
2010-09-25 10:34:42 +00:00
pjd
303ba2f27f - Use $md instead of md0, which fixes tests when md(4) device is already
present.
- Correct message - we create GPT, not MBR.

MFC after:	2 weeks
2010-09-25 10:34:11 +00:00
davidxu
b9b7f896c0 Add test cases for stack unwinding. 2010-09-25 04:26:40 +00:00
imp
0615d5c148 Make the labels match the device name that's mounted, not just the
slice they are on.  When NANO_LABEL is not defined, the fstab
generates entries that specify /dev/ad0s1a.  When NANO_LABEL is
defined, it generates /dev/usb/${NANO_LABEL}s1a.  The prior code
created the file system with a label of ${NANO_LABEL}s1, leading to
problems on boot.

Pointy hat to: imp@
2010-09-22 04:48:39 +00:00
avg
f330cb107c tools/umastat: more cleanups
PR:		misc/146119
Submitted by:	pluknet <pluknet@gmail.com>
MFC after:	1 week
2010-09-21 05:36:30 +00:00
imp
afe5b561cd Support new variable NANO_LABEL. When set to a non-null string,
nanobsd will build a system that uses this label (via
/dev/ufs/${NANO_LABEL}sX) in preference to NANO_DRIVE (well, it forces
NANO_DRIVE to be ufs/${NANO_LABEL}).  This allows images that will
boot off usb stick or CF card easily well.

There is no change if you don't set this variable.
2010-09-20 23:36:54 +00:00
brian
ee15e08fc2 Add a geli resize subcommand to resize encrypted filesystems prior
to growing the filesystem.

Refuse to attach providers where the metadata provider size is
wrong.  This makes post-boot attaches behave consistently with
pre-boot attaches.  Also refuse to restore metadata to a provider
of the wrong size without the new -f switch.  The new -f switch
forces the metadata restoration despite the provider size, and
updates the provider size in the restored metadata to the correct
value.

Helped by:	pjd
Reviewed by:	pjd
2010-09-20 22:04:59 +00:00
avg
6c139814a7 tools/umastat: fix build on amd64
And perhaps other 64-bit platforms.

Submitted by:	Fabian Keil <freebsd-listen@fabiankeil.de>
MFC after:	1 week
2010-09-20 21:22:15 +00:00
brian
d94a5ef824 Revise r197763 which fixes filesystem corruption when extending
into un-zeroed storage.

The original patch was questioned by Kirk as it forces the filesystem
to do excessive work initialising inodes on first use, and was never
MFC'd.  This change mimics the newfs(8) approach of zeroing two
blocks of inodes for each new cylinder group.

Reviewed by:	mckusick
MFC after:	3 weeks
2010-09-19 08:18:56 +00:00
dim
5d5cc59cc7 Vendor import of llvm r114020 (from the release_28 branch):
http://llvm.org/svn/llvm-project/llvm/branches/release_28@114020

Approved by:	rpaulo (mentor)
2010-09-17 15:48:55 +00:00
jilles
2beda3228f sh: Fix exit status if return is used within a loop condition. 2010-09-11 15:07:40 +00:00
jilles
694b7e6c37 sh: Apply variable assignments left-to-right in bltinlookup().
Example:
  HOME=foo HOME=bar cd
2010-09-11 14:15:50 +00:00
jilles
73c5bdeaeb sh: Fix 'read' if all chars before the first IFS char are backslash-escaped.
Backslash-escaped characters did not set the flag for a non-IFS character.

MFC after:	2 weeks
2010-09-08 20:35:43 +00:00
jilles
817eae6892 sh: Add simple tests for backslashes in the read builtin. 2010-09-08 18:32:23 +00:00
jilles
8d1940fec4 sh: Add a test that 'read' leaves the file pointer at the correct place.
Naive buffering would break the common while read x... construct, which did
not appear to be tested yet.
2010-09-03 21:17:33 +00:00
phk
e895a280b3 We need to copy the ports config files before we launch the prefetch 2010-09-03 09:34:15 +00:00
imp
c5088c509e Allow / in the NANO_DEVICE
PR:		149729
Submitted by:	Thomas Quinot <thomas@cuivre.fr.eu.org>
2010-09-03 03:48:06 +00:00
jilles
662ba753ab sh: Weaken builtins/command4 test to only require a nonzero exit status.
This matches what is in POSIX; various other shells use different exit
statuses.

Note that it is still required that there be no output.
2010-08-29 20:53:24 +00:00
brian
a33d520868 Add a Makefile for tools/regression/bin and support 'all' in
pax/Makefile.

MFC after:	3 weeks
2010-08-29 12:14:53 +00:00
brian
a8d67237e0 Correct an out-by-one error when earlying out ustar filenames that
are too long.  Filenames escaping this test are caught later on,
so the bug doesn't cause any breakage.

Document the correct ustar limitations in pax.  As I have no access
to the IEEE 1003.2 spec, I can only assume that the limitations
imposed are in fact correct.

Add regression tests for the filename limitations imposed by pax.

MFC after:	3 weeks
2010-08-29 11:56:56 +00:00
kib
5afcfa8055 Test the poll(2) return value.
MFC after:	2 weeks
2010-08-28 17:38:40 +00:00
gabor
415098b7a0 - Change default grep back to GNU version. BSD grep can be built with the
WITH_BSD_GREP knob.
- Bump __FreeBSD_version

Requested by:   dougb
Approved by:    delphij (mentor)
2010-08-23 10:04:26 +00:00
jilles
44306000bd sh: Remove remnants of '!!' to negate pattern.
This Almquist extension was disabled long ago.

In pathname generation, components starting with '!!' were treated as
containing wildcards, causing unnecessary readdir (which could fail, causing
pathname generation to fail while it should not).
2010-08-22 21:18:21 +00:00
jilles
bf52da60ea sh: Test that all bytes from 128 to 255 can be used in IFS.
To avoid multibyte issues, this test forces ISO8859-1 charset.

This also passes on stable/8.
2010-08-22 13:09:12 +00:00
jilles
a0dc7e84cf sh: Add a test for breaking from a loop outside the current function.
It is unwise to rely on this but I'd like to know if this would break.
2010-08-22 11:04:30 +00:00
rpaulo
1702ed2db3 Update for the new tests.
Sponsored by:	The FreeBSD Foundation
2010-08-21 14:14:24 +00:00
pjd
d2e0fb8db2 More tests. 2010-08-18 22:06:43 +00:00
jilles
28527a66ab sh: Add a test for break from a trap action. 2010-08-18 20:26:50 +00:00
kib
2c928d3c34 Add simple test to check the functioning of retrieval of
pagesize()/pagesizes() after change to use aux vector. Note that
public function getosreldate() is different from libc-internal
__getosreldate() and does not use aux to fetch osreldate value.

MFC after:	1 month
2010-08-17 09:42:50 +00:00
pjd
407c718f42 More tests, especially for lchown(2). 2010-08-17 06:08:09 +00:00
jilles
71f5d94974 sh: Reduce unnecessary testsuite failures with other shells. 2010-08-16 22:23:19 +00:00
jilles
f87a1a2d3e sh: Split off a more dubious test from parser/heredoc2.0. 2010-08-16 21:14:49 +00:00
jilles
81d99cf50d sh: Get rid of unnecessary non-standard empty lists.
POSIX does not allow constructs like:
  if cmd; then fi
  { }
Add a colon dummy command, except in a test that verifies that such empty
lists do not cause crashes when used as a function definition.
2010-08-16 17:18:08 +00:00
pjd
59ce935eae Finish renaming fstest to pjdfstest. 2010-08-15 21:29:03 +00:00
pjd
4a1c311f9e Give fstest a more unique name: pjdfstest.
It is released from time to time and used outside FreeBSD, so it is good to
have a name one can google.
2010-08-15 21:24:17 +00:00
pjd
d4c7d76723 Update copyright years. 2010-08-15 21:20:40 +00:00
pjd
7ec16847fb More tests. 2010-08-15 21:19:42 +00:00
jilles
0328c8f214 sh: Fix break/continue/return sometimes not skipping the rest of dot script.
In our implementation and most others, a break or continue in a dot script
can break or continue a loop outside the dot script. This should cause all
further commands in the dot script to be skipped. However, cmdloop() did not
know about this and continued to parse and execute commands from the dot
script.

As described in the man page, a return in a dot script in a function returns
from the function, not only from the dot script. There was a similar issue
as with break and continue. In various other shells, the return appears to
return from the dot script, but POSIX seems not very clear about this.
2010-08-15 21:06:53 +00:00
jilles
072152a8c4 sh: Test that all bytes from 1 to 127 can be used in IFS.
This also passes on stable/8.
2010-08-15 17:14:05 +00:00
pjd
03b315a9ca More tests (especially for lchmod(2)), less code duplication. 2010-08-15 14:44:48 +00:00
pjd
4d7d840be1 - Use loops to avoid code duplication.
- More tests.
2010-08-13 21:17:59 +00:00
pjd
66fa238445 More tests. 2010-08-12 20:35:14 +00:00
pjd
2ac8e0568d Portable Makefile. 2010-08-12 19:45:27 +00:00
pjd
60f714732b Fix copy&pasted code - we want to create character device here. 2010-08-12 19:43:40 +00:00
pjd
ac4d0fab5f - Use loops where possible to avoid code duplication.
- Don't pass uid and gid to create_file() if not needed.
- More tests.
2010-08-11 17:34:58 +00:00
pjd
510a3e5097 Allow to specify uid, gid and mode for create_file(). 2010-08-11 17:33:32 +00:00
mjacob
5688dd21e9 Consistently set us to be SPC3 for our inquiry data.
For mptest, add delays to I/O that simulate real disks better. This
also allows us to simulate what happens when a device goes away
with active transactions. It's pretty spectacular.

Sponsored by:	Panasas
MFC after:	1 month
2010-08-11 17:25:14 +00:00
pjd
e000343bcd More and more tests. 2010-08-11 16:34:44 +00:00
pjd
c6ffc68b54 Move create_file() to misc.sh, as it is going to be used in more places. 2010-08-11 16:34:26 +00:00
pjd
81f412d303 Make use of recently added dirgen_max() and namegen_max() to implement
ENAMETOOLONG checks.
2010-08-11 16:33:17 +00:00
pjd
286e5bb227 Instead of hardcoding {NAME_MAX} as 255 and {PATH_MAX} as 1024 obtain those from
pathconf(2) and properly generate too long file names.
This should fix ENAMETOOLONG checks on Linux.
2010-08-11 16:29:12 +00:00
pjd
8afd703de9 More tests, mostly related to devices and sockets. 2010-08-10 22:57:43 +00:00
jilles
8824c5ab76 sh: Fix heap-based buffer overflow in pathname generation.
The buffer for generated pathnames could be too small in some cases. It
happened to be always at least PATH_MAX long, so there was never an overflow
if the resulting pathnames would be usable.

This bug may be abused if a script subjects input from an untrusted source
to pathname generation, which a bad idea anyhow. Most shell scripts do not
work on untrusted data. secteam@ says no advisory is necessary.

PR:		bin/148733
Reported by:	Changming Sun snnn119 at gmail com
MFC after:	10 days
2010-08-10 22:45:59 +00:00
pjd
db2419320f Linux has no strlcpy(). 2010-08-09 20:16:52 +00:00
pjd
bf33fb9a4b Fix bind(2) and connect(2) support on Solaris. 2010-08-09 17:42:04 +00:00
pjd
20a20b3ca3 Fix file system type detection on Solaris. 2010-08-09 17:40:59 +00:00
pjd
b69af9bb70 Small tweaks. 2010-08-09 17:37:29 +00:00
pjd
a26561868e No need to use grep to check if path start with /.
Suggested by:	ed
2010-08-09 17:34:57 +00:00
mjacob
fcb0104482 Add a multipath oriented test. 2010-08-09 00:36:22 +00:00
jilles
f9b80b004e sh: Add more testcases for ${var:-word}.
Whether POSIX requires these is unclear.

They pass with 8-stable sh as well.
2010-08-08 17:03:23 +00:00
pjd
fb4dcd8fd5 Various cleanups, mostly to make the test work on FreeBSD/ZFS. 2010-08-06 23:58:54 +00:00
pjd
e7da3338b6 ${GREP} can only be used after loading 'conf'. 2010-08-06 21:58:53 +00:00
pjd
f87a4aad92 Don't use egrep directly - use ${GREP}. 2010-08-06 21:57:11 +00:00
pjd
970b3134a2 Check first todo() argument against operating system name and operating system
name plus file system name.
2010-08-06 21:56:32 +00:00
pjd
cf25be5f47 For FreeBSD and Linux use awk's toupper() function.
Suggested by:	ed
2010-08-06 21:53:50 +00:00
pjd
71f17c1253 Convert file system type to upper case. 2010-08-06 21:02:53 +00:00
pjd
0d945e4c12 Add tests for mknod(2).
Submitted by:	Jan Senolt <senoltj@centrum.cz>
Submitted by:	Milan Cermak <Milan.Cermak@Sun.COM>
Polished by:	pjd
2010-08-06 20:51:39 +00:00
pjd
3898aedc01 Add mknod(2) support.
Submitted by:	Jan Senolt <senoltj@centrum.cz>
Submitted by:	Milan Cermak <Milan.Cermak@Sun.COM>
2010-08-06 20:48:10 +00:00
pjd
9fed776db8 Sort includes. 2010-08-06 20:46:26 +00:00
pjd
c35d47a15b open(2) returns EOPNOTSUPP when trying to open a socket. 2010-08-06 19:22:42 +00:00
pjd
c0ae51d06f Test for EACCES also when opening FIFO or directory. 2010-08-06 19:20:35 +00:00
pjd
4cf064776c Test O_RDONLY|O_RDWR flags as potentially invalid. 2010-08-06 19:19:14 +00:00
pjd
9e5f58cf83 Make description readable. 2010-08-06 19:18:19 +00:00
pjd
177b3b609c Add missing -U argument to usage. 2010-08-06 19:16:48 +00:00
pjd
14f2fd5269 Implement two new syscalls: bind(2) and connect(2) for operating on UNIX
domain sockets.
2010-08-06 19:16:20 +00:00
jilles
184699830c sh: Return 0 from eval if no command was given.
This makes a difference if there is a command substitution.

To make this work, evalstring() has been changed to set exitstatus to 0 if
no command was executed (the string contained only whitespace).

Example:
  eval $(false); echo $?
should print 0.
2010-08-03 22:17:29 +00:00
jilles
2f1480605c sh: Add a test for a corner case in eval that already works correctly. 2010-08-01 22:39:07 +00:00
uqs
c2a17de64b Fix a couple of typos.
PR:		docs/148891
Submitted by:	olgeni
MFC after:	1 week
2010-07-30 11:58:18 +00:00
jilles
f8f703f788 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
17349bffe4 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
f6fa9f4a32 Hook newsyslog regression tests to the Makefile 'build'.
MFC after:	3 weeks
2010-07-22 11:38:48 +00:00
simon
4167320c67 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
45419f13de Chase LLVM version bump to 2.8. 2010-07-21 08:27:56 +00:00
jilles
8be68756a9 sh: Allow a background command consisting solely of redirections.
Example:
  </dev/null &

MFC after:	2 weeks
2010-07-18 12:45:31 +00:00
rdivacky
c1c3262b63 Update LLVM to r108428. 2010-07-15 17:06:11 +00:00
rdivacky
9112829d76 Update LLVM to r108243. 2010-07-13 17:19:57 +00:00
emaste
a3fd34d655 Use canonical spelling of FreeBSD.org
Submitted by:	Garrett Cooper
2010-07-06 19:43:40 +00:00
emaste
24fa71e44c Switch to my @freebsd.org email address. 2010-07-06 17:00:20 +00:00
jilles
4802d158ef 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
rwatson
1bee12309e Add TCP scalability testing wrapper scripts for tcpp.
Sponsored by:	Juniper Networks
MFC after:	1 week
2010-06-22 10:46:57 +00:00
rwatson
bd37a43770 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
58c520e562 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
netchild
603823a076 Add the ZFS periodic daily scripts to the ZFS part. 2010-06-17 12:37:50 +00:00
imp
b6af132fc7 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
imp
ec94057268 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
imp
d320499860 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
imp
67f7af35ee 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
abc3ca6c60 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
bf4bbba565 Fix typo.
Spotted by:	Garrett Cooper
2010-06-10 06:20:26 +00:00
ed
b988a85e4b This should be commented out. 2010-06-09 20:18:18 +00:00
rdivacky
b1ade03b77 Add WITHOUT_CLANG file with a description.
Approved by:	ed (mentor)
2010-06-09 20:11:35 +00:00
mjacob
f6ce2bf5e8 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
rwatson
a4945a1273 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
rwatson
f8ea50244a 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
03bbab0211 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
aa2a5c4ca5 o Makefile BSDfication.
PR:		misc/147461 (with my changes)
Submitted by:	Erik Cederstrand
2010-06-04 08:19:43 +00:00
maxim
34798567b5 o Fix typo: .uudef -> .undef.
PR:		misc/147462
Submitted by:	Erik Cederstrand
2010-06-04 08:14:30 +00:00
brian
cb476e3fa5 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
e65f4ccf95 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
930ce39226 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
c5fcbff43a 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
bb4be30b2d sh: Add some simple tests for ., exec and return from . script. 2010-05-28 22:08:34 +00:00
rwatson
b7cd561c87 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
rdivacky
1e3dec662e Update LLVM to r104832. 2010-05-27 15:15:58 +00:00
rwatson
f991908654 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
raj
08c219d72b 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
add6413e9a sh: Add some simplistic tests for the wait builtin. 2010-05-23 22:10:20 +00:00
jkim
3eeaed332a Add an option file for WITHOUT_MAN_UTILS to regenerate src.conf(5). 2010-05-20 00:07:21 +00:00
uqs
e644199c18 mdoc: consistently spell our email addresses <foo@FreeBSD.org>
Reviewed by:	ru
2010-05-19 08:57:53 +00:00
uqs
1ab3783e1a 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
c49fe4933f 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
169738b8d3 sh: Add some simple testcases for pathname expansion. 2010-05-11 22:28:55 +00:00
jilles
a4f5ad53c1 Fix error in comment. 2010-05-09 17:15:26 +00:00
jilles
c0ec19525d 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
3c55249664 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
e9a796d715 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
f3856c6cf2 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
rdivacky
750ce4d809 Update LLVM to r103004. 2010-05-04 16:11:02 +00:00
philip
306735e614 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
0b9b56e38e 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
jkim
70c33ced37 Adjust a test case and make it more jump optimization neutral for JIT case. 2010-04-23 22:42:49 +00:00
jilles
62aa81d6a0 sh: Add some more tests for ${v#...} and ${v%...}.
These pass on stable/8 as well.
2010-04-23 17:26:49 +00:00
rwatson
78507bba4a Merge @176820, @176822, @177156 to tcpp from P4 to HEAD:
Improve accuracy of connection data transfer math.

  Disable Nagle's algorithm to avoid delaying transfers of data --
  will want to refine this to combine payload with header transfer,
  however.

  Now that we're running w/o Nagle, try to send the initial data
  burst with the header in a single TCP segment.

  Prefer %zu to %ju for size_t.

MFC after:	1 week
Sponsored by:	Juniper, Inc.
2010-04-21 00:52:55 +00:00
rpaulo
4a38b6e8a5 Dump the AR_PHY_TURBO register on the AR5416. This register holds 11n
configurations.

Sponsored by:	iXsystems, inc.
2010-04-19 17:16:23 +00:00
jilles
1027d9c280 sh: Add testcases for double-quotes within quoted ${var+-...} (non-POSIX).
POSIX leaves things like "${var+"word"}" undefined.
We follow traditional ash behaviour here.
Hence, these testcases also work on stable/8.
2010-04-18 22:13:45 +00:00
jilles
286029c478 sh: On startup of the shell, use PWD from the environment if it is valid.
Unset PWD if it is incorrect and no value for it can be determined.
This preserves the logical current directory across shell invocations.

Example (assuming /home is a symlink):
$ cd
$ pwd
/home/foo
$ sh
$ pwd
/home/foo

Formerly the second pwd would show the physical path (symlinks resolved).
2010-04-17 14:35:46 +00:00
jilles
bb1d9873c9 fnmatch: Fix bad FNM_PERIOD disabling if an asterisk has been seen.
Example: fnmatch("a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD)

PR:		116074
MFC after:	1 week
2010-04-16 22:29:24 +00:00
jilles
dd4fae15ab Add some tests for fnmatch(3).
MFC after:	1 week
2010-04-16 22:15:26 +00:00
jilles
61df70a66f sh: Test that bogus values of PWD are not imported from the environment.
Current versions pass this test trivially by never importing PWD, but I plan
to change sh to import PWD if it is an absolute pathname for the current
directory, possibly containing symlinks.
2010-04-11 20:21:34 +00:00
imp
3cfea60eb1 Fix comment about NANO_ARCH. It can be set now. Also add a warning
about how it confuses TARGET and TARGET_ARCH and the need to separate
the two out into independent variables.
2010-04-06 16:23:12 +00:00
rdivacky
5f970ec96e Update LLVM to r100520. 2010-04-06 15:52:58 +00:00
jilles
ca9540f0dc sh: Add test for nested arithmetic substitution.
Pre-r206145 sh changes nested arithmetic substitution to parentheses, which
is not always correct, as exercised by this test.
2010-04-04 16:48:33 +00:00
jilles
85f39c5eeb sh: Add test for some associativity in arithmetic. 2010-04-04 16:29:48 +00:00
jilles
d21d692410 sh: Do tilde expansion in substitutions.
This applies to word in ${v-word}, ${v+word}, ${v=word}, ${v?word} (which
inherits quoting from the outside) and in ${v%word}, ${v%%word}, ${v#word},
${v##word} (which does not inherit any quoting).

In all cases tilde expansion is only attempted at the start of word, even if
word contains spaces. This agrees with POSIX and other shells.

This is the last part of the patch tested in the exp-run.

Exp-run done by: erwin (with some other sh(1) changes)
2010-04-03 22:04:44 +00:00
jilles
2b94976ff7 sh: Fix duplicate variable name in test. 2010-04-03 21:56:24 +00:00
jilles
58f0facfbf sh: Add some testcases for the working parts of tilde expansion. 2010-04-03 21:32:22 +00:00
jilles
8b7edeca44 sh: Allow quoting pattern match characters in ${v%pat} and ${v#pat}.
Note that this depends on r206145 for allowing pattern match characters to
have their special meaning inside a double-quoted expansion like "${v%pat}".

PR:		bin/117748
Exp-run done by:	erwin (with some other sh(1) changes)
2010-04-03 21:07:50 +00:00
jilles
631cfa1748 sh: Fix various things about expansions:
* remove the backslash from \} inside double quotes inside +-=?
  substitutions, e.g. "${$+\}a}"
* maintain separate double-quote state for ${v#...} and ${v%...};
  single and double quotes are special inside, even in a double-quoted
  string or here document
* keep track of correct order of substitutions and arithmetic

This is different from dash's approach, which does not track individual
double quotes in the parser, trying to fix this up during expansion.
This treats single quotes inside "${v#...}" incorrectly, however.

This is similar to NetBSD's approach (as submitted in PR bin/57554), but
recognizes the difference between +-=? and #% substitutions hinted at in
POSIX and is more refined for arithmetic expansion and here documents.

PR:		bin/57554
Exp-run done by:	erwin (with some other sh(1) changes)
2010-04-03 20:55:56 +00:00
jilles
11ba493dd7 sh: Add some testcases for the working parts of ${v%...} and ${v#...}. 2010-04-03 20:14:10 +00:00
rdivacky
62cc576dca Update LLVM to r100285. 2010-04-03 07:51:10 +00:00
rdivacky
20e856b2a5 Update LLVM to r100181. 2010-04-02 08:54:30 +00:00
imp
e62c77fe41 Two fixes:
(1) We don't need a custom install_kernel.  We can install without
symbols by adding INSTALL_NODEBUG (which likely should be
WITHOUT_KERNEL_SYMBOLS_FILE, or something shorter) to CONF_INSTALL
(2) for make buildenv stage, use NANO_MAKE_CONF_BUILD rather than the
non-existant NANO_MAKE_CONF.

MFC after:	7 days
2010-03-31 18:18:37 +00:00
imp
968dcf13b5 Stop hard coding i386 as the arch for the build. Instead, default to the
processor we're running on.  Also, supply amd64 version of create_diskimage
that's the same as i386's.

# didn't fix the confusion between using the processor for this and using
# the machine (which would be more appropriate).  NANO_ARCH smashes the two
# together right now.

MFC after:	7 days
2010-03-31 14:42:07 +00:00
delphij
c77aa7eff5 Remove GNU cpio after fix of CVE-2010-0624.
Note that this is actually a no-op for most users, as this GNU
cpio was broken on -HEAD and 8-STABLE since last March until
the recent fix.

FreeBSD 8.0+ uses BSD cpio by default and the code is being
actively maintained.

Blessed by:	kientzle
With hat:	secteam
MFC after:	3 days
2010-03-26 17:02:32 +00:00
phk
dc22037ebf Use gpart(8) to set the active boot partition. 2010-03-24 11:21:33 +00:00
edwin
9792f6e953 Replace -b with -C and -B (as proposed by Alexander).
Add -3, -A and -B to the usage.
Update regression test for the new parameters.
2010-03-21 21:33:21 +00:00
rdivacky
2f2afc1aae Update LLVM to r99115. 2010-03-21 10:49:05 +00:00
kib
174557d034 Add missing headers. While there, arrange headers alphabetically.
MFC after:	3 days
2010-03-16 20:42:54 +00:00
kib
856f335750 Add missing headers.
MFC after:	3 days
2010-03-16 20:41:45 +00:00
rdivacky
0f448b8416 Update LLVM to r98631. 2010-03-16 16:51:38 +00:00
jilles
d88c6b2784 sh: Do not abort on a redirection error on a compound command.
Redirection errors on subshells already did not abort the shell because
the redirection is executed in the subshell.

Other shells seem to agree that these redirection errors should not abort
the shell.

Also ensure that the redirections will be cleaned up properly in cases like
  command eval '{ shift x; } 2>/dev/null'

Example:
  { echo bad; } </var/empty/x; echo good
2010-03-14 14:24:35 +00:00
jilles
b9152e6b95 sh: Add test for redirection error on subshell (should not abort). 2010-03-14 13:51:12 +00:00
kib
a13f0a9942 Remove dot at the end of errx() message.
Noted by:	bde
MFC after:	3 days
2010-03-14 13:29:09 +00:00
kib
4ec03e4143 Adjust style, fix typo, do not print errno because it is meaningless there.
This test fails for now.

MFC after:	3 days
2010-03-14 13:05:48 +00:00
kib
e919ba6d14 Make it compile on LP64 arches.
MFC after:	3 days
2010-03-14 13:04:09 +00:00