Commit graph

3750 commits

Author SHA1 Message Date
Dag-Erling Smørgrav 39d543db53 cp: Improved conformance when copying directories.
* When copying a directory, if the destination exists and is not a
  directory, we would previously emit an error message and exit.  The
  correct behavior according to POSIX is to emit an error message and
  continue without descending further into the source directory.

* When copying a directory, if the destination does not exist and we
  fail to create it, we would previously emit an error message and
  exit.  The correct behavior according to POSIX is to emit an error
  message and continue.  Whether to descend further into the source
  directory is explicitly left unspecified; GNU cp does not, which
  seems to me to be the safer and less surprising option, so let's not
  either.

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

(cherry picked from commit dd286b0dc1)

cp: Correct the list of non-portable flags.

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

(cherry picked from commit aaa1806f68)
2024-04-08 12:10:14 +02:00
Dag-Erling Smørgrav f862c31a41 ln: Use stdbool, style nits.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude
Differential Revision:	https://reviews.freebsd.org/D44511

(cherry picked from commit 437d53daf7)

ln: Clean up and simplify tests.

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

(cherry picked from commit e0afcbc856)

ln: Add a test case for ln -sfF.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude, asomers
Differential Revision:	https://reviews.freebsd.org/D44513

(cherry picked from commit 2ae8d34666)
2024-04-04 11:51:05 +02:00
Ed Maste 8a17cc127b cat: fix cap_rights_init usage
Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).

PR:		277057
Reported by:	asomers, markj

(cherry picked from commit 05f530f4d2)
(cherry picked from commit dbf34bbb18)
2024-03-22 09:35:44 -04:00
Mariusz Zaborski 1abd98ecf9 cat: add CAP_SEEK capability
The copy_file_range might require that.

Reviewed by:	emaste, theraven, kib, markj
Differential Revision:	https://reviews.freebsd.org/D41967

(cherry picked from commit 64c6327738)
(cherry picked from commit 5f527dbe41)
2024-03-22 09:35:43 -04:00
Lin Lee 416b7acd5b
hostname(1): Add test cases
Sponsored by:	The FreeBSD Foundation
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1069

(cherry picked from commit 73974a78f7)
2024-02-08 14:03:49 +08:00
Konstantin Belousov dc30b2841b chflags(1): obey siginfo request on chflagsat(2) failure
(cherry picked from commit 2954af09f1)
2024-02-06 02:38:35 +02:00
Ricardo Branco 19d960cedd chflags(1): Fix -f option
PR:	276723

(cherry picked from commit fae467c221)
2024-02-06 02:38:34 +02:00
Dag-Erling Smørgrav 006017419b cp: Add tests for hard link case.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43052

(cherry picked from commit 1fead66b64)

cp: Add tests for symbolic link case.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D43054

(cherry picked from commit d3a8e9b43b)

cp: Refactor the core logic.

Rewrite `copy_file()` so the lflag and sflag are handled as early as
possible instead of constantly checking that they're not set and then
handling them at the end.  This also opens the door to changing the
failure logic at some future point (for instance, we might decide to
fall back to copying if `errno` indicates that the file system does not
support links).

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D43055

(cherry picked from commit d002316fd7)

cp: Split the basic_symlink test case in two.

This test case tests two different things: first, that copying a symlink
results in a file with the same contents as the target of the symlink,
rather than a second symlink, and second, that cp will refuse to copy a
file to itself, or to a link to itself, or a link to its target.  Leave
the first part in basic_symlink, move the second part to a new test case
named samefile, and slightly expand both cases.

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

(cherry picked from commit ac56b9d83c)

cp: Move the flags around a bit.

- The HLPR flags are grouped together at the beginning because they are
  the standard flags for programs using FTS.  Move the N flag out from
  among them to its correct place in the sequence.
- The Pflag variable isn't used outside main(), but moving it out lets
  us skip initialization and keeps it with its friends H, L and R.

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

(cherry picked from commit 0f4467ce44)

cp: Further simplify the core logic.

If the destination file exists but we decide unlink it, set the dne
flag.  This means we don't need to re-check the conditions that would
have caused us to delete the file when we later need to decide whether
to create or replace it.

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

(cherry picked from commit 3850927066)

cp: Move the -N flag in the manual page.

This accidentally got left out of 0f4467ce44.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D43067

(cherry picked from commit 53fc8e1902)
2024-01-17 17:15:59 +01:00
Warner Losh a64518b35f cp: Add -N flag, inspired by NetBSD's similar flag
Add -N to supress copying of file flags when -p is specified (explicitly
or implicitly). Often times we don't care about the flags or wish to be
able to copy to NFS, and this comes in handy for that. FreeBSD's and
NetBSD's cp are somewhat different, so I had to reimplement all but one
of the patch hunks...

Obtained from:		NetBSD (cp.1 1.25, cp.c 1.37, utils.c 1.28 by elad)
Sponsored by:		Netflix

Differential Revision:	https://reviews.freebsd.org/D42673

(cherry picked from commit 5a52e3d00d)

cp: Don't warn for chflags() failing with EOPNOTSUPP if flags == 0

From NetBSD's utils.c 1.5 importing importing BSDI change, with light
formatting changes:
    Author: cgd <cgd@NetBSD.org>
    Date:   Wed Feb 26 14:40:51 1997 +0000

    Patch from BSDI (via Keith Bostic):
    >NFS doesn't support chflags; ignore errors unless there's reason
    >to believe we're losing bits.  (Note, this still won't be right
    >if the server supports flags and we were trying to *remove* flags
    >on a file that we copied, i.e., that we didn't create.)

    CVS Info: utils.c 1.6

Obtained from:		NetBSD
Sponsored by:		Netflix

Differential Revision:	https://reviews.freebsd.org/D42674

(cherry picked from commit 3e7e3b5bdf)
2024-01-17 17:15:57 +01:00
Ceri Davies 677a7402ce sys/*/conf/*, docs: fix links to handbook
While here, fix all links to older en_US.ISO8859-1 documentation
in the src/ tree.

PR:             255026
Reported by:    Michael Büker <freebsd@michael-bueker.de>
Reviewed by:    dbaio
Differential Revision: https://reviews.freebsd.org/D30265

(cherry picked from commit c1a148873d)
2024-01-09 22:07:46 -05:00
Thomas Eberhardt 1023abd5b6 Fix /root permissions after 'make installworld'
According to /etc/mtree/BSD.root.dist /root should have
0750 permissions, but the build target 'make installworld'
changes these to 0755.

This is caused by the installation of the configuration
files of sh(1) and csh(1).

Correct this by specifying the correct default /root permissions.

PR:	273342
Reviewed by:	jilles
Approved by:	jilles
MFC after:	2 weeks
Differential Revision:https://reviews.freebsd.org/D42395

(cherry picked from commit a6ed8c9593)
2023-12-01 08:16:38 +01:00
Bojan Novković 55bf2ae43c (s)tty: add support for IUTF8 input flag
This patch adds the necessary kernel and stty code to support setting
the IUTF8 flag for ttys. It is the first of two patches that fix
backspace behaviour for UTF-8 encoded characters when in canonical mode.

Reported by:	christos
Reviewed by:	christos, imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D42066

(cherry picked from commit 128f63cedc)
2023-10-21 17:34:21 +03:00
Mateusz Piotrowski 65b22ee093 date.1: Examples: Use syntax that is also compatible with csh
MFC after:	1 month
Sponsored by:	Klara Inc.

(cherry picked from commit de7a6b6fd0)
2023-10-04 12:51:32 +02:00
Mark Johnston c1c798f174 sh tests: Update $LINENO tests after $FreeBSD$ removal
Fixes:	d0b2dbfa0e ("Remove $FreeBSD$: one-line sh pattern")
(cherry picked from commit c903f66478)
2023-08-23 11:45:13 -06:00
Warner Losh 350f9ac5b3 Remove $FreeBSD$: one-line bare tag
Remove /^\s*\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit 05248206f7)
2023-08-23 11:43:33 -06:00
Warner Losh 24115b70d6 Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit b2c76c41be)
2023-08-23 11:43:32 -06:00
Warner Losh b144e70a33 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit fa9896e082)
2023-08-23 11:43:31 -06:00
Warner Losh 023fc80ee3 Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit d0b2dbfa0e)
2023-08-23 11:43:30 -06:00
Warner Losh 3d497e17eb Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in main:
(cherry picked from commit 1d386b48a5)
2023-08-23 11:43:26 -06:00
Warner Losh 8ad303d68c Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/

Similar commit in main:
(cherry picked from commit 2a63c3be15)
2023-08-23 11:43:23 -06:00
Warner Losh 34041aac83 Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/

Similar commit in main:
(cherry picked from commit 42b388439b)
2023-08-23 11:43:22 -06:00
Warner Losh 17da660ad5 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/

Similar commit in main:
(cherry picked from commit b3e7694832)
2023-08-23 11:43:21 -06:00
Warner Losh f73b4bf27c spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix

(cherry picked from commit b61a573019)
2023-07-25 09:15:32 -06:00
Warner Losh caa41f6417 spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix

(cherry picked from commit 4d846d260e)
2023-07-25 09:13:49 -06:00
Kyle Evans 6fa0b2b484 getfacl: free acl in print_acl error path
Sponsored by:	Klara, Inc.

(cherry picked from commit 781624ca2d)
2023-07-11 10:05:29 -05:00
Mateusz Piotrowski 412394a790 nproc.1: Fix "first appeared in" details
nproc(1) has been MFC'ed into 13-STABLE and made it into 13.2-RELEASE.

MFC after:	3 days

(cherry picked from commit 1e078fb602)
2023-06-05 12:57:17 +02:00
Mateusz Piotrowski e06bc4821e ps: Add libxo to usage message
MFC after:	1 week
Sponsored by:	Klara Inc.

(cherry picked from commit 820ac12679)
2023-06-05 12:57:13 +02:00
Mateusz Piotrowski 19677c0da8 ps: Fix synopsis
In the -L mode, the -L flag is not optional.

MFC after:	3 days
Sponsored by:	Klara Inc.

(cherry picked from commit 3f46bf40a1)
2023-06-05 12:57:13 +02:00
Daniel Kolesa 0edfc2a92c sh(1): fix history file write checking
We cannot just compare histsizeval() against 0, since that returns
a string pointer, which is always non-zero (non-null). The logic
in sethistsize() initializes the history size to 100 with values
that are non-number, and an empty string counts as that. Therefore,
the only time we want to not write into history with HISTSIZE val
set is when it's explicitly 0.

MFC after:	2 weeks

(cherry picked from commit 3ce64010f8)
2023-05-19 10:07:37 +02:00
Stefan Eßer d767bf361b msdosfs: fix debug print format and parameter
Building with -DMSDOSFS_DEBUG failed due to a format mismatch and
a variable that has been renamed but not updated in the printf()
parameter list.

(cherry picked from commit 2d8cf575d5)

fs/msdosfs: add tracking of free root directory entries

This update implements tallying of free directory entries during
create, delete,	or rename operations on FAT12 and FAT16 file systems.

Prior to this change, the total number of root directory entries
was reported as number of inodes, but 0 as the number of free
inodes, causing system health monitoring software to warn about
a suspected disk full issue.

The FAT12 and FAT16 file systems provide a limited number of
root directory entries, e.g. 512 on typical hard disk formats.
The valid range of values is 1 to 65535, but the msdosfs code
will effectively round up "odd" values to the next multiple of 16
(e.g. 513 would allow for 528 root directory entries).

This update implements tracking of directory entries during create,
delete, or rename operations, with initial values determined by
scanning the directory when the file system is mounted.

Total and free directory entries are reported in the f_files and
f_ffree elements of struct statfs, despite differences in semantics
of these values:

- There is no limit on the number of files and directories that can
  be created on a FAT file system. Only the root directory of FAT12
  and FAT16 file systems is limited, any number of files can still be
  created in sub-directories, even when 0 free "inodes" are reported.

- A single file can require 1 to 21 directory entries, depending on
  the character set, structure, and length of the name. The DOS 8.3
  style file name takes up 1 entry, and if the name does not comply
  with the syntax of a DOS 8.3 file name, 1 additional entry is used
  for each 13 characters of the file name. Since all these entries
  have to be contiguous, it is possible that a file or directory with
  a long name can not be created, despite a sufficient total number of
  free directory entries.

- Renaming a file can require more directory entries than currently
  allocated to store its long name, which may prevent an in-place
  update of the name if more entries are needed. This may cause a
  rename operation to fail if no contiguous range of free entries for
  the new name can be found.

- The volume label is stored in a directory entry. An empty FAT file
  system with a volume label will therefore show 1 used "inode" in
  df.

- The perceentage of free inodes shown in df or monitoring tools does
  only represent the state of the root directory of a FAT12 or FAT16
  file system. Neither does a reported value of 0% free inodes does
  prevent files from being created in sub-directories, nor does a
  value of 50% free inodes guarantee that even a single file with
  a "long" name can be created in the root directory (if every other
  directory entry is occupied and there are no 2 contiguous entries).

The statfs(2) and df(1) man pages have been updated with a notice
regarding the possibly different semantics of values reported as
total and free inodes for non-Unix file systems.

PR:		270053
Reported by:	Ben Woods <woodsb02@freebsd.org>
Approved by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D38987

(cherry picked from commit c33db74b53)

fs/msdosfs: Fix potential panic and size calculations

Some combinations of FAT12 file system parameters could cause a kernel
panic due to an unmapped access if the size of the FAT was larger than
the CPU page size. The reason is that FAT12 uses 3 bytes to store
2 FAT pointers, leading to partial FAT pointers at the end of buffers
of a size that is not a multiple of 3.

With a typical page size of 4 KB, this caused the FAT entry at byte
offsets 4095 and 4096 to cross the page boundary, with only the first
page mapped. This was fixed by adjusting the mapping to always cover
both bytes of each FAT entry.

Testing revealed 2 other inconsistencies that are fixed by this commit:

1) The calculation of the size of the data area did not take into
   account the fact that the first two data block numbers are reserved
   and that the data area starts with block 2. This could cause a
   FAT12 file system created with the maximum supported number of
   blocks to be incorrectly identified as FAT16.

2) The root directory does not take up space in the data area of a
   FAT12 or FAT16 file system, since it is placed into a reserved
   area outside of that data area. This commits makes stat() report
   the logical size of the root directory, but with 0 blocks allocated
   from the data area.

PR:		270587
Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D39386

(cherry picked from commit 0728695c63)
2023-05-01 10:09:33 +02:00
Kyle Evans 312c06634e pkill: tests: do a pass for case-sensitive conflicts
As in 76b6a59f9d, encode upper-case flag tests with a leading
underbar to avoid collisions (thus, erroneously dirty git repos) on
case-sensitive filesystems.

PR:		270948
Sponsored by:	Klara, Inc.

(cherry picked from commit 822057bfbb)
2023-04-20 12:29:23 -05:00
Kyle Evans df42ae6d99 pkill: use an ARG_MAX size buffer for argument matching
Right now pkill/pgrep cut off at _POSIX2_LINE_MAX (2048), but argument
strings can be much larger (ARG_MAX is 256K/512K).  Stop arbitrarily
cutting the search off at 2K, rather than documenting the limit.

Reviewed by:	allanjude (earlier version), des
Sponsored by:	Klara, Inc.

(cherry picked from commit 3610bffd28)
2023-04-09 17:49:52 -05:00
Ed Maste c702ed6eb8 csh: install hard link with same mode as target
Previously when using NO_ROOT we recorded METALOG entries for the /.cshrc
hard link with a different file mode than the link target, which is not
permitted.

We cannot just set LINKMODE here as it would also apply to the hard link
for the tcsh binary.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37499

(cherry picked from commit 67d2aaf078)
2023-03-23 10:33:01 -04:00
Ed Maste feb3da2526 sh: install hard link with same mode as target
Previously when using NO_ROOT we recorded a METALOG entry for the
/.profile hard link with a different mode than the link target, which is
not permitted.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37476

(cherry picked from commit 1dbb9994d4)
2023-03-23 10:33:01 -04:00
Baptiste Daroussin bf6280a744 uuidgen(1): fix another typo
(cherry picked from commit 4cd30c640d)
2023-03-06 09:04:54 +01:00
Baptiste Daroussin 131a687385 uuidgen(1): back to the past and fix typo
Reported by:	ceri

(cherry picked from commit 0ba66872be)
2023-03-06 09:04:48 +01:00
Baptiste Daroussin 551a3a6456 uuidgen: add -c for compact uuid
It generates the uuid string but without the hyphen

MFC After:		3 days
Reviews by:		tcberner
Differential Revision:	https://reviews.freebsd.org/D38820

(cherry picked from commit b2b294f27c)
2023-03-06 09:04:42 +01:00
Mateusz Guzik 117d4cafdc nproc: denote an incompatiblity with Linux
On Linux _NPROCESSORS_CONF reports CPU threads disabled by the kernel,
while it does not on FreeBSD.

Flip _NPROCESSORS_ONLN to _NPROCESSORS_CONF. While it keeps reporting
the same value, it will automagically unbreak should someone change the
above.

(cherry picked from commit 059320b8c8)
2023-02-23 17:06:41 +00:00
Mateusz Guzik 31f9db72a3 Add nproc(1)
This program prints the number of CPU threads it can run on, while
respecting cpusets (or not, depending on switches).

It aims to be compatible with nproc as found in GNU coreutils.

Reviewed by:	des
Reviewed by:	pstef
Differential Revision:	https://reviews.freebsd.org/D38386

(cherry picked from commit 48bfd35976)
2023-02-23 17:06:41 +00:00
Dag-Erling Smørgrav d6d22a4530 cp: Add tests involving sparse files.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38290

(cherry picked from commit 822fa7ae1e)

cp: Simplify the common case.

* The allocated buffer is only used in the fallback case, so move it
  there.  The argument for passing it in from the caller was that if
  malloc(3) were to fail, we'd want it to fail before we started
  copying anything, but firstly, it was already not in the right place
  to ensure that, and secondly, malloc(3) never fails (except in very
  contrived circumstances, such as an unreasonable RLIMIT_AS or
  RLIMIT_DATA).

* Remove the mmap(2) option.  It is almost never beneficial,
  especially when the alternative is copy_file_range(2), and it adds
  needless complexity and indentation.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rmacklem, mav
Differential Revision:	https://reviews.freebsd.org/D38291

(cherry picked from commit 6c85042afc)

cp: Minor code cleanup.

* Fix includes in utils.c, cf. style(9).
* Fix type mismatch: readlink(2) returns ssize_t, not int.
* It is not necessary to set errno to 0 as fts_read(3) already does it.

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

(cherry picked from commit cb96a0ef00)

cp: Adjust the sparse file tests.

* The sparsity check was ineffective: it compared the apparent size in bytes to the actual size in blocks.  Instead, write a tool that reliably detects sparseness.
* Some of the seq commands were missing an argument.
* Based on empirical evidence, 1 MB holes are not necessarily large enough to be preserved by the underlying filesystem.  Increase the hole size to 16 MB.

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

(cherry picked from commit 8b418c83d1)
2023-02-09 21:32:56 +01:00
Dag-Erling Smørgrav 1b11dd2108 df: Return non-zero status on write failure.
While here, complete the libxo conversion and switch return value to standard constants.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential revision: https://reviews.freebsd.org/D38097

(cherry picked from commit c968598479)
2023-02-09 21:32:56 +01:00
Mateusz Piotrowski 0a4f7dbd9e timeout: Move from /usr/bin to /bin
timeout(1) is used by /etc/rc.d/zfskeys. Unfortunately, having
timeout(1) installed in /usr/bin causes problems when /usr is an
encrypted ZFS partition.

Implementing timeout(1) in sh(1) is not trivial. A more elegant solution
is to move timeout(1) to /bin so that it is available to early services
in the boot process.

PR:		265221
Reviewed by:	allanjude, des, imp
Approved by:	allanjude, des, imp
Reported by:	Ivan <r4@sovserv.ru>
Fixes:	33ff39796f Add zfskeys rc.d script for auto-loading encryption keys
Relnotes:	yes
Sponsored by:	Modirum MDPay
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D38344

(cherry picked from commit e7ab133648)
2023-02-07 18:37:53 +01:00
Tobias C. Berner 8fd1953b7e bin/uuidgen: add support for v4 uuids
The version 4 UUID is meant for generating UUIDs from truly-random or
pseudo-random numbers. [1]

bin/uuidgen gained the new flag '-r' to create version 4 UUID.

[1] RFC 4122, https://www.rfc-editor.org/rfc/rfc4122#section-4.4

Reviewed by:		pstef
Approved by:		bapt
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D37695

(cherry picked from commit f176fe8e7f)
2023-01-10 08:48:55 +01:00
Aymeric Wibo 36802990d6 ls(1): add a -v flag to sort naturally
Differential Revision:	https://reviews.freebsd.org/D36407

(cherry picked from commit e2662256cd)
2022-12-24 07:47:21 +01:00
John Baldwin e66a9d0570 sh: Fix mismatch in array bounds for vforkexecshell().
Reviewed by:	imp, jilles, emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36760

(cherry picked from commit 10297a9ed4)
2022-11-11 10:18:53 -08:00
Dag-Erling Smørgrav e3a2943249 pax: remove 4.4BSD compatibility
Sponsored by:	Klara, Inc.

(cherry picked from commit 30c30e220a)

pax: comment typo fixes from NetBSD / OpenBSD.

Sponsored by:	Klara, Inc.

(cherry picked from commit 0266a5d610)

pax: name all supported formats.

Sponsored by:	Klara, Inc.

(cherry picked from commit a8e8a91445)

pax: update date parsing code (from OpenBSD)

Sponsored by:	Klara, Inc.
MFC after:	1 week

(cherry picked from commit d05e43bc0d)
2022-11-02 10:39:18 +01:00
Dag-Erling Smørgrav 540add272d sh: read more profile files.
Differential Revision: https://reviews.freebsd.org/D36505
MFC after:	1 month

(cherry picked from commit 497cdf9673)

sh: when loading profile, skip obvious scratch files.

Differential Revision: https://reviews.freebsd.org/D36856

(cherry picked from commit d3890a547d)

sh: when loading profile, read only .sh files.

Reviewers: jilles, eugen_grosbein.net, cy

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D37034

(cherry picked from commit 8d7221ca2d)
2022-11-02 10:30:41 +01:00
Baptiste Daroussin 1a566dd6a4 df: do not report a 100% full inode usage on fs without inodes
Before:
devfs    2        2         0   100%       0          0  100%   /dev

After:
devfs    2        2         0   100%       0          0     -   /dev

The previous behaviour was confusing for end users and many monitoring tools

Note the linux df tools is also using the same syntax '-' for such filesystem

MFC After:		2 weeks
Reviewed by:		manu, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D34515

(cherry picked from commit 2eee44bd5e)
2022-10-12 11:20:09 +02:00
Baptiste Daroussin 21b88b2ba8 sh(1): fix home/del key on mobaxterm env
For $reason mobaxterm default on sending unusual sequence from home/del
key, which makes libedit unabel to catch them and bind them correctly.

mobaxterm seems popular on the windows environment, so add proper
keybinding to default shrc configuration so it works out of box.

Reported by:	lme

(cherry picked from commit f3aad18d5e)
2022-10-12 11:13:20 +02:00
Baptiste Daroussin 89acef8476 sh(1): interactive mode improvement
In the default configuration add 2 bindings which has been requested by
many during the HEADSUP discussion:
* csh like arrow history navigation
* ctrl-arrow to jump from word to words

Add an alias to make the history command exist as an alias to fc -l.

(cherry picked from commit ef0d94a3d3)
2022-10-12 11:13:20 +02:00