aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* sh: Fix break/continue/return in multiline eval.Jilles Tjoelker2014-10-124-0/+20
| | | | | | | | Example: eval $'return\necho bad' Notes: svn path=/head/; revision=272983
* Integrate bin/sleep/tests from NetBSD into atf/kyuaEnji Cooper2014-10-092-0/+18
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=272782
* sh: Eliminate some gotos.Jilles Tjoelker2014-10-055-56/+43
| | | | Notes: svn path=/head/; revision=272575
* sh: Fix LINENO and prompt after $'\0 and newline.Jilles Tjoelker2014-10-034-0/+16
| | | | Notes: svn path=/head/; revision=272482
* Fix pkill unit tests.Craig Rodrigues2014-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) Notes: svn path=/head/; revision=272305
* sh(1): Clarify that assignments before commands do not affect expansions.Jilles Tjoelker2014-09-211-2/+3
| | | | | | | | PR: 193759 MFC after: 1 week Notes: svn path=/head/; revision=271936
* Fix incremental builds involving non-root users with read-only source files.Will Andrews2014-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 Notes: svn path=/head/; revision=271771
* sh: Remove arbitrary length limit on << EOF markers.Jilles Tjoelker2014-09-145-49/+65
| | | | | | | This also simplifies the code. Notes: svn path=/head/; revision=271593
* sh: Make checkend() a real function instead of an emulated nested function.Jilles Tjoelker2014-09-141-36/+39
| | | | | | | | No functional change is intended, but the generated code is slightly different. Notes: svn path=/head/; revision=271592
* sh: Add some const keywords.Jilles Tjoelker2014-09-143-3/+3
| | | | Notes: svn path=/head/; revision=271590
* sh: Allow enabling job control without a tty in non-interactive mode.Jilles Tjoelker2014-09-042-14/+47
| | | | | | | | If no tty is available, 'set -m' is still useful to put jobs in their own process groups. Notes: svn path=/head/; revision=271144
* Update the date for last example.Warner Losh2014-08-301-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=270831
* Add canonical population of a disk / thumb drive from an imageWarner Losh2014-08-281-0/+5
| | | | | | | example. Notes: svn path=/head/; revision=270771
* Return real parent pid in kinfo (used by e.g. ps)Mateusz Guzik2014-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 Notes: svn path=/head/; revision=270745
* Always check the limits of array index variables before using them.Pedro F. Giffuni2014-08-211-1/+1
| | | | | | | | Obtained from: DragonFlyBSD MFC after: 1 week Notes: svn path=/head/; revision=270256
* sh: Remove two redundant (uintmax_t) casts.Jilles Tjoelker2014-08-201-3/+2
| | | | | | | Submitted by: jmallett Notes: svn path=/head/; revision=270246
* Revert r267233 for now. PIE support needs to be reworked.Bryan Drewery2014-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 Notes: svn path=/head/; revision=270168
* sh: Avoid overflow in atoi() when parsing HISTSIZE.Jilles Tjoelker2014-08-171-2/+3
| | | | | | | | Side effect: a non-numeric HISTSIZE now results in the default size (100) instead of 0. Notes: svn path=/head/; revision=270113
* sh: Reject integer overflow in number and is_number.Jilles Tjoelker2014-08-171-3/+11
| | | | Notes: svn path=/head/; revision=270102
* sh: Don't hardcode relative paths in the tests stderr files.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=270101
* sh: Mask off shift distance (<< and >>) in arithmetic.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=270029
* Skip pgrep-j and pkill-j if jail or jls is not installed.Alan Somers2014-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 Notes: svn path=/head/; revision=269977
* Port date/bin/tests to ATFEnji Cooper2014-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 Notes: svn path=/head/; revision=269903
* Convert bin/sh/tests to ATFEnji Cooper2014-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) Notes: svn path=/head/; revision=269902
* Correct the problems with the ptrace(2) making the debuggee an orphan.Konstantin Belousov2014-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 Notes: svn path=/head/; revision=269656
* 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