summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* sh: Allow aliases to force alias substitution on the following word.jilles2014-01-268-3/+52
| | | | | | | | If an alias's value ends with a space or tab, the next word is also checked for aliases. This is a POSIX feature. It is useful with utilities like command and nohup (alias them to themselves followed by a space).
* Stop the options string leak if it is not attached into the optionskevlo2014-01-261-0/+2
| | | | | | linked list. Obtained from: OpenBSD
* sh: Add tests for alias names after another alias.jilles2014-01-253-0/+14
| | | | | Since the first alias's value does not end with a blank, the next word should not be checked for aliases.
* sh: Do not depend on parse/execute split in new alias test.jilles2014-01-241-1/+1
|
* sh: Solve the alias recursion problem in a less hackish way.jilles2014-01-245-48/+11
| | | | | | | | | Add the space to avoid alias recursion when the alias is expanded, not when it is added. As a result, displaying an alias via command -v, command -V or type no longer erroneously appends a space. Adjust the tests so they now require this bug to be absent.
* sh: Add test for nested alias.jilles2014-01-242-0/+7
|
* -h and -H options backwards in manual page.wblock2014-01-161-3/+3
| | | | | | PR: bin/183681 docs/183681 Submitted by: Robin Hahling <robin.hahling@gw-computing.net> MFC after: 3 days
* sh: Remove SIGWINCH handler and just check for resize before every read.jilles2014-01-143-23/+3
| | | | | | | | | | | | | The SIGWINCH handler triggers breakage in libedit which is hard to fix; see PR bin/169773. Also, window size changes while a program is in foreground (and it rather than sh will receive SIGWINCH) will now be picked up automatically. Downside: it is now certain that a resize is only processed after pressing <Enter>. If libedit is fixed, sh will most likely have to be changed also. PR: bin/180146
* Replace hand-crafted Kyuafiles with automatic generation.jmmv2014-01-144-26/+12
| | | | | | | | Redo r260506 by using the new TEST_METADATA functionality of bsd.test.mk to mark the sh(1) and test(1) tests as not supporting root. This is to get rid of hand-crafted Kyuafiles for these very simple cases. MFC after: 5 days
* Use TAP_TESTS_PERL to register the legacy_test in bin/pax.jmmv2014-01-143-11/+1
| | | | | | | | | | | | | | | Redo r260586 by using the new functionality in tap.test.mk to transparently support perl-based test programs. As a side-effect, we get rid of an explicit path to /usr/bin/perl by replacing it with /usr/local/bin/perl (or as defined in tap.test.mk). This also fixes the name of the legacy_test source file because this should have always been legacy_test.pl and not legacy_test.sh. My mistake when originally moving the code around without realizing that this was a perl script. MFC after: 5 days
* Mark the bin/pax tests as requiring perl.jmmv2014-01-132-0/+8
| | | | | | | The effect of this is that the test program is marked as skipped when perl is missing, instead of marking it as broken due to an execution failure. MFC after: 3 days
* Close the newly-created FD if the pathname is too long.adrian2014-01-111-0/+1
| | | | | Coverity: CID 1007204 Sponsored by: Netflix, Inc.
* Run the sh(1) and test(1) tests as unprivileged.jmmv2014-01-104-0/+26
| | | | | | | | | | | One of the tests for test(1) fails and some of the tests for sh(1) are silently bypassed when running as root. To fix these tests and ensure they all run, mark the test programs for sh(1) and test(1) as requiring an unprivileged user. (This should and will be the default in Kyua but isn't yet.) MFC after: 1 week
* sh(1): Discourage use of -e.jilles2014-01-031-2/+8
| | | | | Also, do not say that ! before a pipeline is an operator, because it is syntactically a keyword.
* Correct the description of the V state, which indicates that the process'markj2013-12-281-3/+4
| | | | | | parent is suspended, not the process itself. MFC after: 3 days
* sh: Don't check input for non-whitespace if history is disabled.jilles2013-12-271-8/+2
| | | | | | | | | | | preadbuffer() maintained a flag whether there was any non-whitespace character. This flag is only useful when history is enabled (in that case, lines containing only whitespace are not added to history). Instead, check using strspn() when history is enabled. There is an approximate 2% speedup when running sh -c '. /etc/rc.subr; . /etc/defaults/rc.conf; source_rc_confs' with hot cache.
* sh: Simplify code related to PPID variable.jilles2013-12-252-8/+2
|
* sh: Initialize OPTIND=1 even if it came from the environment.jilles2013-12-243-0/+5
|
* sh: Remove an unused variable.jilles2013-12-241-1/+0
|
* Document the lack of chflags support in pax(1)crees2013-12-211-1/+19
| | | | | | PR: docs/135516 Submitted by: arundel (based on) Approved by: gjb (mentor)
* Migrate tools/regression/bin/ tests to the new layout.jmmv2013-12-11420-2/+7331
| | | | | | | | | | | | | | | | | | | | This change is a proof of concept on how to easily integrate existing tests from the tools/regression/ hierarchy into the /usr/tests/ test suite and on how to adapt them to the new layout for src. To achieve these goals, this change: - Moves tests from tools/regression/bin/<tool>/ to bin/<tool>/tests/. - Renames the previous regress.sh files to legacy_test.sh. - Adds Makefiles to build and install the tests and all their supporting data files into /usr/tests/bin/. - Plugs the legacy_test test programs into the test suite using the new TAP backend for Kyua (appearing in 0.8) so that the code of the test programs does not have to change. - Registers the new directories in the BSD.test.dist mtree file. Reviewed by: freebsd-testing Approved by: rpaulo (mentor)
* sh: Split set -x output into a separate function.jilles2013-12-061-34/+41
|
* test: Avoid looking up again the type of a known binary operator.jilles2013-12-051-7/+6
|
* test: Simplify the code by unifying op_num and op_type.jilles2013-12-011-78/+75
| | | | The global variable t_wp_op is no longer needed.
* sh: Prefer memcpy() to strcpy() in most cases. Remove the scopy macro.jilles2013-11-308-27/+34
|
* sh: Make <&0 disable the </dev/null implicit in a background command.jilles2013-11-241-4/+5
| | | | | | Although <&0 does nothing, it is a redirection affecting standard input and should therefore disable the </dev/null redirection implicit in a background command.
* sh: Properly quote alias output from command -v.jilles2013-11-101-3/+5
| | | | | An alias should be printed by command -v as a command line; therefore, make the alias definition suitable for re-input to the shell.
* pkill - Optimize pgrep -Feadler2013-11-101-1/+4
| | | | | | | Ask for a specific process instead of pulling down all processes when -F <pidfile> is specified. This is much much faster. Obtained from: DragonflyBSD
* sh(1),limits(1): Document kqueues (-k) rlimit.jilles2013-11-011-2/+7
|
* sh: Reorder union node to reduce its size on 64-bit platforms.jilles2013-11-011-3/+3
|
* sh: Allow trapping SIGINT/SIGQUIT after ignore because of '&'.jilles2013-10-301-1/+3
| | | | | | | | | | | | | | If job control is not enabled, background jobs started with ... & ignore SIGINT and SIGQUIT so that they are not affected by such signals that are intended for the foreground job. However, this should not prevent reassigning a different action for these signals (as if the shell invocation inherited these signal actions from its parent). Austin group issue #751 Example: { trap - INT; exec sleep 10; } & wait A Ctrl+C should terminate the sleep command.
* Clean up a spurious "." in SEE ALSO.brueffer2013-10-281-1/+1
| | | | MFC after: 3 days
* Add a resource limit for the total number of kqueues available to thekib2013-10-211-1/+4
| | | | | | | | | | | | | | | | | | user. Kqueue now saves the ucred of the allocating thread, to correctly decrement the counter on close. Under some specific and not real-world use scenario for kqueue, it is possible for the kqueues to consume memory proportional to the square of the number of the filedescriptors available to the process. Limit allows administrator to prevent the abuse. This is kernel-mode side of the change, with the user-mode enabling commit following. Reported and tested by: pho Discussed with: jmg Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Don't test arrays for being NULL.trasz2013-10-211-7/+1
| | | | MFC after: 1 month
* sh: Remove one syscall when waiting for a foreground job.jilles2013-10-181-2/+1
| | | | | | The getpgrp() call is unnecessary: if there is no job control then the result was not used at all and if there is job control then we are not a subshell and our process group ID is equal to our process ID (rootpid).
* Remove extraneous \n.des2013-10-111-1/+1
| | | | | | Noticed by: Nikolai Lifanov <lifanov@mail.lifanov.com> Approved by: re (gjb)
* By popular demand, move freebsd-version(1) from /libexec to /bin.des2013-10-094-0/+271
| | | | Approved by: re (gjb)
* Remove useless check - ki_loginclass is an array; can't be NULL.trasz2013-10-041-1/+0
| | | | | | | CID: 1006559 Approved by: re (kib) MFC after: 2 weeks Sponsored by: FreeBSD Foundation
* Sweep man pages replacing ad -> ada.pluknet2013-10-011-3/+3
| | | | | | Approved by: re (blackend) MFC after: 1 week X-MFC note: stable/9 only
* sh: Make return return from the closest function or dot script.jilles2013-09-044-15/+10
| | | | | | | | | | | | | Formerly, return always returned from a function if it was called from a function, even if there was a closer dot script. This was for compatibility with the Bourne shell which only allowed returning from functions. Other modern shells and POSIX return from the function or the dot script, whichever is closest. Git 1.8.4's rebase --continue depends on the POSIX behaviour. Reported by: Christoph Mallon, avg
* sh: Fix race condition with signals and wait or set -T.jilles2013-09-024-31/+20
| | | | | | | | | | The change in r238888 was incomplete. It was still possible for a trapped signal to arrive before the shell went to sleep (sigsuspend()) because a check was missing or because the signal arrived before in_waitcmd was set. On SMP, this bug sometimes caused the builtins/wait4.0 test to take 1 second to execute; it then might or might not fail. On UP, the test almost always failed.
* sh: Simplify list() in the parser.jilles2013-08-301-21/+22
| | | | | | The erflag argument was only used by old-style (``) command substitutions. We can remove it and handle the special case in the command substitution code.
* sh: Separate out nbinary allocation into a function.jilles2013-08-301-21/+22
|
* sh: Use makename() where possible.jilles2013-08-301-22/+5
|
* sh: Add a function for the case where one token is required in the parse.jilles2013-08-301-31/+23
|
* sh: Recognize "--" as end of options in type builtin.jilles2013-08-301-0/+2
| | | | | This implementation makes minimal changes: command names starting with "-" (other than "--") can still be queried normally.
* sh: Cast -1 to pointer rather than pointer to variable of wrong type.jilles2013-08-302-5/+3
| | | | | | | | | | NEOF needs to be a non-null pointer distinct from valid union node pointers. It is not dereferenced. The new NEOF is much like SIG_ERR except that it is an object pointer instead of a function pointer. The variable tokpushback can now be static.
* Add the ability to display the default FIB number for a process to thewill2013-08-262-0/+4
| | | | | | | | | | | | | | | | | | ps(1) utility, e.g. "ps -O fib". bin/ps/keyword.c: Add the "fib" keyword and default its column name to "FIB". bin/ps/ps.1: Add "fib" as a supported keyword. sys/compat/freebsd32/freebsd32.h: sys/kern/kern_proc.c: sys/sys/user.h: Add the default fib number for a process (p->p_fibnum) to the user land accessible process data of struct kinfo_proc. Submitted by: Oliver Fromme <olli@fromme.com>, gibbs
* sh: Recognize "--" as end of options in alias builtin.jilles2013-08-251-3/+5
| | | | | Aliases starting with "-" (which are non-POSIX) will need to be preceded by an alias not starting with "-" or the newly added "--".
* sh: Disallow empty simple commands.jilles2013-08-251-8/+4
| | | | | | | | | | As per POSIX, a simple command must have at least one redirection, assignment word or command word. These occured in rare cases such as eval "f()" . The extension of allowing no commands inside { }, if, while, for, etc. remains.
OpenPOWER on IntegriCloud