Commit Graph

13878 Commits

Author SHA1 Message Date
Eitan Adler
4750b59aca send-pr: wave goodbye
Entering into the world of 12.x we no longer need even the placeholder
for send-pr. It has not done anything for some time.

With Hat: bugmeister
2018-08-19 07:12:35 +00:00
Kyle Evans
9488de009c diff(1): Refactor -B a little bit
Instead of doing a second pass to skip empty lines if we've specified -I, go
ahead and check both at once. Ignore critera has been split out into its own
function to try and keep the logic cleaner.
2018-08-19 04:15:38 +00:00
Kyle Evans
e68edb8cf0 diff(1): Implement -B/--ignore-blank-lines
As noted by cem in r338035, coccinelle invokes diff(1) with the -B flag.
This was not previously implemented here, so one was forced to create a link
for GNU diff to /usr/local/bin/diff

Implement the -B flag and add some primitive tests for it. It is implemented
in the same fashion that -I is implemented; each chunk's lines are scanned,
and if a non-blank line is encountered then the chunk will be output.
Otherwise, it's skipped.

MFC after:	2 weeks
2018-08-19 03:57:20 +00:00
John Baldwin
5cb9940ce2 Use 'bool' instead of 'int' for various boolean flags.
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16611
2018-08-18 20:23:53 +00:00
Kyle Evans
1a36f105a4 dtc(1): Update to 97d2d5715eeb45108cc60367fdf6bd5b2046b050
Notable fixes:
- Overlays may now be generated properly without -@
- /__local_fixups__ were not including unit address in their structure
- The error reporting a magic token was misleading, reporting
  "Bad magic token in header.  Got d00dfeed expected 0xd00dfeed"
  if the token was missing. This has been split out into a separate message.

MFC after:	1 week
2018-08-17 13:24:48 +00:00
Pedro F. Giffuni
43daed4774 Revert r337419.
The fix is only partial and causes an asymmetry which breaks a test in
multi_test.sh.

We should consider both parts of the issue found in OpenBSD[1], but for now
just revert the change.

[1] http://undeadly.org/cgi?action=article;sid=20180728110010

Reported by: asomers
2018-08-16 18:35:39 +00:00
Piotr Pawel Stefaniak
dad19de0e6 indent(1): bug fix after r336333
The bug was that isalnum() is not exactly equivalent to previous code which
also allowed characters "$" and "_", so check for those explicitly.

Reported by:	tuexen@
2018-08-15 18:19:45 +00:00
Alan Somers
e40369745c tftp: Close a resource leak when putting files
Reported by:	Coverity
CID:		1394842
MFC after:	2 weeks
2018-08-14 17:20:31 +00:00
Jilles Tjoelker
17fffb23f6 printf: Add test for width and precision in %b format
PR:		229641
Submitted by:	pfg
2018-08-13 21:54:27 +00:00
Cy Schubert
61bbe5bf9f Chasing r337661, fix systat after arc accounting change. 2018-08-12 07:47:44 +00:00
Matt Macy
ef8e2d2d01 fix top after arc accounting change 2018-08-11 22:11:12 +00:00
Piotr Pawel Stefaniak
0dee472dd2 indent(1): revert r334640 and r334632
While STACKSIZE macro is indeed problematic on some systems, the commits
were wrong to shrink il[] and cstk[], because they need to be of the same
size as p_stack[] as they're accessed with the same index ps.tos.
2018-08-11 19:20:06 +00:00
Alexander Leidinger
bb50c31811 - Correct the description when jobs are executed related to load avg
to match reality (slightly different to what was submitted in the
   PR: use english word instead of math-symbol).
 - Wrap the corresponding part to below 80 characters per line.

Submitted by:	yamagi@yamagi.org
PR:		202202
Sponsored by:	Essen Hackathon
2018-08-11 16:29:54 +00:00
Brad Davis
bf8a86cd14 Move cron.d/at to usr.bin/at/
This helps with pkgbase as it tags this as a config file so it is handled as
such

Approved by:	allanjude (mentor)
Sponsored by:	Essen Hackathon
Differential Revision:	https://reviews.freebsd.org/D16673
2018-08-11 13:52:23 +00:00
Jilles Tjoelker
051c7fdd5c printf: Fix \c in %b in printf builtin exiting the shell after r337458
SVN r337458 erroneously partially reverted r265885.

This is immediately visible when running the Kyua/ATF tests for
usr.bin/printf, which actually test sh's printf builtin.

PR:		229641
2018-08-11 11:13:34 +00:00
Conrad Meyer
a04ed7615e stat(1): cache id->name resolution
When invoked on a large list of files, it is most common for a small number of
uids/gids to own most of the results.

Like ls(1), use pwcache(3) to avoid repeatedly looking up the same IDs.

Example microbenchmark and non-scientific results:

$ time (find /usr/src -type f -print0 | xargs -0 stat >/dev/null)

BEFORE:
3.62s user 5.23s system 102% cpu 8.655 total
3.47s user 5.38s system 102% cpu 8.647 total

AFTER:
1.23s user 1.81s system 108% cpu 2.810 total
1.43s user 1.54s system 107% cpu 2.754 total

Does this microbenchmark have any real-world significance?  Until a use case
is demonstrated otherwise, I doubt it.  Ordinarily I would be resistant to
optimizing pointless microbenchmarks in base utilities (e.g., recent totally
gratuitous changes to yes(1)).  However, the pwcache(3) APIs actually
simplify stat(1) logic ever so slightly compared to the raw APIs they wrap,
so I think this is at worst harmless.

PR:		230491
Reported by:	Thomas Hurst <tom AT hur.st>
Discussed with:	gad@
2018-08-11 02:56:43 +00:00
Kyle Evans
f032f7b307 apply(1): Fix magic number substitution with magic character ' '
Using a space as the magic character would result in problems if the command
started with a number:

- For a 'valid' number n, n < size of argv, it would erroneously get
  replaced with that argument; e.g. `apply -a ' ' -d 1rm x => `execxrm x`

- For an 'invalid' number n, n >= size of argv, it would segfault.
  e.g. `apply -a ' ' 2to3 test.py` would try to access argv[2]

This problem occurred because apply(1) would prepend "exec " to the command
string before doing the actual magic number replacements, so it would come
across "exec 2to3 1" and assume that the " 2" is also a magic number to be
replaced.

Re-work this to instead just append "exec " to the command sbuf and
workaround the ugliness. This also simplifies stuff in the process.

PR:		226948
Submitted by:	Tobias Stoeckmann <tobias@stoeckmann.org>
MFC after:	1 week
2018-08-08 21:21:28 +00:00
Alan Somers
47cc9ee1b1 Switch the default pager for most commands to less
Finally, a pager for the nineties.

MFC after:	Never
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D13465
Poll:		https://reviews.freebsd.org/V7
2018-08-08 19:24:20 +00:00
Pedro F. Giffuni
702da35288 Fix printf(1) ignores width and precision in %b format.
The precision with the conversion specifier b is specified by POSIX: see
point 7 in the reference documentation.

This corrects previous wrong log in r337440.

Reference: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

PR:	229641
Reported by:	Rudolf Cejka
Submitted by:	Garrett D'Amore (illumos)
MFC after:	1 week
2018-08-08 15:25:01 +00:00
Pedro F. Giffuni
94e460157d Revert r337440: the log message is wrong. 2018-08-08 15:12:32 +00:00
Eitan Adler
550ddd16ed top(1): hide THR column in separate-thread mode.
It does not make sense to show a "thread count" column when displaying
threads separately. In fact we don't, but do show the header for this
column. Fix this.
2018-08-08 06:31:46 +00:00
Pedro F. Giffuni
e21ce9d742 Fix printf(1) ignores width and precision in %b format.
The precision with behavior is "unspecified" by POSIX (as of 2018), but
most implementations seem to have taken it to be treated the same as for
"s"; applied after the unescaping.
Adopt the same treatment on our printf.

PR:	229641
Submitted by:	Garrett D'Amore (illumos)
2018-08-07 23:03:50 +00:00
Pedro F. Giffuni
5102499601 sed(1): partial fix for the case of the regex delimited with '['.
We don't generally support the weird case of regular expresions delimited
by an opening square bracket ('[') but POSIX says that inside
bracket expressions, escaping is not possible and both '[' and '\'
represent themselves.

PR:		230198 (exp-run)
Obtained from:	OpenBSD
2018-08-07 14:47:39 +00:00
John Baldwin
7cf2ca3b01 Remove spurious ABI tags from kdump output.
The abidump routine output an ABI tag when -A was specified for records
that were not displayed due to type or pid filtering.  To fix, split
the code to lookup the ABI from the code to display the ABI, move the
code to display the ABI into dumpheader(), and move dumpheader() later
in the main loop as a simplification.  Previously dumpheader() was
called under a condition that repeated conditions made later in the
main loop.

Reviewed by:	kib
MFC after:	1 month
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D16608
2018-08-07 00:10:58 +00:00
Conrad Meyer
84b851c23f wc(1): Fix 'wc -L'
I inadvertently broke 'wc -L' in r326736.  We must skip the fast path if -L
was specified, in addition to the existing check for the -l option.

Document long-standing -L behavior (count varies depending on whether wc(1)
is run with the -m option or not) in wc.1.  That behavior dates back to the
introduction of the -L option, but was not documented.

PR:		230300
Reported by:	<amstrnad+bugzilla AT gmail.com>
Sponsored by:	Dell EMC Isilon
2018-08-02 23:45:14 +00:00
Mark Johnston
0dbdecfd4f Add a rudimentary test for procstat kstack.
MFC after:	1 week
2018-08-02 16:03:47 +00:00
Pedro F. Giffuni
1a68918570 sed: compile with the default WARNS level. 2018-07-30 19:41:54 +00:00
Pedro F. Giffuni
0649b6706f sed: unsign some indexes to fix sign-compare warnings.
Hinted by:	OpenBSD (CVS 1.32)

MFC after:	 1 week
2018-07-30 18:29:46 +00:00
Alan Somers
6040822c4e Make timespecadd(3) and friends public
The timespecadd(3) family of macros were imported from NetBSD back in
r35029. However, they were initially guarded by #ifdef _KERNEL. In the
meantime, we have grown at least 28 syscalls that use timespecs in some
way, leading many programs both inside and outside of the base system to
redefine those macros. It's better just to make the definitions public.

Our kernel currently defines two-argument versions of timespecadd and
timespecsub.  NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define
three-argument versions.  Solaris also defines a three-argument version, but
only in its kernel.  This revision changes our definition to match the
common three-argument version.

Bump _FreeBSD_version due to the breaking KPI change.

Discussed with:	cem, jilles, ian, bde
Differential Revision:	https://reviews.freebsd.org/D14725
2018-07-30 15:46:40 +00:00
Eitan Adler
ec9eb99714 truncate: delintify 2018-07-29 07:51:42 +00:00
Eitan Adler
c517ae76c1 truncate: use better type for 'round' 2018-07-29 07:51:40 +00:00
Martin Matuska
f1951fd745 MFV r336851:
Update vendor/libarchive/dist to git 2c8c83b9731ff822fad6cc8c670ea5519c366a14

Important vendor changes:
  PR #993: Chdir to -C directory for metalog processing
  OSS-Fuzz #4969: Check size of the extended time field in zip archives
  PR #973: Record informational compression level in gzip header

MFC after:	1 week
2018-07-29 00:12:16 +00:00
Daichi GOTO
08092a9b8f top(1): fix a buffer overflow copying states to display while they were incremented
- fix an AddressSanitizer error

Submitted by:	devnexen@gmail.com
Reviewed by:	eadler
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16183
2018-07-27 07:05:50 +00:00
Xin LI
9977c7b512 Improve --strip-trailing-cr handling:
- Advance ctold for f1 and ctnew for f2
 - ungetc() if the character is unexpected
 - Don't break early when we hit the combination on one side

PR:		230049
Reported by:	maskray <emacsray gmail com>
Reviewed by:	bapt, maskray
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16451
2018-07-27 05:21:20 +00:00
Daichi GOTO
324976739f top(1): fixed the empty output problem in non-interactive mode (-n, -b) regressed in r336028
PR:		229842
Reported by:	Ali Abdallah <aliovx@gmail.com>
Reviewed by:	eadler, cy
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16455
2018-07-27 01:20:34 +00:00
Daichi GOTO
cfb27362b1 top(1): forgot in r336160
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16452
2018-07-26 13:53:22 +00:00
Eitan Adler
10550f0b0a top(1): increase number of columns for memory
The original intention was 4 columns but with a usable a result. In
practice this was not the case. Increase the number of columns to 5
until humanize_number learns alternative ways of presenting the number.

Requested by:	many
Ref D15801
2018-07-25 14:05:17 +00:00
Eitan Adler
2da6fd55d9 find(1): remove empty else condition
reported by:	brooks
2018-07-25 03:42:07 +00:00
John Hixson
d7aabdd96c Add jhixson to committers-ports.dot and calendar.freebsd
Approved by:	miwi (mentor), kmoore (mentor), araujo (mentor)
Differential Revision:	https://reviews.freebsd.org/D16424
2018-07-24 18:33:26 +00:00
Alan Somers
ca2d3691c3 Fix several Coverity warnings in tftp
Some of the changes are in the libexec/tftpd directory, but to functions that
are only used by tftp(1) (they share some code).

* strcpy => strlcpy (1006793, 1006794, 1006796, 1006741)
* Unchecked return value and TOCTTOU (1009314)
* NULL pointer dereference (1018035, 1018036)

Reported by:	Coverity
CID:		1006793, 1006794, 1006796, 1006741, 1009314, 1018035
CID:		1018036
MFC after:	2 weeks
2018-07-22 17:10:12 +00:00
Konstantin Belousov
abbe7d5acd Move mostly useless examples binaries from OFED, as well as the Subnet
Manager, under the new option WITH_OFED_EXTRA, disabled by default.

Reviewed by:	bdrewery, hselasky (previous version)
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D16230
2018-07-20 23:52:11 +00:00
Zach Leslie
3d718b884f Add myself (zleslie) to calendar.freebsd
PR:		D15896
Approved by:	swills(mentor)
2018-07-19 04:31:41 +00:00
Piotr Pawel Stefaniak
01c66110e1 indent(1): rewrite the integer/floating constant scanning part of lexi.c
Remove procedural code that did the scanning, which was faulty and didn't
support complex constants such as 0x1p-61. Replace it with a finite state
machine expressed as a transition table. The table was rewritten by hand
from lx's output, given parts of grammar expressed as regular expressions.

lx is Katherine Flavel's lexer generator, currently available at
https://github.com/katef/libfsm and the parts of grammar were taken from
http://quut.com/c/ANSI-C-grammar-l-2011.html and extended to support binary
integer constants which are a popular GCC extension.

Reported by:	bde
2018-07-16 05:46:50 +00:00
Piotr Pawel Stefaniak
89463812e3 indent(1): move case_indent from parser state to the options struct
This was missed in r334927.
2018-07-15 21:04:21 +00:00
Konstantin Belousov
b3042426d0 Remove bits of the old NUMA.
Remove numactl(1), edit numa(4) to bring it some closer to reality,
provide libc ABI shims for old NUMA syscalls.

Noted and reviewed by:	brooks (previous version)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D16142
2018-07-10 22:00:20 +00:00
Mark Johnston
04354d577d Fix thread state summary line display after r334918. 2018-07-10 17:20:27 +00:00
Brooks Davis
3a20f06a1c Use uintptr_t alone when assigning to kvaddr_t variables.
Suggested by:	jhb
2018-07-10 13:03:06 +00:00
Daichi GOTO
7452122499 top(1): rollback r335836
Encoding-specific processing introduced in r335836 is not recommended.
And doing getenv("LANG") and assuming an encoding based on it is a
very bad practice to internationalize software.

Submitted by:	hrs
Differential Revision:	https://reviews.freebsd.org/D16203
2018-07-10 03:49:48 +00:00
Xin LI
34e314e794 Use endian.h le32dec() instead of rolling our own.
Suggested by:	phk
Reviewed by:	imp, pfg
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16192
2018-07-10 01:42:28 +00:00
Daichi GOTO
5c48c1ee57 top(1): Fix the prompt bug and core dump problem in o / p mode that occurred by r336028
Reviewed by:	cy
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16174
2018-07-10 00:19:52 +00:00