summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
...
* sh: Prepend "$0: " to error messages if there is no command name.jilles2014-11-222-0/+4
|
* sh: Use DQSYNTAX only while expanding, not SQSYNTAX.jilles2014-11-221-1/+1
| | | | | Quoting during expansion only cares about CCTL, which is the same for DQSYNTAX and SQSYNTAX.
* sh(1): Add/improve information about exit status of commands.jilles2014-11-141-10/+24
|
* sh(1): Mention portability issue with shifting zero positional parameters.jilles2014-11-071-2/+3
| | | | | | Per Austin Group issue #459, shifting zero positional parameters may or may not be considered an operand error (which causes the shell to exit in most cases).
* Document that df(1) supports libxo(3).marcel2014-11-071-1/+4
|
* Convert to use libxo.marcel2014-11-072-52/+76
| | | | | Obtained from: Phil Shafer <phil@juniper.net> Sponsored by: Juniper Networks, Inc.
* sh: Fix corruption of CTL* bytes in positional parameters in redirection.jilles2014-10-313-1/+28
| | | | | | | EXP_REDIR was not being checked for while expanding positional parameters in redirection, so CTL* bytes were not being prefixed where they should be. MFC after: 1 week
* Treat IFS separators in "$*" as quoted.jilles2014-10-284-5/+25
| | | | This makes a difference if IFS starts with *, ?, [ or a CTL* byte.
* bin/dd: revert 273734, as it fails on 32bit platformspi2014-10-275-46/+54
| | | | | | Revert: insufficient testing on 32bit platforms PR: 191263
* bin/dd: Fix incorrect casting of argumentspi2014-10-275-54/+46
| | | | | | | | | | | | | | | | | | dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and back again to detect whether or not the original arguments were negative. This caused wrong behaviour in some boundary cases: $ dd if=/dev/zero of=/dev/null count=18446744073709551615 dd: count cannot be negative After the fix: $ dd if=/dev/zero of=/dev/null count=18446744073709551615 dd: count: Result too large PR: 191263 Submitted by: will@worrbase.com Approved by: cognet@
* sh: Make getopts memory-safe if with changing arguments.jilles2014-10-265-6/+39
| | | | | | | | | | | | POSIX does not permit to continuing a getopts loop with different arguments. For parsing the positional parameters, we handle this case by resetting the getopts state when the positional parameters are changed in any way (and the getopts state is local to a function). However, in the syntax getopts <optstring> <var> <arg...>, changes could lead to invalid memory access. In the syntax getopts <optstring> <var> <arg...>, store a copy of the arguments and continue to use them until getopts is reset.
* sh: Allow backslash-newline continuation in more places:jilles2014-10-1910-32/+156
| | | | | | | * directly after a $ * directly after ${ * between the characters of a multi-character operator token * within a parameter name
* sh: Add some tests for backslash-newline continuation.jilles2014-10-174-0/+30
|
* sh: Make parseredir() a proper function instead of an emulated nestedjilles2014-10-151-59/+58
| | | | function.
* sh: Remove more gotos.jilles2014-10-153-73/+86
|
* sh: Fix break/continue/return in multiline eval.jilles2014-10-124-0/+20
| | | | | Example: eval $'return\necho bad'
* Integrate bin/sleep/tests from NetBSD into atf/kyuangie2014-10-092-0/+18
| | | | Sponsored by: EMC / Isilon Storage Division
* sh: Eliminate some gotos.jilles2014-10-055-56/+43
|
* sh: Fix LINENO and prompt after $'\0 and newline.jilles2014-10-034-0/+16
|
* 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
|
OpenPOWER on IntegriCloud