Commit Graph

13714 Commits

Author SHA1 Message Date
rmind 39013e66c1 NPF: Major rework -- migrate NPF to the libnv library.
- This conversion significantly simplifies the code and moves NPF to
  a binary serialisation format (replacing the XML-like format).
- Fix some memory/reference leaks and possibly use-after-free bugs.
- Bump NPF_VERSION as this change makes libnpf incompatible with the
  previous versions.  Also, different serialisation format means NPF
  connection/config saving and loading is not compatible with the
  previous versions either.

Thanks to christos@ for extra testing.
2018-09-29 14:41:35 +00:00
kre f910883c96 A truly ancient bug found by Edgar Fuss
When printf is running builtin in a sh, global vars aren't reset to
0 between invocations.   This affects "rval" which remembers state
from a previous %b \c and thereafter always exits after the first
format conversion, until we get a conversion that generates an
error (which resets the flag almost by accident)

	printf %b abc\\c
	abc				(no \n)
	printf %s%s hello world
	hello				(no \n, of course, no world ...)
	printf %s%s hello world
	hello
	printf %s%s hello world
	hello
	printf %d hello
	printf: hello: expected numeric value
	0				(no \n)
	printf %s%s hello world
	helloworld			(no \n, and we are back!)

This affects both /bin/sh and /bin/csh (and has for a very long time).

XXX pullup -8
2018-09-10 14:42:29 +00:00
christos 0909701cc6 recognize int128 2018-09-07 15:16:15 +00:00
kre 2bdb5be389 Inspired by PR pkg/53543
When calculating the length of the args that can be
appended in a "find .... -exec something {} +"
usage, remember to allow for the arg pointers, which
form part of what is allowed in ARG_MAX.

From a fairly empty installation of HEAD on amd64
and with a "/tmp/args" command that simply prints
its arg count, and the length of the arg strings,
with this mod I see ..

netbsd# find / -exec /tmp/args {} +
Argc 5000 Arglen 107645
Argc 5000 Arglen 151324
Argc 5000 Arglen 187725
Argc 5000 Arglen 206591
Argc 5000 Arglen 172909
Argc 5000 Arglen 186264
Argc 5000 Arglen 167906
Argc 2881 Arglen 98260

The upper limit of 5000 args is in the code.

Using the biggest of those, 5000
args, plus 206591 bytes of strings
uses 246591 bytes total (this excludes
the command name, so add a few more).
That's fairly close to the ARG_MAX
of 262144.

On another system (with longer paths) I see:
(this is just a small part of the output, using a
different version of the dummy command, and a
slightly different invocation)

Args: 4546 Len 218030
Args: 4878 Len 217991
Args: 4813 Len 218028
Args: 4803 Len 218029

There, 4878*8 + 217991 == 257015 which is about
as close as we'd want to come to the arg limit.

XXX pullup -8
2018-09-04 15:16:15 +00:00
kre 8b37a6dbec Printf's that support \e for escape all seem to also support \E.
Except us.   Now we do as well.
2018-09-04 01:13:50 +00:00
christos 6cd09489aa support deprecated("string") for libpcap 2018-09-03 15:16:33 +00:00
kre 68b40b6c11 Tighten syntax a little (no more %*4.*2d nonsense).
Include the format collected so far in "missing format char" err message.
Minor KNF and whitespace.
2018-09-03 04:10:20 +00:00
kre 24f342dfd6 PR standards/53563
POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8
2018-08-31 17:27:35 +00:00
riastradh 3432a2eb7f Bump config(5) version for OPT.foo.c variables. 2018-08-27 16:04:45 +00:00
riastradh 72c36f8199 Tag each .c file with the options that might have brought it in. 2018-08-27 05:35:00 +00:00
christos 4685e01b74 add WITHOUT_GZIP for the tools build. 2018-08-12 09:03:21 +00:00
christos 8e22f7e23d fix libraries 2018-08-12 08:00:32 +00:00
christos 4f89880b45 remove stray paren 2018-08-12 07:59:14 +00:00
christos dfe5f25515 add WITHOUT_BZ2 for tools build. 2018-08-12 07:53:19 +00:00
christos ab4aefc826 use setvbuf if available; it is more portable. 2018-08-11 19:44:19 +00:00
christos 647d6f88ee don't build NLS if we don't need to 2018-08-11 19:43:54 +00:00
christos ce1225c115 remove dup includes (already in grep.h) 2018-08-11 16:03:37 +00:00
kre 9f2b1d9e76 Avoid an infinite loop caused by a line accidentally dropped
in 1.22 (almost 30 months ago!)

[ Discovered by rhialto@ ]
2018-07-30 22:58:09 +00:00
wiz e694dd94ec Use An -nosplit. Use Mt. Fix some mandoc lint. 2018-07-28 08:03:41 +00:00
wiz 8c602bad3c Sync usage with man page. 2018-07-26 08:57:32 +00:00
wiz 4426bfba8a Add -S to SYNOPSIS. Sort option descriptions. 2018-07-26 08:57:26 +00:00
kamil 783e210b8b Introduce a new option -S in crunchgen(1)
The -S argument enables sanitization with a sanitizer in libc.
2018-07-25 23:41:28 +00:00
kre 47ea218fd1 NFC: More KNF (remove () around returned constants). 2018-07-25 15:35:27 +00:00
kre 5755a4ea22 NFC: whitespace & KNF. 2018-07-25 14:41:52 +00:00
christos 706eabb7af Provide MacOS/X compatible flags (where possible)
Propagate errno
2018-07-25 03:45:34 +00:00
kre 2fb3e9fabf Add the new formats to the list of format cracters (oops...) 2018-07-24 20:58:39 +00:00
kre ddc0976a72 Add support for F a and A formats (which go with the eEfgG formats
already supported.)
2018-07-24 20:49:19 +00:00
kre 520d24e3eb Correct a typo (off by one (key)) ...
There is no 'w' format, but there is an 'e'
2018-07-24 19:49:33 +00:00
wiz 3926ef35d5 Fix typo. Comment out SEE ALSO since it only refers nonexistent man pages.
Reduce history to NetBSD until we know more details about other OSes.
Use An. Fix Dt argument.
2018-07-24 19:08:22 +00:00
christos 0d2d986001 Tiny base64 encoder/decoder command patterned after the linux and the macosx
ones with the same name,.
2018-07-24 15:26:16 +00:00
snj d55a68a4f5 add netbsd 8.0, fix whitespace 2018-07-21 18:50:22 +00:00
joerg e077d7edbf Ignore malformed directory entries as created by Dropbox ("/"). 2018-07-19 18:04:25 +00:00
maxv 5ae6235d0e Remove tpfmt(1). Its code was merged into tprof(8). 2018-07-13 11:14:14 +00:00
mrg 1b11df59cf don't try to decend into remove 'pmc' subdir. 2018-07-13 11:13:10 +00:00
maxv 696d8f99b2 Remove the usr.bin/pmc tool. People should use tprof instead. 2018-07-13 09:15:55 +00:00
christos 3a280067df Fix previous: cached_stats() returning < 0 means that the file is not found,
not that it was found in the cache, and centralize reporting.
2018-07-12 18:03:31 +00:00
reinoud 38c2b03323 Remove duplicate code in make(1)'s dir.c.
When the cached_stats() code was added, some old logic stayed around that
implements the cached_stats() too.
2018-07-12 17:46:37 +00:00
msaitoh 24a510d5b0 Print iqdrops, too. This change also fixes a bug that Odrops prints
iqdrops when kvm read failed.
2018-07-11 07:46:20 +00:00
christos f4654072f5 recognize noinline attribute 2018-07-08 17:48:42 +00:00
kre 4bcba09122 Avoid printing error messages twice when an invalid
escape sequence (\ sequence) is present in an arg to a %b
conversion.
2018-07-03 01:56:39 +00:00
kre a78ff1f90a From leot@ on tech-userlevel:
Avoid running off into oblivion when a format string,
or arg to a %b conversion ends in an unescaped backslash.

Patch from Leo slightly modified by me.
2018-07-03 01:54:42 +00:00
christos 9f321dce94 Add our syslog format. 2018-06-29 20:18:36 +00:00
christos 8910c94cf4 add missing args for 123 2018-06-29 20:18:05 +00:00
msaitoh 204f26c6d9 Print BPF direction correctly. 2018-06-26 10:00:25 +00:00
msaitoh 90fcd8faa4 Fix a bug that BPF_D_OUT isn't printed correctly. 2018-06-26 09:50:42 +00:00
msaitoh 3cd62456f9 Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

 This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
2018-06-26 06:47:57 +00:00
kamil 2ca8c8d72f Specify SANITIZER_RENAME_SYMBOL in chpass
Rename local versions of getpwent getpwnam getpwnam_r getpwuid getpwuid_r
(all of the symbols are namespaced) in order to remove symbol clash with
libc.

This program uses code directly from libc.
2018-06-25 18:05:25 +00:00
christos fd98358317 Don't require any arguments as the usage indicates; simplifies the code
and the documentation: now "jot" works like "jot -" used to (and continues
to). From Ingo Schwarze
2018-06-25 14:29:17 +00:00
kamil b6ed70bb6e Add new option -s to crunchgen(1) -- enable sanitization
As of today typical sanitizers require dynamic executables, while
crunchgen(1) programs are produced with static properties.

Lack of specified -s will:
 - generate a Makefile file with NOSANITIZER=
 - build programs that are dependencies with NOSANITIZER=

In future there is an option to handle sanitization in statically linked
programs.

An idea with -s LGTM by <christos>
2018-06-21 10:55:54 +00:00
kamil f4a6ea5271 Disable SANITIZER for ldd(1)
These utilities (elf32, elf32_compat, elf64, liblldb) share code with the
ELF dynamic loader that is not being sanitized and its symbols are
installed into sanitized programs (in particular __tls_get_addr()).

Additionally libldd is used in rescue that is not expected to be sanitized
as of today.
2018-06-21 10:41:45 +00:00