Commit Graph

705 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
874108aed9 MFC @199204 2009-11-12 00:36:22 +00:00
Dag-Erling Smørgrav
1a29dc59c5 Check fork() return value 2009-11-10 10:42:48 +00:00
Jilles Tjoelker
64254a667a sh: Exempt $@ and $* from set -u
This seems more useful and will likely be in the next POSIX standard.

Also document more precisely in the man page what set -u does (note that
$@, $* and $! are the only special parameters that can ever be unset, all
the others are always set, although they may be empty).
2009-10-24 21:20:04 +00:00
Jilles Tjoelker
941538c0f4 Add some tests for ${var?} and set -u. 2009-10-24 20:57:11 +00:00
Jilles Tjoelker
364e9ccb9c wordexp(3): fix some bugs with signals and long outputs
* retry various system calls on EINTR
* retry the rest after a short read (common if there is more than about 1K
  of output)
* block SIGCHLD like system(3) does (note that this does not and cannot
  work fully in threaded programs, they will need to be careful with wait
  functions)

PR:		90580
MFC after:	1 month
2009-10-23 14:50:11 +00:00
Pawel Jakub Dawidek
2cf3d848b6 Fix a case where rename actually succeeds, which is also expected behaviour
according to POSIX. This fixes ZFS on Solaris testing.

Submitted by:	Milan Cermak <Milan.Cermak@Sun.COM>
2009-10-20 21:08:32 +00:00
Dag-Erling Smørgrav
b146811680 Update copyright. 2009-10-19 07:56:03 +00:00
Dag-Erling Smørgrav
6026385bf4 Remove redundant $FreeBSD$. 2009-10-19 07:55:13 +00:00
Konstantin Belousov
eb9de28f20 Tweaks for sigqueue tests:
- slightly adjust code for style, sort headers.
- in sigqtest2, print received signals, to make it easy to see why test
  failed.
- in sigqtest2, job_control_test(), cover a race by adding sleep after
  child stopped itself to allow for SIGCHLD due to stop and exit to not
  be coalesced.

MFC after:	2 weeks
2009-10-11 17:04:13 +00:00
Xin LI
c27838c722 Fix build on amd64.
PR:		misc/139409
Submitted by:	gk
2009-10-07 23:01:31 +00:00
Jilles Tjoelker
640b70e414 sh: Send the "xyz: not found" message to redirected fd 2.
This also fixes that trying to execute a non-regular file with a command
name without '/' returns 127 instead of 126.
The fix is rather simplistic: treat CMDUNKNOWN as if the command were found
as an external program. The resulting fork is a bit wasteful but executing
unknown commands should not be very frequent.

PR:		bin/137659
2009-10-06 22:00:14 +00:00
Robert Watson
9cad1429d6 A few regression tests for SOCK_SEQPACKET UNIX domain sockets.
Sponsored by:	Google
2009-10-05 15:27:01 +00:00
David Schultz
caf17d8660 Regression tests for r197752 (handling of empty/NULL buffers). 2009-10-04 19:44:41 +00:00
Oleksandr Tymoshenko
1ee774f614 - MFC 2009-10-02 19:51:03 +00:00
Bjoern A. Zeeb
492ffed1e3 Replace the name of the sysctl to security.bsd.map_at_zero and to be
consistent updated the name of the variable as well, after the change
in r197711.
2009-10-02 17:53:48 +00:00
Jilles Tjoelker
47e5ae08a1 sh: Disallow mismatched quotes in backticks (...).
Due to the amount of code removed by this, it seems that allowing unmatched
quotes was a deliberate imitation of System V sh and real ksh. Most other
shells do not allow unmatched quotes (e.g. bash, zsh, pdksh, NetBSD /bin/sh,
dash).

PR:		bin/137657
2009-10-01 21:40:08 +00:00
Bjoern A. Zeeb
76e2ffb5a5 Add a simple C program to check mmap calls to various different addresses.
The most important test is the mapping fixed at address 0 depending on the
new sysctl.

Things will be updated and possibly converted to m4/.t style once the
details about the kernel patch will be shaken out.

Submitted by:	simon (initial version)
2009-09-27 21:03:33 +00:00
Edward Tomasz Napierala
c39f46352f Add cross-filesystem regression tests for ACLs. 2009-09-23 15:12:20 +00:00
Edward Tomasz Napierala
95e7b798b9 Add ACL fuzzer. It's not used by the regression tests right now,
but I'd prefert to have it here, so it won't get lost.
2009-09-23 15:06:51 +00:00
John Baldwin
0cab1e9602 - Remove a bogus test: setsockopt() doesn't return a length, getsockopt()
does.
- Use %z to printf a size_t to fix compile on 64-bit platforms.
2009-09-23 14:23:09 +00:00
Diomidis Spinellis
ac8f32ce62 IEEE Std 1003.1, 2004 Edition states:
"The escape sequence '\n' shall match a <newline> embedded in
the pattern space."

It is unclear whether this also applies to a \n embedded in a
character class.  Disable the existing handling of \n in a character
class following Mac OS X, GNU sed version 4.1.5 with --posix, and
SunOS 5.10 /usr/bin/sed.

Pointed by:	Marius Strobl
Obtained from:	Mac OS X
2009-09-20 15:47:31 +00:00
Diomidis Spinellis
76570d0a99 Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementation
of the y (translate) command.

"If a backslash character is immediately followed by a backslash
character in string1 or string2, the two backslash characters shall
be counted as a single literal backslash character"

Pointed by:	Marius Strobl
Obtained from:	Mac OS X
2009-09-20 15:17:40 +00:00
Diomidis Spinellis
91f8201727 Add correct test results. 2009-09-20 15:04:50 +00:00
Diomidis Spinellis
e00741e355 Describe how other systems treat this case. 2009-09-20 14:20:00 +00:00
Diomidis Spinellis
128e6a12b5 Allow [ to be used as a delimiter.
Pointed by:	Marius Strobl
Obtained from:	Apple
2009-09-20 14:11:33 +00:00
Diomidis Spinellis
8d5e165e7f The transition to Subversion allows us to rename files without
repo-copy hacks.
Remove the test-number prefix from the name of the output files,
so that new test cases can be easily added.
2009-09-20 13:39:44 +00:00
Oleksandr Tymoshenko
cbd59a4f65 - MFC from head@196987 2009-09-08 19:15:29 +00:00
Edward Tomasz Napierala
6839605389 Add regression tests for NFSv4 ACL granular permission enforcement. 2009-09-07 19:40:22 +00:00
Edward Tomasz Napierala
0103fcf5dc Add regression tests for NFSv4 ACLs and update POSIX.1e tests to the changed
error messages.
2009-09-07 16:26:03 +00:00
Edward Tomasz Napierala
5f483c5f73 Adapt to the fact that ls(1) correctly prints '+' for symlinks with ACLs now. 2009-09-01 15:51:36 +00:00
Edward Tomasz Napierala
2bf078b30b Add regression test for ACLs on device files - mostly to make
sure we don't crash on attempt to set ACL on them.
2009-08-31 20:11:35 +00:00
Jilles Tjoelker
e16947f83d sh: Fix crash with empty functions (f() { }) introduced in r196483
Empty pairs of braces are represented by a NULL node pointer, just like
empty lines at the top level.

Support for empty pairs of braces may be removed later. They make the code
more complex, have inconsistent behaviour (may or may not change $?), are
not specified by POSIX and are not allowed by some other shells like bash,
dash and ksh93.

Reported by:	kan
2009-08-28 22:41:25 +00:00
Jilles Tjoelker
840f51bb6d Add some tests for a fixed bug in an uncommitted patch.
(Trying to get syntax errors for sh -c ':; do' and `:; do`.)
2009-08-27 22:23:23 +00:00
Jilles Tjoelker
e9d90c5143 Add some tests for poll(2)/shutdown(2) interaction. 2009-08-25 20:33:37 +00:00
Jilles Tjoelker
eb33e843b8 sh: Fix crash when undefining or redefining a currently executing function.
Add a reference count to function definitions.
Memory may leak if multiple SIGINTs arrive in interactive mode,
this will be fixed later by changing SIGINT handling.

PR:		bin/137640
2009-08-23 21:09:46 +00:00
Bjoern A. Zeeb
e7fba5c772 Start respecting WITHOUT_INET6.
Make regression/priv compile again after the multi-IP jail
changes.  Note that we are still using the legacy jail(2)
rather than the jail_set(2)/jail(3) syscall.
Add an IPv4,  and an IPv6 loopback address in case we compile
with INET6 enabled.

Make the priv_vfs_extattr_system compile on amd64 as well using the
proper length modifier to printf(3) for ssize_t.

Reviewed by:	rwatson
Approved by:	re (kib)
2009-08-13 09:11:47 +00:00
Konstantin Belousov
5abb7fe2e9 Fix syntax error, makefile comments start with #.
Submitted by:	bde
Approved by:	re (kensmith)
2009-07-25 21:07:56 +00:00
Konstantin Belousov
5861f96654 Test suite for the poll(2)/select(2) on fifos, pipes and sockets,
and recorded results for several operating systems.

Submitted by:	bde
Approved by:	re (kensmith)
2009-07-12 12:50:43 +00:00
Brian Somers
58a654f664 Fix some uninitialise variables.
PR:		136383
Submitted by:	Ulrich Spoerlein - uqs at spoerlein dot net
Approved by:	re (kib)
MFC after:	3 weeks
2009-07-08 10:16:16 +00:00
Edward Tomasz Napierala
340263c992 Fix fpathconf(3) on fifos, in effect making ls(1) properly
display '+' on them.  Taken from kern/125613, with cosmetic
changes.

PR:		kern/125613
Submitted by:	Jaakko Heinonen <jh at saunalahti dot fi>
Approved by:	re (kib)
2009-07-02 20:05:21 +00:00
Jilles Tjoelker
886bb28357 Add some tests for r194975 and r194977.
Approved by:	ed (mentor) (implicit)
2009-06-25 17:36:08 +00:00
Jilles Tjoelker
30268dfa3f Designate special builtins as such in command -V and type.
Also document various properties of special builtins that we implement.

Approved by:	ed (mentor) (implicit)
2009-06-24 22:04:04 +00:00
Jilles Tjoelker
97ab37f704 Add test for r190698.
Submitted by:	Eygene Ryabinkin
Approved by:	ed (mentor) (implicit)
2009-06-24 20:22:54 +00:00
Jilles Tjoelker
e2451bddff Add tests for r194774.
Approved by:	ed (mentor) (implicit)
2009-06-23 22:03:56 +00:00
Robert Watson
046a577d69 Up the scale of the SPX loopback check a bit: use much larger data sizes
so that we need to do segmentation.
2009-06-20 18:13:20 +00:00
Jilles Tjoelker
57c21ee73a Add tests for r194406 and r194516.
Approved by:	ed (mentor)
2009-06-19 22:15:59 +00:00
John Baldwin
c4f16b69e1 Add a new 'void closefrom(int lowfd)' system call. When called, it closes
any open file descriptors >= 'lowfd'.  It is largely identical to the same
function on other operating systems such as Solaris, DFly, NetBSD, and
OpenBSD.  One difference from other *BSD is that this closefrom() does not
fail with any errors.  In practice, while the manpages for NetBSD and
OpenBSD claim that they return EINTR, they ignore internal errors from
close() and never return EINTR.  DFly does return EINTR, but for the common
use case (closing fd's prior to execve()), the caller really wants all
fd's closed and returning EINTR just forces callers to call closefrom() in
a loop until it stops failing.

Note that this implementation of closefrom(2) does not make any effort to
resolve userland races with open(2) in other threads.  As such, it is not
multithread safe.

Submitted by:	rwatson (initial version)
Reviewed by:	rwatson
MFC after:	2 weeks
2009-06-15 20:38:55 +00:00
Jilles Tjoelker
1251149b3c Add tests for r194127 and r194128.
Approved by:	ed (mentor)
2009-06-14 16:21:51 +00:00
Dag-Erling Smørgrav
4138849fa7 Check that flopen() can lock against self and that children inherit the lock. 2009-06-06 19:07:15 +00:00
Pawel Jakub Dawidek
bf64a6b6b4 lchflags(2) takes int, not u_long like chflags(2) and fchflags(2).
Strange, isn't it?

Pointed out by:	bde
2009-06-03 09:24:58 +00:00