Commit Graph

13404 Commits

Author SHA1 Message Date
Gleb Smirnoff
2ff3551a47 Fix crash with a dotless hostname. 2017-12-06 17:50:10 +00:00
Eitan Adler
fbc88a6f35 sponge(1): revert
I did a complete buildworld and test... with the program disconnected
from the tree. Revert the change for now.

(this keeps the change to .arclint which is still correct)

Wearing:	my pointhat
2017-12-06 02:47:46 +00:00
Cy Schubert
ca94a1c6ca Fix build after r326554; reconnect sponge to build again. 2017-12-05 20:06:53 +00:00
Gleb Smirnoff
65547fb33d Generate fully RFC3164 compliant messages, with timestamp and hostname.
Allow to set hostname to any string with -H.

MFC after:	2 months
2017-12-05 19:55:53 +00:00
Dimitry Andric
8b9fd94981 For now, disconnect usr.bin/sponge from the build, to unbreak world
after r326557.

Noticed by:	many
Pointy hat to:	eadler
2017-12-05 18:26:34 +00:00
Xin LI
aff7b6c709 Use strlcpy().
MFC after:	2 weeks
2017-12-05 07:11:56 +00:00
Xin LI
807e955710 Create links for xzdiff.
MFC after:	2 weeks
2017-12-05 07:01:10 +00:00
Eitan Adler
8d4a7aab40 sponge(1): fix my tests
Reviewed by:	kevans
2017-12-05 04:43:39 +00:00
Alan Somers
95639a80ef dc(1): fix input of non-decimal fractional numbers
Inputting fractional non-decimal numbers has never worked correctly in our
OpenBSD-derived dc(1). It truncates the input to a number of decimal places
equal to the number of hexadecimal (or whatever base) places given on the
input. That's unacceptable, because many numbers require more precision to
represent in base 10 than in their original bases.

Fix this bug by using as many decimal places as needed to represent the
input, up to the maximum of the global scale factor.

This has one mildly surprising side effect: the scale of a number entered in
non-decimal mode will no longer necessarily equal the number of hexadecimal
(or whatever base) places given on the input. I think that's an acceptable
behavior change, given that inputting fractional non-decimal numbers never
worked in the first place, and the man page doesn't specify whether trailing
zeros on the input should affect a number's scale.

PR:		206230
Reported by:	nibbana@gmx.us
Reviewed by:	pfg
Differential Revision:	https://reviews.freebsd.org/D13336
2017-12-05 04:22:35 +00:00
Eitan Adler
cea266bd9f sponge(1) Minor commit for commit log
Differential Revision:	https://reviews.freebsd.org/D12900
RelNotes:		yes
2017-12-05 03:57:51 +00:00
Eitan Adler
7202e5e8f6 sponge(1): initial commit
sponge(1) is a utility that reads input until
complete, then opens the output file, then
writes to it. This makes it useful in pipelines
that read and write to the same file.

Reviewed by:	wblock, jilles, imp, cem, danfe (all: various iterations)
Inspired by:	https://joeyh.name/code/moreutils/
2017-12-05 03:55:10 +00:00
Baptiste Daroussin
625490e842 Only skip looking for manpages if both man directory and cat directory
are not existing.

This allows man(1) to read catpages when no man directories are available at all

PR:		223559
Reported by:	wosch
MFC after:	3 days
2017-12-04 12:51:05 +00:00
Baptiste Daroussin
d9405a926c In case man(1) found a catpage to display skip looking ".so" which is manpage
only.

In case we are trying to read a catpage, the manpage variable is not defined.
It results in the "cattool" having no arguments.

In case the catpage is compressed, the cattool used is "zcat" which dies if the
standard input is a terminal, meaning the function calling it is exiting as if
there were no ".so"
In case the catpage is uncompressed, the cattool used is "zcat -f" which waits
reading standard input, making the man(1) command hang.

PR:		223560
Reported by:	wosch
MFC after:	3 days
2017-12-04 12:33:46 +00:00
Kyle Evans
8433795d66 grep test: Fix copyright notice
The copyright notice was erroneously introduced as one from the NetBSD
foundation due to it being copied from a file in the NetBSD test suite, but
this file itself is not derived from or supplied with the NetBSD test suite.

MFC after:	3 days
2017-12-03 02:23:29 +00:00
Alan Somers
9ccdc62331 Reap dead code
usr.bin/dc/inout.c
	Reap some dead code that was killed back in 2003 in OpenBSD, in
	version 1.8 of this file.

MFC after:	3 weeks
2017-12-02 06:05:03 +00:00
Konstantin Belousov
b05a4a9db7 vmstat: fix style(9) violations and bump WARNS.
Based on the patch by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Sponsored by:	Mysterious Code Ltd. (Pawel),
	  The FreeBSD Foundation (me)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D13228
2017-12-01 22:38:28 +00:00
Eitan Adler
f99112ded5 fmt(1): Fix usage of Nm macro 2017-12-01 21:44:23 +00:00
Eitan Adler
5f0345185b Revert license change.
This isn't identical to the one permitted by UCB since
it is copyright multiple people.
2017-12-01 03:22:40 +00:00
Pedro F. Giffuni
64de3fdd58 SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
Pedro F. Giffuni
8820ecc040 SPDX: Fix some cases wrongly attributed to MIT.
In the cases of BSD-style license variants without clauses, use 0BSD for
the time being in lack of a better description.
2017-11-30 15:10:11 +00:00
Eitan Adler
847e9b668f Finish cleaning up license :\ 2017-11-30 08:23:40 +00:00
Eitan Adler
86fdf1748d Remove advertising clause from pr(1)
Permitted by https://www.freebsd.org/copyright/license.html
Renumber 4->3 to be consistent with other files
2017-11-30 07:08:45 +00:00
Xin LI
2404b5d277 Remove unused include.
MFC after:	2 weeks
2017-11-29 09:18:24 +00:00
John Baldwin
9d9fee3eed Replace a reference to a license in another file with the license text.
The relevant file was recently renamed, so the reference was stale.
In addition, explicit licenses are more typical in our sources.
2017-11-29 05:07:54 +00:00
Alan Somers
013953eb5f Add basic tests for ctfconvert(1), fold(1) and rs(1)
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.

Tests generated via: https://github.com/shivansh/smoketestsuite/

Submitted by:	shivansh
Reviewed by:	asomers
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D12424
2017-11-27 20:01:58 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Alexander Motin
5be4479bfd Make ctlstat -n option work reasonably for sparse LUN list.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2017-11-27 15:24:13 +00:00
Dave Cottlehuber
5ace991266 add myself as ports committer, mentor jrm + swills
Approved by:	jrm
Differential Revision:	https://reviews.freebsd.org/D13268
2017-11-27 14:13:30 +00:00
Edward Tomasz Napierala
7acc357f58 .Xr pmcstat(8) from kgmon(8) and gprof(1).
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-11-27 12:37:14 +00:00
Xin LI
216f72f141 Set errno to EFTYPE instead of EINVAL to be more consistent with the
rest of code.

MFC after:	1 month
2017-11-25 09:03:38 +00:00
John Baldwin
ffb6607984 Decode kevent structures logged via ktrace(2) in kdump.
- Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of
  structures.

  The structure name in the record payload is preceded by a size_t
  containing the size of the individual structures.  Use this to
  replace the previous code that dumped the kevent arrays dumped for
  kevent().  kdump is now able to decode the kevent structures rather
  than dumping their contents via a hexdump.

  One change from before is that the 'changes' and 'events' arrays are
  not marked with separate 'read' and 'write' annotations in kdump
  output.  Instead, the first array is the 'changes' array, and the
  second array (only present if kevent doesn't fail with an error) is
  the 'events' array.  For kevent(), empty arrays are denoted by an
  entry with an array containing zero entries rather than no record.

- Move kevent decoding tables from truss to libsysdecode.

  This adds three new functions to decode members of struct kevent:
  sysdecode_kevent_filter, sysdecode_kevent_flags, and
  sysdecode_kevent_fflags.

  kdump uses these helper functions to pretty-print kevent fields.

- Move structure definitions for freebsd11 and freebsd32 kevent
  structures to <sys/event.h> so that they can be shared with userland.
  The 32-bit structures are only exposed if _WANT_KEVENT32 is defined.
  The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is
  defined.  The 32-bit freebsd11 structure requires both.

- Decode freebsd11 kevent structures in truss for the compat11.kevent()
  system call.

- Log 32-bit kevent structures via ktrace for 32-bit compat kevent()
  system calls.

- While here, constify the 'void *data' argument to ktrstruct().

Reviewed by:	kib (earlier version)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D12470
2017-11-25 04:49:12 +00:00
Konstantin Belousov
72f406a92c vmstat: use 64-bit counters from struct vmtotal.
Consistently print counters using unsigned intmax type.

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Sponsored by:	Mysterious Code Ltd.
Differential revision:	https://reviews.freebsd.org/D13199
2017-11-23 19:10:09 +00:00
Konstantin Belousov
d5589c6c60 Use C standard spelling uint64_t for u_int64_t.
Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Sponsored by:	Mysterious Code Ltd.
X-Differential revision:	https://reviews.freebsd.org/D13199
2017-11-23 19:06:44 +00:00
Konstantin Belousov
1b7a3d1f5f Order declarations alphabetically.
Match signess of the format and the value.

Noted by:	bde
Sponsored by:	The FreeBSD Foundation
2017-11-22 22:04:27 +00:00
Niclas Zeising
37ab131446 Fix language in a bunch of error messages.
Reviewed by:		emaste
Approved by:		emaste
MFC after:		1 month
Differential Revision:	D13193
2017-11-22 18:06:41 +00:00
Kyle Evans
bc4f0fe358 patch(1): don't assume a match if we run out of context to check
Patches with very little context (-U0 and -U1) could get misapplied if
the file to be patched changes and a hunk is no longer applicable. Matching
with fuzz would be attempted and default to a match when we unexpectedly ran
out of context.

This also affected patches with higher levels of context but had limited
actual context due to the hunk being located near the beginning/end of file.

PR:		74127, 223545 (exp-run)
Reviewed by:	emaste, pfg
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D12631
2017-11-22 03:44:19 +00:00
Konstantin Belousov
90dd3e79cc systat: use and correctly display 64bit counters.
Following struct vmtotal changes, make systat use and correctly
display 64-bit counters.  Switch to humanize_number(3) to overcome
homegrown arithmetics limits in pretty printing large numbers.  Use
1024 as a divisor for memory fields to make it consistent with other
tools and users expectations.

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Sponsored by:	Mysterious Code Ltd.
PR:	2137
Differential revision:	https://reviews.freebsd.org/D13105
2017-11-21 19:55:32 +00:00
Xin LI
90f528e8d7 Support SIGINFO.
Obtained from:	NetBSD
MFC after:	2 weeks
2017-11-21 08:14:30 +00:00
Alan Somers
396c556d77 Add ATF tests for head(1)
Submitted by:	Fred Schlecter <https://github.com/fjs-github>
Reviewed by:	asomers, jilles
MFC after:	3 weeks
Differential Revision:	https://github.com/freebsd/freebsd/pull/127
2017-11-20 22:55:02 +00:00
Ed Maste
5f8eed2f42 Install strings unconditionally
Previously it was enabled by WITH_/WITHOUT_TOOLCHAIN, but it is commonly
expected to be available and may have non-toolchain consumers.  As it
is now taken from the BSD-licensed ELF Tool Chain project, just install
it unconditionally.

PR:		213665, 223725
Reviewed by:	bdrewery
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8398
2017-11-20 20:55:41 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Xin LI
b2ea244070 MFV r326007: less v529.
MFC after:	2 weeks
2017-11-20 08:52:33 +00:00
Pedro F. Giffuni
df57947f08 spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00
Andriy Gapon
6effb21323 procstat: fix a crash with -k -a options
The traditional / legacy usage should still be supported.
This fixes a regression in r324619 that introduced a nicer, verb based
interface.

Reviewed by:	brooks
X-MFC with:	r324619
2017-11-16 22:14:49 +00:00
Konstantin Belousov
9898800172 Remove xlint(1).
xlint is currently a fossil.  We have much more useful and alive tools
to do now what xlint did twenty years ago.

I did not cleared some stuff which makes lint operational, in
sys/x86/include and sys/sys, but I might do it as followup.  The
x86/include/ucontext.h and _types.h hacks made to please lint was the
main reason for my initial proposal to classify xlint as obsolete and
to remove it.

Also I do not intend to clear sccs ids.

Reviewed by:	bapt, brooks, emaste, jhb, pfg
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D13015
2017-11-16 14:37:18 +00:00
Benno Rice
0538d7bbe6 Remove all fortune datfiles except freebsd-tips.
Humour is a funny thing. What is funny to one person is not funny to all
people. What is insightful to one person is similarly not universal. The
fortune datfiles have been around a long time and have undoubtedly amused
people but it's time to acknowledge their subjective, and in some cases
at least potentially offensive, nature and stop distributing them with the
imprimatur of the FreeBSD project.

If anyone wishes to distribute these via other mechanisms they are welcome to
check them out of history and do so.

MFC after:	2 days
2017-11-14 21:18:30 +00:00
Warner Losh
0c16b53773 Move zstd from contrib to sys/contrib so it can be used in the
kernel. Adjust the Makefiles that referenced it to the new path.

Sponsored by: Netflix
OK'd by: cem@ and AllanJude@
2017-11-14 05:03:38 +00:00
Mark Felder
fa193c587e Remove fortune quotes attributed to or providing admiration of Adolf Hitler
MFC after:	1 week
2017-11-13 21:55:34 +00:00
Xin LI
0ab69d713c find(1): Don't treat statfs() error as fatal in f_fstype, which can happen
when a directory is removed in the middle of find.

Instead of a full err(), allow find to continue, plus print a warning with
exitstatus set when appropriate.

Reported by:	100.chksetuid via gordon
Reviewed by:	jilles
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D13024
2017-11-11 19:18:47 +00:00
Baptiste Daroussin
d0ab9cbec0 Remove __unused attributed on arguments that are actually used
MFC after:	3 days
2017-11-11 15:18:25 +00:00