aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
...
* cred: Hide internal flag CRED_FLAG_CAPMODEOlivier Certner2024-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This flag is used in field 'cr_flags', which is never directly visible outside the kernel. That field is however exported through 'struct kinfo_proc' objects (field 'ki_cr_flags'), either from the kernel via sysctls or from libkvm, and is supposed to contain exported flags prefixed with KI_CRF_ (currently, KI_CRF_CAPABILITY_MODE and KI_CRF_GRP_OVERFLOW, this second one being a purely userland one signaling overflow of 'ki_groups'). Make sure that KI_CRF_CAPABILITY_MODE is the flag actually exported and tested by userland programs, and hide the internal CRED_FLAG_CAPMODE. As both flags are currently defined to the same value, this doesn't change the KBI, but of course does change the KPI. A code search via GitHub and Google fortunately doesn't reveal any outside uses for CRED_FLAG_CAPMODE. While here, move assignment of 'ki_uid' to a more logical place in kvm_proclist(), and definition of XU_NGROUPS as well in 'sys/ucred.h' (no functional/interface changes intended). Reviewed by: mhorne Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46909
* cat: report copy_file_range() errors with the read filenameKyle Evans2024-12-141-1/+1
| | | | | | | | | | | | | | | | | | The error may be due to an error while writing, but it's more helpful to report what we were trying to from rather than "stdout" for these errors. Noticed because of what happens now when `cat` gets an EISDIR for reading from a dirfd: kevans@ifrit:~$ cat /etc cat: stdout: Is a directory which, after this change, becomes: kevans@aarch64-dev:~$ cat /etc cat: /etc: Is a directory Reviewed by: allanjude, des, mm Differential Revision: https://reviews.freebsd.org/D41784
* sh.1: update history + spdx + linter errorAlexander Ziaee2024-11-291-2/+5
| | | | | | | | | | | | + increase history consistency by adding "first appeared" + remove a skipped new paragraph macro to quiet linter + tag spdx MFC after: 3 days History source: www.in-ulm.de/~mascheck/various/ash/#bsd Reviewed by: mhorne,imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1440
* sh(1): -l is only valid in cli option not as set -lBaptiste Daroussin2024-11-201-1/+1
|
* sh(1): add -l optionBaptiste Daroussin2024-11-204-15/+26
| | | | | | | | | | | | -l is required by LSB for login shell, all other shells: bash, zsh, oksh, mksh, ... implements it. with -l sh will act as a login shell and read the profile. MFC After: 1 week Obtained From: dash (3b7c8442bfe7c2fd0a6b0415df6ddf66a399fd55) Reviewed by: kib, lme Differential Revision: https://reviews.freebsd.org/D47681
* mv: Add test cases for command-line options.Dag-Erling Smørgrav2024-11-191-0/+117
| | | | | | Sponsored by: Klara, Inc. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D47582
* mv: Convert tests to ATF.Dag-Erling Smørgrav2024-11-193-296/+392
| | | | | | Sponsored by: Klara, Inc. Reviewed by: asomers, markj Differential Revision: https://reviews.freebsd.org/D47569
* mv: More style nits.Dag-Erling Smørgrav2024-11-191-22/+15
| | | | | | Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47568
* ps.1: remove stray tab which breaks columns alignmentKonstantin Belousov2024-11-181-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* sh tests: Fix ktrace usage now that envvars are traced by defaultMark Johnston2024-11-172-2/+2
| | | | | | | | | | Some sh tests use ktrace to see whether a particular file, specified in the environment, was accessed by the shell. After commit 65a4daeaf324, this test matches the ktrace record generated by execve. Use ktrace to only log name lookups, to avoid such false matches. Fixes: 65a4daeaf324 ("ktrace: log execve(2) arguments and environment")
* ps.1: restore always true if predicateKonstantin Belousov2024-11-141-5/+1
| | | | | | | Fixes: 62e6ca0f07e448da27cb2cc8165e749e7fdfcd7e Reported and reviewed by: jlduran Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D47561
* mv: Type and style nits.Dag-Erling Smørgrav2024-11-131-6/+7
| | | | | | Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D47537
* ps(1): clean up after swapout removalKonstantin Belousov2024-11-094-53/+10
| | | | | | | | | | | | | | | | The process flag P_INMEM is always set. Eliminate all checks for the bit. Also eliminate LAZY_PS define and code covered by it: we do not have an u-area for long time, and it cannot be swapped out. Also eliminate setting controlled by the '-f' switch, but accept it for backward compatibility. The 'W' process secondary state (swapped out) is impossible, stop calculating it. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D47492
* ps.1: document rest of flag2 bitsKonstantin Belousov2024-11-091-0/+18
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47492
* ps.1: visually align process flags hex values by filling leading zeroesKonstantin Belousov2024-11-091-27/+27
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47492
* tests: Switch bin/hostname/hostname_test to execenv=jailIgor Ostapenko2024-10-311-6/+1
| | | | | | | | | Kyua skips tests based on the jail execution environment if a system is built WITHOUT_JAIL. Thus, the test case does not need to handle it. Reviewed by: markj Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D47334
* manuals: Fix "unusual .Xr" warnings with a scriptGraham Percival2024-10-151-1/+1
| | | | | | | | | | | | | These were reported by `mandoc -T lint ...` as warnings: - unusual Xr order - unusual Xr punctuation Fixes made by script in https://github.com/Tarsnap/freebsd-doc-scripts Signed-off-by: Graham Percival <gperciva@tarsnap.com> Reviewed by: mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com> Sponsored by: Tarsnap Backup Inc. Pull Request: https://github.com/freebsd/freebsd-src/pull/1464
* Update Makefile.depend filesSimon J. Gerraty2024-10-144-1/+18
| | | | | | | After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
* ps(1): Complete libxo transitionYan-Hao Wang2024-10-123-14/+14
| | | | | | Reviewed by: des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D41422
* manuals: Fix typos in -offset for .Bd and .BlGraham Percival2024-10-031-2/+2
| | | | | | | | | | | | | | | | | The intended value is: -offset indent If there's any typo such that the value doesn't match the pre-defined strings, then the offset is the same width as the value. So by chance, "-offset -ident" ended up being a standard-width indent (since the default indent is 6 chars, and "-ident" also has 6 chars), whereas "-offset -indent" had a longer indent, and "-offset ident" had a shorter one. Signed-off-by: Graham Percival <gperciva@tarsnap.com> Reviewed by: mhorne, Alexander Ziaee <concussious.bugzilla@runbox.com> MFC after: 3 days Sponsored by: Tarsnap Backup Inc. Pull Request: https://github.com/freebsd/freebsd-src/pull/1436
* timeout(1): Update STANDARDS sectionGordon Bergling2024-09-241-1/+7
| | | | | | | | | | | | | | Update the STANDARDS section for timeout(1) to POSIX 1003.1-2024. Update mandoc to be able to render the new POSIX macro. Reviewed by: bapt, bcr Approved by: bapt Obtained from: OpenBSD MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D45691
* bin/sh: support RLIMIT_PIPEBUFKonstantin Belousov2024-09-201-1/+4
| | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46619
* date: Documentation nits.Dag-Erling Smørgrav2024-09-101-3/+6
| | | | | | | | | | | * Fix spurious capitalization. * Fix inconsistent quoting. * Use `Dq` rather than ASCII double quotes. MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: 0mp Differential Revision: https://reviews.freebsd.org/D46622
* date: Fix a few nits.Dag-Erling Smørgrav2024-09-041-4/+4
| | | | | | | | | | | * Don't use `asprintf()` when `strdup()` can do the job just as well. * Fix a couple of typos in a comment. Fixes: eeb04a736cb9 MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46533
* faccessat(2): Honor AT_SYMLINK_NOFOLLOWFernando Apesteguía2024-08-111-1/+2
| | | | | | | | | | | | Make the system call honor `AT_SYMLINK_NOFOLLOW`. Also enable this from `linux_faccessat2` where the issue arised the first time. Update manual pages accordingly. PR: 275295 Reported by: kenrap@kennethraplee.com Approved by: kib@ Differential Revision: https://reviews.freebsd.org/D46267
* test(1): quote closing bracket in error messageDaniel Tameling2024-07-291-1/+1
| | | | | | | | | | | | | | If test is called as [ and one forgets to close the bracket, the error message is currently [: missing ] To make it obvious that this is not something printed in brackets, quote the closing bracket in the message, which is what everybody else is doing: [: missing ']' Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1346
* pax: Clear arcn in each read function.Dag-Erling Smørgrav2024-07-242-27/+5
| | | | | | | | | | Instead of initializing individual fields to zero, clear the entire struct prior to populating it. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: 0mp, markj Differential Revision: https://reviews.freebsd.org/D46097
* ls: Make -, apply to -s as well as -l.Dag-Erling Smørgrav2024-07-244-10/+27
| | | | | | | | | While here, remove a bogus comment about a gcc bug. The bug was in ls, which used an incorrect format string, and in libc, which accepted it. MFC after: 1 week Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D46067
* Remove residual blank line at start of MakefileWarner Losh2024-07-1570-70/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* pax: Terminate loop for empty directory namesGanael Laplanche2024-06-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Pax can sometimes loop forever. For example: $ mkdir -p /tmp/src/foo/bar $ rm -rf /tmp/dst ; mkdir -p /tmp/dst $ cd /tmp/src $ echo 'foo/bar/' | /bin/pax -r -w -d -pe "/tmp/dst" <looping infinitely> Here, pax(1) infinitely deletes and re-creates /tmp/dst/foo/bar/. The problem is that chk_path() (bin/pax/file_subs.c), called from node_creat() also creates the leaf directory when a trailing '/' appears in the directory name to create. When the execution goes back from chk_path() to node_creat(), the function still cannot create the leaf directory (it has been created by chk_path()), so it unlinks it and calls node_creat() again. The function re-creates it, and so on... In node_creat() detect trailing slashes and not create a leaf directory, but only intermediate ones. PR: 277060 Reviewed by: imp
* csh: Remove hardlink /.cshrcEmmanuel Vadot2024-05-291-9/+0
| | | | | | | | | | | | | Remove this historical artifact. csh will try to use /.csrch if the user has no home directory defined which is rather unlikely (To be exact if the concatenation of $HOME and "/.cshrc" fail which is the same thing). Also, with this change pkg will happily handle 3way merge for /root/.cshrc Differential Revision: https://reviews.freebsd.org/D45382 Reviewed by: emaste, imp Sponsored by: Beckhoff Automation GmbH & Co. KG
* cp: avoid a resource leakPierre Pronchery2024-05-231-0/+3
| | | | | | | | | | | | In copy_file(), make sure the from_fd file descriptor is closed even when the operation failed early. Reported by: Coverity Scan CID: 1545036 Sponsored by: The FreeBSD Foundation Reviewed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1238
* man filesystems: fix xrefs after move to section 4Alexander Ziaee2024-05-161-1/+1
| | | | | Reviewed by: des, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
* /bin/rmdir: Exit with status 2 for invalid argumentsHenrich Hartzer2024-05-113-11/+12
| | | | | | | | PR: 277677 Signed-off-by: Henrich Hartzer <henrichhartzer@tuta.io> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1161
* cat: Missed a couple.Dag-Erling Smørgrav2024-05-101-3/+3
| | | | | MFC after: 3 days Sponsored by: Klara, Inc.
* cat: Check for lack of success rather than a specific failure.Dag-Erling Smørgrav2024-05-101-5/+5
| | | | | | | MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D45149
* ps: handle incorrect -D valuesJamie Landeg-Jones2024-05-061-0/+2
| | | | | | | | | | | | | | | I just noticed a slight issue with the '-D' option. Basically, I accidentally typed something along the lines of: ps -Dboth-p303 I.E. missing out the "space". Instead of giving an error, it behaved as if I'd just typed "ps". Looking at bin/ps/ps.c, where the -D option is parsed, it doesn't error-out if there is no valid match. This commit fixes the bug.
* date.1: Note that nanosecond support is to appear first in 14.1Mateusz Piotrowski2024-05-021-2/+2
| | | | Sponsored by: Klara, Inc.
* date: Correctly check outcome of mktime().Dag-Erling Smørgrav2024-04-281-1/+3
| | | | | | X-MFC-With: 7b390cb63689 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D44982
* uuidgen(1): Add EXAMPLES to manual pageFernando Apesteguía2024-04-271-0/+24
| | | | | | Approved by: manpages@ (gbe@) Reviewed by: gbe@, pauamma Differential Revision: https://reviews.freebsd.org/D43494
* date: Fix tests by initializing timespec structureMateusz Piotrowski2024-04-261-0/+2
| | | | | | | | | | The tests related to nanosecond support were failing on amd64 due to uninitialized timespec structure. Fixes: eeb04a736cb9 date: Add support for nanoseconds Reviewed by: markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D44975
* date: Add support for nanosecondsMateusz Piotrowski2024-04-263-35/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces support for a conversion specification for nanoseconds. The format of %N is meant to be compatible with that of GNU date. The nanoseconds conversion specification is implemented directly in date(1) instead of libc (in strftime(3)) to avoid introducing non-standard functions to libc at this time and modifying struct tm. Apart from introducing the nanoseconds conversion specification, this patch brings the following changes: - The "ns" format for ISO 8061 dates is now unlocked. E.g., date -Ins prints: 2024-04-22T12:20:28,763742224+02:00 - The -r flag when fed a file is now aware of the nanosecond part of the last modification time. - date(1) is now able to set the time with nanosecond precision. It is not possible as of now to do that by specifying nanoseconds directly via the command-line arguments. Instead, the -r flag can be used. - date(1) is now using the clock_gettime(3) family of functions instead of ctime(3) family of functions where possible. Reviewed by: des, markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D44905
* sync.8: Document that the "sync dance" is not a thingMateusz Piotrowski2024-04-251-1/+29
| | | | | | | | | | People still believe that it is essential to run sync(8) a couple of times before a reboot/halt. Document that this has not been necessary for a long time now. Reviewed by: imp, bcr, Pau Amma <pauamma@gundo.com> MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D33233
* cp: Use warnc().Dag-Erling Smørgrav2024-04-171-2/+1
| | | | | MFC after: 1 week Sponsored by: Klara, Inc.
* cp: Additional sanity check.Dag-Erling Smørgrav2024-04-171-7/+20
| | | | | | | | | | Once we've successfully opened the file we've been asked to copy, check that it's of the same type as FTS told us it was. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude, markj Differential Revision: https://reviews.freebsd.org/D44806
* cp: Clarify an obscure comment.Dag-Erling Smørgrav2024-04-171-2/+8
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D44805
* mv: Set file flags after setting file timesRicardo Branco2024-04-161-5/+6
| | | | | | | | | Some file flags prevent modification of file times, so they should be set later. This matches NetBSD's behaviour. Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1138
* nproc: Prefer sys/cdefs.h __unreachable over the builtinCollin Funk2024-04-121-1/+1
| | | | | | | | | | | | | | The __builtin_unreachable macro provided by Clang and GCC is a hint to the compiler used for optimization. The programs work fine even if the compiler doesn't support it. The sys/cdefs.h has had __unreachable for 9 years (commit 732b31de5d9244bd1cc98192e09ee1881e9f55e9). It expands to the builtin if it is available. In the rare case that it is unsupported it expands to a null statement so compilation does not fail. Signed-off-by: Collin Funk <collin.funk1@gmail.com> Reviewed by: imp, freebsd@igalic.co Pull Request: https://github.com/freebsd/freebsd-src/pull/1117
* cp: Never follow symbolic links in destination.Dag-Erling Smørgrav2024-04-082-39/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically, BSD cp has followed symbolic links in the destination when copying recursively, while GNU cp has not. POSIX is somewhat vague on the topic, but both interpretations are within bounds. In 33ad990ce974, cp was changed to apply the same logic for symbolic links in the destination as for symbolic links in the source: follow if not recursing (which is moot, as this situation can only arise while recursing) or if the `-L` option was given. There is no support for this in POSIX. We can either switch back, or go all the way. Having carefully weighed the kind of trouble you can run into by following unexpected symlinks up against the kind of trouble you can run into by not following symlinks you expected to follow, we choose to go all the way. Note that this means we need to stat the destination twice: once, following links, to check if it is or references the same file as the source, and a second time, not following links, to set the dne flag and determine the destination's type. While here, remove a needless complication in the dne logic. We don't need to explicitly reject overwriting a directory with a non-directory, because it will fail anyway. Finally, add test cases for copying a directory to a symlink and overwriting a directory with a non-directory. MFC after: never Relnotes: yes Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44578
* echo(1): Add EXAMPLESFernando Apesteguía2024-04-081-0/+29
| | | | | | | | While here add CAVEAT section and promote the use of printf(1) Reviewed by: gbe@, imp@ Approved by: manpages (gbe) Differential Revision: https://reviews.freebsd.org/D43493