summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* sh: Allow kill %job on jobs started without job control.jilles2014-03-155-17/+30
| | | | | | | | When killing a %job started without job control, kill all processes in it. As with process groups and zombies, if any process in the job can be killed or has already terminated, the command is successful. This also fixes occasional failures of the builtins/kill1.0 test.
* sh: Add some consts.jilles2014-03-143-11/+11
|
* Make bsd.test.mk the only public mk fragment for the building of tests.jmmv2014-03-145-5/+5
| | | | | | | | | | | | | | Change {atf,plain,tap}.test.mk to be internal implementation details of bsd.test.mk. Makefiles that build tests should now only include bsd.test.mk and declaratively specify what they want to build, without worrying about the internal implementation of the mk files. The reason for this change is to permit building test programs of different interfaces from a single directory, which is something I had a need for while porting tests over from src/tools/regression/. Additionally, this change makes it possible to perform some other requested changes to bsd.test.mk in an easier manner. Coming soon.
* sh: Successfully do nothing when killing a terminated job.jilles2014-03-084-2/+19
| | | | | | If a job has terminated but is still known, silently do nothing when using the kill builtin with the job specifier. Formerly, the shell called kill() with the process group ID that might have been reused.
* sh: Make argstr() return where it stopped and simplify expari() using this.jilles2014-03-041-21/+5
|
* sh: Simplify expari().jilles2014-03-021-48/+46
| | | | | | | | | Redo expari() like evalvar(). This makes the logic more understandable and avoids possible problems if arithmetic expansion occurs if CTLESC characters are not generated (looking backwards for CTLARI is not generally possible in that case but the old code tried anyway). This adds an extra argstr() recursion.
* sh: Do not corrupt internal representation if LINENO inner expansion fails.jilles2014-02-273-6/+17
| | | | | | Example: f() { : ${LINENO+$((1/0))}; } and call this function twice.
* sh: Make expari() static.jilles2014-02-262-2/+2
|
* sh: Add -h option to SYNOPSISdaichi2014-02-251-3/+3
| | | | | Reviewed by: jilles MFC after: soon
* 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.
OpenPOWER on IntegriCloud