Commit Graph

1767 Commits

Author SHA1 Message Date
Jaakko Heinonen
d8eba599f5 Don't read the newline character to line buffer because lines are passed
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.

Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.

Add regression tests for the cases. [1]

PR:		bin/140976
Submitted by:	D'Arcy Cain (original version) [1]
Approved by:	trasz (mentor)
2009-12-12 18:18:46 +00:00
Jilles Tjoelker
df8d66693f sh: Test ;<newline> as well as ; in the 'for' parser test. 2009-12-06 23:31:23 +00:00
Poul-Henning Kamp
5a42d563e4 Add disk-magic for amd64: same as i386.
Pass PORTS_OPTS wherever we invoke ports makefiles

Add a logfile where we can see the progress of distfile prefetching
2009-12-04 10:57:01 +00:00
Brian Feldman
20f492f0eb Do not gratuitously fail *env(3) operations due to corrupt ('='-less)
**environ entries.  This puts non-getenv(3) operations in line with
getenv(3) in that bad environ entries do not cause all operations to
fail.  There is still some inconsistency in that getenv(3) in the
absence of any environment-modifying operation does not emit corrupt
environ entry warnings.

I also fixed another inconsistency in getenv(3) where updating the
global environ pointer would not be reflected in the return values.
It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3)
in order to see the change.
2009-12-01 05:04:31 +00:00
Jilles Tjoelker
772e9b41df Disable job control when running 'sh -i' in the testsuite.
Job control tty manipulations sometimes cause the tests to stop (SIGTTOU
and the like) when run from the 'prove' tool.
2009-11-29 22:58:10 +00:00
Jilles Tjoelker
e1ef314121 Fix some cases where file descriptors from redirections leak to programs.
- Redirecting fds that were not open before kept two copies of the
  redirected file.
    sh -c '{ :; } 7>/dev/null; fstat -p $$; true'
    (both fd 7 and 10 remained open)
- File descriptors used to restore things after redirection were not
  set close-on-exec, instead they were explicitly closed before executing
  a program normally and before executing a shell procedure. The latter
  must remain but the former is replaced by close-on-exec.
    sh -c 'exec 7</; { exec fstat -p $$; } 7>/dev/null; true'
    (fd 10 remained open)

The examples above are simpler than the testsuite because I do not want to
use fstat or procstat in the testsuite.
2009-11-29 22:33:59 +00:00
Julian Elischer
5c2d577a21 exit if "make distribition" fails
Submitted by:	patrick tracanelli
MFC after:	1 week
2009-11-25 19:00:30 +00:00
Jung-uk Kim
0cdc14c810 Make this test case little bit more interesting. 2009-11-23 22:28:15 +00:00
Jilles Tjoelker
eaa3489312 sh: Ensure the same command input file is on top after executing a builtin.
This avoids weirdness when 'fc -e vi' or the like is done and there is a
syntax error in the file. Formerly an interactive shell tried to execute
stuff after the syntax error and exited.

This should also avoid similar issues with 'command eval' and 'command .'
when 'command' is implemented properly as in NetBSD sh.

Special builtins did not have this problem since errors in them cause the
shell to exit or to reset various state such as the current command input
file.
2009-11-22 14:04:20 +00:00
Jilles Tjoelker
e3c2cd7237 trap: do not consider a bad signal name a fatal error.
POSIX explicitly prescribes this.
Continue processing any other signals and return status 1.
2009-11-21 20:44:34 +00:00
Stefan Farfeleder
80d5dd5fdb Add a test for r199631. 2009-11-21 14:54:35 +00:00
Stefan Farfeleder
ee47d334ef Add a few very basic tests for cd -{L,P} and pwd -{L,P}. 2009-11-21 14:12:51 +00:00
Jung-uk Kim
908d88b03b Correct copyright date in the BPF regression test. 2009-11-20 19:01:09 +00:00
Jung-uk Kim
448a7ff2ec Adjust BPF JIT compiler regression tests to catch up with r199603. 2009-11-20 18:53:38 +00:00
Michael Reifenberger
569b2f6954 Add nanobsd example for the PC Engines ALIX board (serial console). 2009-11-19 16:27:51 +00:00
Jung-uk Kim
b78db64f58 Add a test case for very long BPF program. 2009-11-19 00:00:31 +00:00
Attilio Rao
1262810177 Collapse devinfo_state_t with device_state_t in order to avoid a
structure replication and improve manteneability.

Reviewed by:	jhb, imp
Tested by:	Riccardo Torrini <riccardo at torrini dot org>
2009-11-15 16:44:43 +00:00
Jilles Tjoelker
7ab07e8ada sh: Allow a newline before "in" in a for command, as required by POSIX. 2009-11-14 22:08:32 +00:00
Ed Schouten
c0fe95bc1b Convert {small prefix}BSD to TERM=xterm as well.
Clean up the ttys files shipped with PicoBSD, NanoBSD and TinyBSD. While
there, it seems one of them still had references to sio(4). Make it in
sync with what we do in the base system.
2009-11-13 11:32:14 +00:00
Ed Schouten
e42fc36867 Switch the default terminal emulation style to xterm for most platforms.
Right now syscons(4) uses a cons25-style terminal emulator. The
disadvantages of that are:

- Little compatibility with embedded devices with serial interfaces.
- Bad bandwidth efficiency, mainly because of the lack of scrolling
  regions.
- A very hard transition path to support for modern character sets like
  UTF-8.

Our terminal emulation library, libteken, has been supporting
xterm-style terminal emulation for months, so flip the switch and make
everyone use an xterm-style console driver.

I still have to enable this on i386. Right now pc98 and i386 share the
same /etc/ttys file. I'm not going to switch pc98, because it uses its
own Kanji-capable cons25 emulator.

IMPORTANT: What to do if things go wrong (i.e. graphical artifacts):

- Run the application inside script(1), try to reduce the problem and
  send me the log file.
- In the mean time, you can run `vidcontrol -T cons25' and `export
  TERM=cons25' so you can run applications the same way you did before.
  You can also build your kernel with `options TEKEN_CONS25' to make all
  virtual terminals use the cons25 emulator by default.

Discussed on:	current@
2009-11-13 05:54:55 +00:00
Dag-Erling Smørgrav
2deaa94b6a Add test-pidfile.c and increase warning level. 2009-11-12 01:37:25 +00:00
Dag-Erling Smørgrav
761ea75d41 Test cases for pidfile(3) - including two designed to catch issues arising
from the incorrect use of fcntl(2) instead of flock(2).
2009-11-12 01:37:02 +00:00
Dag-Erling Smørgrav
6830953bc1 Fix warnings and remove one unnecessary use of vfork(). The other could
also be removed with a little more work.
2009-11-12 01:34:55 +00:00
Dag-Erling Smørgrav
a2f8e5b371 Fix warnings 2009-11-12 01:33:57 +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
Luigi Rizzo
ed8c4b44e6 Support the specification of a range of destination ports e.g.
netsend 127.0.0.1 6666-7777 [payloadsize] [packet_rate] [duration]

This is useful to test the behaviour of systems that do some kind
of flow classifications and so exhibit different behaviour depending
on the number of flows that hit them.
I plan to add a similar extension to sweep on a range of IP addresses,
so we can issue a single command to flood (obviously, for testing
purposes!) a number of different destinations.

When there is only one destination, we do a preliminary connect()
of the socket so we can use send() instead of sendto().
When we have multiple ports, the socket is not connect()'ed and we
do a sendto() instead. There is a performance hit in this case,
as the throughput on the loopback interface (with a firewall rule
that blocks the transmission) goes down from 900kpps to 490kpps on
my test machine.

If the number of different destinations is limited, one option to
explore is to have multiple connect()ed sockets.

MFC after:	1 month
2009-10-15 15:30:41 +00:00
Luigi Rizzo
54dd21686d A small change to avoid calling gettimeofday() too often
(hardwired to once every 20us at most).

I found out that on many machines round here, i could only get
300-400kpps with netsend even on loopback and a 'deny' rule in
the firewall, while reducing the number of calls to gettimeofday()
brings the value to 900kpps and more.

This code is just a quick fix for the problem. Of course it could be
done better, with proper getopt() parsing and the like, but since
this applies to the entire program i'll postpone that to when i have
more time.

Reviewed by:	rwatson
MFC after:	1 month
2009-10-15 14:18:35 +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
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
Simon L. B. Nielsen
3d5812a230 - When we run our trap cleanup handler, echo that we are running this
handler to make it more clear why we are 'suddenly' running df,
  umount, and mdconfig.
- Remove trap handler again after we have unconfigured the memory
  device etc.  Before we could end up running the trap handler if a
  later stage failed, which was a bit confusing and not really useful.

MFC after:	2 weeks
2009-09-27 21:01:07 +00:00
Rui Paulo
249e7759ac Update the includes to two more levels of subdirs.
MFC after:	1 week
2009-09-24 11:11:00 +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