Commit Graph

14964 Commits

Author SHA1 Message Date
Mark Johnston
cd497bd40b truss: Decode FreeBSD 11 mknod(2) and mknodat(2)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-05-12 12:52:05 -04:00
Alex Richardson
3cbad8287a truss: Add missing underscore to compat_prefix for FreeBSD32
I accidentally dropped this in the final version of D27625, so it didn't
actually work as intended. I found this while testing the MFC to stable/13.

MFC after:	immediately
Fixes:		7daca4e204 ("truss: improved support for decoding compat32 arguments")
2021-05-11 10:53:02 +01:00
Kirk McKusick
9e16b9530a Clean up copyright messages.
Reported by:  Yoshihiro Ota
MFC after:    3 days
Differential Revision: https://reviews.freebsd.org/D29354
2021-05-10 23:14:35 -07:00
Richard Scheffenegger
c55b340f82 netstat: fix typo from 0471a8c734 2021-05-10 20:49:19 +02:00
Richard Scheffenegger
0471a8c734 tcp: SACK Lost Retransmission Detection (LRD)
Recover from excessive losses without reverting to a
retransmission timeout (RTO). Disabled by default, enable
with sysctl net.inet.tcp.do_lrd=1

Reviewed By: #transport, rrs, tuexen, #manpages
Sponsored by: Netapp, Inc.
Differential Revision: https://reviews.freebsd.org/D28931
2021-05-10 19:06:20 +02:00
Konstantin Belousov
73e8f06ac5 gcore: add option to dump core using kernel facility
-k switch causes gcore to use ptrace(PT_COREDUMP) instead of manually
reading process memory and constructing the core.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:26 +03:00
Konstantin Belousov
c192228b73 gcore: split code to open core file into helper
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:26 +03:00
Xin LI
f6b6d216ca usr.bin/netstat: use roundup2 when rounding up to power of 2.
MFC after:	 2 weeks
2021-05-02 09:30:22 -07:00
Xin LI
9769f6f808 usr.bin/patch: remove unneeded header.
MFC after:	2 weeks
2021-05-02 09:27:32 -07:00
Andrew Turner
2abd4f8581 Add a way to map arm64 non-posted device memory
On arm64 we currently use a non-posted write for device memory, however
we should move to use posted writes. This is expected to work on most
hardware, however we will need to support a non-posted option for some
broken hardware.

Reviewed by:	imp, manu, bcr (manpage)
Differential Revision:	https://reviews.freebsd.org/D29722
2021-05-01 06:01:20 +00:00
Thomas Munro
3aaaa2efde poll(2): Add POLLRDHUP.
Teach poll(2) to support Linux-style POLLRDHUP events for sockets, if
requested.  Triggered when the remote peer shuts down writing or closes
its end.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29757
2021-04-28 23:00:31 +12:00
Michael Reifenberger
6648383803 systat: Handle SIGWINCH to properly window resizing and adjust
-swap disk stat based on new size.

Display corrupts after resizing a window.
Process SIGWINCH to redraw all window.

Submitted by:   Yoshihiro Ota ota@j.email.ne.jp
Differential Revision:  https://reviews.freebsd.org/D29337
2021-04-21 20:31:58 +02:00
Michael Reifenberger
dcc2fb3707 systat: Avoid incorrect reallocation in pigs.c
Stop free() even if kvm_getprocs as we can come back but set nprocs = 0.
Check nprocs in showpigs() to ensure not try displaying with kvm_getprocs failed.
Current code can have pt with non-null after kvm_getprocs() failure.

Replace to realloc for simpler operations.

Submitted by:	Yoshihiro Ota ota@j.email.ne.jp
Reviewed by:	mckusick@
Differential Revision:	https://reviews.freebsd.org/D29303
2021-04-21 20:09:21 +02:00
Alex Richardson
c6e66cbfbb usr.bin/lex: regenerate bootstrap files after d37f81e35b
Reviewed by:	jkim
2021-04-21 10:56:29 +01:00
Alex Richardson
3bca8d2b32 Revert "contrib/flex: Drop local __dead2 patch"
I missed the review comment to commit the changes separately, will
reland in multiple smaller commits.

Requested By:   jkim
This reverts commit bbd421cdf6.
2021-04-21 10:48:47 +01:00
Alex Richardson
bbd421cdf6 contrib/flex: Drop local __dead2 patch
Upstream flex has added a yynoreturn, so this diff is no longer needed.
Partially reverts r181269. Also regenerate the pre-generated files that
are used for bootstrapping.

Reviewed By:	jkim

Differential Revision: https://reviews.freebsd.org/D29679
2021-04-20 01:46:42 +01:00
Jung-uk Kim
686cf5468c flex: Regen bootstrap files
This also partially reverts r326025 (8a16b7a18f).  I do not see any
point of adding SPDX tag in generated file.

MFC after:	3 days
Submitted by:	Dan McGregor <dan.mcgregor@usask.ca> (initial version)
Differential Revision:	https://reviews.freebsd.org/D28596
2021-04-19 14:20:51 -04:00
Xin LI
2235c7feac less: upgrade to v581.
MFC after:	2 weeks
2021-04-18 19:46:19 -07:00
Michael Tuexen
9e644c2300 tcp: add support for TCP over UDP
Adding support for TCP over UDP allows communication with
TCP stacks which can be implemented in userspace without
requiring special priviledges or specific support by the OS.
This is joint work with rrs.

Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D29469
2021-04-18 16:16:42 +02:00
Mateusz Piotrowski
16e0391f8e Fix zgrep --version
"zgrep --version" is expected to print the version information in the
same way as "zgrep -V". However, the case handling the --version flag
is never reached, so "zgrep --version" prints:
    zgrep: missing pattern
instead of:
    grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

Reviewed by:	yuripv
Approved by:	yuripv (src)
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D29813
2021-04-18 10:20:11 +02:00
Mateusz Piotrowski
be6b8b7a3a grep: Fix an incorrect description of the -C flag
It seems that the number of lines is no longer an optional parameter to
the -C flag. Document it accordingly both in the manual page and the
usage message.

Reviewed by:	yuripv
Approved by:	yuripv
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28509
2021-04-17 22:35:15 +02:00
Andrew Turner
15221c552b Use if ... else when printing memory attributes
In vmstat there is a switch statement that converts these attributes to
a string. As some values can be duplicate we have to hide these from
userspace.

Replace this switch statement with an if ... else macro that lets us
repeat values without a compiler error.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D29703
2021-04-11 10:58:46 +00:00
Gordon Bergling
97fa288a66 m4(1): Add a SEE ALSO section and reference an AT&T manual
Obtained from:	OpenBSD
MFC after:	1 week
2021-04-08 21:16:54 +02:00
Gordon Bergling
9048d9a933 sed(1): Add a reference for a 4.4BSD manual document
Obtained from:	OpenBSD
MFC after:	1 week
2021-04-08 21:07:31 +02:00
Stefan Eßer
b55a927bc8 [bc] Update to version 4.0.0
This version fixes an issue (missing pop of top-of-stack value in the
"P" command of the dc program).

This issue did not affect the bc program, since it does not use dc as
an back-end to actually perform the calculations as was the case with
the traditional bc and dc programs.

The major number has been bumped due to Windows support that has been
added to this version. It does not correspond to a major change that
might affect FreeBSD.

MFC after:   3 days
2021-04-06 11:57:07 +02:00
Alexander V. Chernikov
4084b1ab04 Fix netstat -rs reporting.
rttrash (unused but not yet delete entries) were eliminated
 during routing rework. Remove reading these symbols from the kernel.

PR:		254681
Reported by:	rashey@superbox.pl
MFC after:	immediately
2021-03-31 20:59:10 +00:00
Daniel Ebdrup Jensen
646bae45e1 fortune/freebsd-tips: Fix markup and wording
'ps' is not a word - rather, it is a utility with its own manual page.
As every other utility referenced in the file has it, append the
relevant manual section that ps(1) can be found in.

While here, also wordsmith a sentence to avoid awkward phrasing, and fix
a typo.

Pointy hat to:	me
Reported by:	danfe, brueffer, maxim
2021-03-31 13:10:30 +02:00
Daniel Ebdrup Jensen
c2a39987e6 fortune/freebsd-tips: Add a few fortunes
These are fortunes I've used locally, probably for decades, so there's
no reason why they shouldn't be available to everyone.
2021-03-30 19:35:50 +02:00
Daniel Ebdrup Jensen
5478176319 fortune/freebsd-tips: Remove errant spaces
I noticed these errant spaces while removing a bogus fortune, and
decided I might as well fix them.

While here, reflow a line to it within 80 columns
2021-03-30 19:05:05 +02:00
Daniel Ebdrup Jensen
968ad154ce fortune/freebsd-tips: Remove bogus fortune
The RCS IDs have been retired as of the move to git, so on 14-CURRENT
and 13.0-STABLE this fortune returns the following.

This fortune brought to you by:
$FreeBSD$

While faintly amusing the first time, this might just cause confusion
for folks, and in addition it's not the most useful of tips, so doesn't
add much.

Therefore it seems prudent to get rid of it.

MFC:		Not to 11-STABLE or 12-STABLE.
2021-03-30 18:59:55 +02:00
Alex Richardson
7daca4e204 truss: improved support for decoding compat32 arguments
Currently running `truss -a -e` does not decode any
argument values for freebsd32_* syscalls (open/readlink/etc.)

This change checks whether a syscall starts with freebsd{32,64}_ and if
so strips that prefix when looking up the syscall information. To ensure
that the truss logs include the real syscall name we create a copy of
the syscall information struct with the updated.

The other problem is that when reading string array values, truss
naively iterates over an array of char* and fetches the pointer value.
This will result in arguments not being loaded if the pointer is not
aligned to sizeof(void*), which can happens in the compat32 case. If it
happens to be aligned, we would end up printing every other value.
To fix this problem, this changes adds a pointer_size member to the
procabi struct and uses that to correctly read indirect arguments
as 64/32 bit addresses in the the compat32 case (and also compat64 on
CheriBSD).

The motivating use-case for this change is using truss for 64-bit
programs on a CHERI system, but most of the diff also applies to 32-bit
compat on a 64-bit system, so I'm upstreaming this instead of keeping it
as a local CheriBSD patch.

Output of `truss -aef ldd32 /usr/bin/ldd32` before:
39113: freebsd32_mmap(0x0,0x1000,0x3,0x1002,0xffffffff,0x0,0x0) = 543440896 (0x20644000)
39113: freebsd32_ioctl(0x1,0x402c7413,0xffffd2a0) = 0 (0x0)
/usr/bin/ldd32:
39113: write(1,"/usr/bin/ldd32:\n",16)		 = 16 (0x10)
39113: fork()					 = 39114 (0x98ca)
39114: <new process>
39114: freebsd32_execve(0xffffd97e,0xffffd680,0x20634000) EJUSTRETURN
39114: freebsd32_mmap(0x0,0x20000,0x3,0x1002,0xffffffff,0x0,0x0) = 541237248 (0x2042a000)
39114: freebsd32_mprotect(0x20427000,0x1000,0x1) = 0 (0x0)
39114: issetugid()				 = 0 (0x0)
39114: openat(AT_FDCWD,"/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
39114: openat(AT_FDCWD,"/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
39114: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0#\0\0\0\0"...,128) = 128 (0x80)
39114: freebsd32_fstat(0x3,0xffffbd98)		 = 0 (0x0)
39114: freebsd32_pread(0x3,0x2042f000,0x23,0x80,0x0) = 35 (0x23)
39114: close(3)					 = 0 (0x0)
39114: openat(AT_FDCWD,"/usr/lib32/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
39114: freebsd32_fstat(0x3,0xffffc7d0)		 = 0 (0x0)
39114: freebsd32_mmap(0x0,0x1000,0x1,0x40002,0x3,0x0,0x0) = 541368320 (0x2044a000)

After:
  783: freebsd32_mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 543543296 (0x2065d000)
  783: freebsd32_ioctl(1,TIOCGETA,0xffffd7b0)    = 0 (0x0)
/usr/bin/ldd32:
  783: write(1,"/usr/bin/ldd32:\n",16)           = 16 (0x10)
  784: <new process>
  783: fork()                                    = 784 (0x310)
  784: freebsd32_execve("/usr/bin/ldd32",[ "(null)" ],[ "LD_32_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_32_TRACE_LOADED_OBJECTS=yes", "LD_TRACE_LOADED_OBJECTS=yes", "USER=root", "LOGNAME=root", "HOME=/root", "SHELL=/bin/csh", "BLOCKSIZE=K", "MAIL=/var/mail/root", "MM_CHARSET=UTF-8", "LANG=C.UTF-8", "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin", "TERM=vt100", "HOSTTYPE=FreeBSD", "VENDOR=amd", "OSTYPE=FreeBSD", "MACHTYPE=x86_64", "SHLVL=1", "PWD=/root", "GROUP=wheel", "HOST=freebsd-amd64", "EDITOR=vi", "PAGER=less" ]) EJUSTRETURN
  784: freebsd32_mmap(0x0,135168,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 541212672 (0x20424000)
  784: freebsd32_mprotect(0x20421000,4096,PROT_READ) = 0 (0x0)
  784: issetugid()                               = 0 (0x0)
  784: sigfastblock(0x1,0x204234fc)              = 0 (0x0)
  784: open("/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
  784: open("/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
  784: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\v\0\0\0"...,128) = 128 (0x80)
  784: freebsd32_fstat(3,{ mode=-r--r--r-- ,inode=18680,size=32768,blksize=0 }) = 0 (0x0)
  784: freebsd32_pread(3,"/usr/lib32\0",11,0x80) = 11 (0xb)

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D27625
2021-03-25 11:14:13 +00:00
Dmitry Chagin
9e5aeba51b Fix warning about signed comparison and drop WARNS for ktrdump(8).
Reviewed By:		jhb, imp
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D29381
2021-03-24 10:51:25 +03:00
Gordon Bergling
a9275d996c ls(1): Refine the HISTORY within the manual page.
A simple find command appeared in Version 1 AT&T UNIX and was removed in
Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later
be enhanced for the Programmer's Workbench (PWB). These changes were
later incorporated in AT&T UNIX v7.

Reviewed by:	imp
MFC after:	1 week
2021-03-13 19:28:26 +01:00
Gordon Bergling
5666643a95 Fix some common typos in comments
- occured -> occurred
- normaly -> normally
- controling -> controlling
- fileds -> fields
- insterted -> inserted
- outputing -> outputting

MFC after:	1 week
2021-03-13 18:26:15 +01:00
Brad Davis
b8e12d2d5c Improve the wording for showing the brightness level
Reviewed by:	allanjude
2021-03-12 09:45:14 -07:00
Mark Murray
cc011d8719 Remove the never-installed setchannel(1) utility. It only work(s|ed)
with the never-committed cxm(4) driver and the now-removed bktr(4)
driver.
2021-03-07 00:06:42 +00:00
Bryan Drewery
eb8bf6bb42 Fix 'make bmake' top-level bootstrapping.
Fixes:	ee10666327
2021-03-06 09:45:08 -08:00
Alex Richardson
6019514b0b truss: split counting of syscalls and syscall calling convention
This change is a refactoring cleanup to improve support for compat32
syscalls (and compat64 on CHERI systems). Each process ABI now has it's
own struct sycall instead of using one global list. The list of all
syscalls is replaced with a list of seen syscalls. Looking up the syscall
argument passing convention now interates over the fixed-size array instead
of using a link-list that's populated on startup so we no longer need the
init_syscall() function.
The actual functional changes are in D27625.

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D27636
2021-03-04 18:30:02 +00:00
Fernando Apesteguía
fc1e79740e compress(1): warn about link handling
compress(1) handles links badly and does not provide link-handling options.
Document this behavior.

PR:     84271
Submitted by: garys@opusnet.com
Approved by: gbe@ (mentor)
Differential Revision:	https://reviews.freebsd.org/D28552
2021-03-04 14:52:12 +01:00
Kyle Evans
0c1a5eaae8 env: style(9) fix, add a space
Reported by:	pstef
Fixes:	55deb0a5f0 ("service(8): use an environment more [...]")
2021-03-03 14:21:56 -06:00
Andrew Gierth
55deb0a5f0 service(8): use an environment more consistent with init(8)
init(8) sets the "daemon" login class without specifying a pw
entry (so no substitutions are done on the variables). service(8)'s
use of env -L had the effect of specifying root's pw entry, with two
effects: getpwnam and getpwuid are being called, which may not be
entirely safe depending on what nsswitch is up to and what stage of
boot we are at, and substitutions would have been done.

Fix by teaching env(8) to allow -L -/classname to set the class
environment with no pw entry at all specified, and use it in
service(8).

PR:		253959
2021-03-03 12:25:11 -06:00
Emmanuel Vadot
1df30489a8 backlight(8): Add note that with option it print the current brightness.
MFC after:    3 days
PR: 	      253737
2021-03-03 09:00:42 +01:00
David Schlachter
3b005d51bd backlight: Fix incr/decr with percent value of 0
This now does nothing instead of incr/decr by 10%

MFC After:    3 days
PR: 	      253736
2021-03-03 08:57:35 +01:00
Alan Somers
60a632f047 fortune: add a tip about gstat
MFC after:	3 weeks
2021-02-26 08:06:07 -07:00
Emmanuel Vadot
8f3c71c85e mkimg: Add support for offset if the source is an image
This allow us to create image with the following format:
mkimg -v -o sdcard -s gpt -p efi:=esp_aarch64.img:1M -p freebsd-ufs::1G

Which will add a efi partition at a 1M offset on the image with its content
coming from the esp_aarch64.img file.

MFC after:	3 days
2021-02-25 18:11:50 +01:00
Emmanuel Vadot
3b6268bb9e mkimg: We always want the last block of the last inserted partition
Even with an absolute offset we want to know the last block the partition
otherwise we endup with an image the size of the metadata.
This allow to create image with the ESP placed at a specific position which
is useful on arm/arm64 where u-boot have always a hard time to read the ESP
if it's not aligned on 512k.
mkimg -v -o sdcard -s gpt -p efi::54M:1M -p freebsd-ufs::1G
now works.

MFC after:	3 days
2021-02-25 16:34:28 +01:00
Baptiste Daroussin
61f66a1f44 ncurses: Add support for terminfo database
Along with the termcap database, ncurses will now lookup for the
terminfo database, note that the terminfo database is being looked
up first and then it fallsback on the termcap one.

While here drop our custom reader for the termcap database, over the
time it is needed maintenance to be able to catchup with changes on ncurses
side.

Install the ncurses tools which are needed to deal with the terminfo
database: tic, infocmp, toe

Replace our termcap only aware tools with the ncurses counterpart:
tput, tabs, tset, clear and reset

In particular they can your the extra capabilities described in the
terminfo database, which does not exist in termcap

Note that to add a new terminfo information to the database from ports
the ports will just need to add their extra information into:
/usr/local/share/site-terminfo/<firstletteroftheterm>/<term>

Tested by:	jbeich, manu
2021-02-25 14:25:11 +01:00
Nathan Whitehorn
f7aebfbe5c Add GPT PREP-boot type to mkimg(1) from geom_gpt.
This partition type can be used to boot some PowerKVM VMs. We don't
support it well because of some limitations in SLOF, but it's worth at
least have feature parity in geom and mkimg.
2021-02-24 10:31:44 -05:00
Daniel Ebdrup Jensen
75e6f664c4 find(1): Mark -not as an extensions to POSIX
While here, change mdoc macro from Ic to Fl.

PR:		253499
Reported by:	Michael Siegel <bugcounterism at malbolge.net>
2021-02-23 17:15:35 +01:00
Rajesh Kumar M A
9f6cf1426f Source repo changes to add new committer Rajesh Kumar M A
Approved by: vmaffione, gallatin

Differential Revision: https://reviews.freebsd.org/D28586
2021-02-16 08:52:09 +00:00
Michael Reifenberger
8d06c3e7a4 Improve size readability.
Preserve more space for swap devise names.
Prevent line overflow with long devise name.
Don't draw a bar when swap is not used at all.
Simplify and optimize code.
Change the label to end at end of 100%.
PR:		251655
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27496
2021-02-15 20:23:32 +01:00
Simon J. Gerraty
85d6747a69 bsd.links.mk wants full paths
The values in LINKS need to be full paths.
2021-02-15 10:05:00 -08:00
Simon J. Gerraty
ee10666327 Links for bmake and bmake.1
Some folk forget that make is bmake, and want the links...

MFC after: 1 week
2021-02-14 17:22:21 -08:00
Konstantin Belousov
25c6318c79 procstat: distinguish vm map guards in procstat vm output.
Requested and reviewed by:	rwatson (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28658
2021-02-14 03:24:58 +02:00
Dimitry Andric
0ff1014944 Update Subversion to 1.14.1 LTS. See contrib/subversion/CHANGES for a
summary of changes, or for a more thorough overview:

https://subversion.apache.org/docs/release-notes/1.14

NOTE 1: There is no need to dump and reload repositories, and the
working copy format is still the same as Subversion 1.8 through 1.13.

NOTE 2: The upstream release also contains a fix for a security issue in
mod_dav_svn (CVE-2020-17525), but since we do not build or use any
Apache modules, it is not an issue for the FreeBSD base system.

Relnotes:	yes
MFC after:	3 days
2021-02-13 14:38:51 +01:00
Simon J. Gerraty
dba7b0ef92 Merge bmake-20210206
Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals
2021-02-10 22:03:22 -08:00
Mateusz Piotrowski
e6f59be239 systat.1: Fix synopsis
systat does not have a "-display" flag. Use Ar to indicate that
"display" is meant to be substituted with an actual display command.

MFC after:	1 week
2021-02-10 18:09:49 +01:00
Mateusz Piotrowski
fcbaf46b76 systat.1: Remove Tn macros
They are no longer supported by mdoc(7).

MFC after:	1 week
2021-02-10 18:09:27 +01:00
Jessica Clarke
01d07b03ef localedef: Fix bootstrapping on Ubuntu 16.04
Glibc's stdlib.h defines various prototypes for GNU extensions that take
a locale_t. Newer versions use locale_t directly and include an internal
bits/types/locale_t.h in order to get its definition, but older versions
include xlocale.h for that, for which our bootstrap version is empty.
Moreover it expects to use the glibc-specific __locale_t type. Thus,
provide dummy definitions of both types in order to ensure the
prototypes don't give any errors, and guard against the header being
inadvertently included between the bootstrapping namespace.h and
un-namespace.h, where locale_t is #define'd.

This header is not used when bootstrapping on FreeBSD and exists solely
to stub out glibc's, so this should have no impact on FreeBSD hosts.

Reviewed by:	arichardson, emaste (comment only)
Differential Revision:	https://reviews.freebsd.org/D28317
2021-02-10 16:41:35 +00:00
Alex Richardson
81c3f64110 usr.bin/grep: Fix Address OOB read error
I found this when compiling all the bootstrap tools with -fsanitize=addres:

==65590==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62d000008400 at pc 0x000000473053 bp 0x7ffc1c7dd910 sp 0x7ffc1c7dd0b8
READ of size 32769 at 0x62d000008400 thread T0
    #0 0x473052 in regexec (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052)
    #1 0x4c9cf3 in procline /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:539:8
    #2 0x4c8687 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:379:18
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

0x62d000008400 is located 0 bytes to the right of 32768-byte region [0x62d000000400,0x62d000008400)
allocated by thread T0 here:
    #0 0x493d5d in malloc (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x493d5d)
    #1 0x4cad75 in grep_malloc /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:656:13
    #2 0x4c8129 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

SUMMARY: AddressSanitizer: heap-buffer-overflow (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052) in regexec

Reviewed By:	kevans
MFC after:	1 week
2021-02-09 17:13:32 +00:00
Kyle Evans
3e2d96ac97 grep: fix -A handling in conjunction with -m match limitation
The basic issue here is that grep, when given -m 1, would stop all
line processing once it hit the match count and exit immediately.  The
problem with exiting immediately is that -A processing only happens when
subsequent lines are processed and do not match.

The fix here is relatively easy; when bsdgrep matches a line, it resets
the 'tail' of the matching context to the value supplied to -A and
dumps anything that's been queued up for -B. After the current line has
been printed and tail is reset, we check our mcount and do what's
needed. Therefore, at the time that we decide we're doing nothing, we
know that 'tail' of the context is correct and we can simply continue
on if there's still more to pick up.

With this change, we still bail out immediately if there's been no -A
flag. If -A was supplied, we signal that we should continue on. However,
subsequent lines will not even bothere to try and process the line.  We
have reached the match count, so even if the next line would match then
we must process it if it hadn't. Thus, the loop in procfile() can
short-circuit and just process the line as a non-match until
procmatches() indicates that it's safe to stop.

A test has been added to reflect both that we should be picking up the
next line and that the next line should be considered a non-match even
if it should have been.

PR:		253350
MFC-after:	3 days
2021-02-08 12:41:22 -06:00
Emmanuel Vadot
8af54bdfca lastcomm(1): Only install if MK_ACCT is on
MFC after:	3 days
2021-02-06 20:41:39 +01:00
Mark Johnston
90da2c797b truss: Decode sendfile(2) arguments
MFC after:	2 weeks
2021-02-05 11:28:29 -05:00
Kyle Evans
2373acbbb7 grep: turn off -w if -x is specified
-x overcomes -w in gnugrep, and it should here as well.  Flip it off as
needed to avoid confusing other parts of grep.
2021-02-04 20:59:43 -06:00
Kyle Evans
f823c6dc73 grep: fix null pattern and empty pattern file behavior
The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong.  Let's unwind that:

- The null pattern should match every line if neither -w nor -x.
- The null pattern should match empty lines if -x.
- The null pattern should not match any lines if -w.

The first two will stop processing (shortcut) even if additional patterns
are specified. In any other case, we will continue processing other
patterns.  If no other patterns are specified beside a null pattern, then
we match if neither -w nor -x or set and do not match if either of those
are specified.

The justification for -w is that it should match on a whole word, but the
null pattern deos not have a whole word to match on.

Empty pattern files should never match anything, and more importantly, -v
should cause everything to be written.

PR:		253209
MFC-after:	4 days
2021-02-04 20:59:42 -06:00
Alex Richardson
39a1f858ad du_test: Skip three tests if sparse files are not supported
This fixes running the du tests with /tmp as tmpfs (which is what we do in the
CheriBSD CI).

Obtained from:	CheriBSD
Reviewed By:	ngie
Differential Revision: https://reviews.freebsd.org/D28398
2021-02-03 17:06:07 +00:00
Olivier Cochard
b67df8d7c2 diff: Use unprivileged_user with report_identical test
Approved by:	bapt
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28466
2021-02-03 17:18:59 +01:00
Baptiste Daroussin
c69047ca75 Revert "diff: eliminate a useless lseek"
This changes breaks when one of the files is stdin

This reverts commit fa977a3b2b.

Reported by:	olivier
2021-02-02 10:08:25 +01:00
Chuck Silvers
7787e7eed9 tail: fix "tail -F" file rotation detection
When checking if the newly opened file is the same as the old one,
we need to fstat() the new file descriptor, not the old one again.

Reviewed by:	glebius
Sponsored by:	Netflix
2021-02-01 16:21:14 -08:00
Kyle Evans
9ca71db495 ofed: fix the WITH_OFED_EXTRA build
This option was not tested when WARNS was globally lifted in the src tree up
to 6.  Drop WARNS back down to unbreak the build; note that this is still
enabling more warnings than it had before the WARNS change, so the gcc build
may need to be independently evaluated at this level.

PR:		252865
Reported-by:	Build Option Servey via Michael Dexter
MFC-after:	3 days
2021-01-29 23:52:13 -06:00
John Baldwin
9d4104b214 Fix ldd to work with more ELF files.
- Use libelf to parse ELF data structures and remove code duplication
  for ELF32.

- Don't require the OSABI field to be set to the FreeBSD OSABI for
  shared libraries.  Both AArch64 and RISC-V leave it set to "none"
  and instead depend on the ABI tag note.  For ldd, this means falling
  back to walking the notes in PT_NOTE segments to find the ABI tag
  note to determine if an ELF shared library without OSABI set in the
  header file is a FreeBSD shared library.

Reviewed by:	kib
MFC after:	5 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D28342
2021-01-29 10:53:50 -08:00
Kyle Evans
bf59049c27 du: tests: use dollar-single quotes where appropriate
No need for "foo$(printf "\t")", $'\t' is both more readable and still
functional.

Reported-by:	Jamie Landeg-Jones <jamie@catflap.org>
2021-01-28 21:02:58 -06:00
Baptiste Daroussin
7a57c9cb5a diff: eleminitate useless macros
The diff_output was not bringing any values but was obfuscating
the code.
2021-01-27 12:29:33 +01:00
Baptiste Daroussin
e43239f514 diff: simplify the hash functions
Instead of 3 different complex case they have all been folded into a
simple on based on switch
2021-01-27 12:28:26 +01:00
Baptiste Daroussin
e52546a3a7 diff: fix typo in a comment 2021-01-27 12:18:46 +01:00
Baptiste Daroussin
931ad51808 diff: remove stalled entries in headers 2021-01-27 12:18:45 +01:00
Baptiste Daroussin
15abb23286 diff: eliminate space at end of line
No functionnal changes
2021-01-27 12:18:45 +01:00
Baptiste Daroussin
fa977a3b2b diff: eliminate a useless lseek
fdopen with the "r" already position the stream at the beginning
of the file.
2021-01-27 12:18:45 +01:00
Baptiste Daroussin
c440e7870a diff: add a test case about the non regular file support 2021-01-27 12:18:45 +01:00
Jamie Landeg-Jones
fefb3c46a8 diff: fix incorrectly displaying files as duplicates
When diff hits certain access errors, function diffreg() shows the error
message, and then returns to the calling function, which calls
print_status() with the return value.

However, in these cases, the return value isn't changed from the initial
default value of D_SAME.

Normally, print_status() with a value of D_SAME does nothing, so this
works out ok, however, if the "-s" flag is set, a message is displayed
showing identicality:

case D_SAME:
                if (sflag)
                        printf("Files %s%s and %s%s are identical\n",                                                                                                       path1, entry, path2, entry);
                break;

This then produces such results as:

% diff  -s /COPYRIGHT /var/run/rpcbind.sock
diff: /var/run/rpcbind.sock: Operation not supported
Files /COPYRIGHT and /var/run/rpcbind.sock are identical

% diff  -s /COPYRIGHT /etc/master.passwd
diff: /etc/master.passwd: Permission denied
Files /COPYRIGHT and /etc/master.passwd are identical

Create a D_ERROR status which is returned in such cases, and
print_status() then deals with that status seperately from D_SAME

PR:		252614
MFC after:	1 week
2021-01-25 20:38:18 +01:00
Baptiste Daroussin
13860e71eb diff: add a test case for failed -s option 2021-01-25 20:37:58 +01:00
Konstantin Belousov
9940ac808d elfctl: Fix type errors.
Target value for val has uint32_t type, not uint, adjust used constant.
Change val type to unsigned so that left and right sides of comparision
operator do not expose different signed types of same range [*].

Switch to unsigned long long and strtoll(3) so that 0x80000000 is
accepted by conversion function [**].

Reported by:	kargl [*]
Noted by:	emaste [**]
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28301
2021-01-23 17:24:32 +02:00
Ed Maste
f302fd1aa6 elfctl: fix typo from last-minute refactoring
Reported by:	jkim
Fixes:		86f33b5fcf
2021-01-22 16:35:05 -05:00
Ed Maste
86f33b5fcf elfctl: allow features to be specified by value
This will allow elfctl on older releases to set bits that are not yet
known there, so that the binary will have the correct settings applied
if run on a later FreeBSD version.

PR:		252629 (related)
Suggested by:	kib
Reviewed by:	gbe (manpage, earlier), kib
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28284
2021-01-22 14:38:52 -05:00
Lewis Cook
e808c8309c Complete Steps 5 and 9 from the Committer's guide
Summary:
Steps 5 and 9:
 - Update Mentor and Mentee Information
 - Update Ports with Personal Information

Reviewers: tcberner, fernape

Reviewed By: fernape

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D28281
2021-01-22 11:54:05 +00:00
Jessica Clarke
5faeda9037 Rename i386's Linux ELF to Linux ELF32
This is what amd64 calls the i386 Linux ABI in order to distinguish it
from the amd64 Linux ABI, and matches the nomenclature used for the
FreeBSD ABIs where they always have the size suffix in the name.

Reviewed by:	trasz
Differential Revision:	https://reviews.freebsd.org/D27647
2021-01-21 01:54:12 +00:00
Alex Richardson
c1a3d7f206 Remove remaining uses of ${COMPILER_FEATURES:Mc++11}
All supported compilers have C++11 support so these checks can be replaced
with MK_CXX guards.
See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252759

PR:		252759
Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D28234
2021-01-19 21:37:36 +00:00
Martin Tournoij
f850fd2496 grep: fix LINKS in Makefile
zstdegrep was listed twice, instead of zstdfgrep

Pull Request:	https://github.com/freebsd/freebsd-src/pull/450
2021-01-18 11:22:48 +01:00
Ed Maste
c763f99d11 elfctl: prefix disable flags with "no"
Some ELF feature flags indicate a request to opt-out of some feature,
for example NT_FREEBSD_FCTL_ASLR_DISABLE indicates that ASLR should be
disabled for the tagged binary.  Using "aslr" as the short name for the
flag is confusing as it seems to indicate a request for ASLR to be
enabled.  Rename "noaslr", and make a similar change for other opt-out
flags.

Reviewed by:	bapt, manu, markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28139
2021-01-14 15:09:13 -05:00
Ed Maste
3dfcb70b6a elfctl: add backwards compatibility for "no" prefixes
I am going to prefix opt-out ELF feature flag names with "no" to make
their meaning more clear (review D28139), but there are some uses of the
existing names already (e.g., the PR referenced below).

For now accept the older, unprefixed name as well, and emit a warning.
We can revert this after FreeBSD 13 branches.

% elfctl -e +aslr foo
elfctl: interpreting aslr as noaslr; please specify noaslr

PR:		239873 (related)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28140
2021-01-14 15:09:08 -05:00
Simon J. Gerraty
06b9b3e0ad Merge bmake-20210110
Quite a lot of churn on style, but lots of
good work refactoring complicated functions
and lots more unit-tests.
Thanks mostly to rillig at NetBSD

Some interesting entries from ChangeLog

o .MAKE.{UID,GID} represent uid and gid running make.

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o add more unit tests for META MODE

Merge commit '8e11a9b4250be3c3379c45fa820bff78d99d5946' into main

Change-Id: I464fd4c013067f0915671c1ccc96d2d8090b2b9c
2021-01-13 22:21:37 -08:00
Ed Maste
f6d95a0110 elftcl: add -i flag to ignore unknown flags
This may allow an identical elfctl invocation to be used on multiple
FreeBSD versions, with features not implemented on older releases being
silently ignored.

PR:		252629 (related)
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28130
2021-01-13 00:10:13 -05:00
Ed Maste
80445b7a3f cmp: fix -s (silent) when used with skip offsets
-s causes cmp to print nothing for differing files, for use when only
the exit status is of interest.

-z compares the file size first, for regular files, and fails the
comparison early if they do not match.

Prior to this change -s implied -z as an optimization, but this is not
valid when file offsets are specified.  Now, enable the -z optimization
for -s only if both skip arguments are not provided / 0.

Note that using -z with differing skip values will currently always
fail.  We may want to compare size1 - skip1 with size2 - skip2 instaead,
and in any case the man page should be clarified.

PR:		252542
Fixes:		3e6902efc8
Reported by:	William Ahern
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28071
2021-01-10 19:02:56 -05:00
Ed Maste
1f7661742d cmp: use C99 bool for flags
MFC after:	1 week
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28072
2021-01-10 19:02:55 -05:00
Ed Maste
c8eee7c0bf ldd: renumber executable type constants
ldd had #defines for AOUT, ELF, and ELF32.  The removal of AOUT left a
possibly confusing gap.  These are not used anywhere but this file so
renumber to avoid the gap.

Reported by:	allanjude
2021-01-09 13:34:58 -05:00
Ed Maste
12a8d3027d diff: honour flags with -q
Previously -q (just print a line when files differ) ignored flags like
-w (ignore whitespace).  Avoid the D_BRIEF short-circuit when flags are
in effect.

PR:		252515
Reported by:	Scott Aitken
Reviewed by:	kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28064
2021-01-09 13:34:06 -05:00
Fernando Apesteguía
53c8d22495 last(1): Add EXAMPLES section
Add two simple examples showing the use of the flags: d, n, s, t
While here, reorder cross references properly by section
Bump .Dd

Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D27540

last(1): Bump .Dd
2021-01-09 18:37:25 +01:00
Fernando Apesteguía
9e23004023 man(1): Bump .Dd
From commit df965a6829
2021-01-09 18:22:08 +01:00
Fernando Apesteguía
df965a6829 man(1): Add EXAMPLES section
Add some examples showing the use of the flags: a, k, P, w

Reviewed by: gbe@, yuripv@
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D27545
2021-01-09 17:57:47 +01:00
Ed Maste
0713c7b88c ldd: Retire aout support
Userland aout support has not been required since FreeBSD 2.x.
If someone needs to use FreeBSD 2 shared libraries they will be best
served by using a FreeBSD 2 ldd, perhaps as part of a jail with a full
FreeBSD 2.x install.

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27478
2021-01-07 19:14:01 -05:00
Kyle Evans
3c5c39c7ad du: tests: make H_flag tests more strict about output requirements
The current version of this test will effectively pass as long as one of the
specified paths is in the output, and it could even be a subset of one of
the paths.

Strengthen up the test a little bit:
  * Specify beginning/end anchors for each path
  * Add egrep -v checks to make sure we don't have any *additional* paths
  * Ratchet down paths2 to exactly the two paths we expect to appear

Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D27984
2021-01-07 16:37:28 -06:00
Kyle Evans
4832d2e8ae du: tests: fix the H_flag test (primarily grep usage)
This test attempts to use \t (tab intended) in a grep expression.  With the
former /usr/bin/grep (i.e. gnugrep), this was interpreted as a literal 't'.
The expression would work anyways because the tr(1) usage would ultimately
replace all of the spaces with a single newline, and they would match the
paths whether they were correctly fromatted or not.

Current /usr/bin/grep (i.e. bsdgrep) is less-tolerant of ordinary-escapes, a
property of the underlying regex(3) engine, to make it easier to identify
when stuff like this happens. In-fact, this expression broke after the
switch happened.

This revision does the bare basics to fix the usage by using a printf to get
a literal tab character to insert into the expression. It also swaps out the
manual insertion of the line prefix into the grep expression by pulling
that part out of $sep and reusing it for the leading path.

The secondary issue was the tr(1) usage, since tr would only replace the
first character of string1 with the first character of string2.  This has
instead been replaced by a sed expression, which similary understands \n to
be a newline on all supported versions of FreeBSD.  Each path now gets
prefixed with the appropriate context that should be there (i.e. numeric
sequence followed by a tab).

PR:		252446
Reviewed by:	emaste, ngie
Differential Revision:	https://reviews.freebsd.org/D27983
2021-01-07 16:36:31 -06:00
Alex Richardson
7fa2f2a62f Rename NO_WERROR -> MK_WERROR=no
As suggested in D27598. This also supports MK_WERROR.clang=no and
MK_WERROR.gcc=no to support the existing NO_WERROR.<compiler> uses.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D27601
2021-01-07 09:31:03 +00:00
Alex Richardson
fe41c64b57 Fix -Wpointer-sign warnings in makefs and mkimg
Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D27175
2021-01-07 09:26:21 +00:00
Mateusz Piotrowski
d41149a8e9 Add some examples to script.1
While here:

- Split synopsis into two parts. The first explains how to record
  sessions, while the second one explains how to replay (some of)
  the recorded sessions.
- Fix the -width argument of the environment variables list.

MFC after:	1 week
2021-01-05 16:32:27 +01:00
Mateusz Piotrowski
225afb6cad Improve readability of the options list
MFC after:	3 days
2021-01-05 15:46:56 +01:00
Emmanuel Vadot
066a8c691e pkgbase: Install atf and kyua in the tests package
While here make sure that all tests dirs are taggued correctly.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D27714
2021-01-04 16:20:47 +01:00
Gordon Bergling
c949ba1d20 fortune(6): Add EXIT STATUS and HISTORY sections
Obtained from:	OpenBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27941
2021-01-03 23:51:39 +01:00
Yoshihiro Takahashi
0cdfa49564 unzip: Sync with NetBSD upstream.
- Ignore malformed directory entries as created by Dropbox ("/").
  (rev 1.24)
- Use libarchive 3.x interface: check result for archive_read_free()
  and don't call archive_read_close manually. (rev 1.23)
- Always overwrite symlinks on extraction, ever if they're newer than
  entries in archive.
- Use getline() rather than getdelim().

PR:		231827
Submitted by:	ak
Reviewed by:	mm
Obtained from:	NetBSD
MFC after:	2 weeks
2021-01-02 10:50:08 +09:00
Stefan Eßer
a3c29cdbd4 Replace strcat, strcpy and snprintf with bounds checking versions 2020-12-31 12:37:37 +01:00
Alexander Motin
ccdd2b2b3c Add "-n" flag to sockstat.
sockstat can "hang" on getpwuid() calls in situations when FreeBSD
is joined to a directory service (AD/LDAP etc) and the directory
service fail to answer in a timely manner when trying to resolve
numeric UIDs to user names.

Submitted by:	Caleb St. John <caleb@ixsystems.com>
MFC after:	1 week
2020-12-30 13:45:53 -05:00
Stefan Eßer
e163cae76e Make calendarhome buffer static
the value may be used in error messages after leaving this function.
2020-12-30 13:44:33 +01:00
Xin LI
2ff66a9155 bsdcat,cpio,tar: derive version string from archive.h
Reviewed by:	mm
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27823
2020-12-29 14:21:50 -08:00
Fernando Apesteguía
f3f16c31fe look(1): Add EXAMPLES section
Add two simple examples. In this case I opted to show a small portion of
the output since it helps to understand what the tool does. It shows the use
of the -t flag too.

PR:
Submitted by:
Reported by:
Reviewed by:	gbe@
Approved by:	manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision:	https://reviews.freebsd.org/D27543
2020-12-29 21:48:12 +01:00
Fernando Apesteguía
0ce6e534d3 lsvfs(1): Add EXAMPLES section
Add one simple exapmle and contrast some of the information using mount(8)

PR:
Submitted by:
Reported by:
Reviewed by:	gbe@, yuripv@
Approved by:	manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision:	https://reviews.freebsd.org/D27544
2020-12-29 21:35:24 +01:00
Martin Matuska
70a567c2c3 bsdcat,cpio,tar: Bump version number to 3.5.1
Matches import of libarchive 3.5.1
2020-12-28 00:37:06 +01:00
Stefan Eßer
dbb25cbe55 Adjust to display more than 999 sleeping threads 2020-12-27 22:32:22 +01:00
Stefan Eßer
6fe8fbdc1c Statistics are for threads, not processes 2020-12-27 22:32:22 +01:00
Konstantin Belousov
67af9aba6b Decode and report native eventfd descriptors from libprocstat and procstat.
Submitted by:   greg@unrelenting.technology
Reviewed by:    markj (previous version)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D26668
2020-12-27 12:57:27 +02:00
Ed Maste
9bc6c7219a gprof: Retire a.out support
FreeBSD has used ELF binaries/libraries for decades, but still has some
support for legacy a.out binaries.  Portions of this have been retired
over time, but support remained in ldd, ldconfig, and gprof.

Retire gprof support; if anyone needs to do development on a.out
binaries still they will be best served by installing a full FreeBSD 2.x
or other obsolete version in a jail.

Kernel support for executing a.out binaries is unchnaged.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27480
2020-12-26 11:47:47 -05:00
Kyle Evans
d1c965f143 grep: tests: stop testing for a nonexistent version of grep
Differential Revision:	https://reviews.freebsd.org/D27732
2020-12-25 15:16:33 -06:00
Kyle Evans
8aff76fb37 build: remove the option to build gnugrep
Unconditionally install bsdgrep as grep, bootstrap or not. Remove all
build glue and stop installing both gnugrep and libgnuregex now that
all consumers of the latter are gone.

Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D27732
2020-12-25 15:14:17 -06:00
Gordon Bergling
a2f1c81b28 patch(1): Fix a few mandoc related issues
- no blank before trailing delimiter

MFC after:	1 week
2020-12-19 13:00:17 +00:00
Gordon Bergling
3f6cdd59fe uname(1): Fix a typo in the man page date
MFC after:	3 days
2020-12-19 12:55:27 +00:00
Gordon Bergling
a5b4dfcfbc ident(1): Normalizing date format
MFC after:	3 days
2020-12-19 12:54:00 +00:00
Pedro F. Giffuni
dcc6f62526 login(1): when exporting variables check the result of setenv(3)
When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

(This change redoes r368776 due to a silly mistake)
2020-12-19 03:07:38 +00:00
Pedro F. Giffuni
a0bed90198 Revert r368776:
login(1): when exporting variables check the result of setenv(3)

mismatch: the return value upon error is -1, so the code was not
doing nothing.
2020-12-19 02:42:14 +00:00
Pedro F. Giffuni
ebb4fcc7cf login(1): when exporting variables check the result of setenv(3)
When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

Differential Revision:	https://reviews.freebsd.org/D26966
2020-12-19 02:23:53 +00:00
Konstantin Belousov
673e2dd652 Add ELF flag to disable ASLR stack gap.
Also centralize and unify checks to enable ASLR stack gap in a new
helper exec_stackgap().

PR:	239873
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-12-18 23:14:39 +00:00
Emmanuel Vadot
395cb8fbc0 kyua: Only install examples if requested
Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D27638
2020-12-17 17:06:57 +00:00
Juraj Lutter
7bd0c4c47d Complete steps 5 and 9 from Committer's guide
Reviewed by:		osa (mentor)
Approved by:		osa (mentor)
Differential Revision:	https://reviews.freebsd.org/D27632
2020-12-16 16:59:52 +00:00
Stefan Eßer
d87cb51f56 Fix WITHOUT_ICONV build
Move the include of langinfo.h out of the WITH_ICONV condition block,
since it is not dependent on ICONV. This was correct when nl_langinfo()
had only been called in the WITH_ICONV case, but that is no longer the
case.

Submitted by:	yuripv
2020-12-13 19:06:59 +00:00
Stefan Eßer
8a428dfecb Revert r368606
The issue will be fixed in a different way.

Reported by:	yuripv
2020-12-13 19:03:38 +00:00
Stefan Eßer
c6e0073a42 Fix WITHOUT_ICONV build
There was an unprotected use of nl_langinfo() to determine the order of
day vs. month in the generated output.

When building without ICONV support, the order will be: month, day.
2020-12-13 09:38:50 +00:00
Yuri Pankov
0d2dcf2166 xargs: compile yesexpr as ERE
yesexpr is an extended regular expression for quite some time now,
use appropriate flag when compiling it.

PR:		238762
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D27509
2020-12-12 15:38:32 +00:00
Stefan Eßer
6f139d796f Use getlocalbase() instead of compiled in LOCALBASE to locate calendars 2020-12-12 11:51:29 +00:00
Fernando Apesteguía
c06f992b02 lock(1): Add EXAMPLES section
Add simple example showing the use of the flags: p, t, v

Reviewed by:	gbe@, yuripv@
Approved by:	manpages (yuripv@)
Differential Revision:		https://reviews.freebsd.org/D27541
2020-12-11 19:27:21 +00:00
Stefan Eßer
580a173a05 Install 2 forgotten shell scripts required to run the tests
Submitted by:		arichardson (Alexander Richardson)
Differential Revision:	https://reviews.freebsd.org/D27568
2020-12-11 13:23:59 +00:00
Guangyuan Yang
92b959f120 Fix a grammar error on locate(1).
While here, also fix a useless .Tn reported by mandoc.

PR:		251746
MFC after:	1 week
Sumbitted by:	David Schlachter <fbsd-bugzilla@schlachter.ca>
2020-12-11 08:04:54 +00:00
Kenneth D. Merry
78adacd4ea Add the LTO-9 density code to libmt and the mt(1) man page.
These values are taken directly from the density report from an
IBM LTO-9 tape drive.  (Using mt getdensity)

A LTO-9 drive stores 18TB raw (45TB with compression) on an LTO-9 tape.

lib/libmt/mtlib.c:
        Add the LTO-9 density code, and bpmm/bpi values.

usr.bin/mt/mt.1:
        Add the LTO-9 density code, bpmm/bpi values and number of
	tracks.  Bump the man page date.

MFC after:	3 days
Sponsored by:	Spectra Logic
2020-12-10 21:06:06 +00:00
Fernando Apesteguía
97c8162543 id(1): Add EXAMPLES section
Add some examples covering the flags: G, n, P, p, u

Add reference to groups(1)

Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D27539
2020-12-10 18:34:15 +00:00
Fernando Apesteguía
fc89b27576 groups(1): Add EXAMPLE
Add a super simple example

Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D27538
2020-12-10 17:48:34 +00:00
Thomas Munro
bb24ee2b7e truss: Add AIO syscalls.
Display the arguments of aio_read(2), aio_write(2), aio_suspend(2),
aio_error(2), aio_return(2), aio_cancel(2), aio_fsync(2), aio_mlock(2),
aio_waitcomplete(2) and lio_listio(2) in human-readable form.

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D27518
2020-12-10 07:13:15 +00:00
Kyle Evans
df546c3b73 grep: replace the internal queue with a ring buffer
We know up front how many items we can have in the queue (-B/Bflag), so
pay the cost of those particular allocations early on.

The reduced queue maintenance overhead seemed to yield about an ~8%
improvement for my earlier `grep -C8 -r closefrom .` test.

MFC after:	2 weeks
2020-12-09 05:27:45 +00:00
Kyle Evans
281412ce7b grep: tests: stop expecting a failure of gnuext w/ bsdgrep
libregex now supports these and we no longer offer to not link against
libregex.
2020-12-09 05:12:04 +00:00
Kyle Evans
c2679dd779 kdump/truss: decode new _umtx_op flags
In both cases, print the flag bits first followed by the command.

Output now looks something like this:

(ktrace)
_umtx_op(0x8605f7008,0xf<UMTX_OP_WAIT_UINT_PRIVATE>,0,0,0)
_umtx_op(0x9fffdce8,0x80000003<UMTX_OP__32BIT|UMTX_OP_WAKE>,0x1,0,0)

(truss)
_umtx_op(0x7fffffffda50,UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)
_umtx_op(0x9fffdd08,UMTX_OP__32BIT|UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D27325
2020-12-09 03:24:09 +00:00
Bryan Drewery
2dfa4b66b3 fts_read: Handle error from a NULL return better.
This is addressing cases such as fts_read(3) encountering an [EIO]
from fchdir(2) when FTS_NOCHDIR is not set.  That would otherwise be
seen as a successful traversal in some of these cases while silently
discarding expected work.

As noted in r264201, fts_read() does not set errno to 0 on a successful
EOF so it needs to be set before calling it.  Otherwise we might see
a random error from one of the iterations.

gzip is ignoring most errors and could be improved separately.

Reviewed by:	vangyzen
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D27184
2020-12-08 23:38:26 +00:00
Kyle Evans
6e5a5dc03d bsdgrep: don't link against libregex for bootstrap
r368355 removed the GNU_GREP_COMPAT knob (off by default) and forgot that
bsdgrep may be built/used for bootstrap on some systems.

All base uses should strive to use only POSIX-compliant expressions anyways
and we haven't had libregex by default here up to this point, so just don't
do that if we're bootstrapping.

Note that the resulting binary has the wrong `grep -V` information as it
falsely claims to be GNU compatible, but it is only for bootstrap.

Reported by:	GitHub cross-builds via yuripv
2020-12-06 17:45:42 +00:00
Kyle Evans
7c2f310f6d Retire GNU_GREP_COMPAT knob
This was introduced and then disabled by default primarily to avoid dealing
with bugs in libgnuregex. rS363823 switched to using libregex for it, so
let's just rip the option out now so we can make sure we're getting tested
with libregex via bsdgrep.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D27476
2020-12-05 02:21:58 +00:00
Martin Matuska
c3afd20f13 MFV r368207:
Update libarchive to 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

MFC after:	1 week
2020-12-01 15:53:12 +00:00