summaryrefslogtreecommitdiffstats
path: root/bin/sh
Commit message (Collapse)AuthorAgeFilesLines
* MFC r314655:ngie2017-05-301-3/+3
| | | | | | bin: normalize paths using SRCTOP-relative paths or :H when possible This simplifies make logic/output
* MFC r317912: sh: Fix INTOFF leak after a builtin with different localejilles2017-05-143-1/+7
| | | | | | | | settings. After executing a builtin with different locale settings such as LC_ALL=C true SIGINT handling was left disabled indefinitely.
* MFC r315005: sh: Fix executing wrong command with ${x#$(y)}$(z).jilles2017-03-183-1/+9
| | | | | | | | | | | | | | | | The parsed internal representation of words consists of a byte string with a list of nodes (commands in command substitution). Each unescaped CTLBACKQ or CTLBACKQ | CTLQUOTE byte corresponds to an entry in the list. If param in ${param#%##%%word} is not set, the word is not expanded (in a deviation of POSIX shared with other ash variants and ksh93). Erroneously, the pointer in the list of commands (argbackq) was not advanced. This caused the wrong command to be executed later if the outer word contained another command substitution. Example: echo "${unsetvar#$(echo a)}$(echo b)" wrote "a" but should write "b".
* MFC r314686: sh: Fix crash if a -T trap is taken during command substitutionjilles2017-03-124-2/+19
| | | | | | | | | | | | | | | Code like t=$(stat -f %m "$file") segfaulted if -T was active and a trap was taken while the shell was waiting for the child process to finish. What happened was that the dotrap() call in waitforjob() was hit. This re-entered command execution (including expand.c) at a point not expected by expbackq(), and global state (unallocated stack string and argbackq) was corrupted. To fix this, change expbackq() to prepare for command execution to be re-entered. Reported by: bdrewery
* MFC r314637: sh: Add some already working tests that exercise new code pathsjilles2017-03-124-0/+20
|
* MFC r313659-r313673bapt2017-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r313659: Remove space at and of line Reported by: make manlint MFC after: 2 days r313660: Remove empty Li Reported by: make manlint MFC after: 2 days r313661: Escape Ss to avoid confusion by mdoc parser with the Ss macro Reported by: make manlint MFC after: 2 days r313662: Add missing -width after -Bl -tag Reported by: make manlint MFC after: 2 days r313663: Add missing section after .Xr reference r313664: Escape No to avoid confusion with the No macro r313665: Remove useless .Pp after the .Sh macro and remove empty line r313666: Remove empty space at EOL and escept Ed r313667: Remove spaces at EOL and sort correctly the SEE ALSO section r313668: Add missing section in manpage reference r313669: Properly use .An macro before Authors name r313670: Escape Sm to avoid confusion with Sm macro r313671: Use correct date format r313672: Remove useless Li macro r313673: Remove spaces at end of line Reported by: make manlint
* MFC r302937ache2016-08-185-1/+39
| | | | | | Path generation was not according to collate Approved by: jilles
* sh: Improve descriptions in 'ulimit -a' output.jilles2016-06-051-2/+2
| | | | | The format limits descriptions to 18 characters and is not changed, so the descriptions do not describe the limits exactly.
* WITH_META_MODE: Don't expect meta files for side-effect generated files.bdrewery2016-06-031-0/+3
| | | | | | | | | The first file in these lists will generate everything else so only it should be getting a .meta file. With bmake's missing=yes meta feature these would otherwise cause a rebuild without the .NOMETA hint. Sponsored by: EMC / Isilon Storage Division
* The (i < PROMPTLEN - 1) test added by r300442 in the code for the defaulttruckman2016-06-011-1/+1
| | | | | | | | | | | case of \c in the prompt format string is a no-op. We already passed this test at the top of the loop, and i has not yet been incremented in this path. Change this test to (i < PROMPTLEN - 2). Reported by: Coverity CID: 1008328 Reviewed by: cem MFC after: 1 week
* Clarify the explanations for the hostname and FQDN entries.wblock2016-05-311-3/+3
| | | | MFC after: 1 week
* Match the descriptions of the \H and \h prompt string sequences to reality.truckman2016-05-251-3/+3
| | | | | | | They were swapped. X-Confirmed by: jilles MFC after: 1 week
* Hopefully fix Coverity CID 1008328 (Out-of-bounds write) in /bin/sh.truckman2016-05-231-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the magic constant 127 in the loop interation count with "PROMPTLEN - 1". gethostname() is not guaranteed to NUL terminate the destination string if it is too short. Decrease the length passed to gethostname() by one, and add a NUL at the end of the buffer to make sure the following loop to find the end of the name properly terminates. The default: case is the likely cause of Coverity CID 1008328. If i is 126 at the top of the loop interation where the default case is triggered, i will be incremented to 127 by the default case, then incremented to 128 at the top of the loop before being compared to 127 (PROMPTLENT - 1) and terminating the loop. Then the NUL termination code after the loop will write to ps[128]. Fix by checking for overflow before incrementing the index and storing the second character in the buffer. These fixes are not guaranteed to satisfy Coverity. The code that increments i in the 'h'/'H' and 'w'/'W' cases may be beyond its capability to analyze, but the code appears to be safe. Reported by: Coverity CID: 1008328 Reviewed by: jilles, cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D6482
* DIRDEPS_BUILD: Run the staged bootstrap-tools version of build-tools.bdrewery2016-05-091-2/+2
| | | | | | This avoids running target binaries. Sponsored by: EMC / Isilon Storage Division
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-048-474/+449
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* sh: Handle empty hostname and $PWD when building promptvangyzen2016-05-041-2/+3
| | | | | | | | | | | If the hostname is empty and \h is used in $PS1, the remainder of the prompt following \h will be empty. Likewise for $PWD and \w. Fix it. Reviewed by: jilles MFC after: 1 week Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D6188
* sh: Write LINENO value to stack string directly.jilles2016-04-161-4/+6
|
* MFHgjb2016-04-162-6/+4
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * META_MODE: Don't rebuild build-tools targets during normal build.bdrewery2016-04-141-3/+3
| | | | | | | | | | | | | | | | | | This avoids 'build command changed' due to CFLAGS/CC changes during the normal build. Without this the build-tools targets end up rebuilding for the *target* rather than keeping the native versions built in build-tools. Sponsored by: EMC / Isilon Storage Division
| * sh: Simplify code by removing variable bracketed_name.jilles2016-04-131-3/+1
| |
* | MFHgjb2016-04-115-9/+9
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * sh(1): replace 0 with NULL for pointers.pfg2016-04-092-2/+2
| | | | | | | | | | | | Found with devel/coccinelle. Reviewed by: jilles
| * sh: Fix some unquoted variables in tests.jilles2016-04-093-7/+7
| | | | | | | | | | The builtins/getopts1.0 test failed if a single-character file existed in the current directory.
* | MFHgjb2016-04-043-1/+15
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * sh: Fix use-after-free if a trap replaces itself.jilles2016-03-283-1/+15
| | | | | | | | MFC after: 1 week
* | MFHgjb2016-03-143-2/+12
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * sh: Fix copying uninitialized field 'special'.jilles2016-03-131-0/+5
| | | | | | | | | | | | | | This just copied uninitialized data and did not depend on it later, so it should not be dangerous. Found by: clang static analyzer
| * Fix handling of umtxp resource limit in sh(1)/ulimit(1), limits(1), addkib2016-03-122-2/+7
| | | | | | | | | | | | | | | | login.conf(5) support. Reviewed by: jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D5610
* | MFHgjb2016-03-1011-3/+96
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.bdrewery2016-03-098-0/+88
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
| * sh: Add test for 'set -o nolog'.jilles2016-03-092-0/+5
| | | | | | | | | | The option does not do anything so check that the output of 'set +o' is different.
| * sh: Avoid out-of-bounds access in setoptionbyindex() for 'set -o nolog'.jilles2016-03-091-3/+3
| | | | | | | | Reported by: hrs
* | MFHgjb2016-03-072-3/+2
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * sh: Fix some dead stores.jilles2016-03-062-3/+2
| | | | | | | | Found by: clang static analyzer
| * sh: Remove a redundant STPUTC check.jilles2016-03-021-1/+1
| |
| * sh: Don't trust that signal descriptions fit within 49 bytes.jilles2016-03-021-18/+18
| |
* | MFHgjb2016-03-022-19/+19
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-03-022-94/+3
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Implement process-shared locks support for libthr.so.3, withoutkib2016-02-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | breaking the ABI. Special value is stored in the lock pointer to indicate shared lock, and offline page in the shared memory is allocated to store the actual lock. Reviewed by: vangyzen (previous version) Discussed with: deischen, emaste, jhb, rwatson, Martin Simmons <martin@lispworks.com> Tested by: pho Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Regenerate without local dependencies.bdrewery2016-02-241-94/+0
| | | | | | | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division
* | MFHgjb2016-02-244-1/+16
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * sh: Fix set -v and multiline history after r295825.jilles2016-02-234-1/+16
| | | | | | | | | | | | | | r295825 erroneously dropped the newline from the input data for 'set -v' output and multiline history. Reported by: vangyzen
* | MFHgjb2016-02-227-32/+52
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * sh: Don't hash alias name when there are no aliases.jilles2016-02-211-2/+4
| |
| * sh: Optimize setprompt(0).jilles2016-02-211-0/+2
| | | | | | | | Avoid doing work to print an empty prompt (such as when reading scripts).
| * sh: Remove unnecessary flushouts while reading script.jilles2016-02-211-2/+0
| | | | | | | | | | Output is flushed when a builtin is done or immediately after writing it (error messages, set -v output, prompts).
| * sh: Rework code to remove '\0' from shell input.jilles2016-02-193-28/+37
| | | | | | | | | | This fixes bugs where '\0' was not removed correctly and speeds up the parser.
| * sh: Add tests for comments in sh -c.jilles2016-02-193-0/+9
| |
* | MFHgjb2016-02-181-2/+0
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Test directories can build in parallel fine.bdrewery2016-02-161-2/+0
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
OpenPOWER on IntegriCloud