Commit Graph
3332 Commits
Author SHA1 Message Date
Edward Tomasz Napierala 16375ed535 MFC r323263:
Hint that the "-o emul" option for ps(1) shows the ABI.
2017-10-04 12:02:42 +00:00
Edward Tomasz Napierala 3f3f5dffb6 MFC r323228:
Make ps(1) flag processes in capsicum(4) capability mode with "C".
2017-10-04 12:02:05 +00:00
Edward Tomasz Napierala dba2b6ea2d MFC r323225:
Reflect realtime and idle priorities in ps(1) state flags, same like
we do for the usual nice values.  It could be argued that they should
use another set of indicators, since the underlying mechanism is
different, but they match the description in the manual page, and so
I think it's ok to not overcomplicate things.

PR:		81757
2017-10-04 12:01:02 +00:00
Enji Cooper 281d3045a3 MFC r320701:
Remove SUBDIR ordering/uniquifying in *bin/Makefile

After the addition of SUBDIR.yes, uniquifying/ordering the SUBDIRs doesn't
make a whole lot of sense, and it's in effect a half measure.

Ordering SUBDIR (after adding SUBDIR.yes to it) in bsd.subdir.mk is a
separate change that warrants more discussion/testing, because while
the SUBDIR_PARALLEL work largely fixed dependency ordering for SUBDIRs,
there might be downstream FreeBSD consumers that rely on the SUBDIR
ordering.
2017-09-08 04:46:55 +00:00
Ed Maste aaa29bc08a MFC r321293: date: avoid crash on invalid time
localtime(3) returns NULL when passed an invalid time_t but date(1)
previously did not handle it. Exit with an error in that case.

PR:		220828
Submitted by:	Vinícius Zavam
2017-08-31 02:37:44 +00:00
Alan Somers faee3a5c03 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-08-25 04:00:13 +00:00
Enji Cooper 726cdb1b54 MFC r321949,r321950,r322101:
r321949:

Add expected failures for ZFS

- :f_flag fails on ZFS because UF_IMMUTABLE isn't supported [1].
- :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 .

PR:	221189 [1], 221188 [2]

r321950:

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

MFC with:	r321949
PR:	221189 [1], 221188 [2]

r322101:

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:	221189
MFC with:	r321949
2017-08-19 01:21:46 +00:00
Edward Tomasz Napierala f2072fbde2 MFC r321368:
Use the "tree" word in ps(1) -d option description, to make it easier
to find.
2017-08-05 09:48:58 +00:00
Enji Cooper 283839843f 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:35:29 +00:00
Enji Cooper 1e7957c974 MFC r303212,r319642,r319830:
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:03:39 +00:00
Enji Cooper d339ff25eb MFC r320172,r320173:
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:11:21 +00:00
Enji Cooper dd96e7cb9f MFC r319857:
ln(1): wordsmith -F option description
2017-07-17 21:09:31 +00:00
Enji Cooper 07c4c4d55c MFC r319855,r319856,r319858:
r319855:

Use readlink(1)/stat(1) to query symlinks instead of file(1)

file(1) can be compiled out of the system via MK_FILE == no, and the
output isn't guaranteed to be stable. It's better to use stat(1)/readlink(1)
instead to query symlink/file paths.

MFC with:	r319714, r319854

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

r319858:

Style fixes: clean up leading whitespace (8 single column spaces -> \t)

MFC with:	r319714, r319854, r319855, r319856
2017-07-17 21:08:24 +00:00
Enji Cooper ab0b92463b 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:32 +00:00
Enji Cooper aaeb2c1111 MFC r319637:
Add testcases for `cat -b`
2017-07-06 05:26:24 +00:00
Enji Cooper d1bf0a0e09 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:02 +00:00
Alan Somers a9c82d429b MFC r319714, r319854
r319714:
Add tests for ln(1)

* Verify that when creating a hard link to a symbolic link, '-L' option
  creates a hard link to the target of the symbolic link
* Verify that when creating a hard link to a symbolic link, '-P' option
  creates a hard link to the symbolic link itself
* Verify that if the target file already exists, '-f' option unlinks it so
  that link may occur
* Verify that if the target file or directory is a symbolic link, '-shf'
  option prevents following the link
* Verify that if the target file or directory is a symbolic link, '-snf'
  option prevents following the link
* Verify that '-s' option creates a symbolic link
* Verify that '-w' option produces a warning if the source of a symbolic
  link does not currently exist

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

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-05 15:58:23 +00:00
Allan Jude bf1e4d328d MFC r320644:
Add deprecation notices for all rcmd tools
2017-07-04 15:53:23 +00:00
Enji Cooper f147af02dc MFC r314655:
bin: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output
2017-05-30 04:15:40 +00:00
Rodney W. Grimes 05c7f8763e MFC r314833
Convert absolute links to relative links.
	Style.Makefile(9) has been ignored to produce minimal diffs.

MFC r314837
	The relative symlink fix causes downstream issues for
	EMC DELL Isilon so revert the relative symlink fix
	pending a better solution.

	Reported by:	ngie

MFC r315091
	Revert r314833 until the problem with INSTALL_RSYMLINKS can be found
	as it appears to break arm release builds.

	PR:		217705
	Reported by:	[email protected]

Approved by:	grehan (mentor)
2017-05-28 00:13:44 +00:00
Edward Tomasz Napierala f2d927897b MFC r317904:
.Xr resizewin from stty(1) man page.
2017-05-23 08:11:55 +00:00
Jilles Tjoelker 2ce2af793a 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-05-14 20:17:50 +00:00
Eric van Gyzen 71fe51501d MFC r316430
Fix indentation in dd(1)

Quoting http://mdocml.bsd.lv/mdoc/details/width.html

Do not use macros in the argument specifying the width,
since that's not portable.  While GNU troff can handle it,
mandoc cannot.

Sponsored by:	Dell EMC
2017-05-01 01:40:24 +00:00
Dmitry Chagin 5cbb976d18 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:13:11 +00:00
Bryan Drewery 3eb1df30bf MFC r314886,r314943,r314944:
r314886:
    pwait: Add a -t flag to specify a timeout before exiting, and tests.
  r314943:
    Remove unneeded -x from tests.
  r314944:
    Rename some tests to end in _test.
2017-03-22 17:53:25 +00:00
Bryan Drewery f836af24bf MFC r314714:
Don't kill pid -1 on overflow from strtol(3).
2017-03-22 17:46:08 +00:00
Jilles Tjoelker c911246d1b 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-03-18 16:07:28 +00:00
Jilles Tjoelker 3e989c8cc2 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.

Reported by:	bdrewery
2017-03-12 18:38:03 +00:00
Jilles Tjoelker 98d502b6af MFC r314637: sh: Add some already working tests that exercise new code paths 2017-03-12 18:24:45 +00:00
Konstantin Belousov 88e41ce23f MFC r313798:
Use uintmax_t to print st_nlink.
2017-02-23 07:42:49 +00:00
Baptiste Daroussin e84433b589 MFC r313659-r313673
r313659:
Remove space at and of line

Reported by:	make manlint
MFC after:	2 days

r313660:
Remove empty Li

Reported by:	make manlint
MFC after:	2 days

r313661:
Escape Ss to avoid confusion by mdoc parser with the Ss macro

Reported by:	make manlint
MFC after:	2 days

r313662:
Add missing -width after -Bl -tag

Reported by:	make manlint
MFC after:	2 days

r313663:
Add missing section after .Xr reference

r313664:
Escape No to avoid confusion with the No macro

r313665:
Remove useless .Pp after the .Sh macro and remove empty line

r313666:
Remove empty space at EOL and escept Ed

r313667:
Remove spaces at EOL and sort correctly the SEE ALSO section

r313668:
Add missing section in manpage reference

r313669:
Properly use .An macro before Authors name

r313670:
Escape Sm to avoid confusion with Sm macro

r313671:
Use correct date format

r313672:
Remove useless Li macro

r313673:
Remove spaces at end of line

Reported by:	make manlint
2017-02-17 11:20:55 +00:00
Sevan Janiyan 3fb9b8efce 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-02-03 16:57:14 +00:00
Sevan Janiyan 01e3253299 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:17:44 +00:00
Konstantin Belousov 831141be84 MFC r311522:
Use type-independent formats for printing nlink_t and ino_t.
2017-01-13 13:37:09 +00:00
Alan Somers 0edac453e2 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:41:00 +00:00
Pedro F. Giffuni d76705554f 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:42:38 +00:00
Pedro F. Giffuni b5291728f2 MFC r309873:
ed(1): Prevent possible overflows during allocation.

Make sure the parameters used for malloc(3) can hold size_t sizes.
This should help ed(1) handle bigger data in the future.
2016-12-26 16:27:01 +00:00
Brooks Davis af93f18e10 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 22:53:10 +00:00
Eric van Gyzen af98f69185 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:51:33 +00:00
Xin LI 6cd7ba5509 MFC r309238,309239:
r309238: Plug a potential memory leak.
r309239: style(9).
2016-12-12 02:13:35 +00:00
Dag-Erling Smørgrav ebacbba769 MFH (r308297): use what(1) instead of strings(1).
PR:		213665
Submitted by:	Pawel Worach <[email protected]>
2016-12-10 20:20:33 +00:00
Enji Cooper f1a69bd832 MFC 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
2016-12-03 02:47:16 +00:00
Marcelo Araujo 0416f8fabf MFC r308443, r308459, r308462, r308478, r308786
r308443:
Add -d flag that prints domain only.

PR:		212875
Submitted by:	Ben RUBSON <[email protected]>
Reviewed by:	pi

r308459:
Fix missing '-' for the flags -s and -d on both manpage and usage.

Reported by:	garga, bde

r308462:
Add flag -B which does the same like batch mode but without exiting after
print. Also add a new flag -s that add blocks size to statistics.

PR:		198347, 212726
Submitted by:	Ben RUBSON <[email protected]>
Tested by:	pi
MFC After:	2 weeks.

r308478:
We can't use protect(1) inside a jail(8)!
To avoid have warning for services that are using oomprotect, oomprotect
will only be applied on services that won't run inside jails.

Reported by:	allanjude
MFC after:	2 weeks.

r308786:
rc.subr: Swap checks so we only fork sysctl if *_oomprotect is set.
2016-11-25 05:54:17 +00:00
Sevan Janiyan b6f1a4139a 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:19:14 +00:00
Sevan Janiyan fa29d7b746 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:15:33 +00:00
Sevan Janiyan a162b426da 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:14:27 +00:00
Sevan Janiyan ec8f4e4e54 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:11:33 +00:00
Sevan Janiyan 97f7d08662 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:55 +00:00
Sevan Janiyan 06c964cc13 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:08:29 +00:00
Sevan Janiyan a76e37b822 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:53:56 +00:00