Commit graph

15856 commits

Author SHA1 Message Date
Eugene Grosbein 7f0dc6e2cd mkimg(1): process non-seekable output gracefully
mkimg may make severe load only to fail in the end
if output is non-seekable pipe, socket or FIFO
unless output format is raw disk image.

Check it out and fail early. Make it clear in the manual.

MFC after:	1 week
2024-03-12 23:00:21 +07:00
Warner Losh ba7b7f94c2 awk: Fix the tests
I'd forgotten that we have to adjust the stderr tests from
upstream. Remove the OK files. Also remove system-status.*.  These
restore the fixes I made in 517e52b6c2 which were lost when I imported
the last version of awk.

Also, force LANG to be C.UTF-8 when testing to ensure that stray lang
settings don't fail tests.

Sponsored by:		Netflix
2024-03-07 22:52:56 -07:00
Kyle Evans 02c57f7b48 kdump: decode pollfd struct arrays coming from poll(2)
We'll handle these just as we do kevents, one per line with subsequent
lines indented sufficiently to distinguish them from the upcoming
return value.

Sample, with indentation stripped and revents changed to '...' in the
first one to keep the line length down:

CALL  poll(0x820610560,0x3,0)
STRU  struct pollfd[] = { { fd=0, events=0x1<POLLIN>, revents=0x11<...>
 { fd=1, events=0x4<POLLOUT>, revents=0x4<POLLOUT>}
 { fd=-1, events=0x4<POLLOUT>, revents=0} }
RET   poll 2

Reviewed by:	bapt, jhb
Differential Revision:	https://reviews.freebsd.org/D44160
2024-03-04 23:44:09 -06:00
Dag-Erling Smørgrav aa80cfadff lorder: Tweak invalid file test.
Different implementations of `nm` have different ways of telling you
that your file is not a valid object or library, but they all seem to
have “not recognized” as a common substring.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44154
2024-02-29 14:59:25 +01:00
Dag-Erling Smørgrav aedb37dc49 lorder: Don't rely on legacy syntax.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44155
2024-02-29 14:59:21 +01:00
Dag-Erling Smørgrav cf4d9bf8b3 lorder: Undeprecate.
While lorder is not required by our current toolchain (or any toolchain
we've used in the past decade or two), it still occasionally shows up
in build systems of third party software, including The Open Group's
UNIX conformance test suite, and the maintenance cost is negligible.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, emaste
Differential Revision:	https://reviews.freebsd.org/D44135
2024-02-28 16:37:44 +01:00
Dag-Erling Smørgrav 96da41b6db lorder: Add unit tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44134
2024-02-28 16:37:41 +01:00
Dag-Erling Smørgrav 5c7b986c21 lorder: Clean up and improve robustness.
* Properly parse (no) command-line options.

* Ensure that errors go to stderr and result in a non-zero exit.

* Drop the special-case code for a single argument, as it will produce
  the wrong outcome if the file does not exist or is corrupted.

* Don't print anything until after we've collected all the data.

* Always create all temporary files before setting the trap.  This
  ensures that the trap can safely fire at any moment, regardless of any
  previous definition of `T`.

* Use a temporary file rather than a pipe between `nm` and `sed` to
  ensure proper termination if `nm` fails due to a missing or invalid
  input.

* The check for self-referential entries was conditional on testing our
  argument list against a regex looking for archives.  This was a
  needless and unreliable optimization; make the check unconditional.

* Document that lorder will not work properly if any of its inputs have
  spaces in their name.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44133
2024-02-28 16:37:36 +01:00
Eugene Grosbein d1797fb5bb mkimg.1: add new PARTITION SPECIFICATION section
The specification follows a commentary to the function parse_part()
in the source code and the code itself.

MFC after:	3 days
2024-02-28 02:56:26 +07:00
Dag-Erling Smørgrav 312b1076c6 diff: Bump manual page date.
Sponsored by:	Klara, Inc.
2024-02-26 19:21:40 +01:00
Dag-Erling Smørgrav 53de23f4d1 diff: Fix --expand-tabs and --side-by-side.
* Overhaul column width and padding calculation.
* Rewrite print_space() so it is now a) correct and b) understandable.
* Rewrite tab expansion in fetch() for the same reason.

This brings us in line with GNU diff for all cases I could think of.

Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44014
2024-02-26 19:08:06 +01:00
Xin LI 8db56defa7 MFV: xz 5.6.0.
MFC after:	2 weeks
2024-02-25 15:46:22 -08:00
Rick Parrish 0112f8c4a8 posixmqcontrol(1): manage posix message queues
Reviewed by:	kib, paumma
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D43845
2024-02-24 01:08:48 +02:00
Bryan Drewery d0bf8b5aac wc: Fix SIGINFO race with casper init.
If a file is specified then fileargs_init(3) may return [EINTR]. With
the SIGINFO handler not being SA_RESTART this causes an early exit
if a SIGINFO comes in. Rather than checking for [EINTR] or changing the
handler just move it later which resolves the problem.
2024-02-18 10:57:42 -08:00
Dag-Erling Smørgrav ad7bef8b89 sdiff: Fix binary case.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43942
2024-02-18 18:39:50 +01:00
Dag-Erling Smørgrav a834edfccd sdiff: Fix --expand-tabs and --tabsize.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43941
2024-02-18 18:39:50 +01:00
Dag-Erling Smørgrav 3cc86989bf sdiff: Misc cleanup.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43943
2024-02-18 18:39:50 +01:00
Dimitry Andric 73ff7384e0 Optionally create full debuginfo for llvm-related executables
Commit de6feefdb7 limited the amount of debuginfo generated for clang
and other llvm-related executables. This was done to save disk space and
memory during building, but it makes debugging any of these executables
much harder.

Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate
full debuginfo instead. This is off by default, but could for example be
enabled for release builds or snapshots, so llvm executables are easier
to debug.

Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43839
2024-02-17 00:15:32 +01:00
LO WEN-CHIEN 49eeca743b
stat(1): Fix grammar error in stat.c
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1014
2024-02-13 15:33:16 +08:00
LO WEN-CHIEN b1d0cf28ff
ar(1): Fix grammar error in write.c
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1013
2024-02-13 15:31:59 +08:00
LO WEN-CHIEN 1d83ae9d3d
install(1): Fix typo in usr.bin/xinstall/xinstall.c
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1012
2024-02-13 15:21:45 +08:00
Dag-Erling Smørgrav 851a9da38f patch: Support long context lines.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43850
2024-02-12 19:26:13 +01:00
Dimitry Andric d9c0e2e166 Revert "Build clang and other llvm executables as PIE"
This reverts commit 470f9f13de.

I need more time to figure out how to make this work correctly with
incremental builds, which it currently miserably fails on.
2024-02-12 10:27:00 +01:00
Dimitry Andric 470f9f13de Build clang and other llvm executables as PIE
There is no reason anymore to not build these as PIE. Unfortunately
bsd.lib.mk does not allow for building _only_ PIE static libraries, so
lib/clang/Makefile.inc needs a kludge to work around that issue.

MFC after:	1 week
2024-02-11 19:01:56 +01:00
Dimitry Andric 4015c06420 Remove usr.bin/clang/llvm-ar/llvm-cxxfilt-driver.cpp file
I accidentally copied this to the wrong place, or by accident to two
places, during the merge of llvmorg-17-init-19304-gd0b54bb50e51.

Fixes:		06c3fb2749
MFC after:	3 days
2024-02-10 22:02:45 +01:00
Hiroki Sato 4594eb4548
systat(1): Plug memory leak
The procstat_getprocs() function call in procgetinfo() allocated
a buffer but it was not freed properly.
2024-02-08 15:45:04 +09:00
Collin Funk 912b52a62c msgs: Use C99 bool instead of defining our own
Use stdbool.h definitions instead of defining non-standard ones.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1105
2024-02-06 08:37:50 -05:00
Ricardo Branco 8e05c2373e wc: Do not use st_size if it equals zero
Pseudo-filesystems often cannot compute the size of the file correctly
and report 0 for the size. Ignore the size when it's zero and fallback
to the size unknown code.

PR: 276093
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/985
2024-02-02 18:34:59 -07:00
Mohamed Akram e85a6f8dff man: fix redirect for locales and file arguments
Use the locale-specific path for localized pages and the appropriate parent
directory for file arguments when handling redirects.

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1019
2024-02-02 18:34:59 -07:00
Graham Perrin 7edb49a115 freebsd-tips: freebsd-update fetch, then install
In end of life (EOL) warning cases: freebsd-update fetch install (the
two commands, combined) may fetch and patch, but not install.

Instead: run the two consecutively. Consistent with installation
information in /releases/ areas and with accepted
https://reviews.freebsd.org/D42722

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1096
2024-02-02 08:25:44 -07:00
Dag-Erling Smørgrav bc2913d173 bintrans: Remove unused variable.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43559
2024-02-01 14:10:45 +01:00
Dag-Erling Smørgrav 64028ac3ba bintrans: Add base64 to name list in manual page.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	0mp, pstef
Differential Revision:	https://reviews.freebsd.org/D43558
2024-02-01 14:10:41 +01:00
Dag-Erling Smørgrav bce34cba07 bintrans: Fix uninitialized variable.
`prev` may be used uninitialized if `body` starts with a newline.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D43534
2024-02-01 14:10:37 +01:00
Dag-Erling Smørgrav 5cb28f7979 bintrans: Error out if writing to the output failed.
- Cover all code paths.
- When decoding, check all output files, not just the last one.
- A simple `ferror()` check is not enough as an error may later occur
  while flushing whatever remains in the output buffer.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43532
2024-02-01 14:10:31 +01:00
Wolfram Schneider b8a484ec34 man: support special characters in filenames
man.sh needs to handle double quotes and sub shell character
as '`' '$' etc.

PR:		275967
Reviewed by:	bapt

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D43453
2024-01-25 07:14:06 +00:00
Tijl Coosemans 95bf75895d join(1): Fix ordering in case of missing fields
The comparison function had the ordering reversed causing join(1) to
miss some matching lines.

PR:		232405
Submitted by:	Martijn van Duren <martijn@openbsd.org>
MFC after:	1 week
2024-01-24 10:58:00 +01:00
Ricardo Branco e4b646ce16 find: Add -readable, -writable & -executable options
Reviewed by:	jhb, Mina Galić
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1080
2024-01-21 17:33:46 -08:00
Fernando Apesteguía 70445a8061 cksum(1): Add EXAMPLES to manual page
Approved by:	bcr@
2024-01-18 14:04:25 +01:00
Kristof Provost 5dea523bd2 pflow: netstat statistics
Expose pflow counters via netstat.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43107
2024-01-16 09:45:53 +01:00
Ricardo Branco 2a121b97e9 find: Allow '/' to be used with -perm for GNU compatibility
In 2005, Gnu find deprecated '+' as the leading character for the -perm
argument, instead preferring '/' with the same meaning. Implement that
behavior here, and document it in the man page.

Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1060
2024-01-15 11:47:24 -07:00
Mohamed Akram ec13a838e6 man: avoid unportable use of utilities
echo -e is not portable. It can be replaced by printf %b (it works
only with the /bin/sh built-in echo, not /bin/echo anyway).
head -# is not portable, but head -n # is.

Replace these two things in three places total.

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1062
2024-01-15 11:30:37 -07:00
Simon J. Gerraty d5e0a182cf Update to bmake-20240108 2024-01-13 17:31:01 -08:00
Wolfram Schneider e3c7b76fa8 man(1): support spaces in filenames
The globbing function in exists() needs to handle white spaces.

PR:          275978
Reviewed by: kevans, bapt, emaste
MFC after:   1 week
2024-01-13 16:16:55 +00:00
Dag-Erling Smørgrav 1e25eb287f login: Missed an instance of getpwnam().
Fixes:		a3d80dd8aa
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D43423
2024-01-12 17:40:55 +01:00
Dag-Erling Smørgrav 899837e8f5 uniq: Error out if writing to the output failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43407
2024-01-12 16:44:06 +01:00
Dag-Erling Smørgrav e2ec8ee02a uniq: Clean up and test obsolete options.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43402
2024-01-12 16:44:00 +01:00
Dag-Erling Smørgrav 11715600e6 uniq: Fix interactive use.
Output a line as soon as it is possible to determine that it will have
to be output.  For the basic case, this means output each line as it is
read unless it is identical to the previous one.  For the -d case, it
means output the first instance as soon as the second is read, unless
the -c option was also given.  The -D and -u cases were already fine.

Add test cases for interactive use with no options and with -d.

Explicitly ignore -d when -D is also specified.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rew, kevans
Differential Revision:	https://reviews.freebsd.org/D43382
2024-01-12 16:43:55 +01:00
Dag-Erling Smørgrav e762fd81e2 uniq: Replace NetBSD's unit tests with our own.
These new tests cover more functionality and are easier to extend.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D43381
2024-01-12 16:43:49 +01:00
Dag-Erling Smørgrav a3d80dd8aa login: Use getpwnam_r() instead of getpwnam().
Since we expect the entry to still be valid after calling into PAM,
which may call getpwnam() itself, we need to use getpwnam_r().

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D43376
2024-01-12 16:43:42 +01:00
Baptiste Daroussin 91dc237466 find: fix build on 32bits 2024-01-12 07:34:28 +01:00
Goran Mekić d06a00963b find: add SIGINFO handler
Print number of files processed and path currently being processed on
SIGINFO.

Reviewed by:	des, asomers
Sponsored by:	Axcient
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D43380
2024-01-11 16:37:14 -07:00
Mark Johnston 1f62718d8b top: Avoid printing a blank line when the ZFS ARC is empty
PR:		275994
MFC after:	2 weeks
2024-01-11 10:01:37 -05:00
Dag-Erling Smørgrav c2356a440d asa: Rewrite to fix line termination issue.
The standard is somewhat unclear, but on the balance, I believe that the
phrase “the rest of the input line” should be interpreted to mean the
rest of the input line including the terminating newline if and only if
there is one.  This means the current implementation is incorrect on two
points:

- First, it suppresses the previous line's newline in the '1' case.

- Second, it unconditionally emits a newline at the end of the output
  for non-empty input, even if the input did not end with a newline.

Resolve this by rewriting the main loop.  Instead of special-casing the
first line and then assuming that every line ends with a newline, we
remember how each line ends and emit that either at the beginning of
the next line or at the end of the file except in the one case ('+')
where the standard explicitly says not to.

While here, try to reduce diff to upstream a little and update their
RCS tag to reflect the fact that while we've diverged significantly
from them, we've incorporated all their changes.  Remove the useless
second RCS tag.

We also update the tests to account for the change in interpretation
of the '1' case and add a test case for unterminated input.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43326
2024-01-09 17:27:15 +01:00
Wolfram Schneider 1e82d882ed fix using man(1) with multiple pages
PR: 275978
Reported by: Mohamed Akram
Fixes: 789480702e
MFC after: 1 week
2024-01-08 16:05:50 +00:00
Lexi Winter 6c951b3717 mail: add volatile in grabh()
setjmp() requires that any stack variables modified between the setjmp
call and the longjmp() must be volatile.  This means that 'saveint' in
grabh() must be volatile, since it's modified after the setjmp().
Otherwise, the signal handler is not properly restored, resulting in a
crash (SIGBUS) if ^C is typed twice while composing.

PR:		276119
Reported by:	Christopher Davidson <christopher.davidson@gmail.com>
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/993
2024-01-04 21:40:53 -05:00
Ricardo Branco 1fb3caee72 tail: Do not trust st_size if it equals zero.
PR:		bin/276107
MFC after:	1 week
2024-01-04 01:00:23 -08:00
Ricardo Branco e23954bd42 hexdump: Do not trust st_size if it equals zero.
Fix for hexdump -s not being able to skip files residing in
pseudo-filesystems that advertise a zero size value.

Historically, many pseudofs-based filesystems (e.g., procfs) report
a va_size of 0 for numerous files classified as regular files.
Typically, the contents of these files are generated on demand
from kernel data as sbuf(9) strings at the time they are read.
Accurately reporting the size of these files is challenging, as it
often involves generating their contents. These pseudofs implementations
frequently report the size as 0. This is a historical behavior and also
aligns with Linux behavior. To maintain compatibility, we have chosen
to preserve the existing behavior and address it in the userland
application, rather than modifying it in the kernel (by updating the
correct value for va_size).

PR:		bin/276106
MFC after:	1 week
2024-01-04 00:16:50 -08:00
Wolfram Schneider 9035bfffed indent: make the URL of the manpage two characters longer so that the test is successful 2023-12-29 09:37:43 +00:00
Lexi Winter f79b200b6a nfsstat: make -q work without -e/-E
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/961
2023-12-28 13:27:07 -07:00
Wolfram Schneider ffd76b1f30 use long manpage URL (broken in last commit)
Reported by:	pstef
2023-12-28 15:58:56 +00:00
Wolfram Schneider 789480702e support spaces in filenames
PR:		275978
MFC after:	1 week
2023-12-28 10:50:29 +00:00
Wolfram Schneider 271887ec35 update manpage URL 2023-12-28 10:48:04 +00:00
Jose Luis Duran a6889c1d5c bmake: Fix typo (triple S)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/955
2023-12-27 20:24:32 -07:00
Lexi Winter 30ce26cacf nfsstat: update option strings in docs
Add the missing -q option to the nfsstat(1) manpage SYNOPSIS (it is
already documented in DESCRIPTION), and add the missing -E and -q
options to the built-in usage output.

PR:		275912
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/958
2023-12-27 10:57:59 -07:00
Wolfram Schneider c4368d03e5 improve handling of shell metacharacters in filenames
PR:		275967
MFC after:	1 week
2023-12-27 17:36:51 +00:00
Christos Margiolis 2b1c477d88 fortune: update mailing list search url
Markmail no longer exists.

Reviewed by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D43209
2023-12-27 18:28:11 +02:00
Gordon Bergling c58205be7a tail(1): Fix a typo in a source code comment
- s/recieved/received/

MFC after:	3 days
2023-12-27 09:35:38 +01:00
Daniel Tameling b3ab6b5029 ncal(1): print the correct option name when -B is specified twice
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/911
2023-12-26 16:45:26 -07:00
Pin-Yi Kuo 4185d1f76a diff(1): fix a typo
On the manpage of diff(1), "when" is mistyped to "wen".

Event: Advanced UNIX Programming Course (Fall'23) at NTHU.
Signed-off-by: Pin-Yi Kuo <kuokuoyiyi@gapp.nthu.edu.tw>
Reviewed by: imp, zlei
Pull Request: https://github.com/freebsd/freebsd-src/pull/943
2023-12-26 10:07:55 -07:00
Pawel Jakub Dawidek eb4d13126d seq(1): Put separator only between the elements.
- Using non-default ('\n') separator will produce an output with the
  separator at the end of the output, eg.

	% echo "[$(seq -s ' ' 0 2)]"
	[0 1 2 ]

- The output should always be followed by a new line character. Currently:

	% seq -s ' ' 0 2
	0 1 2 %

This change makes seq(1) to behave the same way Linux seq(1):

	% echo "[$(seq -s ' ' 0 2)]"
	[0 1 2]

	% seq -s ' ' 0 2
	0 1 2
	%

Approved by:	oshogbo
Differential Revision:	https://reviews.freebsd.org/D43094
2023-12-21 21:54:05 -08:00
Dag-Erling Smørgrav 45438f9c8b find: Add a warning about -delete.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	pauamma_gundo.com
Differential Revision:	https://reviews.freebsd.org/D43162
2023-12-22 00:41:16 +01:00
Dag-Erling Smørgrav afdce08370 renice: Clean up the tests a bit.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	ngie, asomers
Differential Revision:	https://reviews.freebsd.org/D43087
2023-12-20 17:59:37 +01:00
Kyle Evans 0a82cd4f10 calendar: correct the search order for files
Include files that don't begin with a '/' are documented to search the
current directory, then /usr/share/calendar.  This hasn't been accurate
for years, since e061f95e7b ("Rework calendar(1) parser") rewrote a
lot of this.

Stash off the cwd before we do any chdir()ing around and use that to
honor the same order we'll follow for the -f flag.  This may result in
an extra lookup that will fail for the initial calendar file, but I
don't think it's worth the complexity to avoid it.

While we're here, fix the documentation to just reference the order
described in FILES so that we only need to keep it up to date in one
place.

Reviewed by:	bapt
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42278
2023-12-17 23:53:51 -06:00
Yu-Hsun Chen 452c3e9514
mt(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/931
2023-12-17 18:49:42 +08:00
Yu-Hsun Chen 1a35ead682
mkimg(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/930
2023-12-17 18:49:28 +08:00
Yu-Hsun Chen 0ba51e3b63
fstat(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/929
2023-12-17 18:41:53 +08:00
Yu-Hsun Chen a2ee3070d8
awk(1): Fix typo
This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/928
2023-12-17 18:40:29 +08:00
Kyle Evans a206524709 kdump: use print_mask_arg0 appropriately
Some callers are using print_mask_arg() when they should be using
print_mask_arg0(); the latter should be used when all flags are optional
and there's not a flag to be decoded with a 0-mask.  This turns:

nmount(0x6991e009000,0x8,0<><invalid>0)

into:

nmount(0x6991e009000,0x8,0)

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D43007
2023-12-13 10:49:03 -06:00
Raghu Ranganathan 7df526eb10
look(1): Correct the example's description
Remove an extra 'e' in the example command.  It is a prefix, not a typo.

This is from the Advanced UNIX Programming Course (Fall’23) at NTHU.

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/913
2023-12-12 02:19:21 +08:00
Emmanuel Vadot 0fb9d5786b pkgbase: Move tr(1) to runtime
Since f7d16a627e ("certctl: Convert line endings before inspecting files.")
certctl is using tr(1). Add it to FreeBSD-runtime so we can have certctl working
without having the bloated FreeBSD-utilities.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-12-09 12:21:02 +01:00
Dimitry Andric 06c3fb2749 Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.

PR:		273753
MFC after:	1 month
2023-12-08 18:34:50 +01:00
Alexander Motin 1f36ca5de5 vmstat: Rely on libxo for numbers humanization
This makes code cleaner, plus fixes such nonsense as humanized JSON
and XML, making all numbers raw without quotes, spaces, suffixes, etc.

MFC after:      2 weeks
2023-12-07 21:21:35 -05:00
Warner Losh bd234c0d4c sort: Only build FreeBSD-specific ALTMON_x stuff when ATLMON_1 is defined
On MacOS, we bootstrap sort. Since ALTMON_* are not defined there, the
build blows up. Since we don't need this feature for the FreeBSD build
process, and since we won't use it unless we actually install the NL
files that have this data in it, just #ifdef it out for now. In the
extremely unlikely event that the FreeBSD bootstrap/build process grows
this dependency, we can evaluate the best solution then (which most
likely is going to be not depend on the local's month names).

Fixes:			3d44dce90a (MacOS builds and github CI)
Sponsored by:		Netflix
Reviewed by:		jrtc27, jlduran@gmail.com, markj
Differential Revision:	https://reviews.freebsd.org/D42868
2023-12-07 13:42:52 -07:00
Alexander Motin 598d1ac85e vmstat: Let libxo properly humanize -m numbers
Raw numbers can be seen in json/xml or with --libxo=no-humanize.

MFC after:	2 weeks
2023-12-06 23:12:30 -05:00
Alexander Motin 6f048e7130 vmstat: Improve -z formatting for large names/values
MFC after:	2 weeks
2023-12-06 15:00:19 -05:00
Maxim Sobolev 62d47a4db4 vmstat: fix column names broken in c168508655
Loss of the trailing space in the multi-line format string has
resulted in column name being emitted as "FAILSLEEP", instead of
two columns "FAIL" and "SLEEP".
2023-12-04 17:39:21 -08:00
Pedro F. Giffuni 7e8afbb6d6 patch: fix locate_hunk in empty files
if `first_guess' is zero then main() assumes that locate_hunk has failed
and aborts the patch operation.  Instead, make sure to return 1 (the
line number) so that the patch operation can continue.

Issue originally found by Neels Hofmeyr in the regress suite of the diff
implementation for got, where the tests assume that applying a diff with
`patch' and then again with `patch -R' yields back the original file.

Obtained from:	OpenBSD (CVS patch.c,v 1.71)
2023-12-03 12:33:03 -05:00
Christos Margiolis 3d44dce90a sort: test against all month formats in month-sort
The CLDR specification [1] defines three possible month formats:

- Abbreviation (e.g Jan, Ιαν)
- Full (e.g January, Ιανουαρίου)
- Standalone (e.g January, Ιανουάριος)

Many languages use different case endings depending on whether the month
is referenced as a standalone word (nominative case), or in date context
(genitive, partitive, etc.). sort(1)'s -M option currently sorts months
by testing input against only the abbrevation format, which is
essentially a substring of the full format. While this works fine for
languages like English, where there are no cases, for languages where
there is a different case ending between the abbreviation/full and
standalone formats, it is not sufficient.

For example, in Greek, "May" can take the following forms:

Abbreviation: Μαΐ (genitive case)
Full: Μαΐου (genitive case)
Standalone: Μάιος (nominative case)

If we use the standalone format in Greek, sort(1) will not able to match
"Μαΐ" to "Μάιος" and the sort will fail.

This change makes sort(1) test against all three formats. It also works
when the input contains mixed formats.

[1] https://cldr.unicode.org/translation/date-time/date-time-patterns

Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42847
2023-12-01 02:30:10 +02:00
Dag-Erling Smørgrav b70e57be2c tail: Clean up error messages.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D42842
2023-11-29 22:49:44 +01:00
Dag-Erling Smørgrav 621f45532c tail: Fix heap overflow in -F case.
The number of events we track can vary over time, but we only allocate
enough space for the exact number of events we are tracking when we
first begin, resulting in a trivially reproducable heap overflow.  Fix
this by allocating enough space for the greatest possible number of
events (two per file) and clean up the code a bit.

Also add a test case which triggers the aforementioned heap overflow,
although we don't currently have a way to detect it.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D42839
2023-11-29 22:49:38 +01:00
Mateusz Piotrowski 9f20787fe8 tail.1: Add an example for +n 1
MFC after:	3 days
Sponsored by:	Klara, Inc.
2023-11-28 17:55:58 +01:00
Mateusz Piotrowski 51c27021b2 tail.1: Lint with mandoc(1)
MFC after:	3 days
Sponsored by:	Klara, Inc.
2023-11-28 17:55:58 +01:00
Warner Losh 5e3934b15a usr.bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:01 -07:00
Warner Losh 0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh 5b31cc94b1 sccs: Manual changes
For the uncommon items: Go through the tree and remove sccs tags that
didn't fit any nice pattern. If in the neighborhood, other SCM tags were
removed when they were detritis of long-ago CVS somehow in the early
mists of the project. Some adjacent copyrights stringswere removed (they
duplicated the copyright notices in the file). This also removed
non-standard formations of omission of SCCS tags (usually by adding an
extra #if 0 somewhere.

After this commit, a number of strings tagged with the 'what' @(#)
prefix remain, but they are primarily copyright notices.

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh bdcbfde31e usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:30 -07:00
Ka Ho Ng d030761168 dirdeps: Update/fix Makefile.depend* for toolchain
This fixes make pseudo/toolchain.
2023-11-26 20:50:13 -05:00
Kyle Evans e4967d4d48 lockf: switch to strtonum() for parsing timeout
Convert waitsec to a long long to be able to hold the full domain of
alarm(3) timeout on all platforms, and let strtonum(3) handle the input
validation.  strtonum(3) also happens to provide a neater interface for
error handling, and it already includes our pre-existing empty input
check.

Sponsored by:	Klara, Inc.
2023-11-25 22:41:05 -06:00
Kyle Evans 09a7fe0a55 lockf: allow locking file descriptors
This is most useful inside a shell script, allowing one to lock just
portions of a script rather than having to wrap the entire script in a
lock.

PR:		262738
Reviewed by:	0mp, allanjude (both previous versions)
Co-authored-by:	Daniel O'Connor <darius@dons.net.au>
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42718
2023-11-25 22:15:05 -06:00
Kyle Evans 296a5a4db1 lockf: add some tests
Provide basic coverage for the existing options, nothing deeper (e.g.,
pipe closing behavior) is tested in this set.

Reviewed by:	allanjude
Feedback from:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D42714
2023-11-25 22:09:58 -06:00