Commit Graph

3021 Commits

Author SHA1 Message Date
Kyle Evans
18d9146d7e MFC r322325: cat: fix build with -DNO_UDOM_SUPPORT
PR:		230489
2018-08-14 01:57:11 +00:00
John Baldwin
ed527c8787 MFC 330872:
Add a "jail" keyword to list the name of a jail rather than its ID.
2018-03-24 00:26:42 +00:00
Alan Somers
80b7443245 MFC r323275, r324112
r323275:
Add basic tests for chflags, mkdir, rcp, and rmdir

Add basic command line parsing test coverage for these utilities.  The tests
were automatically generated based on their man pages.  These tests can be
expanded by hand for more thorough coverage.  The aim is to generate very
basic amount of test coverage for all the utilities in the base system.

Submitted by:	shivansh
Reviewed by:	asomers, brooks
Sponsored by:	Google, Inc (GSoC 2017)
Differential Revision:	https://reviews.freebsd.org/D12036

r324112:
Fix Makefile entries from r323275

Reported by:		Vladimir Zakharov <zakharov.vv@gmail.com>
Reviewed by:		ngie
X-MFC-With:		323275
2017-11-28 18:18:39 +00:00
Enji Cooper
c0eb492e98 MFC r322951:
Respect MK_TCSH with build-tools and native-xtools

This helps reduce the WORLDTMP footprint slightly.

Based on a patch I submitted 5 years ago to GNATS.

PR:		174051
Relnotes:	yes (anyone who cross-builds with MK_TCSH=yes will run into
		     build failures if the host doesn't have tcsh(1))
Reminded by:	Fabian Keil <fk@fabiankeil.de>
2017-09-30 20:44:25 +00:00
Marius Strobl
cdebb82c3e MFC: r321293
date: avoid crash on invalid time

PR:		220828
Approved by:	re (kib)
2017-09-07 23:28:35 +00:00
Glen Barber
bd1d923514 MFC r321949, r321950, r322101:
r321949 (ngie):
  Add expected failures for ZFS

  - :f_flag fails on ZFS because UF_IMMUTABLE isn't supported.
  - :v_flag fails on ZFS because the mode for foo is [always] updated
    unnecessarily.

  get_filesystem(..) (supporting function that was added to the test
  script) is based on equivalent logic in
  usr.bin/extattr/tests/extattr_test.sh .

 r321950 (ngie):
  Always use first parameter passed to get_filesystem(..) instead of
  discarding it and using `.` instead.

 r322101 (ngie):
  Don't check result of chflags in f_flag_cleanup()

  This will prevent false positives from occurring if the test is run
  on ZFS since ZFS doesn't support fflags throbbing like UFS.

PR:		221188, 221189
Approved by:	re (marius)
Sponsored by:	The FreeBSD Foundation
2017-08-21 17:20:31 +00:00
Alan Somers
9189199095 MFC r320269:
style fixes in bin/echo/tests

Submitted by:	shivansh
Reviewed by:	asomers
X-MFC-With:	319626
Sponsored by:	Google, Inc (GSoC 2017)
Differential Revision:	https://reviews.freebsd.org/D11318
2017-07-31 23:03:10 +00:00
Alan Somers
0978fc7245 MFC r319854:
bin/ln: Set umask appropriately before creating files for testing

These changes were missed in D11084

Submitted by:	shivansh
Reviewed by:	asomers
X-MFC-With:	319714
Sponsored by:	Google, Inc (GSoC 2017)
Differential Revision:	https://reviews.freebsd.org/D11158
2017-07-31 21:42:18 +00:00
Enji Cooper
5c5d7b215f MFC r302500,r319339,r319543,r319544,r319551,r321138:
r302500 (by cem):

dd(1): Enable access to SIZE_T_MAX character devices

On machines where SIZE_T_MAX exceeds OFF_MAX (signed 64-bit), permit seeking
character devices to negative off_t values.  This enables dd(1) to interact
with kernel KVA in /dev/kmem on amd64, for example.

r319339 (by asomers):

Fix integer overflow detection in dd

dd(1) tried to detect whether the seek offset would overflow, but it failed
to account for the case where the provided argument was negative and the
file was a regular file (negative seeks are allowed for character devices).
I fixed it, and added a regression test.

CID:		1368659

r319543:

Stylistic tweaks

Move opening braces of functions from the last column to column 0.

MFC with:	r319339

r319544:

Mark :seek_overflow as an expected failure

MFC with:	r319339
PR:		219757

r319551 (by asomers):

Fix bin/dd/dd2_tests:seek_overflow on UFS and TMPFS

Split the postive and negative parts into separate test cases.  The positive
test case can only run on ZFS, because only ZFS supports files that large.

PR:		219757

r321138:

Remove unnecessary make logic added in r319339

This makes the change cleaner and easier to backport to ^/stable/10.
2017-07-18 17:36:25 +00:00
Enji Cooper
6a27f42c06 MFC r268030,r268793,r303212,r319642,r319830:
r268030 (by eadler):

chown: add a test

Add a test for the chown utility. This sets up chown(8) to be capable of being
tested.  As such, only add one test for now as an example.

r268793 (by eadler):

chown: Fix chown test number

r303212 (by bdrewery):

Move chown tests to proper path

r319642:

Add some basic tests for chmod(1)

r319830:

Add more simple positive tests for chown(1)

The tests are largely symmetric with the tests for chmod(1)--added in r319642.

Remove chown-f_test (added in r268030) since the test coverage is now being
provided by `chown_test`.
2017-07-18 16:27:10 +00:00
Enji Cooper
9984ea0bf9 MFC r319856,r320172,r320173:
r319856:

Add a testcase for `ln -sF`

The testcase fails today, so mark it with atf_expect_fail: in
particular, the target (B) isn't being unlinked and the documentation
doesn't suggest special handling for directories. Thus, there's either
a doc or an implementation bug in ln(1) that needs to be resolved.

MFC with:	r319714, r319854, r319855
PR:		219943

r320172:

ln(1): fix -F behavior

When '-F' option is used, the target directory needs to be unlinked.
Currently, the modified target ("target/source") is being unlinked, and
since it doesn't yet exist, the original target isn't removed.
This is fixed by skipping the block where target is modified to
"target/source" when '-F' option is set.
Hence, a symbolic link (with the same name as of the original target) to
the source_file is produced.

Update the test for ln(1) to reflect fix for option '-F'

PR:		219943

r320173:

Don't expect :sF_flag to fail anymore

While here, also add a check to verify that the link target
is updated in the testcase

MFC with:	r320172
PR:		219943
2017-07-17 21:13:43 +00:00
Enji Cooper
9aa7e86105 MFC r319857:
ln(1): wordsmith -F option description
2017-07-17 21:12:02 +00:00
Enji Cooper
7574569ebc MFC r319857:
ln(1): wordsmith -F option description
2017-07-17 21:10:08 +00:00
Enji Cooper
fd8eaeab81 MFC r319626:
Add basic tests for echo(1)

Verify that echo(1) does not...
- ... print the trailing newline character with option '-n'.
- ... print the trailing newline character when '\c' is appended to
      the end of the string.
2017-07-06 05:28:35 +00:00
Enji Cooper
6a0c4499bb MFC r319637:
Add testcases for `cat -b`
2017-07-06 05:26:27 +00:00
Enji Cooper
0d34ffdb31 MFC r319634:
Add additional testcases for cat(1)

Verify the following additional cases:
- -s (in isolation, in addition to the -se testcase obtained via the
      NetBSD test).
- -vt
2017-07-06 05:22:10 +00:00
Allan Jude
fdc6b7a777 MFC r320644:
Add deprecation notices for all rcmd tools
2017-07-04 15:53:54 +00:00
Jilles Tjoelker
5dae12fd47 MFC r317912: sh: Fix INTOFF leak after a builtin with different locale
settings.

After executing a builtin with different locale settings such as
  LC_ALL=C true
SIGINT handling was left disabled indefinitely.
2017-07-01 12:57:00 +00:00
Jilles Tjoelker
7dd60cfdd8 MFC r315005: sh: Fix executing wrong command with ${x#$(y)}$(z).
The parsed internal representation of words consists of a byte string with a
list of nodes (commands in command substitution). Each unescaped CTLBACKQ or
CTLBACKQ | CTLQUOTE byte corresponds to an entry in the list.

If param in ${param#%##%%word} is not set, the word is not expanded (in a
deviation of POSIX shared with other ash variants and ksh93). Erroneously,
the pointer in the list of commands (argbackq) was not advanced. This caused
the wrong command to be executed later if the outer word contained another
command substitution.

Example:
  echo "${unsetvar#$(echo a)}$(echo b)"
wrote "a" but should write "b".
2017-06-30 21:32:48 +00:00
Dmitry Chagin
e8f43d26b7 MFC r315948:
Update tcsh to 6.20.00

MFC r315952:

Update tcsh to vendor git b605cb561d

Vendor changes:

1. PR/471: Daiki Ueno: Delay interpreting arginp until we've processed
our startup files (which can change the NLS environment).

2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar).

3. Fix out of bounds read (Brooks Davis)
(reproduce by starting tcsh and hitting tab at the prompt).

4. Don't play pointer tricks that are undefined in modern c
(Brooks Davis).
2017-04-15 11:16:11 +00:00
Jilles Tjoelker
52e5de6f29 MFC r314686: sh: Fix crash if a -T trap is taken during command substitution.
Code like  t=$(stat -f %m "$file")  segfaulted if -T was active and a trap
was taken while the shell was waiting for the child process to finish.

What happened was that the dotrap() call in waitforjob() was hit. This
re-entered command execution (including expand.c) at a point not expected by
expbackq(), and global state (unallocated stack string and argbackq) was
corrupted.

To fix this, change expbackq() to prepare for command execution to be
re-entered.

In stable/10, there is more global state that needs to be restored than in
stable/11 and head.

Reported by:	bdrewery
2017-04-14 21:42:27 +00:00
Sevan Janiyan
60c6f55323 MFC r306715
Add history section for dd(1)
First version of UNIX to include dd found using TUHS
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/dd.c

PR:		211777
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D8104
2017-03-30 02:23:02 +00:00
Sevan Janiyan
7a39c7325e MFC r285645
Mention the dd-like recoverdisk(1) to help folks find this great BSD command.
2017-03-30 02:19:42 +00:00
Sevan Janiyan
29e339000c MFC r270831
Update the date for last example.

Sponsored by: Netflix
2017-03-30 02:17:48 +00:00
Sevan Janiyan
04df75e5cb MFC r270771
Add canonical population of a disk / thumb drive from an image example.
2017-03-30 02:16:34 +00:00
Bryan Drewery
0035a4ba79 MFC r314714:
Don't kill pid -1 on overflow from strtol(3).
2017-03-22 17:49:56 +00:00
Jilles Tjoelker
2238e200d5 MFC r314637: sh: Add some already working tests that exercise new code paths 2017-03-12 19:49:08 +00:00
Enji Cooper
e155225fa2 MFC r295643:
r295643 (by bdrewery):

Test directories can build in parallel fine.
2017-02-16 05:17:40 +00:00
Enji Cooper
3cd543dec2 MFC r305358,r305449,r305451,r306367,r306397,r309474:
This also contains a merge of ^/projects/netbsd-tests-update-12@r304035 .
This change never hit ^/head because bin/cat's behavior was changed (on ^/head)
to match NetBSD.

PR:	210607

r305358:

Update contrib/netbsd-tests with new content from NetBSD

This updates the snapshot from 09/30/2014 to 08/11/2016

This brings in a number of new testcases from upstream, most
notably:

- bin/cat
- lib/libc
- lib/msun
- lib/libthr
- usr.bin/sort

lib/libc/tests/stdio/open_memstream_test.c was moved to
lib/libc/tests/stdio/open_memstream2_test.c to accomodate
the new open_memstream test from NetBSD.

Tested on:	amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox

r305449:

Install h_db to unbreak some of the lib/libc/db testcases after
r305358

r305451:

Fix lib/libc/rpc test assumptions added in r305358

- Require root in the tcp/udp subtests (it's needed on FreeBSD when
  registering services).
- Skip the tests if service registration fails.

r306367 (by br):

Allow up to 6 arguments only on MIPS.

r306397 (by br):

Use right piece of code for FreeBSD.

r309474:

Don't build :strvis_locale if VIS_NOLOCALE is undefined

The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features
in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower
in conditionally running the test instead of backporting the newer version of
libc-vis
2017-02-10 01:13:12 +00:00
Enji Cooper
c06eac9206 MFC r289172,r290254:
r289172:

Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

r290254:

Remove unused variable (SRCDIR)
2017-02-09 22:49:48 +00:00
Sevan Janiyan
4b327e54b7 In v3 UNIX, the kill utility is documented in category 8, not 1.
Add a note of it.
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man8/kill.8

PR:		211786
Approved by:	bcr (mentor)
Obtained from:	TUHS
Differential Revision:	https://reviews.freebsd.org/D8105
2017-02-03 11:18:34 +00:00
Alan Somers
254f9cc3e7 MFC r310118
Fix ls_tests:o_flag with ZFS TMPDIR

Unlike UFS or TMPFS, ZFS sets uarch automatically whenever a file is
updated. The test must explicitly clear uarch to be portable across
filesystems. Also, it doesn't need to run as root.
2017-01-12 21:46:31 +00:00
Pedro F. Giffuni
49bc0f8da6 MFC r310367:
pax(1):	Fix a bug with archives smaller than 512 bytes.

The problem here is that the archive is too short (< 512 bytes). The
buffer routines, try to read at least 512 bytes, even when we try to
determine what format file we have, which is wrong.

Obtained from:	NetBSD (CVS rev 1.26)
2016-12-26 16:43:39 +00:00
Brooks Davis
730c58600b MFC r310088, r310090, r310095
r310088:
Put the undocumented df feature of mounting filesystems from device
nodes
under an ifdef.  Leave enabled.

Reviewed by:	cem
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513

r310090:
Mount filesystems without executable permissions since they should never
be used.

Reviewed by:	cem
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513

r310095:
Use nmount(2) rather than the obsolete mount(2).

Reviewed by:	cem
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D8513
2016-12-21 23:59:58 +00:00
Eric van Gyzen
86496ace5b MFC r309676
Export the whole thread name in kinfo_proc

kinfo_proc::ki_tdname is three characters shorter than
thread::td_name.  Add a ki_moretdname field for these three
extra characters.  Add the new field to kinfo_proc32, as well.
Update all in-tree consumers to read the new field and assemble
the full name, except for lldb's HostThreadFreeBSD.cpp, which
I will handle separately.  Bump __FreeBSD_version.

Sponsored by:	Dell EMC
2016-12-15 16:52:17 +00:00
Xin LI
11cd360d7a MFC r309238,309239:
r309238: Plug a potential memory leak.
r309239: style(9).
2016-12-12 02:14:42 +00:00
Dag-Erling Smørgrav
2c2d81719c MFH (r308297): use what(1) instead of strings(1).
PR:		213665
Submitted by:	Pawel Worach <pawel.worach@gmail.com>
2016-12-10 20:24:22 +00:00
Sevan Janiyan
1aca80ed93 MFC r306722:
Add history section for test(1)
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/test.c

PR:		211789
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D8104
2016-10-16 23:18:35 +00:00
Sevan Janiyan
02e4504e75 MFC r306721:
Add history section for stty(1)
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/stty.1

PR:             211788
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8104
2016-10-16 23:16:05 +00:00
Sevan Janiyan
bbeff4444c MFC r306720:
Add history section of pwd(1)
http://minnie.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s2/pwd.c

PR:		211787
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D8104
2016-10-16 23:13:27 +00:00
Sevan Janiyan
cb6673d650 MFC r306719:
Document origins of expr & authors
http://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/usr/man/man1/expr.1

PR:             173979
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8104
2016-10-16 23:12:07 +00:00
Sevan Janiyan
d3200b7e71 MFC r306718:
Add history section for echo(1)
Sourced using the draft copy of the second edition manual
http://www.tuhs.org/Archive/PDP-11/Distributions/research/1972_stuff/unix_2nd_edition_manual.pdf

PR:		211785
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D8104
2016-10-16 23:09:04 +00:00
Sevan Janiyan
6b28082ba0 MFC r267667:
use .Mt to mark up email addresses consistently (part1)

PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2016-10-16 22:02:50 +00:00
Sevan Janiyan
365570e54f MFC r306582:
"POSIX doesn't specify -h." - r1.27 from NetBSD
http://man.openbsd.org/?query=chmod&apropos=0&sec=0&arch=default&manpath=POSIX-2013

PR:		212337
Approved by:	bcr (mentor)
Obtained from:	NetBSD
Differential Revision:	https://reviews.freebsd.org/D8118
2016-10-10 16:07:23 +00:00
Sevan Janiyan
af509cf3e4 MFC r306581:
Use .At macro instead of specifying AT&T UNIX literaly.

PR:             212034
Approved by:    bcr (mentor)
Differential Revision:  https://reviews.freebsd.org/D8114
2016-10-10 15:54:32 +00:00
Sevan Janiyan
59d2b31de2 MFC r306714:
Document where chio(1) originated from & which version of FreeBSD first
included it.

PR:           211776
Approved by:  bcr (mentor)
Differential Revision:        https://reviews.freebsd.org/D8104
2016-10-10 15:48:40 +00:00
Sevan Janiyan
a13df39f1c MFC r306584:
Move the description of CHANGER variable to ENVIRONMENT section rather than
in the DESCRIPTION section.
From OpenBSD src/bin/chio/chio.1 r1.23

PR:           212158
Approved by:  bjk
Obtained from:        OpenBSD
Differential Revision:        https://reviews.freebsd.org/D8117
2016-10-10 15:44:42 +00:00
Andrey A. Chernov
c72704747b MFC r305841
Implement multibyte encoding support for -v with fallback
2016-09-22 16:46:59 +00:00
Konstantin Belousov
d680fe9b09 MFC r303423:
Force SIGSTOP to be the first signal reported after the attach.
2016-08-15 21:44:06 +00:00
John Baldwin
6c57684dd2 MFC 302900,302902,302921,303461,304009:
Add a mask of optional ptrace() events.

302900:
Add a test for user signal delivery.

This test verifies we get the correct ptrace event details when a signal
is posted to a traced process from userland.

302902:
Add a mask of optional ptrace() events.

ptrace() now stores a mask of optional events in p_ptevents.  Currently
this mask is a single integer, but it can be expanded into an array of
integers in the future.

Two new ptrace requests can be used to manipulate the event mask:
PT_GET_EVENT_MASK fetches the current event mask and PT_SET_EVENT_MASK
sets the current event mask.

The current set of events include:
- PTRACE_EXEC: trace calls to execve().
- PTRACE_SCE: trace system call entries.
- PTRACE_SCX: trace syscam call exits.
- PTRACE_FORK: trace forks and auto-attach to new child processes.
- PTRACE_LWP: trace LWP events.

The S_PT_SCX and S_PT_SCE events in the procfs p_stops flags have
been replaced by PTRACE_SCE and PTRACE_SCX.  PTRACE_FORK replaces
P_FOLLOW_FORK and PTRACE_LWP replaces P2_LWP_EVENTS.

The PT_FOLLOW_FORK and PT_LWP_EVENTS ptrace requests remain for
compatibility but now simply toggle corresponding flags in the
event mask.

While here, document that PT_SYSCALL, PT_TO_SCE, and PT_TO_SCX both
modify the event mask and continue the traced process.

302921:
Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.

303461:
Note that not all optional ptrace events use SIGTRAP.

New child processes attached due to PTRACE_FORK use SIGSTOP instead of
SIGTRAP.  All other ptrace events use SIGTRAP.

304009:
Remove description of P_FOLLOWFORK as this flag was removed.
2016-08-15 21:10:41 +00:00