Commit Graph

16453 Commits

Author SHA1 Message Date
Martin Matuska eb5165bb49 libarchive: merge from vendor branch
libarchive 3.8.7

Important bugfixes:
 #2871 libarchive: fix handling of option failures
 #2897 iso9660: fix undefined behavior
 #2898 RAR: fix LZSS window size mismatch after PPMd block
 #2900 CAB: fix NULL pointer dereference during skip
 #2911 libarchive: do not continue with truncated numbers
 #2919 CAB: Fix Heap OOB Write in CAB LZX decoder
 #2934 iso9660: fix posibble heap buffer overflow on 32-bit systems
 #2939 cpio: Fix -R memory leak
 #2947 libarchive: lzop and grzip filter support

Important bugfixes between 3.8.5 and 3.8.6:
 #2860 bsdunzip: fix ISO week year and Gregorian year confusion
 #2864 7zip: ix SEGV in check_7zip_header_in_sfx via ELF offset validation
 #2875 7zip: fix out-of-bounds access on ELF 64-bit header
 #2877 RAR5 reader: fix infinite loop in rar5 decompression
 #2878 mtree reader: Fix file descriptor leak in mtree parser cleanup
       (CWE-775)
 #2892 RAR5 reader: fix potential memory leak
 #2893 RAR5: fix SIGSEGV when archive_read_support_format_rar5 is called
       twice
 #2895 CAB reader: fix memory leak on repeated calls to
       archive_read_support_format_cab

Obtained from:	libarchive
Vendor commit:	ded82291ab41d5e355831b96b0e1ff49e24d8939
MFC after:	1 week
2026-04-13 15:47:17 +02:00
Kyle Evans 22fba3a9d6 find: add -xattr and -xttrname
We use -xattr in our openrsync tests for convenience, and it seems like
a good addition to FreeBSD.  -xattr and -xattrname will both consult all
available namespaces by default, but -xattrname allows filtering by
namespace using a "user:" or "system:" prefix.

Inspired by:	https://github.com/apple-oss-distributions/shell_cmds
Reviewed by:	kib, rmacklem
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D55286
2026-04-08 21:41:12 -05:00
Xin LI c0d9a07101 MFV: zstd 1.5.7.
MFC after:	2 weeks
Relnotes:	yes
2026-04-08 14:22:45 -07:00
Alexander Ziaee dd201e407e lockf.1: Organize and provide error numbers
Add error numbers to the exit codes so that readers can decode them
without having to use a separate utility. Organize exits by error code.
Mark up the error constants with the error constant macro, even though
this is really not very helpful because people will search for the error
code, the macro is explicitly for the constants and not the codes.

While where, align and alphabetize the options list as well, fix
misaligned padding in an example, and a one-sentance-per-line error.

MFC after:		3 days
Reported by:		Antranig Vartanian <antranigv@freebsd.am>
Differential Revision:	https://reviews.freebsd.org/D48470
2026-04-08 16:09:15 -04:00
Dag-Erling Smørgrav 8cbd394929 stat: Nits in stat tests
* Use ourselves as test file instead of /COPYRIGHT, which may or may not
  be present in the test environment.

* atf-check understands \n in strings, use it.

* Some file systems don't like creating small holes, so create large ones
  instead.  This means we need two variables: ps (page size) is the
  minimum size of a data region and the alignment for a hole, while hs
  (hole size) is the minimum size of the holes we create.  This makes no
  difference on FreeBSD but makes it easier to port the test to other
  platforms.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D56304
2026-04-08 17:35:35 +02:00
Dag-Erling Smørgrav 1c793e7cbe stat: Nits in readlink tests
* The f_flag test may fail if a component of the full path to the
  temporary directory is a symbolic link.

* The n_flag test had an empty head; give it a description.

* Use consistent quoting.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D56293
2026-04-08 13:26:23 +02:00
Bojan Novković cff675e83c netstat: Add -F support for -g
This change adds the ability to examine the contents of multicast
routing tables for other FIBs without the need for executing
`netstat` with `setfib(1)`.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D56205
Reviewed by:	glebius, markj, zlei
2026-04-07 16:39:51 +02:00
Olivier Certner 3174985952 netstat(1): '-w': Banners to appear before a new statistics line, not after
Recurring banners except the first are printed just after the latest
interval's statistics line, giving the false impression that the latter
are omitted.  It is also better to print a new banner only if it is
going to be followed by a new line of statistics, in case netstat(1) is
interrupted or we have reached the number of iterations specified by
'-q'.

Fix this by pushing printing these banners inside the loop producing
statistics lines, after having waited for the next interval.

The first banner is printed before the loop, as we want it to be printed
immediately at launch, even if at this point we do not have statistics
to display (we have to wait for an interval to compute these, as they
are based on a difference).

While here, remove the 'goto' spaghetti by putting banner printing into
its own private function and using a proper infinite loop in
sidewaysintpr().

While here, document the why of the 21 statistics line span between two
banners.

While here, check for the number of output lines of statistics once such
a line has effectively been printed.  This allows to remove the internal
incrementation performed when reading '-w''s argument, which was a hack
to compensate the misplaced check.

While here, in the manual page, simplify the description of the '-w'
mode and mention that passing 0 to '-q' means "no count limit".

Reviewed by:    glebius
Fixes:          84c1edcbad ("Rewrite netstat/if.c to use ...")
Fixes:          bf10ffe1d3 ("Add a new option, -q howmany, ...")
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56227
2026-04-07 11:23:09 +02:00
Simon J. Gerraty 34a3834ead Merge bmake-20260313
Merge commit 'fe271bdb43cf88ee129d94c0e286fe618fd28e89'
2026-04-06 11:32:43 -07:00
Olivier Cochard c5961b6fcf yes: fix argv test race between fork and exec
The argv test checks ps(1) output immediately after backgrounding yes(1), but
the forked child briefly shows the parent shell's argv before exec(2) replaces it.
This caused intermittent failures where ps(1) captured the atf shell wrapper
command line instead of "yes y".

Approved by:	des
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D56231
2026-04-06 19:22:25 +02:00
Lexi Winter ab9257599a Remove WITHOUT_BZIP2, WITHOUT_BZIP2_SUPPORT
WITHOUT_BZIP2_SUPPORT only affects a single binary, gzip(1); it doesn't
remove bzip2 support from other bits (e.g., libarchive) and there are
no similar options for gzip, xz or zstd.

WITHOUT_BZIP2 has not done anything at all since it was first added
in 2007.

MFC after:	never
Discussed on:	arch@
Reviewed by:	imp, des, adrian, delphij, emaste
Differential Revision:	https://reviews.freebsd.org/D56148
Sponsored by:		https://www.patreon.com/bsdivy
2026-04-03 14:50:09 +01:00
Ishan Agrawal 8ef0093f29 truss: add support for decoding Netlink messages
Netlink usage is growing in FreeBSD. This patch adds support to
`truss(1)` to decode Netlink headers in sendmsg/recvmsg calls, making
debugging network configuration tools significantly easier.

Changes:

libsysdecode: Add `sysdecode_netlink()` to parse struct `nlmsghdr`.
truss: Detect `AF_NETLINK` sockets and decode the message payload.

Reviewed by:	kp
Signed-off-by:	Ishan Agrawal <iagrawal9990@gmail.com>
Github PR:	https://github.com/freebsd/freebsd-src/pull/1950
2026-04-03 08:52:29 +02:00
Baptiste Daroussin c8d40bf8ec diff: use O_CLOEXEC on pipes
This only simplifies the code, no functional changes expected

MFC After:	1 week
2026-03-28 09:55:24 +01:00
Baptiste Daroussin 945e60e018 diff3: set O_CLOEXEC on pipes
This avoid leaking pipe fd in children and simplifies the code

MFC After:	1 week
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D56120
2026-03-28 09:51:48 +01:00
Baptiste Daroussin 9b98c4b053 diff: handle read(2) failures
MFC After:	1 week
2026-03-26 10:25:50 +01:00
Baptiste Daroussin 33424fd50e diff3: plug fd leak
MFC After:	1 week
Reported by:	kib
2026-03-26 08:40:29 +01:00
Baptiste Daroussin 6d8b2ac449 diff: prefer posix_spawn over pdfork/execl
MFC After:		1 week
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D56076
2026-03-26 08:36:55 +01:00
Baptiste Daroussin 5f7f0efe8e diff3: prefer posix_spawn over pdfork/execlp
MFC After:		1 week
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D56075
2026-03-26 08:36:55 +01:00
Dag-Erling Smørgrav 41474e78c4 m4: Misc style fixes
MFC after:	1 week

Reviewed by:	fuz
Differential Revision:	https://reviews.freebsd.org/D55794
2026-03-25 01:41:23 +01:00
Marc Espie f8f6f1cbd5 m4: Stop abbreviating builtin names
* Stop abbreviating macro names half-randomly to 8 chars, this is no
  longer 1990.

* Likewise for function names (in particular use doindex for a function
  that is notably different from the classic index function).

* Rename a few things for more fidelity: eval is the builtin name, not
  expr and your maketemp/mkstemp conform to mkstemp semantics for better
  security.

* Rewrap a few comments that were ludicrously short.

No functional changes except improved accuracy of some error messages.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55793
2026-03-25 01:41:18 +01:00
Mateusz Piotrowski e23f0decea mdo.1: Cross-reference with security.7
MFC after:	3 days
Reviewed by:	olce
Differential Revision:	https://reviews.freebsd.org/D56024
2026-03-23 13:30:21 +08:00
Ed Maste d478715a72 llvm: Link cross-tools with static libllvm.a
We generally use TOOLS_PREFIX being set to indicate that we are building
in the cross-build tools stage.  This check was missing for llvm.prog.mk
consumers other than *tblgen, which have not previously been built as
cross tools.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55930
2026-03-19 09:10:24 -04:00
Salman Sarray 424d3ca81f backlight.8: Fix typo in man
Increment and decrement where swapped.

Signed-off-by: Salman Sarray <salman@sarray.de>
Reviewed by: ziaee, Christos Longros <chris.longros@gmail.com>
Pull Request: https://github.com/freebsd/freebsd-src/pull/2072
2026-03-15 23:02:06 +03:30
Pierre Pronchery 4c72e5cde0 calendar.freebsd: add myself (khorben@)
This adds my date and place of birth to FreeBSD's calendar file, so I
can let the system(tm) remind me when that counter increments.

Confirmed to be working with the following command:

```
$ calendar -f usr.bin/calendar/calendars/calendar.freebsd -t 18.08
Aug 18  Pierre Pronchery <khorben@FreeBSD.org> born in Nantes, France, 1982
[...]
```

Reviewed by:	philip (mentor)
Approved by:	philip (mentor)
Differential Revision:	https://reviews.freebsd.org/D55825
2026-03-12 23:53:32 +01:00
Gleb Smirnoff 985ac74138 systat: remove kvm(3) support for -netstat mode
The kvm(3) mode was actually non-functional since FreeBSD 8 for kernels
with VIMAGE, since FreeBSD 12 for the GENERIC kernel and since FreeBSD 14
for all kernels.  The reason for that is that systat(1) tried to lookup
symbol "tcb" to check if kvm(3) is working.  The symbol no longer exist in
the kernel.

A side effect was that systat(1) lost true kvm(3) support for all other
modes, e.g. -swap or -pigs.  The tool was still working, but libkvm was
just a shim to sysctl(3) API.

So, contrary to what the header line says, this change actually restores
the kvm(3) support for other modes.  Now we read the "allproc" symbol.

This was the last tool that abused _WANT_INPCB.
2026-03-12 09:37:52 -07:00
Lorenzo Salvadore 738aea3387 Calendars: Update status reports deadlines
Also move the deadlines in their own calendar file.

Reported by:	jhs
Reviewed by:	jhs, adamw,
		Graham Percival <gperciva@tarsnap.com>
Differential Revision:	https://reviews.freebsd.org/D55491
2026-03-11 15:49:23 +01:00
Ed Maste e71bfbe2f5 llvm-*: Use SYMLINKS for unprefixed LLVM binutils
Previously they were hard links.  This change will support future
packaging changes by decoupling the prefixed (e.g. llvm-ar) and
unprefixed (e.g. ar) names.

Reviewed by:	dim, ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55693
2026-03-11 09:37:05 -04:00
Dag-Erling Smørgrav 67728a18b9 yes: Add tests
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D55802
2026-03-11 04:44:17 +01:00
Dag-Erling Smørgrav ba7439f0a9 yes: Add missing header
This is a no-op on FreeBSD due to namespace pollution.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Fixes:		cf74b63d61 ("yes: Completely overengineer")
2026-03-10 18:41:27 +01:00
Dag-Erling Smørgrav cf74b63d61 yes: Completely overengineer
If we're going to overengineer this, we may as well go all the way.

* If multiple arguments are given, concatenate them into a space-
  separated list like GNU coreutils does.

* When duplicating the expletive, do so exponentially.

* Most importantly, don't modify the memory that argv points to.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D55617
2026-03-10 11:18:08 +01:00
Dag-Erling Smørgrav df5b2cf2b3 Complete removal of GNU diff
Fixes:		9a44e42a2b ("Retire GNU diff3")
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D55423
2026-03-10 09:21:32 +01:00
Ed Maste 88dedd16ba llvm-cxxfilt: Install as c++filt only with LLVM_BINUTILS
When building WITHOUT_LLVM_BINUTILS /usr/bin/c++filt is the one from
ELF Tool Chain.

PR: 293610
Fixes: 5d757312ad ("build: Retire LLVM_CXXFILT option")
Sponsored by: The FreeBSD Foundation
2026-03-06 10:52:37 -05:00
Ed Maste 42e4df8b85 usr.bin: Exclude ELF Tool Chain cxxfilt build
when LLVM_BINUTILS is enabled (which is the default).

PR: 293610
Fixes: 5d757312ad ("build: Retire LLVM_CXXFILT option")
Sponsored by: The FreeBSD Foundation
2026-03-06 09:50:54 -05:00
Ed Maste 5d757312ad build: Retire LLVM_CXXFILT option
The LLVM_CXXFILT option was added when we used ELF Tool Chain tools by
default.  ELF Tool Chain's c++filt failed to demangle some symbols, so
we added a special case to install LLVM's version and enabled it by
default.

The rest of the LLVM tools are now used by default, as of commit
9fa94e1c09 ("Turn on WITH_LLVM_CXXFILT by default").  Simplify the
build logic by removing a special case and just include llvm-cxxfilt
with the rest of the LLVM utilities.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55654
2026-03-05 09:43:46 -05:00
Tuukka Pasanen 5778700fb8 diff3: Add SPDX-License-Identifier tag
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55462
2026-03-03 14:43:21 -05:00
Ed Maste b6bb2fc77e src.opts.mk: Retire BSD_CPIO option
Prior to commit 6973701a00 ("1. Make the BSD version of cpio the
default [1]") GNU cpio was installed unconditionally.  The BSD_CPIO
option was added when we introduced the BSD licensed, libarchive-based
cpio, to support installation of GNU cpio, libarchive cpio, or both.

GNU cpio was removed long ago and there is no longer a need for this
option.  We can just install BSD cpio unconditionally.

Reviewed by:	des
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55467
2026-03-03 09:25:53 -05:00
Ed Maste 34d7f100c1 lesspipe: Use zstdcat
zstdcat is equivalent to zstd -dcf, and matches our intention.

Suggested by:	delphij (in D55101)
Sponsored by:	The FreeBSD Foundation
2026-03-02 14:18:41 -05:00
Kenneth D. Merry 930486f9be mt(1)/libmt: Add LTO-10 density codes and specs.
These were obtained from IBM specs and actual tapes/drives.

Standard LTO-10 cartriges hold 30TB raw, 75TB with 2.5:1 compression.
Premium LTO-10 cartridges hold 40TB raw, 100TB with 2.5:1 compression.
LTO-10 tape drives are not backward compatible with previous generation
LTO tapes. (This is a change from older generation drives.)

Since the Premium tape is a new thing for LTO, we'll call this density
code LTO-10P vs. the standard LTO-10.  The barcode identifier for LTO-10
tapes is "LA"; the barcode identifier for LTO-10P tapes is "PA".

LTO-10 cartridges contain 1035m of tape, while LTO-10 Premium
cartridges contain 1337m of tape and have slightly higher density.
(Obtained from MAM data on actual tape cartridges and the density
report, obtained via 'mt getdensity'.)  LTO-10 cartridges use a
polyethylene naphthalate (PEN) film substrate. LTO-10 Premium
cartridges use an Aramid (aromatic polyamide) substrate that is thinner
and stronger, allowing a longer tape to fit in the same cartridge form
factor.

usr.bin/mt/mt.1:
	Add density codes and specs for LTO-10 and LTO-10P.

lib/libmt/mtlib.c:
	Add density codes for LTO-10 and LTO-10P.

Sponsored by:	Spectra Logic
MFC after:	3 days
2026-03-02 14:13:47 -05:00
Dag-Erling Smørgrav fe5341287c diff3: Produce correct exit status
Use exit status 2 for errors, 1 only to indicate that differences were
found between the inputs (in some operating modes).

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	ngie, bapt
Differential Revision:	https://reviews.freebsd.org/D55608
2026-03-02 09:52:06 +01:00
Mariusz Zaborski ffe7d45d29 from(1): style fixes
No functional changes.
2026-03-01 18:03:13 +01:00
Faraz Vahedi 4a4c885337 from(1): Capsicumise
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by: imp, oshogbo, markj (previous version)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1491
2026-03-01 18:03:13 +01:00
Faraz Vahedi dde5113f47 from(1): Replace magic exit codes with standard macros
Signed-off-by: Faraz Vahedi <kfv@kfv.io>

With minor changes from committer.

Reviewed by: imp, oshogbo, markj (previous version)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1491
2026-03-01 18:03:12 +01:00
Faraz Vahedi 452ee04d62 paste(1): Capsicumise
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by: imp, oshogbo
Pull Request: https://github.com/freebsd/freebsd-src/pull/1443
2026-03-01 09:36:15 -07:00
Faraz Vahedi 2e01fc43f2 paste(1): Make small modifications to improve readability
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by: imp, oshogbo
Pull Request: https://github.com/freebsd/freebsd-src/pull/1443
2026-03-01 09:36:15 -07:00
Faraz Vahedi 4ba5c9d015 paste(1): Utilise STAILQ from <sys/queue.h> in lieu of the home-rolled linked-list
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by: imp, oshogbo
Pull Request: https://github.com/freebsd/freebsd-src/pull/1443
2026-03-01 09:36:15 -07:00
Baptiste Daroussin 5ddfd1db27 diff3: bump version to the date when the GNU diff3 compat was reached 2026-03-01 12:37:24 +01:00
Dag-Erling Smørgrav c2dee7786b diff3: Code cleanup
* Order includes.

* Turn the diff type into an enum.

* Turn an unreachable error message into an assertion.

* Remove unused debugging code.

* Remove some dead assignments.

* Consistently use 1 instead of EXIT_FAILURE.

* Turn a return from main() into an exit().

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D55517
2026-02-28 19:15:23 +01:00
Felix Johnson 86dc5dd0b2 newgrp.1: Provide examples
"These examples appear to be originally noted thirteen years ago by
Mark Saad, contributed by eadler, put into a patch by Felix Johnson,
and made into mdoc by myself. Finally, put this bug to rest." ~ziaee

PR:			167742
Co-authored-by:		eadler, ziaee, Mark Saad
Differential Revision:	https://reviews.freebsd.org/D48877
2026-02-26 19:57:20 -05:00
Pouria Mousavizadeh Tehrani 2f7cfeebcc netstat(1): Fix expire column in -r flag using netlink
Reviewed by: glebius
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D55440
2026-02-26 13:18:09 +03:30
David Bright 42ab99095b procstat: CID 1593951: Resource leak
Summary: A trivial resource leak fix; free the allocated memory before return.

Test Plan: Code inspection, run command.

I built a simple program that waits for a signal on a kqueue, then ran
that. The standard procstat displays:

```
fbsd-dev% Waiting for SIGTERM...
procstat -a kqueue
    PID       KQFD   FILTER      IDENT      FLAGS     FFLAGS       DATA      UDATA     STATUS
  84352          3   SIGNAL         15          C          -          0        0x0          -
```

The revised procstat displays:
```
fbsd-dev% sudo LD_LIBRARY_PATH=/usr/obj/usr/home/dab/git/freebsd/src/arm64.aarch64/lib/libutil /usr/obj/usr/home/dab/git/freebsd/src/arm64.aarch64/usr.bin/procstat/procstat -a kqueue
    PID       KQFD   FILTER      IDENT      FLAGS     FFLAGS       DATA      UDATA     STATUS
  84352          3   SIGNAL         15          C          -          0        0x0          -
fbsd-dev%
```

As expected, the two displays are identical. This doesn't prove that
the leak is gone, but it does prove that the revised command still
operates correctly. I think it can clearly be seen from inspection of
the change that the leak has been remedied.

Reviewed-bys: vangyzen
Differential Revision: https://reviews.freebsd.org/D55422
2026-02-22 15:29:25 -06:00