summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* sh: Simplify find_command() slightly.jilles2014-05-311-7/+5
|
* sh: In getopts, unset OPTARG where POSIX says we should.jilles2014-05-104-13/+26
|
* sh: Add new tests to the Makefile.jilles2014-05-101-0/+2
|
* sh: Don't discard getopts state on unknown option or missing argument.jilles2014-05-103-8/+17
| | | | | | | When getopts finds an invalid option or a missing option-argument, it should not reset its state and should set OPTIND as normal. This is an old ash bug that was fixed long ago in dash. Our behaviour now matches most other shells.
* sh: Send getopts error messages to stderr, not stdout.jilles2014-05-092-3/+3
| | | | Adjust a testcase for this change.
* sh: Add more necessary INTOFF/INTON.jilles2014-05-092-0/+6
|
* Incorporate feedback from bde and jilles regarding r265472 to dd(1).asomers2014-05-083-15/+12
| | | | | | | | | | | | | | | * Don't use sysexits.h. Just exit 1 on error and 0 otherwise. * Don't sacrifice precision by converting the output of clock_gettime() to a double and then comparing the results. Instead, subtract the values of the two clock_gettime() calls, then convert to double. * Don't use CLOCK_MONOTONIC_PRECISE. It's an unportable synonym for CLOCK_MONOTONIC. * Use more appropriate names for some local variables. * In the summary message, round elapsed time to the nearest microsecond. Reported by: bde, jilles MFC after: 3 days X-MFC-With: 265472
* sh: Add some tests for normal use of getopts.jilles2014-05-074-0/+29
|
* (dd_out): Fix handling of all-zeroes block at end of input withthomas2014-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
* dd(1) uses gettimeofday(2) to compute the throughput statistics. However,asomers2014-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
* Use src.opts.mk in preference to bsd.own.mk except where we need stuffimp2014-05-0611-11/+11
| | | | from the latter.
* Minor comment fix: dbsz is the block size as set by bs/ibs/obs,thomas2014-05-031-1/+1
| | | | not the size of the buffer.
* Minor comment fix.thomas2014-05-031-1/+1
|
* Add -J to filter by matching jail IDs and names.bdrewery2014-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
* date(1): Forgot to update manpage date in r264968dumbbell2014-04-261-1/+1
| | | | | MFC after: 1 week MFC with: 264968
* date(1): Add "-R" flag to use RFC 2822 date and time output formatdumbbell2014-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.
* Bump Dd, missed as part of r264098 and related commits.gjb2014-04-131-1/+1
| | | | Sponsored by: The FreeBSD Foundation
* -k option is compliant with POSIX.grog2014-04-041-3/+1
|
* Typo.grog2014-04-031-1/+1
| | | | Reported by: Igor Sobrado.
* Make C_* contants fit in 32 bits again by using 4 unused bits.delphij2014-04-033-32/+32
| | | | Noticed by: bde
* Add information on standards compliance of many options.grog2014-04-031-5/+58
| | | | MFC after: 2 weeks
* Make -f set -a, as required by the standard.grog2014-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
* Implement GNU's extension of 'status' operand. The GNU syntax isdelphij2014-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
* sh: Fix memory leak with an assignment before a regular builtin.jilles2014-03-271-2/+8
| | | | MFC after: 1 week
* sh: Fix memory leak when trying to set a read only variable.jilles2014-03-271-1/+4
| | | | MFC after: 1 week
* Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to processdim2014-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
* sh: Fix possible memory leaks and double frees with unexpected SIGINT.jilles2014-03-265-14/+31
|
* sh: Don't overwrite old exit status if a PID is reused.jilles2014-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".
* Migrate tools/regression/usr.bin/pkill to the new tests layout.jmmv2014-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.
* 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.
OpenPOWER on IntegriCloud