Commit Graph

2449 Commits

Author SHA1 Message Date
jilles
e193bb76ce sh: Reduce more needless differences between error messages. 2011-06-04 15:05:52 +00:00
jilles
0383d0751d sh: Honour -n while processing -c string. 2011-06-04 11:28:42 +00:00
jilles
3bebe47ce6 sh: Add tests for -n flag. These already pass. 2011-06-03 21:17:42 +00:00
imp
d57b0d50d5 Don't need (and can't use) -L to copy links here. 2011-05-31 17:14:06 +00:00
jilles
18f41c73b0 sh: Add tests for some somewhat obscure aspects of function definitions. 2011-05-30 21:49:59 +00:00
bz
be4c43d6c4 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
rwatson
9674a8bca3 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
rwatson
5c20eca2e1 Add missing include of stdio.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:06:24 +00:00
rwatson
bd69c2eac9 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
rwatson
94eb70f754 Add missing #include of err.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 08:54:32 +00:00
jilles
32bc69c8c8 sh: Add test for 'set +o'. 2011-05-29 15:02:10 +00:00
jilles
979af05e77 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
5c7c156d1e 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
f32ab04694 sh: Add simple CDPATH test. 2011-05-27 19:36:07 +00:00
jilles
543f63b8dc 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
be709df8e6 Include an EEPROM dump program for the AR9287 EEPROM format. 2011-05-26 19:49:32 +00:00
obrien
1f1269be06 + 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
ru
2628ba45f7 [mdoc] Fixed .Dt call. 2011-05-25 14:13:53 +00:00
obrien
0b7fec6762 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
imp
397ad8d2f3 Add the description properly... 2011-05-22 18:23:17 +00:00
imp
a0d11553bf Add documentation for WITHOUT_KERNEL_SYMBOLS 2011-05-22 18:12:59 +00:00
jilles
a87bf7ff74 sh: Add test for r222173. 2011-05-22 12:15:14 +00:00
uqs
d86220fde0 Update URLs and fix regex to work with current version of the files. 2011-05-22 09:48:25 +00:00
jilles
3dd8ae4222 sh: Expand aliases after assignments and redirections. 2011-05-21 22:03:06 +00:00
jilles
d865e9ee8f 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
8c45da6d46 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
343e29c626 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
imp
4633a79407 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
ru
928571ffaf Added description for WITH_OFED. 2011-05-17 11:06:41 +00:00
jilles
975e1272ee sh: Add tests for lines that look like heredoc delimiters but are not. 2011-05-14 14:19:30 +00:00
imp
8366271eef Restore BOOT2CFG, accidentally removed in r212938.
PR:		157020
2011-05-14 04:32:30 +00:00
imp
cab53a9d98 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
imp
baa502d654 Add ${} around variable dereference...
Submitted by:	garrett coopper
2011-05-13 18:46:20 +00:00
imp
733bbac7ce 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
imp
6fa2130df3 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
ru
28829a855e Reassurance for impatient. 2011-05-10 13:01:11 +00:00
ru
b2902af260 Style. 2011-05-10 12:57:39 +00:00
ru
cfe73ed34b - 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
ru
a6d00e343c The Objective C support was removed in r220755.
Submitted by:	des
2011-05-10 11:06:14 +00:00
adrian
5064bc4392 This is a full 32 bit field for kite. 2011-05-09 10:39:15 +00:00
jilles
c9be2081e0 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
8ac39aa5be 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
8bbce85526 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
ru
7a04583844 MK_GPIO changed its default; reflect. 2011-05-06 19:14:06 +00:00
ru
318532a63a Removed trailing whitespace. 2011-05-06 19:13:03 +00:00
ru
751b576a63 Tidy up formatting. 2011-05-06 19:10:27 +00:00
jilles
5a49f52603 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
ba0d29571f 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
fa0f3c42ef 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
ba47b21115 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
gnn
896f8696ac 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
dim
2b06698890 Vendor import of llvm trunk r130700:
http://llvm.org/svn/llvm-project/llvm/trunk@130700
2011-05-02 19:34:44 +00:00
bz
5b8b8b0a6a 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
gnn
220f968bbf 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
des
a09ee46337 executable 2011-04-28 11:21:49 +00:00
jilles
7b50330e01 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
f250dc2f44 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
a6d81a941f 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
1347144ea4 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
900999dc14 sh: Add test for bin/12137. 2011-04-15 15:33:24 +00:00
jilles
d59eb063a4 sh: Add test for obscure and ambiguous ${#?}. 2011-04-15 15:26:05 +00:00
jilles
6f6442dbe0 sh: Add test for bin/56147. 2011-04-15 15:14:58 +00:00
adrian
9975f19c3b 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
uqs
9cb0f450df 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
uqs
51399b5e54 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
c902a38c4a 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
4166e50b5a * re-enable marker stuff, I accidentally disabled it during debugging
* correct arg check
2011-04-05 16:12:38 +00:00
adrian
45d22c5507 Flesh out a simple tool to print the ALQ dump generated by the HAL. 2011-04-05 15:11:09 +00:00
mr
b45e127653 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
c38540fcc9 Oops, fix badness i must've introduced earlier. 2011-03-23 11:16:06 +00:00
trasz
6db2fedb23 Add test for acl_is_trivial_np(3). 2011-03-22 17:26:56 +00:00
mr
56f05ef7d3 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
mr
98f46dcc77 Add a file with some remarks for setting up a zfs boot environment 2011-03-20 13:01:57 +00:00
mr
4406676855 - 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
mr
9260208741 - 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
161663c247 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
pjd
eed23027f0 POSIX accepts only ELOOP if O_NOFOLLOW is specified and target is a symlink. 2011-03-13 19:35:13 +00:00
jilles
3dcb70500a sh: Add some tests for ${#parameter}. 2011-03-13 16:20:38 +00:00
brucec
e3ccdf9a91 Fix warnings and style(9) issues.
Set WARNS to 6.
2011-03-12 14:47:54 +00:00
pjd
1f59cd375f Add some missing consts. 2011-03-12 14:09:43 +00:00
brucec
71e24b546b Fix warnings and style(9) issues.
Set WARNS to 6.
2011-03-11 19:32:15 +00:00
brucec
023a3a685e Fix the build: we have snprintf(3).
MFC after:	1 week
2011-03-11 19:19:47 +00:00
brucec
48d19c106d Fix warnings and set WARNS to 6.
MFC after:	1 week
2011-03-11 18:51:42 +00:00
brucec
80d4acd061 Fix warnings and set WARNS to 6.
MFC after:	1 week
2011-03-11 18:48:28 +00:00
brucec
2e64420c58 mptable.h is now in include/x86. 2011-03-11 18:44:16 +00:00
brucec
20ac0c6f7f Fix warnings and style(9) issues.
Set WARNS to 6.

MFC after:	1 week
2011-03-11 17:33:31 +00:00
pjd
f132b5f04d 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
pjd
5f0f37248d 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
pjd
62b96f668a Few initial ftruncate(2) tests. One of them covers stand/154873.
PR:	stand/154873
2011-03-09 23:11:30 +00:00
pjd
cf63dbabf1 Pass descriptor number to write(2), now that it is possible. 2011-03-09 22:50:15 +00:00
pjd
7d5541f691 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
e0eca42999 The regdomain entries are 16 bits, not 8. Print out all 16 bits. 2011-03-09 04:48:06 +00:00
adrian
3acee14718 Update to keep in sync with the HAL 2011-03-08 12:08:23 +00:00
jilles
28c75d673c 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
das
44a5422553 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
20bf8c09c5 Add support for printing out the open-loop TX power control EEPROM fields. 2011-03-06 23:15:24 +00:00
trasz
6a60e48338 One more fix. Now all ACL tests pass again. 2011-03-04 18:46:19 +00:00
trasz
e4e58a6ac8 Adapt tools-crossfs.test to the new semantics. 2011-03-04 18:37:26 +00:00
trasz
89a4324b38 Adapt NFSv4 ACL regression test to the fact that the new ZFS uses
new semantics.
2011-03-04 17:10:39 +00:00
trasz
501918bbcb Make ACL tests slightly easier to run. 2011-03-04 17:07:02 +00:00
delphij
fbf06de861 Accept == as an alias of = which is a popular GNU extension.
This is intentionally undocumented for now since it's not part
of any standard.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Outside an EXIT trap, 'exit' is still equivalent to 'exit $?'.
2011-01-08 23:08:13 +00:00
jilles
25806c21fc sh: Add simple test for 'exit' without parameters. 2011-01-08 23:00:38 +00:00
jilles
742083bfc4 sed: Add test for r217133 (-i race).
PR:		bin/153261
MFC after:	2 weeks
2011-01-08 00:06:22 +00:00
keramida
406dbc36d2 tests: sort & fix includes, remove -include from CFLAGS of acct tests
- Sort the includes of pack.c, moving sys/*.h files near the top.
- Add a couple of missing #include lines, and remove the need for
  custom -include options in the CFLAGS of the test Makefile.
- Remove the ad-hoc 'all' target, but keep its 'regress' bits for
  testing.
- Convert the ad-hoc 'clean' target to proper CLEANFILES stuff,
  so that the normal bsd.prog.mk machinery can clean up.
- Use `make -V .OBJDIR' to detect the place where 'pack' lives,
  so that regress.t works both with and without 'make obj'.

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

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

Submitted by:	phk
2011-01-03 19:32:54 +00:00
imp
339b108495 Put in the other half of the SRCCONF patch.
Submitted by:	phk
2011-01-03 19:30:47 +00:00
jilles
3487ce2142 sh: Test that exit $? replaces the original exit status in an EXIT trap. 2011-01-01 15:25:15 +00:00
jilles
9391068711 sh: Check readonly status for assignments on regular builtins.
An error message is written, the builtin is not executed, nonzero exit
status is returned but the shell does not abort.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This was caused because these tests were committed after the sh -> ${SH}
change but were created before.
2010-12-12 21:18:16 +00:00
jilles
955b676ba9 sh: Add a test for r216387 (long arithmetic expression in here document). 2010-12-12 16:56:16 +00:00
trasz
df80d2ec05 Add regression test for new NFSv4 ACL semantics, verified with ZFSv28.
Note that to run it, you need not only ZFSv28, but also a modified setfacl(1),
which is not in the tree yet.
2010-12-12 13:04:30 +00:00
pjd
4bcdb20a60 Allow to specify path to a file we want to test with sendfile(2).
This allows to specify selected file system and not only /tmp/.
2010-12-11 16:06:52 +00:00
jilles
b69863b7fd printf: Test that the "--" option terminator works. 2010-12-08 22:54:18 +00:00
das
c0634c2105 Work around gcc constant folding bugs. 2010-12-06 00:19:56 +00:00
das
812571675e signbit() returns nonzero for negative arguments, but we shouldn't assume
that it always returns the same nonzero value.
2010-12-06 00:02:49 +00:00
das
c1efcc0baa Fix some warnings. 2010-12-05 23:50:49 +00:00
das
e63325a777 Add regression tests for logarithmic functions in the math library. 2010-12-05 22:18:35 +00:00
uqs
27a502627f Document two more ways to find duplicates in the obsolete file list.
Remove the only duplicate found by the optional files check. Fix typos,
while here.

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

Submitted by:	n_hibma
2010-12-03 07:39:29 +00:00
imp
52bedd6250 _WITHOUT_SRCCONF has too much baggage. Instead, use the simpler
SRCCONF=/dev/null.
2010-12-03 07:33:43 +00:00
das
ac10040980 Add some basic regression tests for nearbyint(). 2010-12-03 00:44:31 +00:00
jilles
a3f372978c sh: Make the test for cd/pwd with long pathnames more useful:
* Use $(getconf PATH_MAX /) to make sure we actually exercise the hard part
* Delete our test area even if the test fails
2010-11-28 22:49:58 +00:00
phk
d30712dbd5 Don't checksum distfiles twice if they match the first time. 2010-11-23 21:21:56 +00:00
phk
92ac246b47 Optimize the ports recurser a bit more. 2010-11-23 20:47:39 +00:00
phk
95f9248b6e Improve the ports-dependency resolver by truncating the recursion if
we already did the target port, and by leaving behind a /tmp/_.plist.dot
which documents which ports pulled in what other ports.
2010-11-23 20:28:21 +00:00
jilles
b37eae53ee sh: Add a test that manipulates various long strings.
It is quite effective at detecting mistakes in memalloc.c and code using it.

It is somewhat slow, but some of the patches in my queue improve it.
2010-11-19 22:25:32 +00:00
jilles
30e8287182 sh: Add another simple test for the wait builtin. 2010-11-19 21:15:06 +00:00
gnn
22828c5963 Fix an error in our results printing. 2010-11-16 20:39:52 +00:00
gonzo
ca4a476430 Add optional files controlled by WITH_GPIO knob
Submitted by:	Alexander Best <arundel@freebsd.org>
2010-11-14 22:14:36 +00:00
brucec
e3018c2449 lib32 is installed on powerpc64 too. 2010-11-14 19:37:07 +00:00
brucec
f1bbcabe40 libatm_p.a, libkeycap_p.a and libmytinfo_p.a are already in ObsoleteFiles.inc.
liblwres.so.10 has been replaced by liblwres.so.50.

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

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

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

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

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

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

MFC after:	1 week
2010-11-08 23:15:10 +00:00
n_hibma
ffd0f29be4 - Set -x flag when executing customisation scripts to aid in debugging them.
- Use KERNCONFDIR with KERNCONF instead of copying the kernel config into the source tree
  so included kernel configs work.
- Put more stuff in the _.bk/_.ik log file, not just make statements.
- Add the kernel config name to the pprint during kernel installation.
- Add NANO_MODULES providing a list of modules to build and install.

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

The new code is clearer as well.

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

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

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-29 21:06:57 +00:00