summaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* sh: Allow arbitrarily large numbers in break and continue.Jilles Tjoelker2014-07-203-1/+18
| | | | | | | The argument is capped to loopnest, so strtol()'s [ERANGE] can be ignored. Notes: svn path=/head/; revision=268927
* sh: Remove prefix() function. Use strncmp() instead.Jilles Tjoelker2014-07-204-18/+5
| | | | Notes: svn path=/head/; revision=268920
* sh: Deduplicate some code in ulimit builtin.Jilles Tjoelker2014-07-191-27/+25
| | | | Notes: svn path=/head/; revision=268873
* Replace all uses of libncurses and libtermcap with their wide characterBrooks Davis2014-07-173-6/+6
| | | | | | | | | | | | | variants. This allows usable file system images (i.e. those with both a shell and an editor) to be created with only one copy of the curses library. Exp-run: antoine PR: 189842 Discussed with: bapt Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=268804
* sh: Correctly handle positional parameters beyond INT_MAX on 64-bit systems.Jilles Tjoelker2014-07-123-2/+19
| | | | | | | | | | | | | | | | Currently, there can be no more than INT_MAX positional parameters. Make sure to treat all higher ones as unset to avoid incorrect results and crashes. On 64-bit systems, our atoi() takes the low 32 bits of the strtol() and sign-extends them. On 32-bit systems, the call to atoi() returned INT_MAX for too high values and there is not enough address space for so many positional parameters, so there was no issue. Notes: svn path=/head/; revision=268576
* sh: Consistently treat ${01} like $1.Jilles Tjoelker2014-07-123-7/+11
| | | | | | | | Leading zeroes were ignored when checking whether a positional parameter is set, but not when expanding its value. Ignore leading zeroes in any case. Notes: svn path=/head/; revision=268568
* sh: Add test for ${01} and ${010} that already works.Jilles Tjoelker2014-07-082-0/+5
| | | | | | | | | | | Although it is probably unwise to use this, POSIX is clear that leading zeroes are permitted in positional parameters (and do not indicate octal). Such positional parameters are checked for being unset and/or null correctly, but their value is incorrectly expanded. Notes: svn path=/head/; revision=268436
* Don't install locale1.0 if MK_NLS == no.Jilles Tjoelker2014-07-081-0/+2
| | | | | | | | | | | | | | | The test locale1.0 depends on locale support; it is meaningless without a working LC_MESSAGES. I added an OptionalObsoleteFiles.inc entry. PR: 181151 Submitted by: Garrett Cooper (original version) MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=268429
* rm -rf can fail sometimes with an error from fts_read. Make it honorWarner Losh2014-07-071-1/+1
| | | | | | | | | | | | | | | | fflag to ignore fts_read errors, but stop deleting from that directory because no further progress can be made. When building a kernel with a high -j value on a high core count machine, during the cleanobj phase we can wind up doing multiple rm -rf at the same time for modules that have subdirectories. This exposed this race (sometimes) as fts_read can return an error if the directory is removed by another rm -rf. Since the intent of the -f flag was to ignore errors, even if this was a bug in fts_read, we should ignore the error like we've been instructed to do. Notes: svn path=/head/; revision=268376
* sh: Fix overflow checking on 'ulimit' operand.Jilles Tjoelker2014-07-051-10/+14
| | | | Notes: svn path=/head/; revision=268304
* Check if fchflags() is needed by fstat'ing before and checkXin LI2014-07-011-4/+13
| | | | | | | | | | the results. Reviewed by: jilles X-MFC-With: r267977 Notes: svn path=/head/; revision=268129
* Always set UF_ARCHIVE on target (because they are by definition new filesXin LI2014-06-271-2/+2
| | | | | | | | | | and should be archived) and ignore error when we can't set it (e.g. NFS). Reviewed by: ken MFC after: 2 weeks Notes: svn path=/head/; revision=267977
* use .Mt to mark up email addresses consistently (part1)Baptiste Daroussin2014-06-204-10/+7
| | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco@lastsummer.de> Notes: svn path=/head/; revision=267667
* mdoc: remove superfluous paragraph macros.Joel Dahl2014-06-152-3/+0
| | | | Notes: svn path=/head/; revision=267505
* In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.Bryan Drewery2014-06-081-0/+2
| | | | | | | | | | | | | | | | | | | This is currently an opt-in build flag. Once ASLR support is ready and stable it should changed to opt-out and be enabled by default along with ASLR. Each application Makefile uses opt-out to ensure that ASLR will be enabled by default in new directories when the system is compiled with PIE/ASLR. [2] Mark known build failures as NO_PIE for now. The only known runtime failure was rtld. [1] http://www.bsdcan.org/2014/schedule/events/452.en.html Submitted by: Shawn Webb <lattera@gmail.com> Discussed between: des@ and Shawn Webb [2] Notes: svn path=/head/; revision=267233
* Add support for inspecting process flags set in p_flag2.Sergey Kandaurov2014-06-062-1/+15
| | | | | | | | Reviewed by: jhb MFC after: 1 week Notes: svn path=/head/; revision=267196
* When building picobsd, define WITHOUT_OPENSSL and WITHOUT_KERBEROS andWarner Losh2014-06-061-3/+1
| | | | | | | | | | | | remove the now-redundant checks for RELEASE_CRUNCH. This originally was defined for building smaller sysinstall images, but was later also used by picobsd builds for a similar purpose. Now that we've moved away from sysinstall, picobsd is the only remaining consumer of this interface. Adding these two options reduces the RELEASE_CRUNCH special cases in the tree by half. Notes: svn path=/head/; revision=267147
* sh: Avoid undefined behaviour shifting negative values left in arithmetic.Jilles Tjoelker2014-06-011-1/+1
| | | | | | | With i386 base clang, arith_yacc.o remains unchanged. Notes: svn path=/head/; revision=266947
* sh: Simplify find_command() slightly.Jilles Tjoelker2014-05-311-7/+5
| | | | Notes: svn path=/head/; revision=266932
* sh: In getopts, unset OPTARG where POSIX says we should.Jilles Tjoelker2014-05-104-13/+26
| | | | Notes: svn path=/head/; revision=265849
* sh: Add new tests to the Makefile.Jilles Tjoelker2014-05-101-0/+2
| | | | Notes: svn path=/head/; revision=265846
* sh: Don't discard getopts state on unknown option or missing argument.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=265844
* sh: Send getopts error messages to stderr, not stdout.Jilles Tjoelker2014-05-092-3/+3
| | | | | | | Adjust a testcase for this change. Notes: svn path=/head/; revision=265773
* sh: Add more necessary INTOFF/INTON.Jilles Tjoelker2014-05-092-0/+6
| | | | Notes: svn path=/head/; revision=265772
* Incorporate feedback from bde and jilles regarding r265472 to dd(1).Alan Somers2014-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 Notes: svn path=/head/; revision=265698
* sh: Add some tests for normal use of getopts.Jilles Tjoelker2014-05-074-0/+29
| | | | Notes: svn path=/head/; revision=265616
* (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