aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
...
* ps(1): Make '-O' more versatile and predictableOlivier Certner2025-04-282-27/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ps(1) display's list of columns is now first built without taking into account the '-O' options. In a second step, all columns passed via '-O' are finally inserted after the built-so-far display's first PID column (if it exists, else at start), in their order of appearance as arguments to the '-O' options. This new two-step procedure suppresses the following undesirable behaviors: - '-O' used to insert the columns of the default display even if the user also passed other options to request specific columns. - Each occurence of '-O' beyond the first would just insert the passed keywords after those requested by the previous options, as if by '-o', inconsistently with the behavior for the first occurence. These behaviors had more annoying consequences: - Where the columns of some '-O' occurence appear in the display used to depend on the actual position of '-O' with respect to other options, despite the natural expectation that they should go near a single PID column considered as an anchor regardless of other options adding columns. - Columns specified with multiple '-O' options would not be grouped together. - It used to be impossible to specify custom headers but for the last column for columns that are next to each other (i.e., specified by a single '-O' occurence). which are now all lifted. With these changes, '-O' can still be used alone to amend the default display, but can now be used also in conjunction with any specific display, and in particular "canned" ones invoked by '-j', '-l', '-u' or '-v'. ****** This part discusses other ps(1) implementations' behaviors and compares them to the one established by this change. NetBSD seems to be the only other BSD having refined the meaning of ps(1)'s '-O' option. While the behavior there is similar to the new one here on the surface, it differs on the following points: 1. If no options requesting a specific display are present before the first '-O' option, the appearance of '-O' triggers the insertion of the default display, regardless of whether such specific display options appear *after* it. 2. If options requesting a specific display appear before the first '-O' and none specify a PID column, columns listed in the first '-O' are appended to them (as '-o' would do), but columns passed by further '-O' options are then inserted next to the columns of the first '-O' options. Behavior of point 1 seems to have only one advantage: To allow to customize the default display by first using '-O' and then other options appending to it, but as the default display finishes with the COMMAND column, it is unlikely that one wants to use '-o' or other specific display options after '-O' (NetBSD's ps(1) does not suppress duplicate columns). A much simpler and easy-to-understand way to reach that effect in FreeBSD, if it really proves useful, would be to introduce a new explicit option that inserts the default display. The column-appending behavior of the first '-O' option in point 2 can be also achieved by using '-o' instead. As '-O' is used to insert columns after the PID one, which is located near the left in the default and all "canned" displays, we found it more consistent and practical to push its columns completely to the left on the absence of a PID column. The effect of multiple '-O' options in NetBSD when no PID column has been requested beforehand is also cumbersome and inconsistent with the documentation (it is likely a bug). Both NetBSD-specific behaviors exposed above also have the disadvantage that the position of '-O' options with respect to other ones is meaningful in ways that are not obvious and that are arguably not desirable as '-O' is meant to append columns after an anchor (the PID column). Linux's procps-ng's ps(1) is very limited in its handling of '-O', and more generally when mixing options tweaking the display. '-O' causes insertion of the default display (like NetBSD does). If '-o' options are specified, '-O' must come before them. '-O' is not usable with canned display options. Additionally, only one '-O' option may appear on the command line, limiting header customization. The only case in which these implementations and ours behave in the same way with respect to '-O' is if only a single '-O' option and no other options changing the display are specified. MFC after: 3 days Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49615 (code) Differential Revision: https://reviews.freebsd.org/D49616 (manual page)
* ps(1): Constify the format strings for canned displaysOlivier Certner2025-04-281-16/+10
| | | | | | | | | | | | | | | | Now that removal of non-explicitly-requested duplicate columns work with a O(n) algorithm, remove the ad-hoc optimization of crushing the canned displays' formats after first use and constify their format strings. No functional change intended. This change could also be useful if/when allowing, e.g., to double letters of canned displays to indicate their columns should not be subject to automatic removal of duplicates (e.g., 'ps -ll'). MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49614
* ps(1): Remove not-explicitly-requested columns with duplicate dataOlivier Certner2025-04-285-32/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, when stacking up more columns in the display through command-line options, if user requested to add some "canned" display (through options '-j', '-l', '-u' or '-v'), columns in it that were "duplicates" of already requested ones (meaning that they share the same keyword, regardless of whether their headers have been customized) were in the end omitted. However, this mechanism did not work the other way around, i.e., requesting some canned display(s) first and then adding some columns that are duplicates (through '-o' or '-O') would not remove them from the canned display. Additionally, it did not take into account keyword aliases (which also lead to displaying the same information). This whole mechanism of removing columns from requested canned displays when there are duplicates is useful in a number of scenarios: 1. When one wants the columns of a canned display, but with some of them in a different order and at the edges of the bulk. This needs the change here to move columns after the bulk (previously, only moving them before the bulk would work). 2. To combine multiple canned displays to get more information without repeating common columns. This part has been working before and this behavior is unchanged. 3. In combination with requesting a canned display and additional columns after it, ensure that a single COMMAND column appears at the end of the display (to benefit from the fact that a last COMMAND column can extend further to the right). Point 2 above implies that, when multiple canned displays are requested, we should keep the leftmost column with same keyword. However, columns requested explicitly by '-o' have priority (as the natural extension of point 1's behavior before this change), and in this case all matching columns in canned displays must be suppressed. To this end, when adding requested options to the display's list, we stop trying to find an earlier matching column (which is incidentally a O(n²) algorithm). Instead, we do a first pass over all requested options once they have all been added to the display's list (in scan_vars()). For each keyword, we note if it was requested at least once explicitly (through '-o' or '-O'), in addition to setting 'needuser' and 'needcomm' (as before). Then, a second pass decides whether to keep each column. A column is removed if it should not be kept absolutely (i.e., it wasn't specified via '-o' or '-O') and there is either a matching column that must be kept (determined during the first pass), or we have seen one already (earlier canned displays take precedence). Matching columns are in fact not only those that have same keywords, but also those that have keywords determined to be aliases to each other. Some previous commits ensured that this determination is O(1) and in practice just a few assembly instructions. find_varentry() has been kept although its last caller has been removed as next commit will reintroduce a call to it. MFC after: 3 days Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49612 Differential Revision: https://reviews.freebsd.org/D49613 (manual page)
* ps(1): Aliases: Resolve once, merge specificationsOlivier Certner2025-04-285-77/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, an alias keyword is resolved once and for all by merging specifications of the keyword (or chain of keywords) it points to. This merge in particular determines the final attributes of the alias keyword, as well as the final keyword it points to, which uniquely determines which information is printed (all non-alias keywords are assumed to display different data). Also, the alias resolving code has been moved into the resolve_alias() function and helpers (e.g., merge_alias()). Aliases are still resolved lazily as needed by default. The new top-level resolve_aliases() function is used to resolve them at once at program startup if ps(1) has been compiled with PS_CHECK_KEYWORDS defined. Else, it can also be called directly from a debugger. This is in preparation for removing columns that actually display the same information in a subsequent commit, as this requires being able to (quickly) determine if they are aliases to each other. *** The merge process is now explicit and more flexible. Previously, all fields of the resolved keyword were unconditionally used for the alias (the pointer to an alias keyword structure was replaced by one to the aliased keyword's one). Now, field 'final_kw' on the alias keyword will store a pointer to the aliased keyword structure (and not only its name, as a subsequent commit will need the structure address). Fields 'header', 'field' and 'flag' are taken from the aliased keyword if they have default values (NULL or 0), else the alias' values prevail. This allows an alias to override one or more of these fields. All fields after 'oproc', because they describe the information to display consistently with each other, are always taken from the aliased keyword. merge_alias() checks that the values of these fields in the alias keyword structure are unspecified (NULL, or some neutral value like 0 and UNSPEC). While here, parsefmt() was reworked to avoid any direct recursion and the break-up/recombination steps that were used when processing aliases. The latter was due to the mutual recursion with findvar() and its odd-for-that-purpose signature. findvar() has been removed in the process. Simplification of parsefmt() also allows to be more precise with the errors reported (in particular, the case of an empty keyword with a specific header would just be reported as a "keyword not found" message). While here, introduce the check_keywords() function, performing sanity checks on the declared keywords, currently only validating that they are declared in alphabetical order. As for resolve_aliases(), this function is called at startup on PS_CHECK_KEYWORDS, else it is available to be called from a debugger. Ideally, alias resolution should be done at compile time. In practice, it seems doing so at runtime was never a problem (there are only a few aliases compared to all available keywords, and there's currently at most one level of aliasing). With the changes here, it seems very unlikely to become one even if many more keywords, aliases or aliasing levels are added. MFC after: 3 days Sponsored by: The FreeBSD Foundation
* ps(1): Keywords: New UNSPEC type, rename 'alias', re-order fieldsOlivier Certner2025-04-283-175/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is in preparation for a change in how aliases are resolved, itself in preparation for being able to quickly identify columns displaying the same information (same final keyword). Add the new UNSPEC ("unspecified") type, as the keywords' type field is only used by the kvar() and rvar() output routines, and has no meaning for alias keywords. In particular, this will allow to check that no specific type is associated to any alias. An immediate benefit is that now most keywords have UNSPEC as their "type", which now makes kvar()/rvar() explicitly fail (instead of trying to print a character, as the previous CHAR type was requesting). A developer introducing new keywords via copy-paste will thus be reminded that it also needs to set 'type' meaningfully if using kvar()/rvar() as the output routine. Rename field 'alias' of keywords ('VAR' type) into 'aliased'. Move it just after the keyword's name, as it makes it easier to spot aliases in the list. Make it a union, as a subsequent commit will... alias it with a pointer to another 'VAR' structure. Turn aliases' header string ("" for all aliases) into NULL. It is currently not used, but will be when introducing the new "merge" procedure for aliases (where it will mean: Use the header of the aliased keyword). While here, rename vars[] into the more descriptive keywords[]. MFC after: 3 days Sponsored by: The FreeBSD Foundation
* ps(1): Consider references to keywords as immutableOlivier Certner2025-04-284-11/+8
| | | | | | | | | | | | | | | | | | | | | Building on the previous commit that moved the 'width' field from VAR (structure representing the meaning of a keyword) to VARENT (structure representing an actual column in a display), it is now possible to declare the field 'var' of VARENT as a constant reference. At this point, it could be possible to constify the var[] array containing all the recognized keywords. However, we do not do it as a subsequent commit will change the way alias keywords are resolved, causing their fields to be modified to reflect the final values to use after alias resolution. In parsefmt(), forget about allocating a new VAR for the selected keyword to be pointed by the corresponding column (VARENT), and instead just keep a pointer to that structure in var[]. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49611
* ps(1): Move 'width' field from VAR to VARENT; Remove sizevars()Olivier Certner2025-04-284-145/+126
| | | | | | | | | | | | | | | | | | | | | | | Some column's width depends not only on the information displayed but also on the its header, which may have been customized. Consequently, that width is a property of the actual column and should not be attached to the keyword specifying which information to print. This change fixes a bug where multiple columns displaying the same information (same keyword) but with different headers would have the same width, although they should not if they have long enough headers that have different lengths (the width computed from the largest header would be applied to all the corresponding keyword's columns). Remove sizevars(), as the 'width' field is now initialized directly in parsefmt(), which creates the VARENT structures. While here, remove var[]'s sentinel line, and consequently adjust the upper limit in showkey()'s loop and findvar()'s binary search. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49610
* ps(1): find_varentry() to take a name instead of a VAROlivier Certner2025-04-283-4/+4
| | | | | | | | | | | | | | | The only information that find_varentry() needs and uses is a keyword/var name. The rest of the fields in the passed VAR are unused. Changing its signature will ease introducing new calls to find_varentry() in subsequent commits, as there no VAR object will exist to be passed but just a name. Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49609
* ps(1): Have parsefmt() take the list of columns to updateOlivier Certner2025-04-284-25/+28
| | | | | | | | | | | | | | | | This is in preparation for changing the behavior of the '-O' option. While here, reformat the definition of 'struct varent', fix formatting of that of 'struct var' and expand slightly their herald comments. More reformatting/commenting in 'ps.h'. No functional change intended. Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49607
* ps(1): Remove internal documentation for '-A'Olivier Certner2025-04-281-5/+0
| | | | | | | | | Now that it is officially documented in the manual page. Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49606
* ps(1): Whitespace cleanupOlivier Certner2025-04-282-2/+2
| | | | | | | No functional change (intended). MFC after: 3 days Sponsored by: The FreeBSD Foundation
* ps.1: Revamp: Explain general principles, update to match realityOlivier Certner2025-04-281-342/+599
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The preamble has been revamped to give a thorough overview of the different aspects of the ps(1) command in the following separate paragraphs: 1. What it outputs. 2. Which processes are listed. 3. Which information is displayed by process. 4. How lines are sorted. 5. Considerations about the (mostly broken) output width. 6. Backwards compatibility features. Fix or expand the description of several options and some keywords to match their actual behavior. Expand the STANDARDS section, noting the options conforming to POSIX and those that do not (but may be changed to), as well as current diverging behaviors. Expand the BUGS section with a thorough description of other known problems. While here, document the POSIX-specified '-A' option. We have been supporting it since 2004 (commit "Support more POSIX/SUSv3 options:", a4c8a745a85b18d7, r127499) and it has been standard for longer. It seems now highly unlikely we will ever want to use it for any other purpose, so just stop trying to hide it. While here, re-order flags according to mdoc(7)'s prescription. Given the current state, this also requires less changes than, e.g., putting all uppercase flags first. While here, move the detailed specifications of keywords from the DESCRIPTION to the KEYWORDS section. While here, fix the formatting of some references to keywords. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49605
* getfacl: implement --skip-base (-s)Kyle Evans2025-04-212-18/+52
| | | | | | | | | | | | | This skips files that only have a trivial ACL, which is useful for callers that want to examine files with more unique ACLs. While we're here, don't issue the file name/ownership header if we're just going to error out on the file; this adds extra noise for little gain. Reviewed by: markj, olce Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D40603
* getfacl: add some long options for Linux compatibilityKyle Evans2025-04-212-5/+15
| | | | | | | | | | Only three of our options have compatible looking long options, w.r.t. the commonly provided getfacl(1) on Linux systems. Of particular interest is --omit-header, which is -c on !FreeBSD and -q on FreeBSD. Reviewed by: imp, markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D40602
* Remove references to rcp(1) since we no longer ship rcp.Jens Schweikhardt2025-04-191-1/+0
|
* pwait tests: Fix some exit annotationsMark Johnston2025-04-181-6/+6
| | | | | | | | A number of tests rely on timeout(1) to kill a pwait instance, and with --preserve-status the corresponding exit status is propagated to atf_check. Update the checks to reflect this. MFC after: 2 weeks
* timeout(1): Document the reaper implementation and behaivorAaron LI2025-04-161-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | If timeout(1) runs with the --foreground option, it becomes the reaper of the command and its descendants and will wait for all of them to terminate. This behavior is different from the old FreeBSD version and GNU version. For example, if there is a descendant running in the background, like: $ timeout -s INT 2 sh -c 'sleep 4 & sleep 5' when timeout(1) sends the SIGINT to all descendants, the child 'sh' process and the foreground 'sleep 5' process will immediately terminate, but the background 'sleep 4' will be reparented to the timeout(1) itself. Because a background process ignores SIGINT and SIGQUIT, the whole command completes until the background 'sleep 4' finishes. In comparison, the old FreeBSD version and GNU version will just terminate itself, letting the background 'sleep 4' process be reparented to an upper reaper like init. The POSIX.1-2024 standard doesn't specify the required behavior in such cases, so I decided to keep the current implementation. Nonetheless, the updated timeout(1) has changed a lot in order to conform to the standard. Obtained-from: DragonFly BSD
* timeout(1): adapt the preserve_status test to the new behaviourBaptiste Daroussin2025-04-161-1/+1
| | | | | | | atf-check cannot check anymore the exit number if the program is terminated via a signal, it needs to be catched by -s signal because we cannot pass twice the -s command, we cannot anymore check for the exit value :(
* timeout(1): Kill self with the same signal that terminated the childAaron LI2025-04-162-29/+57
| | | | | | | | | | | | | | A shell may not set '$?' to '128 + signal_number' when the process was terminated by a signal. For example, KornShell 93 sets '$?' to '256 + signal_number' in such cases. In order to avoid any possible ambiguity, the POSIX.1-2024 standard requires that timeout mimic the wait status of the child process by terminating itself with the same signal, while disabling core generation. Update the man page accordingly. Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
* timeout(1): Catch all signals and propagate themAaron LI2025-04-162-35/+79
| | | | | | | | | | | | The POSIX.1-2024 standard requires that timeout(1) utility propagate all signals except SIGALRM, so timeout(1) needs to catch all signals for this purpose. In addition, we need to separate those signals whose default action is to terminate the program, because timeout(1) should start the second timer for the kill signal if those signals are received. Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
* timeout(1): Fix the inheritance of signal dispositionsAaron LI2025-04-162-21/+39
| | | | | | | | | | | POSIX.1-2024 requires that the child process inherit the same signal dispositions as the timeout(1) utility inherited, except for the signal to be sent upon timeout. For example, when timeout(1) is run by nohup(1), the command should be protected from SIGHUP. Obtained-from: DragonFly BSD
* timeout(1): Improve to show more verbose log messagesAaron LI2025-04-162-1/+21
|
* timeout(1): Fix the handling of repeated terminating signalsAaron LI2025-04-161-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | This actually fixes the following two issues: * If a terminating signal (e.g., HUP/INT/TERM) was received, timeout would propagate it to the command and then ignore it. So it was unable to resend the same terminating signal to the command. This was different from the GNU's timeout(1), and also contradicted the POSIX.1-2024 standard. * Sending two different terminating signals would break timeout(1)'s --kill-after mechanism. That was because the second signal would break the for() loop, so the second SIGALRM set by '--kill-after' would never be caught. For example, in one shell run: $ time timeout -f -v -s INT -k 1 2 sh -T -c \ 'trap date INT HUP; sleep 5; echo ok; date' and in another shell run: $ pkill -INT timeout; pkill -HUP timeout in the end, the time(1) would report it cost 5 seconds instead of the expected 3 seconds. Obtained-from: DragonFly BSD
* timeout(1): Also send SIGCONT because the child may be stoppedAaron LI2025-04-161-0/+18
| | | | | | | | | | | | | | | | The POSIX.1-2024 says: "If the subsequent wait status of the child process shows that it was stopped by a signal, a SIGCONT signal shall also be sent in the same manner as the first signal; otherwise, a SIGCONT signal may be sent in the same manner." As it's allowed by the standard, we just always send the SIGCONT signal to the child process regardless of its stop state, so that timeout could terminate a stopped child. Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
* timeout(1): Enhance send_sig() and prepare for later updatesAaron LI2025-04-161-14/+32
| | | | | | | | | | Enhance send_sig() to better encapsulate the signal sending for both foreground and non-foreground modes. This also fixes the issue that the latter mode was missing verbose messages. In addition, improve the verbose logging for signals. Obtained-from: DragonFly BSD
* timeout(1): Add -f and -p options as per POSIX.1-2024Aaron LI2025-04-162-19/+24
| | | | | | | | | | POSIX.1-2024 first defined the timeout(1) utility and specified the '-f' and '-p' options, which are the short versions of '--foreground' and '--preserve-status' options, respectively. Add the short versions to comply with the Standard. Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
* timeout(1): Handle sig_alrm and sig_term together to dedup codeAaron LI2025-04-161-25/+12
| | | | | | | Merge the 'sig_alrm' and 'sig_term' conditionals, and thus reduce some duplicate code. Obtained-from: DragonFly BSD
* timeout(1): Multiple minor tweaks and cleanupsAaron LI2025-04-162-92/+97
|
* timeout(1): sig_atomic_t variables must also be 'volatile'Aaron LI2025-04-161-4/+4
| | | | Obtained-from: OpenBSD (via DragonFly BSD)
* timeout(1): Use _exit(2) instead of err() in child if exec failedAaron LI2025-04-161-8/+4
| | | | | | | | | * The child should _exit(2) instead of calling exit(3) via err(3) if the execvp() failed. * execvp(2) does not return except on error, so there is no need to check if the return value is -1. Obtained-from: OpenBSD (via DragonFly BSD)
* timeout(1): fix test after improvement of error messagesBaptiste Daroussin2025-04-161-5/+5
|
* timeout(1): Improve duration parsing and error messagesAaron LI2025-04-161-10/+10
| | | | Obtained-from: OpenBSD (via DragonFly BSD)
* ln: Tweak append logic.Dag-Erling Smørgrav2025-04-152-8/+32
| | | | | | | | | | | If the target is "." or ends in "/" or "/.", we always want to append the source's basename, even in the Fflag case. MFC after: never Relnotes: yes Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D49842
* cp: Improve error messages.Dag-Erling Smørgrav2025-04-151-9/+9
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude, markj Differential Revision: https://reviews.freebsd.org/D49841
* ps.1: Use ISO/IEC byte unitsAlexander Ziaee2025-03-281-7/+7
| | | | | | | | | | | | | | | The ps(1) utility uses 1024 byte units, not 1000 byte units. git grep KiB | wc -l 535 git grep KBytes | wc -l 39 Fixes: 20bdda14fa5c (Consistent usage of Kbyte unit) MFC after: 3 days Reviewed by: jsm, imp, mhorne Approved by: mhorne (mentor) Differential Revision: https://reviews.freebsd.org/D49522
* ps(1): Consistent usage of Kbyte unitOlivier Cochard2025-03-261-2/+2
| | | | | | Approved by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49504
* pkill tests: Fix pkill usage in the pkill -x testMark Johnston2025-03-201-4/+4
| | | | | | | | | | The target process name(s) mark the beginning of the command's positional parameters, so the -P filter wasn't getting applied as intended. As a result, the second "pkill -x sleep -P $$" would kill all sleep(1) processes in the system, which can cause problems when running tests in parallel. MFC after: 2 weeks
* sh(1): Replace recommendation of use of -e with a noteMichael Osipov2025-03-081-6/+4
| | | | | | | | | This partially reverts b14cfdf665bb8b7b2898a4ee5b073ab87f8ea3d0 and has been discussed in D42719. Reviewed by: jrm (mentor), otis (mentor), mandree, ziaee (manpages) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45073
* sh.1: extend the section about getoptsPiotr Pawel Stefaniak2025-02-271-14/+46
| | | | | | | | | | Provide more details about the influence of optargs' first character on the shell's behavior in regard to invalid arguments. Also do some minor word-smithing. Original submission by rea@ Differential Revision: https://reviews.freebsd.org/D49106
* sh.1: document optional arguments to `:`Alexander Ziaee2025-02-241-3/+4
| | | | | | | | | | | TIL the `:` command accepts and discards arguments, and this is occasionally used to embed comments in interesting places. While here, fix another `...` argument that was not marked up. MFC after: 3 days Thanks: Community Discord Approved by: carlavilla, mhorne (mentors) Differential Revision: https://reviews.freebsd.org/D48398
* csh: Remove gethost dependency on tc.const.hEd Maste2025-02-091-1/+6
| | | | | | | | | | | | | | | | | gethost is a build tool built in stage 2.3, but it had a dependency on tc.const.h, which requires target headers (that are not installed until stage 4.1). The build falls back to the host's headers if the target headers don't yet exist, which may result in a build failure if the host's headers don't match the target. As gethost.c doesn't actually require the definitions in tc.const.h, add a hack to skip the include of tc.const.h and remove the dependency. PR: 283273 Reviewed by: imp Sponsored by: The FreeBSD Foundation Fixes: e754e5f36195 ("Upgrade to 6.10") Differential Revision: https://reviews.freebsd.org/D48880
* ls: --group-directories requires stat informationPiotr Pawel Stefaniak2025-01-221-4/+4
| | | | Fixes: 8b92977857f8
* kill.1: mention special meaning of PGID as a PIDartembunichev2025-01-191-0/+3
| | | | | PR: 284158 MFC after: 3 days
* kill.1: mention special PID 0artembunichev2025-01-191-0/+3
| | | | | PR: 284158 MFC after: 3 days
* ls.1: bump date after 82fa7f83b53b and 8b92977857f8Piotr Pawel Stefaniak2025-01-161-1/+1
|
* ls: implement --group-directories-first for compatibility with GNU lsPiotr Pawel Stefaniak2025-01-163-7/+51
| | | | | | | | | | | Also implement --group-directories which takes a parameter. "first" is equivalent to --group-directories-first, "last" gives reversed sorting. Changes in sorting between elements of the same type (files, directories) are not intended. Differential Revision: https://reviews.freebsd.org/D48347
* ls -lh: humanize the totalPiotr Pawel Stefaniak2025-01-162-1/+12
| | | | | | | | | | | | | | | | | | | Before this change, the total printed on the first line was always in blocks. Now the long format with -h will print the "humanized number" instead. `ls -sh` never provided sizes in anything other than blocks, total or individual, and this commit doesn't change that. The total number of blocks is a sum of fts_statp->st_blocks, so it's multiplied by 512 and not by blocksize. $ ls -lh /usr/bin | head -n 2 total 442 MB -r-xr-xr-x 1 root wheel 70B Dec 20 21:06 CC Differential Revision: https://reviews.freebsd.org/D48329
* ls: Release resources before returning from traverse()Mark Johnston2025-01-141-1/+4
| | | | | | PR: 278476 MFC after: 2 weeks Reported by: valgrind
* timeout(1): Add -v/--verbose option to show diagnosis infoGordon Bergling2025-01-042-7/+27
| | | | | | | | | | | | | The -v/--verbose option enables this utility to show diagnosis info to stderr about any signal sent on timeout. This implementation refers to GNU coreutils's timeout(1). Reviewed by: bapt, Alexander Ziaee (manpages) Approved by: bapt (src) Obtained from: DragonFlyBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48225
* timeout(1): Some minor tweaks and improvementsGordon Bergling2024-12-282-41/+60
| | | | | | | | | | | | | | | | - Define exit status and macros and use them - Improve the second kill logic by setting 'do_second_kill = false' after configuring the second kill - Minor style tweaks - Reorder options in the man page, as well as the usage help - Reorder the exit status in the man page - Enhance the HISTORY section in the man page (obtained from NetBSD) Reviewed by: bapt, Alexander Ziaee (manpages) Approved by: bapt (src) Obtained from: DragonFlyBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47866