aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* Prevent access to an uninitialized variablePedro F. Giffuni2015-01-311-1/+1
| | | | | | | | | | The "-h" option may access an uninitialized value. Prevent it by properly initializing the value. CID: 1006559 Notes: svn path=/head/; revision=277979
* sh: Abort a wait builtin on any trapped signal.Jilles Tjoelker2015-01-312-5/+6
| | | | | | | | | | | This is required by POSIX. PR: 197210 Reported by: ache MFC after: 2 weeks Notes: svn path=/head/; revision=277973
* Fix overflow check for multiplication:Stefan Eßer2015-01-271-4/+16
| | | | | | | | | | | | | | | | - Add special test to detect the case of -1 * INTMAX_MIN - Protect against elimination of the test division by the optimizer Garrett Cooper noticed that the overflow checks were incomplete, and Bruce Evans suggested the use of the "volatile" qualifier to counter the effect of the undefined behaviour, when the prior multiplication caused overflow, and he also suggested improvements to the comments. Reviewed by: bde MFC after: 1 week Notes: svn path=/head/; revision=277798
* cp,mv,touch: Set timestamps with nanosecond precision.Jilles Tjoelker2015-01-242-10/+10
| | | | | | | This uses utimensat(). Notes: svn path=/head/; revision=277645
* Add futimens and utimensat system calls.Jilles Tjoelker2015-01-231-3/+4
| | | | | | | | | | | | | | | | | The core kernel part is patch file utimes.2008.4.diff from pluknet@FreeBSD.org. I updated the code for API changes, added the manual page and added compatibility code for old kernels. There is also audit and Capsicum support. A new UTIME_* constant might allow setting birthtimes in future. Differential Revision: https://reviews.freebsd.org/D1426 Submitted by: pluknet (partially) Reviewed by: delphij, pluknet, rwatson Relnotes: yes Notes: svn path=/head/; revision=277610
* Don't include newvers.sh into freebsd-version.Hajimu UMEMOTO2015-01-221-1/+1
| | | | Notes: svn path=/head/; revision=277531
* Integrate contrib/netbsd-tests/bin/expr into the build/kyua as bin/expr/testsEnji Cooper2015-01-192-0/+22
| | | | | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=277358
* Add a ${CP} alias for copying files in the build.Will Andrews2015-01-161-1/+1
| | | | | | | | | | | | | | | | | Some users build FreeBSD as non-root in Perforce workspaces. By default, Perforce sets files read-only unless they're explicitly being edited. As a result, the -f argument must be used to cp in order to override the read-only flag when copying source files to object directories. Bare use of 'cp' should be avoided in the future. Update all current users of 'cp' in the src tree. Reviewed by: emaste MFC after: 1 week Sponsored by: Spectra Logic Notes: svn path=/head/; revision=277273
* Install d_align.{in,out} for the :align testEnji Cooper2015-01-051-0/+5
| | | | | | | | X-MFC with: r276669 Pointyhat to: me Notes: svn path=/head/; revision=276723
* Integrate bin/cat/tests from NetBSD into atf/kyuaEnji Cooper2015-01-042-0/+19
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=276669
* symlink(7): Note that stat(1) does not follow symlinks by default.Jilles Tjoelker2014-12-291-9/+8
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=276359
* sh: Move some code from onint() to onsig(), making onint() noreturn.Jilles Tjoelker2014-12-214-21/+21
| | | | | | | | As a result, the INTON macro which is used many times generates fewer bytes of code. Notes: svn path=/head/; revision=276038
* sh: Remove EXP_REDIR.Jilles Tjoelker2014-12-213-15/+8
| | | | | | | | | | | | | EXP_REDIR was supposed to generate pathnames in redirection if exactly one file matches, as permitted but not required by POSIX in interactive mode. It is unlikely this will be implemented. No functional change is intended. MFC after: 1 week Notes: svn path=/head/; revision=276037
* sh: Make sure output suitable as shell input is also printable.Jilles Tjoelker2014-12-143-22/+76
| | | | | | | | | | | | | | Commands like 'export -p', 'set' and 'trap', and tracing enabled via 'set -x' generate output suitable as shell input by adding quotes as necessary. If there are control characters other than newline or invalid UTF-8 sequences, use $'...' and \OOO to display them safely. The resulting output is not parsable by a strict POSIX.1-2008 shell but sh from FreeBSD 9.0 and newer and many other shells can parse it. Notes: svn path=/head/; revision=275766
* Add facility to stop all userspace processes. The supposed use of theKonstantin Belousov2014-12-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | feature is to quisce the system before suspend. Stop is implemented by reusing the thread_single(9) with the special mode SINGLE_ALLPROC. SINGLE_ALLPROC differs from the existing single-threading modes by allowing (requiring) caller to operate on other process. Interruptible sleeps for !TDF_SBDRY threads are suspended like SIGSTOP does it, instead of aborting the sleep, like SINGLE_NO_EXIT, to avoid spurious EINTRs on resume. Provide debugging sysctl debug.stop_all_proc, which causes total stop and suspends syncer, while waiting for variable reset for resume. It is used for debugging; should be removed after the real use of the interface is added. In collaboration with: pho Discussed with: avg Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=275745
* Fix dependency on newvers.shDag-Erling Smørgrav2014-12-101-2/+1
| | | | | | | | Noticed by: marck MFC after: 1 week Notes: svn path=/head/; revision=275659
* sh: Remove special case for '=' in set -x; always quote it in outqstr().Jilles Tjoelker2014-11-302-11/+2
| | | | | | | | I plan to make set -x output always printable using $'...'; avoiding quoting words containing '=' is not worth the extra complexity. Notes: svn path=/head/; revision=275346
* Convert bin/ to LIBADD, reduce overlinking allow to build all components asBaptiste Daroussin2014-11-258-21/+9
| | | | | | | static Notes: svn path=/head/; revision=275028
* sh: Prepend "$0: " to error messages if there is no command name.Jilles Tjoelker2014-11-222-0/+4
| | | | Notes: svn path=/head/; revision=274899
* sh: Use DQSYNTAX only while expanding, not SQSYNTAX.Jilles Tjoelker2014-11-221-1/+1
| | | | | | | | Quoting during expansion only cares about CCTL, which is the same for DQSYNTAX and SQSYNTAX. Notes: svn path=/head/; revision=274854
* sh(1): Add/improve information about exit status of commands.Jilles Tjoelker2014-11-141-10/+24
| | | | Notes: svn path=/head/; revision=274515
* sh(1): Mention portability issue with shifting zero positional parameters.Jilles Tjoelker2014-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). Notes: svn path=/head/; revision=274254
* Document that df(1) supports libxo(3).Marcel Moolenaar2014-11-071-1/+4
| | | | Notes: svn path=/head/; revision=274214
* Convert to use libxo.Marcel Moolenaar2014-11-072-52/+76
| | | | | | | | Obtained from: Phil Shafer <phil@juniper.net> Sponsored by: Juniper Networks, Inc. Notes: svn path=/head/; revision=274213
* sh: Fix corruption of CTL* bytes in positional parameters in redirection.Jilles Tjoelker2014-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 Notes: svn path=/head/; revision=273920
* Treat IFS separators in "$*" as quoted.Jilles Tjoelker2014-10-284-5/+25
| | | | | | | This makes a difference if IFS starts with *, ?, [ or a CTL* byte. Notes: svn path=/head/; revision=273802
* bin/dd: revert 273734, as it fails on 32bit platformsKurt Jaeger2014-10-275-46/+54
| | | | | | | | | Revert: insufficient testing on 32bit platforms PR: 191263 Notes: svn path=/head/; revision=273743
* bin/dd: Fix incorrect casting of argumentsKurt Jaeger2014-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@ Notes: svn path=/head/; revision=273734
* sh: Make getopts memory-safe if with changing arguments.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=273700
* sh: Allow backslash-newline continuation in more places:Jilles Tjoelker2014-10-1910-32/+156
| | | | | | | | | | * directly after a $ * directly after ${ * between the characters of a multi-character operator token * within a parameter name Notes: svn path=/head/; revision=273276
* sh: Add some tests for backslash-newline continuation.Jilles Tjoelker2014-10-174-0/+30
| | | | Notes: svn path=/head/; revision=273243
* sh: Make parseredir() a proper function instead of an emulated nestedJilles Tjoelker2014-10-151-59/+58
| | | | | | | function. Notes: svn path=/head/; revision=273153
* sh: Remove more gotos.Jilles Tjoelker2014-10-153-73/+86
| | | | Notes: svn path=/head/; revision=273152
* 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