aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* (dd_out): Fix handling of all-zeroes block at end of input withThomas Quinot2014-05-071-24/+43
| | | | | | | | | | | | | | | | | | | | | | | | conv=sparse. This change fixes two separate issues observed when the last output block is all zeroes, and conv=sparse is in use. In this case, care must be taken to roll back the last seek and write the entire last zero block at the original offset where it should have occurred: when the destination file is a block device, it is not possible to roll back by just one character as the write would then not be properly aligned. Furthermore, the buffer used to write this last all-zeroes block needs to be properly zeroed-out. This was not the case previously, resulting in a junk data byte appearing instead of a zero in the output stream. PR: bin/189174 PR: bin/189284 Reviewed by: kib MFC after: 2 weeks Notes: svn path=/head/; revision=265593
* dd(1) uses gettimeofday(2) to compute the throughput statistics. However,Alan Somers2014-05-062-12/+20
| | | | | | | | | | | | | | | | | | gettimeofday returns the system clock, which may jump forward or back, especially if NTP is in use. If the time jumps backwards, then dd will see negative elapsed time, round it up to 1usec, and print an absurdly fast transfer rate. The solution is to use clock_gettime(2) with CLOCK_MONOTONIC_PRECISE as the clock_id. That clock advances steadily, regardless of changes to the system clock. Reviewed by: delphij MFC after: 3 days Sponsored by: Spectra Logic Notes: svn path=/head/; revision=265472
* Use src.opts.mk in preference to bsd.own.mk except where we need stuffWarner Losh2014-05-0611-11/+11
| | | | | | | from the latter. Notes: svn path=/head/; revision=265420
* Minor comment fix: dbsz is the block size as set by bs/ibs/obs,Thomas Quinot2014-05-031-1/+1
| | | | | | | not the size of the buffer. Notes: svn path=/head/; revision=265258
* Minor comment fix.Thomas Quinot2014-05-031-1/+1
| | | | Notes: svn path=/head/; revision=265257
* Add -J to filter by matching jail IDs and names.Bryan Drewery2014-05-023-7/+62
| | | | | | | | | | | | | -J 0 can be used to show only host processes. Patch partially based on work by bz@ PR: bin/78763 MFC after: 2 weeks Relnotes: yes Notes: svn path=/head/; revision=265229
* date(1): Forgot to update manpage date in r264968Jean-Sébastien Pédron2014-04-261-1/+1
| | | | | | | | MFC after: 1 week MFC with: 264968 Notes: svn path=/head/; revision=264970
* date(1): Add "-R" flag to use RFC 2822 date and time output formatJean-Sébastien Pédron2014-04-262-6/+32
| | | | | | | | | | As stated in the man page, this is equivalent to use "%a, %d %b %Y %T %z" as the output format while LC_TIME is set to the "C" locale. This is compatible with date(1) from the GNU core utilities. Notes: svn path=/head/; revision=264968
* Bump Dd, missed as part of r264098 and related commits.Glen Barber2014-04-131-1/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=264393
* -k option is compliant with POSIX.Greg Lehey2014-04-041-3/+1
| | | | Notes: svn path=/head/; revision=264098
* Typo.Greg Lehey2014-04-031-1/+1
| | | | | | | Reported by: Igor Sobrado. Notes: svn path=/head/; revision=264093
* Make C_* contants fit in 32 bits again by using 4 unused bits.Xin LI2014-04-033-32/+32
| | | | | | | Noticed by: bde Notes: svn path=/head/; revision=264067
* Add information on standards compliance of many options.Greg Lehey2014-04-031-5/+58
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=264066
* Make -f set -a, as required by the standard.Greg Lehey2014-04-032-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | From the original OpenBSD commit message: restore the traditional behavior of -f implying -a; apparently Keith Bostic forgot to restore it when the -f flag was put back on 2nd of September 1989, after being removed on 16th of August as a consequence of issues getting it working over NFS, so deviation from traditional UNIX behavior in all BSDs looks like an historical accident; as a side effect, this change accommodates behavior of this option to IEEE Std 1003.1-2008 (``POSIX.1''). joint work with jmc@ (who found the inaccuracy in our implementation), schwarze@ (who provided a detailed tracking of historical facts) and millert@ Submitted by: Igor Sobrado Discussed with: mckusick Obtained from: OpenBSD project MFC after: 2 weeks Notes: svn path=/head/; revision=264064
* Implement GNU's extension of 'status' operand. The GNU syntax isXin LI2014-04-036-34/+69
| | | | | | | | | | | | | | | borrowed where syntax status=noxfer means no transfer statistics and status=none means no status information at all. This feature is useful because the statistics information can sometimes be annoying, and redirecting stderr to /dev/null would mean error messages also gets silenced. Obtained from: OpenBSD MFC after: 2 weeks Notes: svn path=/head/; revision=264059
* sh: Fix memory leak with an assignment before a regular builtin.Jilles Tjoelker2014-03-271-2/+8
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=263847
* sh: Fix memory leak when trying to set a read only variable.Jilles Tjoelker2014-03-271-1/+4
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=263846
* Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to processDimitry Andric2014-03-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | all the SUBDIR entries in parallel, instead of serially. Apply this option to a selected number of Makefiles, which can greatly speed up the build on multi-core machines, when using make -j. This can be extended to more Makefiles later on, whenever they are verified to work correctly with parallel building. I tested this on a 24-core machine, with make -j48 buildworld (N = 6): before stddev after stddev ======= ====== ======= ====== real time 1741.1 16.5 959.8 2.7 user time 12468.7 16.4 14393.0 16.8 sys time 1825.0 54.8 2110.6 22.8 (user+sys)/real 8.2 17.1 E.g. the build was approximately 45% faster in real time. On machines with less cores, or with lower -j settings, the speedup will not be as impressive. But at least you can now almost max out a machine with buildworld! Submitted by: jilles MFC after: 2 weeks Notes: svn path=/head/; revision=263778
* sh: Fix possible memory leaks and double frees with unexpected SIGINT.Jilles Tjoelker2014-03-265-14/+31
| | | | Notes: svn path=/head/; revision=263777
* sh: Don't overwrite old exit status if a PID is reused.Jilles Tjoelker2014-03-201-1/+2
| | | | | | | | | | | | Only store exit status for a process if that process has not terminated yet. Test (slow): exit 7 & p1=$!; until exit 8 & p2=$!; [ "$p1" = "$p2" ]; do wait "$p2"; done; sleep 0.1; wait %1; echo $? should write "7". Notes: svn path=/head/; revision=263453
* Migrate tools/regression/usr.bin/pkill to the new tests layout.Julio Merino2014-03-1930-0/+1053
| | | | | | | | | Interestingly, the pkill tool lives in bin, not usr.bin. Haven't bothered to check if this is because the tool moved or because the tests were originally added in the wrong place. Notes: svn path=/head/; revision=263351
* sh: Allow kill %job on jobs started without job control.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=263206
* sh: Add some consts.Jilles Tjoelker2014-03-143-11/+11
| | | | Notes: svn path=/head/; revision=263195
* Make bsd.test.mk the only public mk fragment for the building of tests.Julio Merino2014-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. Notes: svn path=/head/; revision=263161
* sh: Successfully do nothing when killing a terminated job.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=262931
* sh: Make argstr() return where it stopped and simplify expari() using this.Jilles Tjoelker2014-03-041-21/+5
| | | | Notes: svn path=/head/; revision=262755
* sh: Simplify expari().Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=262697
* sh: Do not corrupt internal representation if LINENO inner expansion fails.Jilles Tjoelker2014-02-273-6/+17
| | | | | | | | | Example: f() { : ${LINENO+$((1/0))}; } and call this function twice. Notes: svn path=/head/; revision=262565
* sh: Make expari() static.Jilles Tjoelker2014-02-262-2/+2
| | | | Notes: svn path=/head/; revision=262533
* sh: Add -h option to SYNOPSISDaichi GOTO2014-02-251-3/+3
| | | | | | | | Reviewed by: jilles MFC after: soon Notes: svn path=/head/; revision=262467
* sh: Allow aliases to force alias substitution on the following word.Jilles Tjoelker2014-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). Notes: svn path=/head/; revision=261192
* Stop the options string leak if it is not attached into the optionsKevin Lo2014-01-261-0/+2
| | | | | | | | | linked list. Obtained from: OpenBSD Notes: svn path=/head/; revision=261181
* sh: Add tests for alias names after another alias.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=261160
* sh: Do not depend on parse/execute split in new alias test.Jilles Tjoelker2014-01-241-1/+1
| | | | Notes: svn path=/head/; revision=261141
* sh: Solve the alias recursion problem in a less hackish way.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=261125
* sh: Add test for nested alias.Jilles Tjoelker2014-01-242-0/+7
| | | | Notes: svn path=/head/; revision=261121
* -h and -H options backwards in manual page.Warren Block2014-01-161-3/+3
| | | | | | | | | PR: bin/183681 docs/183681 Submitted by: Robin Hahling <robin.hahling@gw-computing.net> MFC after: 3 days Notes: svn path=/head/; revision=260782
* sh: Remove SIGWINCH handler and just check for resize before every read.Jilles Tjoelker2014-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 Notes: svn path=/head/; revision=260654
* Replace hand-crafted Kyuafiles with automatic generation.Julio Merino2014-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 Notes: svn path=/head/; revision=260635
* Use TAP_TESTS_PERL to register the legacy_test in bin/pax.Julio Merino2014-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 Notes: svn path=/head/; revision=260634
* Mark the bin/pax tests as requiring perl.Julio Merino2014-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 Notes: svn path=/head/; revision=260586
* Close the newly-created FD if the pathname is too long.Adrian Chadd2014-01-111-0/+1
| | | | | | | | Coverity: CID 1007204 Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=260544
* Run the sh(1) and test(1) tests as unprivileged.Julio Merino2014-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 Notes: svn path=/head/; revision=260506
* sh(1): Discourage use of -e.Jilles Tjoelker2014-01-031-2/+8
| | | | | | | | Also, do not say that ! before a pipeline is an operator, because it is syntactically a keyword. Notes: svn path=/head/; revision=260246
* Correct the description of the V state, which indicates that the process'Mark Johnston2013-12-281-3/+4
| | | | | | | | | parent is suspended, not the process itself. MFC after: 3 days Notes: svn path=/head/; revision=259995
* sh: Don't check input for non-whitespace if history is disabled.Jilles Tjoelker2013-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. Notes: svn path=/head/; revision=259946
* sh: Simplify code related to PPID variable.Jilles Tjoelker2013-12-252-8/+2
| | | | Notes: svn path=/head/; revision=259874
* sh: Initialize OPTIND=1 even if it came from the environment.Jilles Tjoelker2013-12-243-0/+5
| | | | Notes: svn path=/head/; revision=259846
* sh: Remove an unused variable.Jilles Tjoelker2013-12-241-1/+0
| | | | Notes: svn path=/head/; revision=259844
* Document the lack of chflags support in pax(1)Chris Rees2013-12-211-1/+19
| | | | | | | | | PR: docs/135516 Submitted by: arundel (based on) Approved by: gjb (mentor) Notes: svn path=/head/; revision=259695