Find a file
Dag-Erling Smørgrav 44101eb580 install: Always use a temporary file.
Previously, we would only use a temporary file if explicitly asked to
with the `-S` option, and even then, only if the target file already
existed.  This meant that an outside observer looking for the target
file might see a partial file, and might see the file disappear and
then reappear.

With this patch, we always use a temporary file, ensuring atomicity.
The downside is slightly increased disk usage.  The upside is never
having to worry about, for instance, cron jobs randomly failing if
they happen to run simultaneously with `make installworld`.

The `-S` option is retained, partly for compatibility, and partly
to control the use of `fsync(2)`, which has a non-negligible cost
(approximately 10% increase in wall time for `make installworld`).

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	0mp, brooks, imp, markj
Differential Revision:	https://reviews.freebsd.org/D44742

(cherry picked from commit e5035d0857)

install: Simplify path construction.

There's no need to copy the path twice to split it into base and dir.
We simply call `basename()` first, then handle the two trivial cases in
which it isn't safe to call `dirname()`.

While here, add an early check that the destination is not an empty
string.  This would always fail eventually, so it may as well fail
right away.  Also add a test case for this shortcut.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44743

(cherry picked from commit 17dc7017d7)

install: Remove the mmap(2) option.

We already removed it from cp(1) over a year ago but never followed up
here.  Do so now, for the same reasons: significant complexity for
little to no benefit.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44809

(cherry picked from commit a0439a1b82)

install: Assorted nitpickery.

* Use `errc()` instead of manually setting `errno` before calling `err()`.
* Change one warning into a fatal error.
* Drop some unnecessary casts.
* `strlcat()` bounds checks were off-by-one.  This does not matter in
  practice because the subsequent code renders an overrun harmless.
* We were passing `SSIZE_MAX` to `copy_file_range()` instead of the
  requested size.  This only matters if we're asked to install a file
  which is still being written to while we are copying it.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44810

(cherry picked from commit 000a533e6d)
2024-04-27 14:58:40 +00:00
.cirrus-ci
.github/workflows .github: Switch to v4 of actions/checkout 2024-04-08 11:03:08 -07:00
bin ln: Improve link(1) variant of ln(1). 2024-04-08 12:10:15 +02:00
cddl zfs: merge openzfs/zfs@fb6d53206 (zfs-2.1-release) into stable/13 2024-03-01 15:16:06 +01:00
contrib MFV: less: Do not trust st_size if it equals zero 2024-04-27 00:08:17 -07:00
crypto heimdal: asn1: Use unsigned bitfields for named bitsets 2024-04-24 23:27:27 +02:00
etc Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb 2024-04-19 23:23:40 +02:00
gnu Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
include posix_spawn(3): add POSIX_SPAWN_DISABLE_ASLR_NP 2024-03-11 02:29:51 +02:00
kerberos5 Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
lib libpmc: Import AMD Zen 4 PMU events 2024-04-26 23:02:51 -04:00
libexec rtld(1): minor clarification for LD_STATIC_TLS_EXTRA 2024-04-23 03:32:54 +03:00
release release: Use the ABI of the target release to fetch packages 2024-04-23 22:04:44 -07:00
rescue rescue: include ping iff at least one of INET & INET6 is enabled 2023-09-24 11:48:33 -04:00
sbin ifconfig(8): Fix two typos in source code comments 2024-04-23 07:26:30 +02:00
secure caroot: routine update 2024-02-13 13:15:13 -06:00
share share/mk/bsd.cpu.mk: add F16C feature for i386 and amd64 architectures 2024-04-21 21:02:09 +02:00
stand loader: For EFI, if we don't have ConOut, try ConIn 2024-02-06 17:12:40 -07:00
sys nullfs: Show correct exported flag. 2024-04-27 14:58:40 +00:00
targets Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51 2024-01-08 00:04:38 +01:00
tests path_test: fix cap_rights_init usage 2024-03-22 09:35:44 -04:00
tools mwlstats: Fix a typo in an error message 2024-04-25 08:17:38 +02:00
usr.bin install: Always use a temporary file. 2024-04-27 14:58:40 +00:00
usr.sbin binmiscctl.8: Remove a double word 2024-04-23 07:25:10 +02:00
.arcconfig
.arclint
.cirrus.yml Cirrus-CI: bump Clang versions to 16 and 17 2024-04-24 10:06:09 -04:00
.clang-format Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
.gitattributes
.gitignore gitignore: whack dead architectures 2023-08-06 21:05:36 +02:00
COPYRIGHT
LOCKS Remove $FreeBSD$: one-line bare tag 2023-08-23 11:43:33 -06:00
MAINTAINERS Remove $FreeBSD$: one-line bare tag 2023-08-23 11:43:33 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
Makefile.inc1 Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51 2024-01-08 00:04:38 +01:00
Makefile.libcompat Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
Makefile.sys.inc Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
ObsoleteFiles.inc Add a few missed libclang_rt files to ObsoleteFiles.inc 2024-04-24 23:26:28 +02:00
README.md hier(7): remove text describing /usr/src layout 2022-12-05 12:37:07 -04:00
RELNOTES Remove $FreeBSD$: one-line bare tag 2023-08-23 11:43:33 -06:00
UPDATING net80211: deal with lost state transitions 2024-02-19 08:02:01 +00:00

FreeBSD Source:

This is the top level of the FreeBSD source directory.

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.

For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.

The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.

For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.

Source Roadmap:

Directory Description
bin System/user commands.
cddl Various commands and libraries under the Common Development and Distribution License.
contrib Packages contributed by 3rd parties.
crypto Cryptography stuff (see crypto/README).
etc Template files for /etc.
gnu Commands and libraries under the GNU General Public License (GPL) or Lesser General Public License (LGPL). Please see gnu/COPYING* for more information.
include System include files.
kerberos5 Kerberos5 (Heimdal) package.
lib System libraries.
libexec System daemons.
release Release building Makefile & associated tools.
rescue Build system for statically linked /rescue utilities.
sbin System commands.
secure Cryptographic libraries and commands.
share Shared resources.
stand Boot loader sources.
sys Kernel sources (see sys/README.md).
targets Support for experimental DIRDEPS_BUILD
tests Regression tests which can be run by Kyua. See tests/README for additional information.
tools Utilities for regression testing and miscellaneous tasks.
usr.bin User commands.
usr.sbin System administration commands.

For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.