summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* Fix pkill unit tests.rodrigc2014-09-302-53/+106
| | | | | | | - use daemon(8) to write out a pid file for processes, and check for for the existence of that file after killing processes - use explict named parameters to jail(8)
* sh(1): Clarify that assignments before commands do not affect expansions.jilles2014-09-211-2/+3
| | | | | PR: 193759 MFC after: 1 week
* Fix incremental builds involving non-root users with read-only source files.will2014-09-181-1/+1
| | | | | | | | | | | Makefiles should not assume that source files can be overwritten. This is the common case for Perforce source trees. This is a followup commit to r211243 in the same vein. MFC after: 1 month Sponsored by: Spectra Logic MFSpectraBSD: r1036319 on 2014/01/29, r1046711 on 2014/03/06
* sh: Remove arbitrary length limit on << EOF markers.jilles2014-09-145-49/+65
| | | | This also simplifies the code.
* sh: Make checkend() a real function instead of an emulated nested function.jilles2014-09-141-36/+39
| | | | | No functional change is intended, but the generated code is slightly different.
* sh: Add some const keywords.jilles2014-09-143-3/+3
|
* sh: Allow enabling job control without a tty in non-interactive mode.jilles2014-09-042-14/+47
| | | | | If no tty is available, 'set -m' is still useful to put jobs in their own process groups.
* Update the date for last example.imp2014-08-301-1/+1
| | | | Sponsored by: Netflix
* Add canonical population of a disk / thumb drive from an imageimp2014-08-281-0/+5
| | | | example.
* Return real parent pid in kinfo (used by e.g. ps)mjg2014-08-282-1/+4
| | | | | | | | | | | Add a separate field which exports tracer pid and add a new keyword ("tracer") for ps to display it. This is a follow up to r270444. Reviewed by: kib MFC after: 1 week Relnotes: yes
* Always check the limits of array index variables before using them.pfg2014-08-211-1/+1
| | | | | Obtained from: DragonFlyBSD MFC after: 1 week
* sh: Remove two redundant (uintmax_t) casts.jilles2014-08-201-3/+2
| | | | Submitted by: jmallett
* Revert r267233 for now. PIE support needs to be reworked.bdrewery2014-08-191-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | 1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other build-only utility libraries. 2. Another 40% is fixed by generating _pic.a variants of various libraries. 3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR) where it never would work anyhow, such as csu or loader. This suggests there may be better ways of adding support to the tree. Many of these cases can be fixed such that -fPIE will work but there is really no reason to have it in those cases. 4. Some of the uses are working around hacks done to some Makefiles that are really building libraries but have been using bsd.prog.mk because the code is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have been needed. We likely do want to enable PIE by default (opt-out) for non-tree consumers (such as ports). For in-tree though we probably want to only enable PIE (opt-in) for common attack targets such as remote service daemons and setuid utilities. This is also a great performance compromise since ASLR is expected to reduce performance. As such it does not make sense to enable it in all utilities such as ls(1) that have little benefit to having it enabled. Reported by: kib
* sh: Avoid overflow in atoi() when parsing HISTSIZE.jilles2014-08-171-2/+3
| | | | | Side effect: a non-numeric HISTSIZE now results in the default size (100) instead of 0.
* sh: Reject integer overflow in number and is_number.jilles2014-08-171-3/+11
|
* sh: Don't hardcode relative paths in the tests stderr files.jilles2014-08-1711-17/+11
| | | | | | | | These paths have had to be adjusted to changes in the testsuite runner several times, so modify the tests to remove the need for such adjustment. A cp in functional_test.sh is now unneeded, but this matters little in performance.
* sh: Mask off shift distance (<< and >>) in arithmetic.jilles2014-08-153-2/+44
| | | | | | | | | | | In C, shift distances equal to or larger than the number of bits in the operand result in undefined behaviour. As part of eliminating undefined behaviour in arithmetic, mask off the distance like Java and JavaScript specify and C on x86 usually does. Assumption: conversion from unsigned to signed retains the two's complement bits. Assumption: uintmax_t has no padding bits.
* Skip pgrep-j and pkill-j if jail or jls is not installed.asomers2014-08-141-0/+2
| | | | | | | | | | Even though jail is part of the base system, it can be disabled by src.conf settings. Therefore, it should be listed as a required program for tests that use it. CR: D603 MFC after: 3 days Sponsored by: Spectra Logic
* Port date/bin/tests to ATFngie2014-08-133-92/+93
| | | | | | | | | Phabric: D545 Approved by: jmmv (mentor) Submitted by: keramida (earlier version) MFC after: 2 weeks Sponsored by: Google, Inc Sponsored by: EMC / Isilon Storage Division
* Convert bin/sh/tests to ATFngie2014-08-1315-82/+127
| | | | | | | | | | | | | The new code uses a "test discovery mechanism" to determine what tests are available for execution The test shell can be specified via: kyua test -v test_suites.FreeBSD.bin.sh.test_shell=/path/to/test/sh Sponsored by: EMC / Isilon Storage Division Approved by: jmmv (mentor) Reviewed by: jilles (maintainer)
* Correct the problems with the ptrace(2) making the debuggee an orphan.kib2014-08-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | One problem is inferior(9) looping due to the process tree becoming a graph instead of tree if the parent is traced by child. Another issue is due to the use of p_oppid to restore the original parent/child relationship, because real parent could already exited and its pid reused (noted by mjg). Add the function proc_realparent(9), which calculates the parent for given process. It uses the flag P_TREE_FIRST_ORPHAN to detect the head element of the p_orphan list and than stepping back to its container to find the parent process. If the parent has already exited, the init(8) is returned. Move the P_ORPHAN and the new helper flag from the p_flag* to new p_treeflag field of struct proc, which is protected by proctree lock instead of proc lock, since the orphans relationship is managed under the proctree_lock already. The remaining uses of p_oppid in ptrace(PT_DETACH) and process reapping are replaced by proc_realparent(9). Phabric: D417 Reviewed by: jhb Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* sh: Allow arbitrarily large numbers in break and continue.jilles2014-07-203-1/+18
| | | | The argument is capped to loopnest, so strtol()'s [ERANGE] can be ignored.
* sh: Remove prefix() function. Use strncmp() instead.jilles2014-07-204-18/+5
|
* sh: Deduplicate some code in ulimit builtin.jilles2014-07-191-27/+25
|
* Replace all uses of libncurses and libtermcap with their wide characterbrooks2014-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
* sh: Correctly handle positional parameters beyond INT_MAX on 64-bit systems.jilles2014-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.
* sh: Consistently treat ${01} like $1.jilles2014-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.
* sh: Add test for ${01} and ${010} that already works.jilles2014-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.
* Don't install locale1.0 if MK_NLS == no.jilles2014-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
* rm -rf can fail sometimes with an error from fts_read. Make it honorimp2014-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.
* sh: Fix overflow checking on 'ulimit' operand.jilles2014-07-051-10/+14
|
* Check if fchflags() is needed by fstat'ing before and checkdelphij2014-07-011-4/+13
| | | | | | | the results. Reviewed by: jilles X-MFC-With: r267977
* Always set UF_ARCHIVE on target (because they are by definition new filesdelphij2014-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
* use .Mt to mark up email addresses consistently (part1)bapt2014-06-204-10/+7
| | | | | PR: 191174 Submitted by: Franco Fichtner <franco@lastsummer.de>
* mdoc: remove superfluous paragraph macros.joel2014-06-152-3/+0
|
* In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.bdrewery2014-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]
* Add support for inspecting process flags set in p_flag2.pluknet2014-06-062-1/+15
| | | | | Reviewed by: jhb MFC after: 1 week
* When building picobsd, define WITHOUT_OPENSSL and WITHOUT_KERBEROS andimp2014-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.
* sh: Avoid undefined behaviour shifting negative values left in arithmetic.jilles2014-06-011-1/+1
| | | | With i386 base clang, arith_yacc.o remains unchanged.
* 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.
OpenPOWER on IntegriCloud