Commit Graph

2273 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
fe5ddba7a9 Add optional files controlled by WITH_GPIO knob
Submitted by:	Alexander Best <arundel@freebsd.org>
2010-11-14 22:14:36 +00:00
Rebecca Cran
97f9dcf763 lib32 is installed on powerpc64 too. 2010-11-14 19:37:07 +00:00
Rebecca Cran
60db6c3233 libatm_p.a, libkeycap_p.a and libmytinfo_p.a are already in ObsoleteFiles.inc.
liblwres.so.10 has been replaced by liblwres.so.50.

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

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

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

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

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

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

MFC after:	1 week
2010-11-08 23:15:10 +00:00
Nick Hibma
bb595df94d - 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
Edward Tomasz Napierala
43b838f75c Remove useless comment. 2010-11-07 17:33:04 +00:00
Jilles Tjoelker
5aa39e6a7e 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 Tjoelker
135ff4b5b0 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 Tjoelker
e20776d503 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 Tjoelker
60f7eec450 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 Tjoelker
048f26671a 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 Tjoelker
6c38071288 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 Tjoelker
9cec947f3f 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 Tjoelker
67e109adbe 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 Tjoelker
074e83b14e 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 Tjoelker
3dec7d0c15 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 Tjoelker
7aaae32724 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 Tjoelker
ba08f69b5c 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 Tjoelker
281fb05e83 sh: Add some testcases for alias expansion. 2010-10-24 16:55:17 +00:00
Robert Watson
6e4d736661 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
Robert Watson
1c2b97e084 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
Robert Watson
73e5f76349 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
Robert Watson
4e20912ad8 Add Cambridge/Google tag since the copyright has been updated.
MFC after:	2 weeks
2010-10-21 19:03:24 +00:00
Robert Watson
c4cc2fbf5c 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
Robert Watson
3e36aa656e 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
Robert Watson
1dca6a2844 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
Robert Watson
37931439fd 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 Tjoelker
f1bb5f6a87 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
David E. O'Brien
7c7a210ab8 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
David E. O'Brien
7cfe69417c 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
David E. O'Brien
f3bf9b7a16 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
David E. O'Brien
5f7f699749 Correct regression test to not show a false positive when run as root. 2010-10-11 23:24:57 +00:00
Mark Murray
60e6ef07e0 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
Sergey Kandaurov
cd94bb1e54 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
Alexander Leidinger
916d70039a Add some missing files to optionally delete.
Submitted by:	Paul B Mahol <onemda@gmail.com>
2010-10-06 07:49:28 +00:00
Oleksandr Tymoshenko
923974ab03 - Add WITH_GPIO entry to src.conf(5) man page 2010-10-05 22:26:01 +00:00
George V. Neville-Neil
d329352945 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
Michael Reifenberger
a15cc72e0c - 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 Tjoelker
88deede54a 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
Pawel Jakub Dawidek
332bbedddd Correct message.
Pointed out by:	jhb
MFC after:	2 weeks
2010-09-27 21:10:37 +00:00
Pawel Jakub Dawidek
9eecfa1c33 Add some regression tests for newly added -J and -j options.
MFC after:	2 weeks
2010-09-25 17:41:02 +00:00
Pawel Jakub Dawidek
5c181adf40 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
Edward Tomasz Napierala
5b098ddce2 Don't leave zombies behind. 2010-09-25 14:54:31 +00:00
Edward Tomasz Napierala
9e294983e9 Add a shell script to generate a test script for trivial ACLs. 2010-09-25 14:33:35 +00:00
Pawel Jakub Dawidek
d3937ea915 Update regression tests after AES-XTS addition.
MFC after:	2 weeks
2010-09-25 10:34:42 +00:00
Pawel Jakub Dawidek
e5fa43590a - 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
David Xu
e04b953e48 Add test cases for stack unwinding. 2010-09-25 04:26:40 +00:00
Warner Losh
12d455a6b1 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
Andriy Gapon
928405318d 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
Warner Losh
eba842f9d8 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 Somers
044bf69fd5 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
Andriy Gapon
4b5ccbf768 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 Somers
1ad5f80fac 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
Jilles Tjoelker
8f2dc7de67 sh: Fix exit status if return is used within a loop condition. 2010-09-11 15:07:40 +00:00
Jilles Tjoelker
011d162dd3 sh: Apply variable assignments left-to-right in bltinlookup().
Example:
  HOME=foo HOME=bar cd
2010-09-11 14:15:50 +00:00
Jilles Tjoelker
917fdfb106 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 Tjoelker
ad931dfdcb sh: Add simple tests for backslashes in the read builtin. 2010-09-08 18:32:23 +00:00
Jilles Tjoelker
10ea2923a9 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
Poul-Henning Kamp
9f5b45662f We need to copy the ports config files before we launch the prefetch 2010-09-03 09:34:15 +00:00
Warner Losh
42908e80e6 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 Tjoelker
83866607fb 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 Somers
25fdbebeb2 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 Somers
cd14b45756 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
Konstantin Belousov
42992a3a9c Test the poll(2) return value.
MFC after:	2 weeks
2010-08-28 17:38:40 +00:00
Gabor Kovesdan
6608cc579e - 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 Tjoelker
8fdbdb5d50 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 Tjoelker
394357b2b6 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 Tjoelker
193da04bd8 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
Rui Paulo
7d924a46c2 Update for the new tests.
Sponsored by:	The FreeBSD Foundation
2010-08-21 14:14:24 +00:00
Pawel Jakub Dawidek
af8ec89da4 More tests. 2010-08-18 22:06:43 +00:00
Jilles Tjoelker
44510b41ff sh: Add a test for break from a trap action. 2010-08-18 20:26:50 +00:00
Konstantin Belousov
7ac7ad63d8 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
Pawel Jakub Dawidek
385cae0f8e More tests, especially for lchown(2). 2010-08-17 06:08:09 +00:00
Jilles Tjoelker
7ba25e6e69 sh: Reduce unnecessary testsuite failures with other shells. 2010-08-16 22:23:19 +00:00
Jilles Tjoelker
2070b57f64 sh: Split off a more dubious test from parser/heredoc2.0. 2010-08-16 21:14:49 +00:00
Jilles Tjoelker
c06336d428 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
Pawel Jakub Dawidek
3618f38566 Finish renaming fstest to pjdfstest. 2010-08-15 21:29:03 +00:00
Pawel Jakub Dawidek
5a31155215 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
Pawel Jakub Dawidek
c6d1bc95b8 Update copyright years. 2010-08-15 21:20:40 +00:00
Pawel Jakub Dawidek
af2ec7ee6b More tests. 2010-08-15 21:19:42 +00:00
Jilles Tjoelker
ae7c0700dc 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 Tjoelker
a129ce0167 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
Pawel Jakub Dawidek
6d4317a1e4 More tests (especially for lchmod(2)), less code duplication. 2010-08-15 14:44:48 +00:00
Pawel Jakub Dawidek
ea9ba9fe93 - Use loops to avoid code duplication.
- More tests.
2010-08-13 21:17:59 +00:00
Pawel Jakub Dawidek
5b2bae575b More tests. 2010-08-12 20:35:14 +00:00
Pawel Jakub Dawidek
af7198501c Portable Makefile. 2010-08-12 19:45:27 +00:00
Pawel Jakub Dawidek
d4f106bd86 Fix copy&pasted code - we want to create character device here. 2010-08-12 19:43:40 +00:00
Pawel Jakub Dawidek
d999d7ae4f - 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
Pawel Jakub Dawidek
8db93ae7d4 Allow to specify uid, gid and mode for create_file(). 2010-08-11 17:33:32 +00:00
Matt Jacob
288f3fd63a 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
Pawel Jakub Dawidek
0cc88f266d More and more tests. 2010-08-11 16:34:44 +00:00
Pawel Jakub Dawidek
35f540a74b Move create_file() to misc.sh, as it is going to be used in more places. 2010-08-11 16:34:26 +00:00
Pawel Jakub Dawidek
5ad80c5727 Make use of recently added dirgen_max() and namegen_max() to implement
ENAMETOOLONG checks.
2010-08-11 16:33:17 +00:00
Pawel Jakub Dawidek
1d6b6a46d7 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
Pawel Jakub Dawidek
828160e93c More tests, mostly related to devices and sockets. 2010-08-10 22:57:43 +00:00
Jilles Tjoelker
c8a3d81f34 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
Pawel Jakub Dawidek
6a4e10db54 Linux has no strlcpy(). 2010-08-09 20:16:52 +00:00
Pawel Jakub Dawidek
ef01b5b762 Fix bind(2) and connect(2) support on Solaris. 2010-08-09 17:42:04 +00:00
Pawel Jakub Dawidek
57ab39b94a Fix file system type detection on Solaris. 2010-08-09 17:40:59 +00:00
Pawel Jakub Dawidek
cd9b233e0a Small tweaks. 2010-08-09 17:37:29 +00:00
Pawel Jakub Dawidek
4b9cdebd26 No need to use grep to check if path start with /.
Suggested by:	ed
2010-08-09 17:34:57 +00:00
Matt Jacob
a55e712763 Add a multipath oriented test. 2010-08-09 00:36:22 +00:00
Jilles Tjoelker
40d2ccc36f 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
Pawel Jakub Dawidek
6a8ecf4c59 Various cleanups, mostly to make the test work on FreeBSD/ZFS. 2010-08-06 23:58:54 +00:00
Pawel Jakub Dawidek
f8287aa0ac ${GREP} can only be used after loading 'conf'. 2010-08-06 21:58:53 +00:00
Pawel Jakub Dawidek
8f3ff75868 Don't use egrep directly - use ${GREP}. 2010-08-06 21:57:11 +00:00
Pawel Jakub Dawidek
3556206aad Check first todo() argument against operating system name and operating system
name plus file system name.
2010-08-06 21:56:32 +00:00
Pawel Jakub Dawidek
520fad0247 For FreeBSD and Linux use awk's toupper() function.
Suggested by:	ed
2010-08-06 21:53:50 +00:00
Pawel Jakub Dawidek
f7bfc405c7 Convert file system type to upper case. 2010-08-06 21:02:53 +00:00
Pawel Jakub Dawidek
bbbc67e6ff 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
Pawel Jakub Dawidek
ce29a12f91 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
Pawel Jakub Dawidek
c9ea9723b0 Sort includes. 2010-08-06 20:46:26 +00:00
Pawel Jakub Dawidek
6c4a79e1b1 open(2) returns EOPNOTSUPP when trying to open a socket. 2010-08-06 19:22:42 +00:00
Pawel Jakub Dawidek
ce2decb660 Test for EACCES also when opening FIFO or directory. 2010-08-06 19:20:35 +00:00
Pawel Jakub Dawidek
482fdb1334 Test O_RDONLY|O_RDWR flags as potentially invalid. 2010-08-06 19:19:14 +00:00
Pawel Jakub Dawidek
adab8b00ab Make description readable. 2010-08-06 19:18:19 +00:00
Pawel Jakub Dawidek
b8f0e1661c Add missing -U argument to usage. 2010-08-06 19:16:48 +00:00
Pawel Jakub Dawidek
feb6813113 Implement two new syscalls: bind(2) and connect(2) for operating on UNIX
domain sockets.
2010-08-06 19:16:20 +00:00
Jilles Tjoelker
b84d7af7c6 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 Tjoelker
d0a59d85df sh: Add a test for a corner case in eval that already works correctly. 2010-08-01 22:39:07 +00:00
Ulrich Spörlein
32ba16b6e6 Fix a couple of typos.
PR:		docs/148891
Submitted by:	olgeni
MFC after:	1 week
2010-07-30 11:58:18 +00:00
Jilles Tjoelker
6c0c240366 sh: Fix crash due to uninitialized here-document.
If an ; or & token was followed by an EOF token, pending here-documents were
left uninitialized. Execution would crash, either in the main shell process
for literal here-documents or in a child process for expanded
here-documents. In the latter case the problem is hard to detect apart from
the core dumps and log messages.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Example:
  echo /*"/null"

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

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

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

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

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

PR:		144900
Submitted by:	Peter Jeremy
2010-04-24 12:11:41 +00:00
Jung-uk Kim
ed9dd82fa2 Adjust a test case and make it more jump optimization neutral for JIT case. 2010-04-23 22:42:49 +00:00
Jilles Tjoelker
e9615a1a0e sh: Add some more tests for ${v#...} and ${v%...}.
These pass on stable/8 as well.
2010-04-23 17:26:49 +00:00
Robert Watson
0e4ae43e17 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
Rui Paulo
4ad53b2511 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 Tjoelker
348c81a032 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 Tjoelker
8eac1f9477 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 Tjoelker
139ac6b239 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 Tjoelker
bfbe51816a Add some tests for fnmatch(3).
MFC after:	1 week
2010-04-16 22:15:26 +00:00
Jilles Tjoelker
e74e09f851 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
Warner Losh
6a47fc38e2 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
Jilles Tjoelker
8ef6f9f2d2 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 Tjoelker
07c0b06768 sh: Add test for some associativity in arithmetic. 2010-04-04 16:29:48 +00:00
Jilles Tjoelker
634e9188af 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 Tjoelker
5cada825b4 sh: Fix duplicate variable name in test. 2010-04-03 21:56:24 +00:00
Jilles Tjoelker
382e6ae29d sh: Add some testcases for the working parts of tilde expansion. 2010-04-03 21:32:22 +00:00
Jilles Tjoelker
6415a1293f 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 Tjoelker
8cf06f5eee 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 Tjoelker
cc4b8e985d sh: Add some testcases for the working parts of ${v%...} and ${v#...}. 2010-04-03 20:14:10 +00:00
Warner Losh
9ffdaef2bf 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
Warner Losh
638554f5f2 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
Xin LI
36e60cda45 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
Poul-Henning Kamp
ac33b97078 Use gpart(8) to set the active boot partition. 2010-03-24 11:21:33 +00:00
Edwin Groothuis
531a1a4b2c 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
Konstantin Belousov
fe03378831 Add missing headers. While there, arrange headers alphabetically.
MFC after:	3 days
2010-03-16 20:42:54 +00:00
Konstantin Belousov
888025e45a Add missing headers.
MFC after:	3 days
2010-03-16 20:41:45 +00:00
Jilles Tjoelker
c3bb858966 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 Tjoelker
a4a58620d3 sh: Add test for redirection error on subshell (should not abort). 2010-03-14 13:51:12 +00:00
Konstantin Belousov
43648bc031 Remove dot at the end of errx() message.
Noted by:	bde
MFC after:	3 days
2010-03-14 13:29:09 +00:00
Konstantin Belousov
6e2e67160e 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
Konstantin Belousov
31f957034a Make it compile on LP64 arches.
MFC after:	3 days
2010-03-14 13:04:09 +00:00
Edwin Groothuis
3d7b0d842d Create regression tests for ncal:
- A couple of tests to check if the layout of the generated calenders
  is correct.

- A couple of tests to see if impossible combinations for -3, -A,
  -m, -y etc properly abort.

- A couple of test to confirm that the order of -A, -B, -3 etc give
  the right number of months.
2010-03-14 10:24:03 +00:00
Jilles Tjoelker
3a64dbc20a sh: Do not abort on a redirection error if there is no command word.
Although simple commands without a command word (only assignments and/or
redirections) are much like special builtins, POSIX and most shells seem to
agree that redirection errors should not abort the shell in this case. Of
course, the assignments persist and assignment errors are fatal.

To get the old behaviour portably, use the ':' special builtin.
To get the new behaviour portably, given that there are no assignments, use
the 'true' regular builtin.
2010-03-13 22:53:17 +00:00
Jilles Tjoelker
45249f152b sh: Add test for assignment errors (e.g. trying to change a readonly var).
We currently ignore readonly status for assignments before regular builtins
and external programs (these assignments are not persistent anyway), so just
check that the readonly variable really is not changed.
The test depends on the command builtin changes for 'command :'.
2010-03-13 22:30:52 +00:00
Jilles Tjoelker
d5c6bd74d9 sh: Add tests for " and $ inside `. 2010-03-12 23:23:46 +00:00
Jilles Tjoelker
0de1173276 sh: Add some testcases for ${v=w}, ${v-w}, ${v+w}.
These expansions, which were already in the Bourne shell, work correctly for
the most part. The testcases are only about the parts that already work
correctly.
2010-03-07 18:43:29 +00:00
Jilles Tjoelker
0019284ae8 sh: Add various testcases for here documents.
They are mainly about expansions in here documents but because all the
testcases are in $() command substitution, we also test that $() command
substitution is recursively parsed (or very close to it).
2010-03-07 15:08:42 +00:00
Jilles Tjoelker
1749097497 sh: Make sure to popredir() even if a function caused an error. 2010-03-06 17:31:09 +00:00
Jilles Tjoelker
544754df6f sh: Make sure to popredir() even if a special builtin caused an error. 2010-03-06 17:09:22 +00:00
Jilles Tjoelker
c848bc18e8 sh: Improve the command builtin:
* avoid unnecessary fork
* allow executing builtins via command
* executing a special builtin via command removes its special properties

Obtained from:	NetBSD (parts)
2010-03-06 16:57:53 +00:00
Jaakko Heinonen
12794df244 - Use errx(3) instead of err(3) when checking if snprintf(3) succeeded.
snprintf(3) doesn't set errno in the tested cases.
- If the same argument reference (for example %1) was specified more than
  once, the command didn't necessarily fit to the final command buffer. Fix
  this using a dynamic sbuf buffer. Add a few regression tests for the case.

PR:		bin/95079
No objections:	freebsd-hackers
2010-03-05 15:23:01 +00:00
Joel Dahl
0371d265dc The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-03 07:38:12 +00:00
Joel Dahl
2509081a31 The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-02 22:25:50 +00:00
Joel Dahl
7f890ba505 The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-02 17:05:19 +00:00
Ulrich Spörlein
47e1a877c5 Always assign WARNS using ?=
- fix some nearby style bugs
- include Makefile.inc where it makes sense and reduces duplication

Approved by:	ed (co-mentor)
2010-03-02 16:58:04 +00:00
Antoine Brodin
b974b08f1d Add files to remove when MK_PPP=no. 2010-02-28 14:43:55 +00:00
Antoine Brodin
72647fe8e4 Add files to remove when MK_PORTSNAP=no. 2010-02-28 14:41:28 +00:00
Antoine Brodin
78d8164c0f Add files to remove when MK_PKGTOOLS=no. 2010-02-28 14:39:39 +00:00
Antoine Brodin
c13190b297 Add files to remove when MK_PF=no. 2010-02-28 14:37:39 +00:00
Antoine Brodin
58f47440a2 Add files to remove when MK_NTP=no. 2010-02-28 14:32:29 +00:00
Antoine Brodin
fda29b2349 Update files to remove when MK_RCMDS=no. 2010-02-28 14:29:22 +00:00
Antoine Brodin
50d16bbe9f Add files to remove when MK_RCS=no. 2010-02-28 14:26:28 +00:00
Antoine Brodin
236443476e Add files to remove when MK_ROUTED=no. 2010-02-28 14:24:38 +00:00
Antoine Brodin
1fe4843a49 Add files to remove when MK_TELNET=no. 2010-02-28 14:23:38 +00:00
Antoine Brodin
94cd15a9ee Add files to remove when MK_NDIS=no. 2010-02-28 14:21:15 +00:00
Antoine Brodin
8c7d0ea263 Update files to remove when MK_NCP=no. 2010-02-28 14:13:33 +00:00
Antoine Brodin
c742deed4f Update files to remove when MK_LPR=no. 2010-02-28 14:12:05 +00:00
Antoine Brodin
9586e95257 Add files to remove when MK_WIRELESS=no. 2010-02-28 14:08:12 +00:00
Antoine Brodin
e94be45c0c Do not remove fmt.1 when MK_MAIL=no.
X-MFC-With:	r203584
2010-02-26 23:26:15 +00:00
Ruslan Ermilov
9fd69f37d2 Fixed missing or broken library dependencies. 2010-02-25 14:42:26 +00:00
Ruslan Ermilov
a6d8ff1d6d Moved mcgrab(1) into a separate directory -- our .mk infrastructure
doesn't currently have support for building multiple programs in a
single makefile.

While here, fixed manpages and makefiles (missing dependencies).
2010-02-25 14:36:50 +00:00
Rebecca Cran
8dd83f1e16 Update the sendfile regression test so that it outputs results in the
TAP format.
Add a checksum to verify that the data hasn't been corrupted between
being read from disk and being received.

Approved by:	rrs (mentor)
2010-02-24 23:00:16 +00:00
Attilio Rao
4ed925457a Add a regression test for the kthread(9) interface.
Submitted by:	Giovanni Trematerra
		<giovanni dot trematerra at gmail dot com>
2010-02-20 15:20:28 +00:00
Jilles Tjoelker
9f21d0a3a5 sh: arith: Add a test for a bug in the dash arith code,
which I plan to import at some point.
Our current code handles it fine and it should stay that way.
2010-02-17 22:25:22 +00:00
Jilles Tjoelker
70293312f8 sh: arith: Test an octal constant as well. 2010-02-17 22:22:20 +00:00
Ulrich Spörlein
54673381cd Add missing newline in last line of file.
Uncovered via:	fromcvs vs. svn
Approved by:	ed (co-mentor)
2010-02-16 09:10:21 +00:00
Pawel Jakub Dawidek
7b0706f670 - Implement -q option for pgrep(1).
- Add regression test to test -q option.
2010-02-12 18:52:24 +00:00
Ruslan Ermilov
2949bd100b Fixed error checking of pthread(3) functions.
PR:		143807
Submitted by:	pluknet (partly)
2010-02-12 16:33:03 +00:00
Xin LI
cebcc1ac1b Symbolic link to mailwrapper should only be removed if both MK_MAILWRAPPER
and MK_SENDMAIL is "no".

Reported by:	Rob Farmer <rfarmer at predatorlabs.net>
2010-02-10 00:01:35 +00:00
Xin LI
07ea9a7c2f As it turns out, fmt(1) is being used by the base system as well as the
ports tree extensively and it is probably a good idea to keep it
regardless of NO_MAIL setting.

Reported by:	Alexander Best
Reviewed by:	antoine
X-MFC-With:	r203584
2010-02-09 18:22:26 +00:00
Jilles Tjoelker
91f2621cd1 sh: Make sure the mail2.0 test can actually fail if $MAIL is not touched. 2010-02-08 18:57:18 +00:00
Xin LI
4c63c240fb Add files for NO_MAIL, NO_SENDMAIL and NO_MAILWRAPPER.
MFC after:	2 weeks
2010-02-07 00:38:31 +00:00
Jilles Tjoelker
5706357661 sh: Do not stat() $MAIL/$MAILPATH in non-interactive shells.
These may be NFS mounted, and we should not touch them unless we are going
to do something useful with the information.
2010-02-06 22:57:24 +00:00
Antoine Brodin
a48279bb03 Update files to remove when MK_KERBEROS=no. 2010-02-06 20:21:03 +00:00
Antoine Brodin
e86622b3d7 Add files to remove when MK_JAIL=no. 2010-02-06 20:11:23 +00:00
Antoine Brodin
2677a43216 Update files to remove when MK_IPX=no. 2010-02-06 20:09:55 +00:00
Antoine Brodin
02eb407f8c Add files to remove when MK_IPFW=no. 2010-02-06 20:08:46 +00:00