Commit Graph

2613 Commits

Author SHA1 Message Date
Max Khon
c33e09b444 Add a comment that shows how to limit the build to the specific list of arches. 2011-11-28 14:03:36 +00:00
Jilles Tjoelker
0d4c3087c0 sh: Add tests for some corner cases of 'case' exit status.
These already work properly.
2011-11-26 22:28:25 +00:00
Max Khon
b8a1e4a8c3 Add missing ;; 2011-11-24 14:22:05 +00:00
Max Khon
bc14d7f4c4 Utility script to build specific parts of the source tree on all arches 2011-11-24 14:16:01 +00:00
Adrian Chadd
317d14cf46 Tidy up the statistic documentation.
Sponsored by:	Hobnob, Inc.
2011-11-23 05:03:27 +00:00
Adrian Chadd
1df8da4c64 Add the new statistics introduced in r227868.
Sponsored by:	Hobnob, Inc.
2011-11-23 05:01:23 +00:00
Jilles Tjoelker
bf3db314f7 sh: Allow unsetting OPTIND.
Note that only assigning the decimal value 1 resets getopts, as before.
2011-11-20 21:48:50 +00:00
Dimitry Andric
fd75cb79ce Revert r227538, since it doesn't compile with clang at all (it doesn't
allow the built-in operations to be redefined, at least not without
excessive force).

Instead, just disable LLVM's support for atomic operations for now.
Nothing in either clang or the tablegen tools currently depends on it.

This still allows users of head built before r198344 to upgrade to
top-of-head seamlessly.
2011-11-17 21:06:53 +00:00
Luigi Rizzo
68b8534bdf Bring in support for netmap, a framework for very efficient packet
I/O from userspace, capable of line rate at 10G, see

	http://info.iet.unipi.it/~luigi/netmap/

At this time I am bringing in only the generic code (sys/dev/netmap/
plus two headers under sys/net/), and some sample applications in
tools/tools/netmap. There is also a manpage in share/man/man4 [1]

In order to make use of the framework you need to build a kernel
with "device netmap", and patch individual drivers with the code
that you can find in

	sys/dev/netmap/head.diff

The file will go away as the relevant pieces are committed to
the various device drivers, which should happen in a few days
after talking to the driver maintainers.

Netmap support is available at the moment for Intel 10G and 1G
cards (ixgbe, em/lem/igb), and for the Realtek 1G card ("re").
I have partial patches for "bge" and am starting to work on "cxgbe".
Hopefully changes are trivial enough so interested third parties
can submit their patches. Interested people can contact me
for advice on how to add netmap support to specific devices.

CREDITS:
    Netmap has been developed by Luigi Rizzo and other collaborators
    at the Universita` di Pisa, and supported by EU project CHANGE
    (http://www.change-project.eu/)
    The code is distributed under a BSD Copyright.

[1] In my opinion is a bad idea to have all manpage in one directory.
  We should place kernel documentation in the same dir that contains
  the code, which would make it much simpler to keep doc and code
  in sync, reduce the clutter in share/man/ and incidentally is
  the policy used for all of userspace code.
  Makefiles and doc tools can be trivially adjusted to find the
  manpages in the relevant subdirs.
2011-11-17 12:17:39 +00:00
Dimitry Andric
5a880d34e1 LLVM uses atomic operations, which are not supported on i386 and GCC
emits calls for them, rather than expanding them inline.  Older FreeBSD
versions compile for i386 by default and as such we end up with
unresolved symbols when we build LLVM's TableGen utility as a build
tool on them.  Add the functions that GCC emits here, but don't bother
to make them atomic. Such is not needed.

Submitted by:	marcel
MFC after:	1 week
2011-11-15 20:15:58 +00:00
David Schultz
35ee51e291 A regression test to ensure that arc4random returns different sequences
in parent and child processes after a fork.
2011-11-15 05:55:15 +00:00
Olivier Houchard
c2a24727c8 Add IPv6 support to netblast/netsend/netreceive
PR:		bin/161368
Submitted by:	Olivier Cochard-Labbe <olivier AT cochard doT me>
2011-11-08 17:23:43 +00:00
Jilles Tjoelker
ddc13b6f44 fifo_misc test: Fix swapped lseek arguments.
It worked regardless because SEEK_CUR happens to be 1.
2011-11-05 22:33:19 +00:00
Jilles Tjoelker
06842f4c3e sh: Add test for exit status of for loop without items.
POSIX says the exit status of a for loop without any items shall be 0. There
are no exceptions if the exit status of the previous command was not 0 or if
the item list contains a command substitution with non-zero exit status.
2011-10-28 23:02:21 +00:00
Adrian Chadd
b1b75b3b75 Bring over the new aggregate statistics from the 11n branch.
Some of these values are currently updated by the driver (the 11n
RX related statistics) so they are immediately useful.
2011-10-26 16:11:49 +00:00
Pawel Jakub Dawidek
13e6fd986b Fix resize regressions tests - we need to destroy BSDlabel before we can
create GPT.

MFC after:	3 days
2011-10-25 13:41:12 +00:00
Poul-Henning Kamp
b2d1ddebf1 Add a "-P olddistfiles" facility to prefetch ports distfiles, using an
old distfile directory as primary source:

      mkdir /freebsd/ports/distfiles.old
      mv /freebsd/ports/distfiles/* /freebsd/ports/distfiles.old
      sh sysbuild.sh -c $yourconfig -P /freebsd/ports/distfiles.old
      rm -rf /freebsd/ports/distfiles.old

Unfortunately bsd.ports.mk does not attempt to use a hard-link so
while this runs you need diskspace for both your old and your "new"
distfiles.
2011-10-23 19:46:01 +00:00
Pawel Jakub Dawidek
1ae7ff8ba6 Because ZFS boot code was very fragile in the past and real PITA to debug,
introduce zfsboottest.sh script that will verify if it will be possible to boot
from the given pool.

	# zfsboottest.sh system

Where "system" is pool name of the pool we want to boot from.

What is being verified by the script:
- Does the pool exist?
- Does it have bootfs property configured?
- Is mountpoint property of the boot dataset set to 'legacy'?

Dataset configured in bootfs property has to be mounted to perform more
checks:
- Does the /boot directory in boot dataset exist?
- Is this dataset configured as root file system in /etc/fstab or set
  in vfs.root.mountfrom variable in /boot/loader.conf?

By using zfsboottest tool the script will read all the files in /boot
directory using ZFS boot code and calculate their checksums.
Then, it will walk /boot directory using find(1) though regular file sytem
and also read all the files in /boot directory and calculate their checksums.
If any of the files cannot be looked up, read or checksum is invalid it will
be reported and booting off of this pool is probably not possible.

Some additional checks may be interesting as well. For example if the disks
contain proper pmbr and gptzfsboot code or if all expected files in /boot/
are present.

When upgrading FreeBSD, one should snapshot datasets that contain operating
system, upgrade (install new world and kernel) and use zfsboottest.sh to verify
if it will be possible to boot from new configuration. If all is good one
should upgrade boot blocks, by eg.:

	# gpart -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

If something is wrong, one should rollback datasets and report the problems.

MFC after:	3 days
2011-10-21 13:44:26 +00:00
Pawel Jakub Dawidek
cf43b453ec - Allow to specify multiple files to check, eg.
zfsboottest gpt/system0 gpt/system1 - /boot/kernel/kernel /boot/zfsloader

- Instead of printing file's content calculate MD5 hash of the file,
  so it can be easly compared to the hash calculated via file system.
- Some other minor improvements.

MFC after:	3 days
2011-10-21 13:13:18 +00:00
David Schultz
417c551014 Add regression tests for modf{,f,l}(). 2011-10-21 06:36:40 +00:00
David Schultz
6fcec4dd2b Tests for complex trig and hyperbolic functions. 2011-10-21 06:34:38 +00:00
David Schultz
417f648842 Tests for cancellation in fma(). Also include more tests for 128-bit
long doubles. Thanks for clusteradm (simon) for making the needed
hardware available.
2011-10-21 06:32:54 +00:00
Dimitry Andric
36981b17ed Vendor import of clang release_30 branch r142614:
http://llvm.org/svn/llvm-project/cfe/branches/release_30@142614
2011-10-20 21:14:49 +00:00
Dimitry Andric
30815c536b Vendor import of llvm release_30 branch r142614:
http://llvm.org/svn/llvm-project/llvm/branches/release_30@142614
2011-10-20 21:10:27 +00:00
Jilles Tjoelker
b0e4234a5a Fix some memory errors in *at() regression tests. 2011-10-18 22:51:40 +00:00
David Schultz
31b4d3aef3 Add some tests for corner cases of log() in unusual rounding modes.
I wrote these ages ago, but they've been failing until now.
2011-10-15 05:28:13 +00:00
David Schultz
9c7781b7a3 Add some tests for double-rounding bugs in fma(). 2011-10-15 05:26:16 +00:00
Andrew Thompson
b1657d09e6 Fix build after TARGET_BIG_ENDIAN was nuked from orbit. 2011-10-11 01:11:57 +00:00
Stanislav Sedov
7c450da7b4 - Import Heimdal 1.5 distribution. 2011-10-05 07:23:29 +00:00
Stanislav Sedov
b4e3a10e93 - Kill files that do not belong to the laters heimdal version imported. 2011-09-29 05:58:09 +00:00
Stanislav Sedov
31f1e9c17f - Flatten the vendor heimdal tree. 2011-09-29 05:23:57 +00:00
Stanislav Sedov
611ff617cf - Add missing interdependencies to kerberos libraries. Some of the
kerberos libraries were not linked properly (missing dependencies),
  which causes 3rd party applications linking to fail when --as-needed
  ld flag is used.  I also added the --no-undefined ld(1) flag to make
  sure that there're no missing dependencies.

MFC after:	3 days
2011-09-27 07:14:12 +00:00
Andriy Gapon
ed8945cb71 zfsboottest: some additional enhancements
- redirect diagnostics printfs in the boot code to stderr
- do not read trailing garbage from a trailing block of a file

Also add my copyright to the file after making so many changes.

Approved by:	re (kib)
MFC after:	1 week
2011-09-16 08:24:31 +00:00
Andriy Gapon
d560f3523c zfstest: rename to zfsboottest and move to tools
Approved by:	re (kib)
MFC after:	1 week
2011-09-16 08:22:48 +00:00
Marius Strobl
7493181297 Fix alignment assumptions.
PR:		160289
Approved by:	re (kib)
MFC after:	3 days
2011-09-02 16:40:18 +00:00
Bjoern A. Zeeb
8a006adb24 Add support for IPv6 to ipfw fwd:
Distinguish IPv4 and IPv6 addresses and optional port numbers in
user space to set the option for the correct protocol family.
Add support in the kernel for carrying the new IPv6 destination
address and port.
Add support to TCP and UDP for IPv6 and fix UDP IPv4 to not change
the address in the IP header.
Add support for IPv6 forwarding to a non-local destination.
Add a regession test uitilizing VIMAGE to check all 20 possible
combinations I could think of.

Obtained from:	David Dolson at Sandvine Incorporated
		(original version for ipfw fwd IPv6 support)
Sponsored by:	Sandvine Incorporated
PR:		bin/117214
MFC after:	4 weeks
Approved by:	re (kib)
2011-08-20 17:05:11 +00:00
Jonathan Anderson
b465884f42 Test process descriptors.
Ensure that process descriptors work as expected. We should be able to:
 - pdfork(), like regular fork(), but producing a process descriptor
 - pdgetpid() to convert a PD into a PID
 - pdkill() to send signals to a process identified by a PD

Approved by:  re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-18 23:15:04 +00:00
Jonathan Anderson
d6f7248983 poll(2) implementation for capabilities.
When calling poll(2) on a capability, unwrap first and then poll the
underlying object.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-16 14:14:56 +00:00
Jonathan Anderson
d1b6899e83 Rename CAP_*_KEVENT to CAP_*_EVENT.
Change the names of a couple of capability rights to be less
FreeBSD-specific.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-12 14:26:47 +00:00
Jonathan Anderson
a0108be612 Test *at(2) calls with capability-mode lookup.
This commit adds regression testing for openat(), fstatat(), etc. with
capability scoping ("strict relative" lookup), which applies:
 - in capability mode
 - when performing any *at() lookup relative to a capability

These tests will fail until the *at() code is committed; on my local
instance, with the *at() changes, they all pass.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-12 10:52:46 +00:00
Jonathan Anderson
dbb202b398 Use the right printf() format string without a cast to maxint_t.
As per kib's suggestion, we also change test_count from a size_t to an int;
its value at the moment is 4, and we only expect it to go up to 7.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-11 15:52:06 +00:00
Robert Watson
a9d2f8d84f Second-to-last commit implementing Capsicum capabilities in the FreeBSD
kernel for FreeBSD 9.0:

Add a new capability mask argument to fget(9) and friends, allowing system
call code to declare what capabilities are required when an integer file
descriptor is converted into an in-kernel struct file *.  With options
CAPABILITIES compiled into the kernel, this enforces capability
protection; without, this change is effectively a no-op.

Some cases require special handling, such as mmap(2), which must preserve
information about the maximum rights at the time of mapping in the memory
map so that they can later be enforced in mprotect(2) -- this is done by
narrowing the rights in the existing max_protection field used for similar
purposes with file permissions.

In namei(9), we assert that the code is not reached from within capability
mode, as we're not yet ready to enforce namespace capabilities there.
This will follow in a later commit.

Update two capability names: CAP_EVENT and CAP_KEVENT become
CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they
represent.

Approved by:	re (bz)
Submitted by:	jonathan
Sponsored by:	Google Inc
2011-08-11 12:30:23 +00:00
Navdeep Parhar
223eb00dd0 Move cxgbtool from usr.sbin to tools/tools.
Approved by:	re (kib)
MFC after:	1 month
2011-08-10 22:03:34 +00:00
Robert Watson
e397f116c3 Properly initialise the "len" argument to getsockname(2) in the tcpdrop
regression test so that it works (more) consistently.

Approved by:	re (bz)
Sponsored by:	Juniper Networks
2011-08-06 19:20:17 +00:00
Jonathan Anderson
b7f2d66a79 Expect fchflags(2) to fail with EOPNOTSUPP on NFS.
Even if we have CAP_FCHFLAGS, fchflags(2) fails on NFS. This is normal
and expected, so don't fail the test because of it.

Note that, whether or not we are on NFS, fchflags(2) should always fail
with ENOTCAPABLE if we are using a capability that does not have the
CAP_FCHFLAGS right.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-05 17:43:11 +00:00
Jonathan Anderson
da7496721e Flesh out the cap_test regression test.
Add more regression testing, some of which is expected to fail until we
commit more kernel implementation.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-04 17:17:57 +00:00
Jonathan Anderson
f8c6c2cf5a Flesh out the cap_test regression test.
Add more regression testing, some of which is expected to fail until we
commit more kernel implementation.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-04 14:20:13 +00:00
Andriy Gapon
235cc4c620 update smp related documentation after recent changes
Remove references to machdep.hlt_logical_cpus and
machdep.hlt_cpus sysctls and tunables.
Document machdep.hyperthreading_allowed and
hint.lapic.X.disabled tunables.

Prompted by:	ru
Proofreading:	bf
Reviewed by:	jhb
Approved by:	re (kib)
2011-07-30 20:42:14 +00:00
Adrian Chadd
9381916024 Add athradar, an implementation of the radar parameter diagnostic
API.

This is a reimplementation from scratch.

Approved by:	re (kib)
2011-07-22 09:34:31 +00:00
Dimitry Andric
180abc3db9 Vendor import of clang trunk r135360:
http://llvm.org/svn/llvm-project/cfe/trunk@135360
2011-07-17 15:40:56 +00:00
Dimitry Andric
411bd29eea Vendor import of llvm trunk r135360:
http://llvm.org/svn/llvm-project/llvm/trunk@135360
2011-07-17 15:36:56 +00:00
Jilles Tjoelker
53b93f2f8a sh: Add a test for a fairly obscure case with aliases.
This also passes on stable/8.
2011-07-16 16:14:14 +00:00
Philip Paeps
daf097c040 Garbage-collect the tools for maintaining the previous PCI vendors list. The
sources this tool collates are no longer available and the format of the
current database is directly usable by pciconf(8) without needing any special
processing.
2011-07-16 15:43:14 +00:00
Jilles Tjoelker
9ea47cacda posix_spawn: If an error is detected in the child process, reap the zombie.
Formerly, in this case an error was returned but the pid was also returned
to the application, requiring the application to use unspecified behaviour
(the returned pid in error situations) to avoid zombies.

Now, reap the zombie and do not return the pid.

MFC after:	2 weeks
2011-07-10 14:20:11 +00:00
Jonathan Anderson
345f2b96e2 Clarify the meaning of a test.
Rather than using err() if either of two failure conditions
fires (which can produce spurious error messages), just use
errx() if the one condition that really matters fires.

In practice, this single test is enough to detect the failure
mode we're looking for (kqueue being inherited across fork).

Approved by: mentor (rwatson), re (Capsicum blanket)
Sponsored by: Google Inc
2011-07-08 12:16:30 +00:00
Jonathan Anderson
0136244a52 Ensure that kqueue is not inherited across fork().
Modify the existing unit test (from libkqueue) which already exercises process events via
fork() and kill(). Now, the child process simply checks that the 'kqfd' descriptor is invalid.

Some minor modifications were required to make err() work correctly. It seems that this test
was imported using the output of a configure script, but config.h was not included in key
places, nor was its syntax correct (need '#define HAVE_FOO 1' rather than '#define HAVE_FOO').

Finally, change main() to run the "proc" suite by default, but widened the '#if TODO' in
proc.c to include the non-functioning test event_trigger().

Approved by: mentor (rwatson), re (Capsicum blanket)
Sponsored by: Google Inc
2011-07-07 18:07:03 +00:00
Jilles Tjoelker
b5845df384 sh: Test that '!' is literal if quoted and first char of bracket expression
This also works on stable/8.
2011-06-25 20:37:43 +00:00
Hans Petter Selasky
c9a6ce0cd8 - Need to respect the module name and the USB mode when accumulating device ID's.
- Be more verbose on file seek failures. Allow a file size of zero.
- Improve the wrapper shell.

MFC after:	14 days
2011-06-25 15:22:44 +00:00
Hans Petter Selasky
4449ead376 - Improve bus_autoconf tool.
- Implement simple and generic language which can
be used to describe any kind of device ID structures.
- Fix endian issues.
- Add an example format file.

Suggested by:	imp @
MFC after:	14 days
2011-06-25 13:44:05 +00:00
Hans Petter Selasky
a433a3d8c9 - We need to sort all USB device ID's together. Else the matching order will
be wrong. This is required because devd only executes one entry.

MFC after:	14 days
2011-06-24 21:27:33 +00:00
Hans Petter Selasky
160d9dc32b - Make sure we don't match the wrong device by adding
a match for the bus the device belongs to.

PR:		misc/157903
MFC after:	14 days
2011-06-24 04:35:58 +00:00
Hans Petter Selasky
e71c21385e - Add additional information to the PnP info of USB HUBs children which
is now required by bus_autoconf.
- Allow interface class matching even if device class is vendor specific.
- Update bus_autoconf tool to not generate system and subsystem match lines
  for the nomatch event.

PR:		misc/157903
MFC after:	14 days
2011-06-24 04:16:06 +00:00
Hans Petter Selasky
f1a16106b6 - Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
	host, device or dual mode
- Add generic tool to extract these data:
	tools/bus_autoconf

Discussed with:	imp
Suggested by:	Robert Millan <rmh@debian.org>
PR:		misc/157903
MFC after:	14 days
2011-06-24 02:30:02 +00:00
Jilles Tjoelker
57b1b54fdd sh: Add test for r223282. 2011-06-19 00:00:36 +00:00
Ed Schouten
9f0c9022c2 Add WITHOUT_UTMPX switch to the build system.
This knob removes the tools that are exclusively used to view and
maintain the databases maintained by utmpx, namely last, users, who,
wtmpcvt, ac, lastlogin and utxrm.

The tool w is not in this list, because it has some other functionality
which is unrelated to utmpx; it is hardlinked to the uptime tool.
2011-06-17 21:30:21 +00:00
Ed Schouten
2663175a9e Don't remove the periodic script for ac(8) when setting WITHOUT_ACCT. 2011-06-17 21:20:41 +00:00
Ed Schouten
f1c344b293 Don't omit ac(8) as part of WITHOUT_ACCT.
The WITHOUT_ACCT switch is supposed to omit tools related to process
accounting, namely accton and sa. ac(8) is just a simple tool that
prints statistics based on data in the utx.log database. It has nothing
to do with the former.
2011-06-17 20:47:44 +00:00
Jilles Tjoelker
c9afaa6389 sh: Add case statement fallthrough (with ';&' instead of ';;').
Replacing ;; with the new control operator ;& will cause the next list to be
executed as well without checking its pattern, continuing until a list ends
with ;; or until the end of the case statement. This is like omitting
"break" in a C "switch" statement.

The sequence ;& was formerly invalid.

This feature is proposed for the next POSIX issue in Austin Group issue
#449.
2011-06-17 13:03:49 +00:00
Jilles Tjoelker
f5f215e251 sh: Skip variables with invalid names in "set", "export -p", "readonly -p".
This ensures the output of these commands is valid shell input.
2011-06-17 10:21:24 +00:00
Jilles Tjoelker
c5aef5377c sh: Reduce unnecessary forks with eval.
The eval special builtin now runs the code with EV_EXIT if it was run
with EV_EXIT itself.

In particular, this eliminates one fork when a command substitution contains
an eval command that ends with an external program or a subshell.

This is similar to what r220978 did for functions.
2011-06-16 21:50:28 +00:00
Jilles Tjoelker
ff4dc67299 sh: Add support for named character classes in bracket expressions.
Example:
  case x in [[:alpha:]]) echo yes ;; esac
2011-06-15 21:48:10 +00:00
Dimitry Andric
29cafa66ad Vendor import of clang trunk r132879:
http://llvm.org/svn/llvm-project/cfe/trunk@132879
2011-06-12 15:46:16 +00:00
Dimitry Andric
56fe8f1409 Vendor import of llvm trunk r132879:
http://llvm.org/svn/llvm-project/llvm/trunk@132879
2011-06-12 15:42:51 +00:00
Jilles Tjoelker
7de40d014f sh: Add test for LC_COLLATE-based character ranges in case. 2011-06-12 12:55:46 +00:00
Jilles Tjoelker
477a50a6f6 sh: Add test for case pattern matching with iso-8859-1 charset.
This also passes on stable/8.
2011-06-12 12:27:17 +00:00
Navdeep Parhar
df262243ac Add "context" subcommand to fetch and display SGE context. 2011-06-11 04:55:15 +00:00
Jilles Tjoelker
1a62d8843d sh: Do parameter expansion on ENV before using it.
This is required by POSIX, and allows things like ENV=\$HOME/.shrc.

Note that tilde expansion is explicitly not performed.
2011-06-10 22:42:00 +00:00
Jilles Tjoelker
292e667663 sh: Do parameter expansion before printing PS4 (set -x).
The function name expandstr() and the general idea of doing this kind of
expansion by treating the text as a here document without end marker is from
dash.

All variants of parameter expansion and arithmetic expansion also work (the
latter is not required by POSIX but it does not take extra code and many
other shells also allow it).

Command substitution is prevented because I think it causes too much code to
be re-entered (for example creating an unbounded recursion of trace lines).

Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would
be quite useful.
2011-06-09 23:12:23 +00:00
Navdeep Parhar
8a6a6922d9 cxgbetool: a tool for the cxgbe(4) driver. 2011-06-09 20:21:45 +00:00
Jilles Tjoelker
725cc7854e sh: Add simple tests for set -x and PS4. 2011-06-08 21:58:19 +00:00
Jilles Tjoelker
b3f892d9e0 sh: Fix $? in heredocs on simple commands.
PR:		bin/41410
2011-06-05 14:13:15 +00:00
Jilles Tjoelker
b17788c1a9 sh: Add already working testcases for $? in here-document.
If the here-document is attached to a compound command or subshell, $?
already works properly. This is both a workaround for bin/41410 and a
requirement for a true fix for bin/41410.

PR:		bin/41410
MFC after:	1 week
2011-06-05 12:46:26 +00:00
Robert Watson
7fcc404b47 Add a very simple IPDIVERT test, which creates IP divert sockets and
checks for collision/non-collision properties in binding them.  This
test would have identified a bug recently reported on current@
involding my disaggregation of the pcbinfo lock.

It would be nice if this test also exercised packet diversion and
injection, but that is for another day.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-06-04 16:25:12 +00:00
Jilles Tjoelker
47a5ab295a sh: Reduce more needless differences between error messages. 2011-06-04 15:05:52 +00:00
Jilles Tjoelker
9338c85c31 sh: Honour -n while processing -c string. 2011-06-04 11:28:42 +00:00
Jilles Tjoelker
3eee62c606 sh: Add tests for -n flag. These already pass. 2011-06-03 21:17:42 +00:00
Warner Losh
1d6fbefd90 Don't need (and can't use) -L to copy links here. 2011-05-31 17:14:06 +00:00
Jilles Tjoelker
36ae1a9441 sh: Add tests for some somewhat obscure aspects of function definitions. 2011-05-30 21:49:59 +00:00
Bjoern A. Zeeb
3e622db1cb Upgrade jail(2) to latest jail(2) API to make the regression test work
again.  Eventually should switch to jail_set(2).

Reported by:	rwatson
MFC after:	10 days
2011-05-30 09:41:38 +00:00
Robert Watson
0d9535331d Rework TIMEWAIT regression test so that kernel-allocated port numbers are
used rather than a fixed userspace one, avoiding conflicts between the two
test runs.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:34:15 +00:00
Robert Watson
57431792c8 Add missing include of stdio.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:06:24 +00:00
Robert Watson
e8c546028b In the tcpdrop regression test, allow the kernel to allocate us a port
rather than using a fixed port number.  This means that the regression test
can be run many times in a row without waiting on TIMEWAIT to release a
hard-coded port number.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:04:35 +00:00
Robert Watson
27d36ca1a8 Add missing #include of err.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 08:54:32 +00:00
Jilles Tjoelker
562c9f003e sh: Add test for 'set +o'. 2011-05-29 15:02:10 +00:00
Jilles Tjoelker
98102dabd3 printf: Allow multibyte characters for '<char> form, avoid negative codes.
Examples:
  LC_ALL=en_US.UTF-8 printf '%d\n' $(printf \'\\303\\244)
  LC_ALL=en_US.ISO8859-1 printf '%d\n' $(printf \'\\344)
Both of these should print 228.

Like some other shells, incomplete or invalid multibyte characters yield the
value of the first byte without a warning.

Note that there is no general way to go back from the character code to the
character.
2011-05-28 11:37:47 +00:00
Jilles Tjoelker
64fa41f3e1 sh: Correct criterion for using CDPATH in cd.
CDPATH should be ignored not only for pathnames starting with '/' but also
for pathnames whose first component is '.' or '..'.

The man page already describes this behaviour.
2011-05-27 20:01:46 +00:00
Jilles Tjoelker
4daae0cde6 sh: Add simple CDPATH test. 2011-05-27 19:36:07 +00:00
Jilles Tjoelker
715a0dd556 sh: Fix unquoted $@/$* if IFS=''.
If IFS is null, unquoted $@/$* should still expand to separate words.
This differs from quoted $@ (which does not depend on IFS) in that pathname
generation is performed and empty words are removed.
2011-05-27 15:56:13 +00:00
Adrian Chadd
775b7a6663 Include an EEPROM dump program for the AR9287 EEPROM format. 2011-05-26 19:49:32 +00:00
David E. O'Brien
3c24f8e827 + Tighten up (and simplify) the pass_cmd_vars_1 "variable definition arrived
from the calling make" test.
+ Be more tolerant of newlines in the plus_flag "supports the '+' flag" test.
2011-05-25 23:33:49 +00:00
Ruslan Ermilov
a6d11f7139 [mdoc] Fixed .Dt call. 2011-05-25 14:13:53 +00:00
David E. O'Brien
a23d1c70b3 Build and install a BSD licensed grep.
If WITH_BSD_GREP is not set, it will be 'bsdgrep' and GNUgrep will be
'[ef]grep'.  Otherwise, BSD-grep will be the grep family, and GNUgrep
will be 'gnugrep'.

Discussed with: brooks
2011-05-25 01:04:12 +00:00
Warner Losh
3a58f40e09 Add the description properly... 2011-05-22 18:23:17 +00:00
Warner Losh
becb5566df Add documentation for WITHOUT_KERNEL_SYMBOLS 2011-05-22 18:12:59 +00:00
Jilles Tjoelker
4d79e0296a sh: Add test for r222173. 2011-05-22 12:15:14 +00:00
Ulrich Spörlein
c5917de726 Update URLs and fix regex to work with current version of the files. 2011-05-22 09:48:25 +00:00
Jilles Tjoelker
05a447d0b9 sh: Expand aliases after assignments and redirections. 2011-05-21 22:03:06 +00:00
Jilles Tjoelker
47fb896960 sh: Add test for positional parameters with more than one digit.
This also passes on stable/8.
2011-05-21 14:52:26 +00:00
Jilles Tjoelker
d6ee26ad02 sh: Implement the cd -e flag proposed for the next POSIX issue.
This reflects failure to determine the pathname of the new directory in the
exit status (1). Normally, cd returns successfully if it did chdir() and the
call was successful.

In POSIX, -e only has meaning with -P; because our -L is not entirely
compliant and may fall back to -P mode, -e has some effect with -L as well.
2011-05-20 22:55:18 +00:00
Jilles Tjoelker
85307c9ed9 sh: Allow terminating a heredoc with a terminator at EOF without a newline.
This is sometimes used with eval or old-style command substitution, and most
shells other than ash derivatives allow it.

It can also be used with scripts that violate POSIX's requirement on the
application that they end in a newline (scripts must be text files except
that line length is unlimited).

Example:
v=`cat <<EOF
foo
EOF`
echo $v

This commit does not add support for the similar construct with new-style
command substitution, like
v=$(cat <<EOF
foo
EOF)
This continues to require a newline after the terminator.
2011-05-20 16:03:36 +00:00
Warner Losh
0163af2360 Implement WITH{,OUT}_{GCC,BINUTILS} to provide finer-grained control
over building gcc and binutils.  They default to true, unless
MK_TOOLCHAIN is no.

Reviewed by:	ru@
2011-05-19 05:13:25 +00:00
Ruslan Ermilov
1562ef0218 Added description for WITH_OFED. 2011-05-17 11:06:41 +00:00
Jilles Tjoelker
d69e16c977 sh: Add tests for lines that look like heredoc delimiters but are not. 2011-05-14 14:19:30 +00:00
Warner Losh
9df02b5476 Restore BOOT2CFG, accidentally removed in r212938.
PR:		157020
2011-05-14 04:32:30 +00:00
Warner Losh
9a6e729a11 If there's no package directory, don't try to install packages from
it.  Instead, report that 0 packages are reported.

PR:		misc/140436
2011-05-13 19:40:02 +00:00
Warner Losh
14f9771b27 Add ${} around variable dereference...
Submitted by:	garrett coopper
2011-05-13 18:46:20 +00:00
Warner Losh
94a74d9427 Implement -f to inhibit copying s1 partition out for speed.
(-z not taken from PR, it is no longer needed since we basically always
 do that now)

PR:		misc/151698
Submitted by:	lev@
2011-05-13 18:36:24 +00:00
Warner Losh
b0effdce7c Copy symbolic links as files rather than recreating the links.
PR:		misc/151697
Submitted by:	lev@
MFC after:	2 weeks
2011-05-13 18:28:25 +00:00
Ruslan Ermilov
e6a714e703 Reassurance for impatient. 2011-05-10 13:01:11 +00:00
Ruslan Ermilov
cae68bef11 Style. 2011-05-10 12:57:39 +00:00
Ruslan Ermilov
2701a1b7a1 - There now exist options that have different defaults depending on
the architecture, reflect this in documentation.  For such
  options, both WITH_FOO and WITHOUT_FOO description files should
  be provided.

  Prodded by:	des

- Setting a build option may enforce other build options, try harder
  to detect this case.

- Setting a build option may change other option's default value,
  try harder to detect this case.
2011-05-10 11:14:40 +00:00
Ruslan Ermilov
37730efb9a The Objective C support was removed in r220755.
Submitted by:	des
2011-05-10 11:06:14 +00:00
Adrian Chadd
9a086c6988 This is a full 32 bit field for kite. 2011-05-09 10:39:15 +00:00
Jilles Tjoelker
07eb7033a6 sh: Add \u/\U support (in $'...') for UTF-8.
Because we have no iconv in base, support for other charsets is not
possible.

Note that \u/\U are processed using the locale that was active when the
shell started. This is necessary to avoid behaviour that depends on the
parse/execute split (for example when placing braces around an entire
script). Therefore, UTF-8 encoding is implemented manually.
2011-05-08 17:40:10 +00:00
Jilles Tjoelker
7cc6b3df80 sh: Add UTF-8 support to pattern matching.
?, [...] patterns match codepoints instead of bytes. They do not match
invalid sequences. [...] patterns must not contain invalid sequences
otherwise they will not match anything. This is so that ${var#?} removes the
first codepoint, not the first byte, without putting UTF-8 knowledge into
the ${var#pattern} code. However, * continues to match any string and an
invalid sequence matches an identical invalid sequence. (This differs from
fnmatch(3).)
2011-05-08 11:32:20 +00:00
Jilles Tjoelker
4c244ed255 sh: Add UTF-8 support to ${#var}.
If the current locale uses UTF-8, ${#var} counts codepoints (more precisely,
bytes b with (b & 0xc0) != 0x80).
2011-05-07 14:32:16 +00:00
Ruslan Ermilov
751f92ecc8 MK_GPIO changed its default; reflect. 2011-05-06 19:14:06 +00:00
Ruslan Ermilov
a7a066b13f Removed trailing whitespace. 2011-05-06 19:13:03 +00:00
Ruslan Ermilov
64a9cf7693 Tidy up formatting. 2011-05-06 19:10:27 +00:00
Jilles Tjoelker
a62ab0274a sh: Add $'quoting' (C-style escape sequences).
A string between $' and ' may contain backslash escape sequences similar to
the ones in a C string constant (except that a single-quote must be escaped
and a double-quote need not be). Details are in the sh(1) man page.

This construct is useful to include unprintable characters, tabs and
newlines in strings; while this can be done with a command substitution
containing a printf command, that needs ugly workarounds if the result is to
end with a newline as command substitution removes all trailing newlines.

The construct may also be useful in future to describe unprintable
characters without needing to write those characters themselves in 'set -x',
'export -p' and the like.

The implementation attempts to comply to the proposal for the next issue of
the POSIX specification. Because this construct is not in POSIX.1-2008,
using it in scripts intended to be portable is unwise.

Matching the minimal locale support in the rest of sh, the \u and \U
sequences are currently not useful.

Exp-run done by: pav (with some other sh(1) changes)
2011-05-05 20:55:55 +00:00
Jilles Tjoelker
3937fc9c26 sh: Apply set -u to variables in arithmetic.
Note that this only applies to variables that are actually used.
Things like (0 && unsetvar) do not cause an error.

Exp-run done by: pav (with some other sh(1) changes)
2011-05-04 22:12:22 +00:00
Jilles Tjoelker
fc0818fef3 sh: Detect an error for ${#var<GARBAGE>}.
In particular, this makes things like ${#foo[0]} and ${#foo[@]} errors
rather than silent equivalents of ${#foo}.

PR:		bin/151720
Submitted by:	Mark Johnston
Exp-run done by: pav (with some other sh(1) changes)
2011-05-04 21:49:34 +00:00
Jonathan Anderson
ceb42a13a1 Regression tests for Capsicum capability mode.
Ensure that system calls that access global namespaces, e.g. open(2), are not permitted, and that whitelisted sysctls like kern.osreldate are.

Approved by: rwatson
Sponsored by: Google, Inc.
2011-05-04 12:44:46 +00:00
George V. Neville-Neil
c3b14674a7 Give some sort of message when the program is not run as root.
Root privileges are required to talk to the device.

Submitted by:	Sriram Rapuru at Wipro for Exar Inc.
MFC after:	2 weeks
2011-05-03 16:00:36 +00:00
Dimitry Andric
01af97d3b2 Vendor import of clang trunk r130700:
http://llvm.org/svn/llvm-project/cfe/trunk@130700
2011-05-02 19:39:53 +00:00
Dimitry Andric
6b943ff3a3 Vendor import of llvm trunk r130700:
http://llvm.org/svn/llvm-project/llvm/trunk@130700
2011-05-02 19:34:44 +00:00
Bjoern A. Zeeb
970a765389 Introduce two new options MK_INET and MK_INET_SUPPORT analogically
with INET6 equivalents. Patch reather than re-genenerating src.conf
(given the current problem with the script that does the re-gen).

Reviewed by:	gnn
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	2 weeks
2011-04-30 17:58:28 +00:00
George V. Neville-Neil
3c31540d7c A diagnostic tool to go along with the vxge(4) 10GbE driver.
This tool can be used to print statistics, registers, and
other device specific information once the driver is loaded
into the kernel.

Submitted by:	Sriram Rapuru from Exar
MFC after:	2 weeks
2011-04-28 16:29:19 +00:00
Dag-Erling Smørgrav
158e440d2b executable 2011-04-28 11:21:49 +00:00
Jilles Tjoelker
03b3a844d0 sh: Set $? to 0 for background commands.
For backgrounded pipelines and subshells, the previous value of $? was being
preserved, which is incorrect.

For backgrounded simple commands containing a command substitution, the
status of the last command substitution was returned instead of 0.

If fork() fails, this is an error.
2011-04-25 20:54:12 +00:00
Jilles Tjoelker
45496405c6 sh: Allow EV_EXIT through function calls, make {...} <redir more consistent.
If EV_EXIT causes an exit, use the exception mechanism to unwind
redirections and local variables. This way, if the final command is a
redirected command, an EXIT trap now executes without the redirections.

Because of these changes, EV_EXIT can now be inherited by the body of a
function, so do so. This means that a function no longer prevents a fork
before an exec being skipped, such as in
  f() { head -1 /etc/passwd; }; echo $(f)

Wrapping a single builtin in a function may still cause an otherwise
unnecessary fork with command substitution, however.

An exit command or -e failure still invokes the EXIT trap with the
original redirections and local variables in place.

Note: this depends on SHELLPROC being gone. A SHELLPROC depended on
keeping the redirections and local variables and only cleaning up the
state to restore them.
2011-04-23 22:28:56 +00:00
Simon L. B. Nielsen
d95c6beaac Expand / correct newsyslog regression tests:
- Test newslog with clasic naming of rotates files to actually test
  the correct number of log files as newsyslog now does the correct
  thing post r220926.
- Add some more newsyslog tests which tests keeping 0, 1, and 2
  logfiles.
2011-04-21 16:40:34 +00:00
Jilles Tjoelker
caa7ccdc54 sh: Do not word split "${#parameter}".
This is only a problem if IFS contains digits, which is unusual but valid.

Because of an incorrect fix for PR bin/12137, "${#parameter}" was treated
as ${#parameter}. The underlying problem was that "${#parameter}"
erroneously added CTLESC bytes before determining the length. This
was properly fixed for PR bin/56147 but the incorrect fix was not backed
out.

Reported by:	Seeker on forums.freebsd.org
MFC after:	2 weeks
2011-04-20 22:24:54 +00:00
Jilles Tjoelker
1e5dccaa9b sh: Add test for bin/12137. 2011-04-15 15:33:24 +00:00
Jilles Tjoelker
9638724dc8 sh: Add test for obscure and ambiguous ${#?}. 2011-04-15 15:26:05 +00:00
Jilles Tjoelker
149cf1e03b sh: Add test for bin/56147. 2011-04-15 15:14:58 +00:00
Adrian Chadd
6b3664c018 Generate opt_ah.h now for all ath tools, a recent HAL change of mine
now requires it.
2011-04-11 06:53:45 +00:00
Ulrich Spörlein
cebea500a0 Regenerate after r220401. It turns out makeman is clever about implied
flags, so remove that part from WITHOUT_CXX again.

This is only partially regenerated, as the entries for FDT and GPIO seem to
have switched their default state, too.
2011-04-06 20:19:07 +00:00
Ulrich Spörlein
b3eb927f6e Complete WITHOUT_CXX support. It implies WITHOUT_GROFF and
WITHOUT_CLANG.

Don't build clang bootstrap/build-tools depending on this flag. We also
keep gperf, devd and libstdc++ around to prevent foot-shooting and to
make this a two-way street.
2011-04-06 20:08:23 +00:00
Jilles Tjoelker
2973057493 Allow strerror(0) and strerror_r(0, ...).
Of course, strerror_r() may still fail with ERANGE.

Although the POSIX specification said this could fail with EINVAL and
doing this likely indicates invalid use of errno, most other
implementations permitted it, various POSIX testsuites require it to
work (matching the older sys_errlist array) and apparently some
applications depend on it.

PR:		standards/151316
MFC after:	1 week
2011-04-05 21:56:05 +00:00
Adrian Chadd
179d23212e * re-enable marker stuff, I accidentally disabled it during debugging
* correct arg check
2011-04-05 16:12:38 +00:00
Adrian Chadd
0a74f776db Flesh out a simple tool to print the ALQ dump generated by the HAL. 2011-04-05 15:11:09 +00:00
Michael Reifenberger
9d47a91b22 Use ${NANO_WORLDDIR}/var/empty as copy source since it has no schg flag set.
Copying over /var/empty's schg flag had unpleasant side effects (schg flag on /etc and /cfg)
during nanobsd boot before.
2011-03-28 07:00:41 +00:00
Adrian Chadd
7ee26a530a Oops, fix badness i must've introduced earlier. 2011-03-23 11:16:06 +00:00
Edward Tomasz Napierala
a8e852babc Add test for acl_is_trivial_np(3). 2011-03-22 17:26:56 +00:00
Michael Reifenberger
0380bf4d79 Delete all GPT partitions at once. (Suggested by Andrey V. Elsukov <bu7cher@yandex.ru>)
Fix amd64 merge script.
2011-03-21 13:23:25 +00:00
Michael Reifenberger
e1c9ab494d Add a file with some remarks for setting up a zfs boot environment 2011-03-20 13:01:57 +00:00
Michael Reifenberger
24f0cf3b18 - Add script for preparing disks in GPT/ZFS boot environment
- Add merge script for integrating amd64 slice into i386 disk image
2011-03-20 12:40:17 +00:00
Michael Reifenberger
8ad865445e - Build disk image (for USB sticks) and iso image
- Change name to reflect this
- Install all kernel modules
- Choose image size that i386 and amd64 can be combined into one image
- Mount tmpfs over /boot/zfs for zpool imports
2011-03-18 22:56:53 +00:00
Jilles Tjoelker
35c641ed21 sh: Fix some parameter expansion variants ${#...}.
These already worked: $# ${#} ${##} ${#-} ${#?}
These now work as well: ${#+word} ${#-word} ${##word} ${#%word}

There is an ambiguity in the standard with ${#?}: it could be the length of
$? or it could be $# giving an error in the (impossible) case that it is not
set. We continue to use the former interpretation as it seems more useful.
2011-03-13 20:02:39 +00:00
Pawel Jakub Dawidek
fb7db28c25 POSIX accepts only ELOOP if O_NOFOLLOW is specified and target is a symlink. 2011-03-13 19:35:13 +00:00
Jilles Tjoelker
18584d14e3 sh: Add some tests for ${#parameter}. 2011-03-13 16:20:38 +00:00
Rebecca Cran
d7d3cbdadf Fix warnings and style(9) issues.
Set WARNS to 6.
2011-03-12 14:47:54 +00:00
Pawel Jakub Dawidek
87c7a11664 Add some missing consts. 2011-03-12 14:09:43 +00:00
Rebecca Cran
71c8cbe3ef Fix warnings and style(9) issues.
Set WARNS to 6.
2011-03-11 19:32:15 +00:00
Rebecca Cran
ac34e5511b Fix the build: we have snprintf(3).
MFC after:	1 week
2011-03-11 19:19:47 +00:00
Rebecca Cran
e6bcbac1f7 Fix warnings and set WARNS to 6.
MFC after:	1 week
2011-03-11 18:51:42 +00:00
Rebecca Cran
59d06d2fb0 Fix warnings and set WARNS to 6.
MFC after:	1 week
2011-03-11 18:48:28 +00:00
Rebecca Cran
a797c79b34 mptable.h is now in include/x86. 2011-03-11 18:44:16 +00:00
Rebecca Cran
01ded8b942 Fix warnings and style(9) issues.
Set WARNS to 6.

MFC after:	1 week
2011-03-11 17:33:31 +00:00
Pawel Jakub Dawidek
7ab5d09839 Add support for *at syscalls:
- openat(2)
- unlinkat(2)
- mkdirat(2)
- linkat(2)
- symlinkat(2)
- renameat(2)
- mkfifoat(2)
- mknodat(2)
- fchmodat(2)
- fchownat(2)
- fstatat(2)
2011-03-10 21:00:30 +00:00
Pawel Jakub Dawidek
97b700501b Improve test a bit, now that we have fstat(2) support.
The test was support to check if SUID/SGID bits are removed on first
write, but actually we were checking if they were removed after close.
Now we can check if SUID/SGID bits are gone after first write.

While here add checks to see if when both SUID and SGID bits are set they are
both cleared on first write.
2011-03-10 20:59:02 +00:00
Pawel Jakub Dawidek
7a0452188b Few initial ftruncate(2) tests. One of them covers stand/154873.
PR:	stand/154873
2011-03-09 23:11:30 +00:00
Pawel Jakub Dawidek
7535f6533c Pass descriptor number to write(2), now that it is possible. 2011-03-09 22:50:15 +00:00
Pawel Jakub Dawidek
446727a7a4 Add support for the following syscalls:
- fchmod(2),
- fchown(2),
- fchflags(2),
- fstat(2),
- ftruncate(2),
- fpathconf(2),
- lpathconf(2).
Make write(2) syscall to take descriptor instead of file name.

We implement descriptors by keeping track of open files and allowing to
reference them by the following syscalls. Because pjdfstest already supports
executing multiple syscalls from one command it works pretty well.

For example, the following command:

	pjdfstest open foo "O_CREAT,O_RDWR" 0 : open bar "O_CREAT,O_RDONLY" 640 : fchmod 0 0666 : fchown 0 -1 20 : fchmod 1 0444

is equivalent of (error checking omitted):

	int fd[2];

	fd[0] = open("foo", O_CREAT | O_RDWR, 0);
	fd[1] = open("bar", O_CREAT | O_RDONLY, 0640);
	fchmod(fd[0], 0666);
	fchown(fd[0], -1, 20);
	fchmod(fd[1], 0444);
2011-03-09 22:39:10 +00:00
Adrian Chadd
d445d5407a The regdomain entries are 16 bits, not 8. Print out all 16 bits. 2011-03-09 04:48:06 +00:00
Adrian Chadd
87cd3ddacc Update to keep in sync with the HAL 2011-03-08 12:08:23 +00:00
Jilles Tjoelker
7b8b6c9c46 sh: Test that . /dev/null returns exit status 0 and does not preserve $?.
Preserving $? may cause problems particularly if set -e is in effect.

It may be useful to preserve the old value of $? in the dot script but this
must not be implemented in such a way that it would break this test.
2011-03-07 23:52:23 +00:00
David Schultz
2dc9da4376 Add some tests for cexp() and cexpf(). (I need to clean up all of
these tests some day, but in the mean time, they're a useful sanity
check for future changes.)
2011-03-07 03:15:49 +00:00
Adrian Chadd
799caf55bb Add support for printing out the open-loop TX power control EEPROM fields. 2011-03-06 23:15:24 +00:00
Edward Tomasz Napierala
62089c2843 One more fix. Now all ACL tests pass again. 2011-03-04 18:46:19 +00:00
Edward Tomasz Napierala
aa25dc0272 Adapt tools-crossfs.test to the new semantics. 2011-03-04 18:37:26 +00:00
Edward Tomasz Napierala
6b2094d83c Adapt NFSv4 ACL regression test to the fact that the new ZFS uses
new semantics.
2011-03-04 17:10:39 +00:00
Edward Tomasz Napierala
b5b5b80711 Make ACL tests slightly easier to run. 2011-03-04 17:07:02 +00:00
Xin LI
eaea8924ce 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
Dimitry Andric
c3b054d250 Vendor import of clang trunk r126547:
http://llvm.org/svn/llvm-project/cfe/trunk@126547
2011-02-26 22:09:03 +00:00
Dimitry Andric
d0e4e96dc1 Vendor import of llvm trunk r126547:
http://llvm.org/svn/llvm-project/llvm/trunk@126547
2011-02-26 22:03:50 +00:00
Gabor Kovesdan
bcf205e1ee - 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 Kovesdan
ad30f8e79b 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
Ulrich Spörlein
705669adda The default for FDT has changed, rename the flag/options file. 2011-02-22 08:20:12 +00:00
Ulrich Spörlein
423102c6fa 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
Ulrich Spörlein
3dfe8ce942 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
Martin Wilke
dd41c1d72e - 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 Tjoelker
553870e83b sh: Add some tests for omitting whitespace whereever possible. 2011-02-20 17:28:58 +00:00
Jilles Tjoelker
a9942298fe 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
Dimitry Andric
bca07a4524 Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
2011-02-20 13:06:31 +00:00
Dimitry Andric
cf099d1121 Vendor import of llvm trunk r126079:
http://llvm.org/svn/llvm-project/llvm/trunk@126079
2011-02-20 12:57:14 +00:00
Jilles Tjoelker
9d59796db7 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 Tjoelker
3d9394a391 sh: Make execution/fork1.0 work even if the basename of ${SH} is not "sh". 2011-02-19 13:22:18 +00:00
Jilles Tjoelker
e8d17ee524 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 Tjoelker
cfd69ae791 sh: Unset some more locale vars in two tests that may cause them to break. 2011-02-18 20:37:09 +00:00
Xin LI
f6ac113d5e 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
Poul-Henning Kamp
8c8d5abcb3 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 Chadd
ba277b0892 * add in new EEPROM fields from later revisions
* add in printing futureBase
2011-02-13 13:11:00 +00:00
Jilles Tjoelker
e9749129ad 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
Warner Losh
ed34bfa8f1 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 Tjoelker
f01be3fe53 sh: Add tests for new features in arithmetic. 2011-02-08 23:23:55 +00:00
Jilles Tjoelker
e029e397f3 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 Tjoelker
b15e9aa322 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 Tjoelker
ef0cb80dd4 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 Tjoelker
604e8224f8 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 Tjoelker
0df2165c11 sh: Add test for shell script without '#!'. 2011-02-02 22:03:18 +00:00
Jilles Tjoelker
b9f696953d 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 Chadd
b2691d144a 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 Tjoelker
8c3afde82c 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 Chadd
65824341e7 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 Chadd
a9c52f70eb Add a simple tool to print the contents of a v4k EEPROM dump. 2011-01-24 06:46:03 +00:00
Adrian Chadd
24edeee241 Add a new tool which takes a text hexdump of the current EEPROM contents. 2011-01-22 23:44:56 +00:00
Adrian Chadd
8363d9c421 Patch the athstats code/Makefile to cross-compile correctly. 2011-01-22 23:37:42 +00:00
Adrian Chadd
eefbdb2a6e 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 Chadd
3a85395536 Remove an un-needed trailing / after OBJDIR.
Nitpicked by: juli
2011-01-21 02:56:59 +00:00
Adrian Chadd
1045db19f5 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
Poul-Henning Kamp
cb2e9eede4 Make sure the PKGDIR exists before we move stuff into it. 2011-01-18 21:36:51 +00:00
Jilles Tjoelker
0d5ccb45d8 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 Tjoelker
ebdfd6dc4d 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 Tjoelker
a043cc4c68 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
Giorgos Keramidas
50ffd2d643 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 Tjoelker
4b45b49a70 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 Tjoelker
70df11eaad 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 Tjoelker
02edd492b4 sh: Add simple test for 'exit' without parameters. 2011-01-08 23:00:38 +00:00
Jilles Tjoelker
e916b99243 sed: Add test for r217133 (-i race).
PR:		bin/153261
MFC after:	2 weeks
2011-01-08 00:06:22 +00:00
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