summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* In preparation for 10.3-RELEASE, revert r296976, i. e. the merge ofmarius2016-03-231-1/+0
| | | | | | | | | | | | | | r296416 (head) and r296969 (stable/10) respectively. With SAVESIGVEC enabled, csh(1) and tcsh(1) leak signal masks after spawning external commands. This causes strange effects like for example SIGTERM not being delivered to rc(8) scripts on shutdown albeit these use sh(1), if csh(1) or tcsh(1) are used as login shell of root. As such r296976 causes way more problems than it solves. It is anticipated that a proper changeset for the original problem will be issued as an Errata Notice post-10.3-RELEASE. PR: 208132 Approved by: re (gjb)
* MFC 296416:mp2016-03-171-0/+1
| | | | | | | | | | | Signal handling within tcsh vfork code path will conflict with some system libraries (such as libthr) which maintain their own signal state. This change adds the tcsh SAVESIGVEC option to save and restore the sigvecs for the signals the child modifies before it execs. Reviewed by: kib, rwatson Reported by: kib Approved by: re
* MFC r289677:bdrewery2016-01-071-1/+1
| | | | Fix a ton of speelling errors
* MFC r292877:pfg2016-01-061-1/+1
| | | | | | | | | pax: prevent possible buffer overflow Or at least quiet down some static analyzers about it. CID: 978835 Obtained from: OpenBSD
* MFC r292517: sh/mknodes: Close files and check for errors when writing.jilles2015-12-271-5/+15
| | | | | | This is a build tool only and does not affect run time. PR: 204951
* MFC r292454, r292455pfg2015-12-261-4/+6
| | | | | | | | | ed(1): Prevent possible string overflows Use strlcpy to guarantee NULL termination. With hint from: imp, cem, ngie CID: 1007252
* MFC r292360: sh: Fix use-after-free when attempting to modify a read-onlyjilles2015-12-231-1/+1
| | | | | | variable. Reported by: bapt
* MFC r276669,r276723:ngie2015-12-152-0/+24
| | | | | | | | | | | | | | r276669: Integrate bin/cat/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division r276723: Install d_align.{in,out} for the :align test Pointyhat to: me
* MFC r291942:bdrewery2015-12-141-1/+1
| | | | Add missing CLEANFILES.
* MFC r291919:ngie2015-12-101-6/+0
| | | | | | | | | | | Enable bin/ls testcases disabled previously because of issues with how kyua 0.11's version of report-junit was rendering non-printable characters Upgrade to kyua 0.12 to obtain a fixed version of the command Output verified with python 2.7.10's xml.dom.minidom module Sponsored by: EMC / Isilon Storage Division
* MFC r289393:bdrewery2015-12-041-0/+2
| | | | Add more SUBDIR_PARALLEL.
* MFC r284105,r284106,r284163:bdrewery2015-12-044-71/+98
| | | | | | | | | | | | r284105: Cleanup some indentation issues. r284106: Implement '-s' to copy as symlink, similar to the current -l link(2) handling. r284163: Cleanup some style(9) issues. Relnotes: yes
* MFC r269902,r270101:ngie2015-12-0120-86/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | r269902: Convert bin/sh/tests to ATF 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) r270101 (by jilles): sh: Don't hardcode relative paths in the tests stderr files. 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.
* MFC r289195:ngie2015-11-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | Integrate the tests from lib/libarchive, usr.bin/cpio, and usr.bin/tar in to the FreeBSD test suite functional_test.sh was ported from bin/sh/tests/functional_test.sh, as a small wrapper around libarchive_test, bsdcpio_test, and bsdtar_test provided by upstream. A handful of testcases in lib/libarchive/tests have been disabled as they were failing when run with kyua test (see BROKEN_TESTS in lib/libarchive/tests/Makefile) As a sidenote: this removes the check/test targets from the Makefiles as they don't match the pattern used in the rest of the FreeBSD test suite. Sponsored by: EMC / Isilon Storage Division Conflicts: lib/libarchive/test usr.bin/cpio/test
* MFC r290480bapt2015-11-102-4/+3
| | | | | | | | | Protecting against rm -rf / is now POSIXLY_CORRECT per posix 1003.1 edition 2013. No need anymore to disable the protection if one set the POXILY_CORRECT environment variable. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D4092
* MFC r289487:ngie2015-11-092-0/+18
| | | | | | | | | | Integrate contrib/netbsd-tests/bin/dd into the FreeBSD test suite as bin/dd/tests Ensure fdescfs is mounted on /dev/fd/ for the length testcase as it's used in validating the characters read from /dev/zero Sponsored by: EMC / Isilon Storage Division
* MFC r289488:ngie2015-10-261-9/+9
| | | | Clean up trailing whitespace
* MFC r288330,r288423,r288678,r288905,r288906,r288907,r289102:ngie2015-10-253-0/+979
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r288330: Add initial testcases for bin/ls Sponsored by: EMC / Isilon Storage Division r288423: Skip the B_flag testcase to stop blowing up freebsd-current@ with "test failure emails" because kyua report-jenkins doesn't properly escape non-printable chars r288678: Merge additional testcases and improvements to bin/ls/ls_tests from ^/user/ngie/more-tests. - Additional testcases added: -- ls -D -- ls -F -- ls -H -- ls -L -- ls -R -- ls -S -- ls -T -- ls -b -- ls -d -- ls -f -- ls -g -- ls -h -- ls -i -- ls -k -- ls -l -- ls -m -- ls -n -- ls -o -- ls -p -- ls -q/ls -w -- ls -r -- ls -s -- ls -t -- ls -u -- ls -y - Socket file creation is limited to the ls -F testcase, greatly speeding up the test process - The ls -C testcase was made more robust by limiting the number of columns via COLUMNS and by dynamically formulating the columns/lines. - Add `atf_test_case` before all testcase `head` functions. Sponsored by: EMC / Isilon Storage Division r288905: Add some more syncs to quiesce the filesystem after creating the files to see if this fixes deterministic Jenkin failures r288906: Explicitly set BLOCKSIZE to 512 in the environment r288907: Call sync consistently using atf_check Remove superfluous sync's r289102: Remove all of the syncs They're unnecessary as shown by further testing on my VM Requested by: jhb
* MFC r288430: wordexp: Rewrite to make WRDE_NOCMD reliable.jilles2015-10-254-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shell syntax is too complicated to detect command substitution and unquoted operators reliably without implementing much of sh's parser. Therefore, have sh do this detection. While changing sh's support anyway, also read input from a pipe instead of arguments to avoid {ARG_MAX} limits and improve privacy, and output count and length using 16 instead of 8 digits. The basic concept is: execl("/bin/sh", "sh", "-c", "freebsd_wordexp ${1:+\"$1\"} -f "$2", "", flags & WRDE_NOCMD ? "-p" : "", <pipe with words>); The WRDE_BADCHAR error is still implemented in libc. POSIX requires us to fail strings containing unquoted braces with code WRDE_BADCHAR. Since this is normally not a syntax error in sh, there is still a need for checking code in libc, we_check(). The new we_check() is an optimistic check that all the characters <newline> | & ; < > ( ) { } are quoted. To avoid duplicating too much sh logic, such characters are permitted when quoting characters are seen, even if the quoting characters may themselves be quoted. This code reports all WRDE_BADCHAR errors; bad characters that get past it and are a syntax error in sh return WRDE_SYNTAX. Although many implementations of WRDE_NOCMD erroneously allow some command substitutions (and ours even documented this), there appears to be code that relies on its security (codesearch.debian.net shows quite a few uses). Passing untrusted data to wordexp() still exposes a denial of service possibility and a fairly large attack surface. This is also a MFC of r286830 to reduce conflicts. I changed the code somewhat to avoid changes from r286941; in particular, WRDE_BADVAL can still only be returned if WRDE_UNDEF was passed. Relnotes: yes Security: fixes command execution with wordexp(untrusted, WRDE_NOCMD)
* MFC r287237: Respect locale settings.delphij2015-09-141-0/+3
|
* MFC r287236:delphij2015-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use exit() instead of return in main(). The difference in practice is subtle: C standard requires the language runtime to make return of int from main() behave like calling exit(), and in FreeBSD we do: exit(main(argc, argv, env)) In lib/csu/${ARCH}/crt1.c, so the real difference is using exit() explicitly would use an additional stack frame. Note however, if there is a on stack pointer is the last reference of an allocated memory block, returning from the function would, technically, result in a memory leak because we lost the last reference to the memory block, and calling exit() from C runtime could potentionally overwrite that stack frame that used to belong to the main() function. In practice, this is normally Okay because eventually the kernel would tear down the whole address space that belongs to the process in the _exit(2) system call, but the difference could confuse compilers (which may want to do stack overflow checks) and static analyzers. Replacing return with exit() in main() allows compilers/static analyzers to correctly omit or generate the right warnings when they do not treat main() specifically. With the current version of clang on FreeBSD/amd64, use of exit() would result in slightly smaller code being generated and eliminated a false positive warning of memory leak.
* MFC r268436,273243,278806,280920,286971: sh: Add various tests.jilles2015-09-1312-0/+65
| | | | These new tests from head pass with unmodified stable/10 sh.
* MFC r287148: sh: Fix out of bounds read when there is no ] after a [:class:].jilles2015-09-133-12/+17
| | | | | | | | | The initial check for a matching ] was incorrect if a ] may be consumed by a [:class:]. The subsequent loop assumed that there must be a ]. Remove the initial check and make the loop cope with a missing ]. Found with afl-fuzz.
* MFC r278826,279330: sh: Various cleanups to expand.c:jilles2015-09-131-60/+55
| | | | | | | | * Remove some gotos. * Remove unused parameter. * Remove duplicate code. This MFC is to avoid conflicts in the MFC of r287148.
* MFC r272575: sh: Eliminate some gotos.jilles2015-09-135-56/+43
| | | | This MFC is to avoid conflicts in the MFC of r287148.
* MFC r287081: sh: Don't create bad parse result when postponing a badjilles2015-09-134-2/+13
| | | | | | | | | | | | | | substitution error. An invalid substitution like ${var@} does not cause a parse error but is stored in the intermediate representation, to be written as part of the error message. If there is a CTL* byte in the stored part, this confuses some code such as the code to skip an unused alternative such as in ${var-alternative}. To keep things simple, do not store CTL* bytes. Found with afl-fuzz.
* MFC r287012:jamie2015-08-295-21/+78
| | | | | | | Make pkill/pgrep -j ARG take jname, not just jid. PR: 201588 Submitted by: Daniel Shahaf <danielsh at apache.org>
* MFC r284916: mv: Improve message when moving two or more files tojilles2015-08-221-1/+1
| | | | | | | | | | | non-directory. The message text is from cp, which has had a nicer message for this since 2007 (PR bin/50656). As with cp, the exit status changes from 64 to 1. PR: 201083
* MFC r284779: sh: Fix some arithmetic undefined behaviour.jilles2015-08-152-4/+3
| | | | | Fix shifts of possibly negative numbers found with ubsan and avoid signed integer overflow when hashing an extremely long command name.
* MFH (r277531): don't include newvers in freebsd-versiondes2015-07-021-1/+1
|
* MFH (r275659): fix dependency on newvers.shdes2015-06-301-2/+1
|
* MFC r283257:delphij2015-06-0512-17/+1
| | | | Eliminate unneeded includes.
* MFC r282208:smh2015-06-014-80/+90
| | | | | | | Standardise chmod, chflags, chown and chgrp recursive symlink processing Relnotes: Yes Sponsored by: Multiplay
* Merge: 278618 278633 278636 278653 278742 278776 279121rodrigc2015-05-232-142/+128
| | | | | | Multiple fixes for pgrep and pkill tests. PR: 19109
* MFC r282608:delphij2015-05-212-4/+13
| | | | | | | | date(1): Make -r behave like GNU's version when the option can not be interpreted as a number, which checks the file's modification time and use that as the date/time value. This improves compatibility with GNU coreutils's version of date(1).
* MFC r282482: cp: Remove fts sorting.jilles2015-05-141-28/+1
| | | | | | | | | | | | | | | | | | | | | In an attempt to improve performance, cp reordered directories first (although the comment says directories last). This is not effective with new UFS layout policies. The sorting reorders multiple arguments passed to cp, which may be undesirable. Additionally, the comparison function does not induce a total order. Per POSIX, this causes undefined behaviour in qsort(). NetBSD removed the sorting in 2009. On filesystems that return directory entries in hash/btree order, sorting by d_fileno before statting improves performance on large directories. However, this can only be implemented in fts(3). PR: 53475 Reviewed by: bde (in 2004)
* MFC r275805:tijl2015-04-302-2/+2
| | | | | | | | | | | | | Fix incorrect type of "invalids" argument in __iconv() prototype. MFC r281550,281591: Remove the const qualifier from iconv(3) to comply with POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html Adjust all code that calls iconv. PR: 199099
* MFC r280206:eadler2015-04-174-11/+19
| | | | | | | | | Implement pax -O option to permit limiting a PAX archive to a single volume. -O Force the archive to be one volume. If a volume ends prematurely, pax will not prompt for a new volume. PR: 198481
* MFC r280357:dim2015-04-061-0/+3
| | | | | | | Build expr with -fwrapv, since it relies on signed integer wrapping having defined behavior. Reported by: rodrigc
* MFC r278848: symlink(7): Mention chflagsat() (can take AT_SYMLINK_NOFOLLOW).jilles2015-03-101-1/+2
|
* MFC r276359: symlink(7): Note that stat(1) does not follow symlinks byjilles2015-02-081-9/+8
| | | | default.
* MFC r277358:ngie2015-01-262-0/+22
| | | | | | | | r277358 (by ngie): Integrate contrib/netbsd-tests/bin/expr into the build/kyua as bin/expr/tests Sponsored by: EMC / Isilon Storage Division
* MFC r274254: sh(1): Mention portability issue with shifting zero positionaljilles2015-01-041-2/+3
| | | | | | | | parameters. 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).
* MFC r271936: sh(1): Clarify that assignments before commands do not affectjilles2015-01-041-2/+3
| | | | | | expansions. PR: 193759
* MFC r272777,r272779,r272780,r272781,r272782,r272783,r272784,r272787,r272788:ngie2015-01-012-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r272777: Integrate usr.sbin/nmtree/tests from NetBSD into atf/kyua In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r272779: Integrate usr.sbin/basename/tests from NetBSD into atf/kyua In collaboration with: pho Sponsored by: EMC / Isilon Storage Division r272780: Integrate usr.bin/cmp/tests from NetBSD into atf/kyua In collaboration with: sjg Sponsored by: EMC / Isilon Storage Division r272781: Integrate usr.bin/dirname/tests from NetBSD into atf/kyua In collaboration with: pho, sjg Sponsored by: EMC / Isilon Storage Division r272782: Integrate bin/sleep/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division r272783: Integrate usr.bin/cut/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division r272784: Integrate usr.bin/grep/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division r272787: Integrate usr.bin/diff/tests from NetBSD into atf/kyua at gnu/usr.bin/diff/tests Sponsored by: EMC / Isilon Storage Division r272788: Integrate usr.bin/gzip/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division
* MFC r276037: sh: Remove EXP_REDIR.jilles2014-12-293-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 r274854: sh: Use DQSYNTAX only while expanding, not SQSYNTAX.jilles2014-12-291-1/+1
| | | | | Quoting during expansion only cares about CCTL, which is the same for DQSYNTAX and SQSYNTAX.
* MFC r273920: sh: Fix corruption of CTL* bytes in positional parameters injilles2014-12-293-1/+28
| | | | | | | redirection. 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 r275745:kib2014-12-271-1/+2
| | | | | | | | | | Add facility to stop all userspace processes. MFC r275753: Fix gcc build. MFC r275820: Add missed break.
* MFC r268576: sh: Correctly handle positional parameters beyond INT_MAX onjilles2014-12-143-2/+19
| | | | | | | | | | | | | | | | | 64-bit systems. 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. PR: 195918
OpenPOWER on IntegriCloud