Commit Graph

14989 Commits

Author SHA1 Message Date
Kyle Evans
f66b9b40f4 cmp: add -b, --print-bytes
This is compatible with GNU cmp.

Reviewed by:	bapt, markj (earlier version)
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32074
2021-09-29 13:04:57 -05:00
Kyle Evans
8d546b6832 cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args
This is compatible with GNU cmp.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32073
2021-09-29 13:03:34 -05:00
Kyle Evans
4e380e8474 cmp: add -n, --bytes to limit number of bytes to compare
This is compatible with GNU cmp.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32072
2021-09-29 13:03:34 -05:00
Kyle Evans
f6787614fd cmp: accept SI suffixes for skip1 and skip2
This is compatible with GNU cmp.

Reviewed by:	bapt (earlier version), markj, imp
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32071
2021-09-29 13:03:34 -05:00
Yasuhiro Kimura
74237127e3 Add myself to calendar.freebsd
It corresponds to the 9th step of the procedure described in section
7.1 of Committer's Guide.

Approved by:	meta (mentor)
Differential Revision:	https://reviews.freebsd.org/D32153
2021-09-27 17:47:01 +09:00
Yoshihiro Takahashi
a4724ff481 unzip: sync with NetBSD upstream to add passphrase support
- Add support for password protected zip archives.
  We use memset_s() rather than explicit_bzero() for more portable
  (See PR).
- Use success/failure macro in exit()
- Mention ZIPX format in unzip(1)

Submitted by:	Mingye Wang and Alex Kozlov (ak@)
PR:		244181
Reviewed by:	mizhka
Obtained from:	NetBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28892
2021-09-26 01:32:42 +09:00
Kyle Evans
f555b39e6b man: reset OPTIND before parsing args
From jilles: POSIX requires that a script set `OPTIND=1` before using
different sets of parameters with `getopts`, or the results will be
unspecified.

The specific problem observed here is that we would execute `man -f` or
`man -k` without cleaning up state from man_parse_args()' `getopts`
loop.  FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the
second getopts loop, rendering the following shift harmless; other
/bin/sh implementations will leave it at what we came into the loop at
(e.g., bash as /bin/sh), shifting off any keywords that we had.

Input from:	jilles
Reviewed by:	allanjude, bapt, imp
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32063
2021-09-23 14:13:34 -05:00
Olivier Houchard
f4b7018af1 truss: Decode correctly 64bits arguments on 32bits arm.
Mostly revert ebbc3140ca.
We don't need to special-case anything for arm64, the check for the pointer
size is already done for us, just keep the bits about having arm and arm64
having to add padding for 32bits binaries.

MFC after:	1 week
2021-09-23 01:26:42 +02:00
Olivier Houchard
ebbc3140ca truss: Decode correctly 64bits arguments on 32bits arm.
When decoding 32bits arm syscall, make sure we account for the padding when
decoding 64bits args. Do it too when using a 64bits truss on a 32bits binary.

MFC After:	1 week
PR:		256199
2021-09-23 01:04:16 +02:00
Konstantin Belousov
cf0ee8738e Drop cloudabi
According to https://github.com/NuxiNL/cloudlibc:
CloudABI is no longer being maintained. It was an awesome experiment,
but it never got enough traction to be sustainable.

There is no reason to keep it in FreeBSD.

Approved by:	ed (private mail)
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31923
2021-09-22 00:18:44 +03:00
Kevin Bowling
007c2463d6 calendar.freebsd: Fix off-by-one error 2021-09-17 16:07:23 -07:00
Konstantin Belousov
ac8af19380 proccontrol(1): Add wxmap control
Reviewed by:	brooks, emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31779
2021-09-17 15:42:07 +03:00
Konstantin Belousov
1349891a0e Style
Reviewed by:	brooks, emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31779
2021-09-17 15:41:54 +03:00
Piotr Pawel Stefaniak
12061d2626 diff: link with libm for sqrt()
Reported by:	Jenkins
Fixes:		bcf2e78dc4
2021-09-16 09:31:44 +02:00
Piotr Pawel Stefaniak
e51aabf8cb diff: implement option -F (--show-function-line)
With unified and context diffs, show the last line that matches the
provided pattern before the context.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31714
2021-09-16 01:46:44 +02:00
Cameron Katri
f38702e5a5 diff(1): Add --color support
Adds a --color flag to diff(1) that supports the same options as GNU's
diff(1). The colors are customizable with the env var DIFFCOLORS in
a format similar to grep(1)'s GREPCOLORS. An example would be 04;36:41
for additions to be underlined light blue, and deletions have a red
background.

Differential Revision:	https://reviews.freebsd.org/D30545
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
7760b85414 diff: decrease indent level
An upcoming change will add more code in the loop.
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
2171b2cbe0 diff: avoid applying offsets to null pointer
This was the only instance of undefined behavior I could find so far.
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
bcf2e78dc4 diff: replace isqrt() with sqrt()
Remove cruft and use a system-provided and maintained function instead.
2021-09-16 01:46:43 +02:00
Piotr Pawel Stefaniak
e43df07e37 diff: move functions around and reduce their visibility
Most of them become static. There will be more such functions added in
upcoming commits, so they would be inconsistent with existing code.
Improve the existing code instead of reinforcing the unwanted pattern.
2021-09-16 01:36:41 +02:00
Piotr Pawel Stefaniak
b5541f456d diff: convert boolean flag variables to bool
There will be more boolean flags added in upcoming commits and they
would have to be stored in ints in order to be consistent with existing
code. Change the existing code to use the bool type.
2021-09-16 01:36:41 +02:00
Piotr Pawel Stefaniak
0358202111 diff: improve code style
Reflow comments, strip trailing space, improve wrapping of lines.
2021-09-16 01:36:41 +02:00
John Baldwin
4c9cb057bd top: Remove a duplicate extern declaration for show_args.
This fixes a -Wnested-extern error with GCC 9.  There is an existing
extern declaration in top.h.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31937
2021-09-15 09:03:17 -07:00
Pietro Cerutti
41ba691f92 tee: use queue(9) in place of a custom linked list
Approved by: cognet
2021-09-15 11:04:24 +00:00
Jessica Clarke
f28c1d0c5c llvm-objcopy: Install llvm-strip, and optionally strip, links
Just as elftoolchain's objcopy doubles as strip, so does LLVM's. This
ensures that a strip binary is still present for WITH_LLVM_BINUTILS
builds. Note that we do not currently have a committed copy of the
manpage generated from the rST source so no manpage is installed for
(llvm-)strip.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Tested by:	Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after:	1 week
2021-09-13 21:52:40 +01:00
Warner Losh
d780a23a99 tabs: a hacky version of tabs appeared in 1st edition Unix
First edition Unix had an /etc/tabs file. It contained the escape
sequences to set tabs to every 8 stops on an old Teletype Model 37 and
compatible terminals. One would 'cat /etc/tabs' to reset them.  Unix at
the time effectively mandated this because the delays in the tty driver
assumed this and tabs didn't work when they were too different from '8'.
Document this historical niggle in HISTORY after it was brought to my
attention on a Hacker News thread.

Sponsored by: Netflix
2021-09-09 17:11:18 -06:00
John Grafton
4ccbbe5f06 top(1): indicate how to reset grep string
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/536/files
2021-09-07 20:56:45 -06:00
Emmanuel Vadot
b5be5c35db pkgbase: Create a FreeBSD-ftp package
ftp tools aren't that useful nowadays but some might want them.
Create a FreeBSD-ftp package so users have a choice to have
them or not.

Differential Revision:	https://reviews.freebsd.org/D31794
2021-09-07 10:25:23 +02:00
Emmanuel Vadot
a30235a4c3 pkgbase: Create a FreeBSD-kerberos package
This allows users to install or not kerberos related utilities
and libs.

Differential Revision:	https://reviews.freebsd.org/D31801
2021-09-07 10:23:14 +02:00
Emmanuel Vadot
cab6a39d7b pkgbase: Create a FreeBSD-rdma package
Put all the rdma related tools into this package.

Differential Revision:	 https://reviews.freebsd.org/D31799
2021-09-07 10:22:16 +02:00
Emmanuel Vadot
c7fd29f0f2 pkgbase: Create a FreeBSD-telnet package
both telnet and telnetd aren't that useful nowadays but some
might want them.
Create a FreeBSD-telnet package so users have a choice to have
them or not.

Differential Revision:	https://reviews.freebsd.org/D31791
Reviewed by: emaste
2021-09-07 10:18:11 +02:00
Alex Richardson
021385aba5 Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain
When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as
ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones.
Having the LLVM binutils instead of the elftoolchain ones allows us to use
features such as LTO that depend on binutils that understand LLVM IR.
Another benefit will be an improved user-experience when compiling with
AddressSanitizer, since ASAN does not symbolize backtraces correctly if
addr2line is elftoolchain addr2line instead of llvm-symbolizer.
See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html
for more details.

This is currently off by default but will be turned on by default at some
point in the near future.

Reviewed By:	emaste

Differential Revision: https://reviews.freebsd.org/D31060
2021-09-06 09:49:49 +01:00
Alex Richardson
8e1c989abb Don't build and install {llvm,clang,lldb}-tblgen for the target
The tablegen binaries are only needed to build software that uses
LLVM's infrastructure for command line options,
disassembler tables, etc. They are not user-facing binaries and
should therefore not be installed by default.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D31058
2021-09-06 09:32:41 +01:00
Mitchell Horne
4d0dc60f14 xinstall: fix invocation of llvm-strip
When executing strip(1), '--' is passed as an argument to explicitly
terminate the getopt(3) loop. The option parsing in llvm-strip doesn't
support this however, so setting XSTRIPBIN=llvm-strip results in an
unsupported argument error. llvm-strip(1) is otherwise
commandline-compatible with FreeBSD's strip(1), so just use the
documented argument format that is common to both.

Special care needs to be taken for filenames beginning with a '-'.

Reviewed by:	arichardson, eugen (earlier version, both)
Discussed with:	jilles
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D30614
2021-08-30 11:56:10 -03:00
Konstantin Belousov
17fc43bc01 ldd: Remove non-functional -v option
It seems -v only worked for a.out.  Remove it, not even keeping the current
nop for compat.  Also remove more mentions of a.out format from the man
page.

Reviewed by:	dim, emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31708
2021-08-28 23:39:16 +03:00
Gordon Bergling
5bdf58e196 Fix some common typos in source code comments
- s/priviledged/privileged/
- s/funtion/function/
- s/doens't/doesn't/
- s/sychronization/synchronization/

MFC after:	3 days
2021-08-28 18:57:23 +02:00
Piotr Pawel Stefaniak
9f7a81b133 diff3: document and test -T
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31650
2021-08-25 18:20:59 +02:00
Jessica Clarke
c8edd05426 clang: Support building with GCC and DEBUG_FILES disabled
If MK_DEBUG_FILES=no then the Clang link rule has clang as .TARGET,
rather than clang.full, causing the implicit ${CFLAGS.${.TARGET:T}} to
be CFLAGS.clang, and thus pull in flags intended for when your compiler
is Clang, not when linking Clang itself. This doesn't matter if your
compiler is in fact Clang, but it breaks using GCC as, for example,
bsd.sys.mk adds -Qunused-arguments to CFLAGS.clang. This is seen when
trying to build a bootstrap toolchain on Linux where GCC is the system
compiler.

Thus, introduce a new internal NO_TARGET_FLAGS variable that is set by
Clang to disable the addition of these implicit flags. This is a bigger
hammer than necessary, as flags for .o files would be safe, but that is
not needed for Clang.

Note that the same problem does not arise for LDFLAGS when building LLD
with BFD, since our build produces a program called ld.lld, not plain
lld (unlike upstream, where ld.lld is a symlink to lld so they can
support multiple different flavours in one binary).

Suggested by:	sjg
Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
Reviewed by:	dim, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31532
2021-08-24 15:04:25 +01:00
Piotr Pawel Stefaniak
3cbf98e2be diff: read whole files to determine if they are ASCII text
Before this change, only the first BUFSIZE bytes were checked.

Reviewed by:	bapt (previous version)
Differential Revision:	https://reviews.freebsd.org/D31639
2021-08-23 16:09:05 +02:00
Gordon Bergling
72a92f91f4 nfsstat(1): Fix a typo in an error message
- s/priviledged/privileged/

MFC after:	1 week
2021-08-23 09:21:28 +02:00
Piotr Pawel Stefaniak
54a3415cb6 diff3: implement --strip-trailing-cr
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31626
2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
e8ff95356c diff3.1: update manual page to match code 2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
702dda4368 diff3: improve style 2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
7f7b03f389 diff3: sync with upstream
* replace realloc calls with reallocarray calls
 * fix merging of files that lack newlines

Obtained from:	OpenBSD
2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
af2f016431 diff: don't output carriage returns that were stripped on input
--strip-trailing-cr worked as intended for comparison between files,
but the characters were still present in final output.
2021-08-23 07:04:28 +02:00
Thomas Munro
f30a1ae8d5 lio_listio(2): Allow LIO_READV and LIO_WRITEV.
Allow multiple vector IOs to be started with one system call.
aio_readv() and aio_writev() already used these opcodes under the
covers.  This commit makes them available to user space.

Being non-standard extensions, they're only visible if __BSD_VISIBLE is
defined, like the functions.

Reviewed by:    asomers, kib
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D31627
2021-08-22 23:00:42 +12:00
Ka Ho Ng
ce71a0fa99 truncate(1): Update tests' golden output
After commit 5ee2c35751 truncate(1)'s usage output was extended.
Update the golden output in test cases to match the changes made.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	lwhsu
Differential Revision:	https://reviews.freebsd.org/D31628
2021-08-21 17:04:21 +08:00
Ka Ho Ng
a54abe119e truncate(1): Fix missing -d option manpage
Mention that either one of the -r, -s and -d options must be specified.

Sponsored by:	The FreeBSD Foundation
2021-08-19 18:45:25 +08:00
Ka Ho Ng
5ee2c35751 truncate(1): Add hole-punching support
This commit adds hole-punching support to the truncate(1) utility. If
the option -d is specified, truncate(1) performs zeroing, and if
possible hole-punching in case the operation is supported by the
underlying file system of the specified files.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31556
2021-08-19 18:30:41 +08:00
Ka Ho Ng
89c0d2b190 truncate(1): main() return statement style fix
Sponsored by:	The FreeBSD Foundation
2021-08-18 23:45:59 +08:00