aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* sh: Add test for arithmetic expansion in [x-y] pattern range.Jilles Tjoelker2017-05-132-0/+11
| | | | | | | | | | | It does not make much sense to generate the '-' in a pattern bracket expression using arithmetic expansion, but it does not make sense to forbid it either. This test already passes. Notes: svn path=/head/; revision=318258
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-05-091-0/+1
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=318000
* sh: Fix INTOFF leak after a builtin with different locale settings.Jilles Tjoelker2017-05-073-1/+7
| | | | | | | | | | | After executing a builtin with different locale settings such as LC_ALL=C true SIGINT handling was left disabled indefinitely. MFC after: 1 week Notes: svn path=/head/; revision=317912
* .Xr resizewin from stty(1) man page.Edward Tomasz Napierala2017-05-071-0/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=317904
* sh: Update TOUR and comments for some code changes, some of them old.Jilles Tjoelker2017-05-065-44/+58
| | | | | | | Also, improve some terminology in TOUR and comments. Notes: svn path=/head/; revision=317882
* sh: Simplify handling of newlines in command substitution.Jilles Tjoelker2017-04-281-22/+17
| | | | | | | | Unless we need to split on newlines, just append them as normal and remove them at the end. Notes: svn path=/head/; revision=317559
* sh: Add some tests for command substitution final newline stripping.Jilles Tjoelker2017-04-273-0/+15
| | | | Notes: svn path=/head/; revision=317514
* sh: Add tests for NUL byte in command substitution output.Jilles Tjoelker2017-04-232-0/+25
| | | | Notes: svn path=/head/; revision=317347
* sh: Simplify setinteractive().Jilles Tjoelker2017-04-223-9/+4
| | | | | | | setsignal() does nothing if the signal disposition is already set correctly. Notes: svn path=/head/; revision=317298
* sh: Fix use after free when resetting an in-use alias.Jilles Tjoelker2017-04-163-10/+10
| | | | | | | | | The special case of modifying an existing alias does not work correctly if the alias is currently in use. Instead, handle this case by unaliasing the old alias (if any) and then creating a new alias. Notes: svn path=/head/; revision=317039
* sh: Link the new test to the build.Jilles Tjoelker2017-04-161-0/+1
| | | | Notes: svn path=/head/; revision=317038
* sh: Fix unalias -a while an alias is currently in use.Jilles Tjoelker2017-04-162-12/+27
| | | | | | | | It is a rare situation to modify aliases while an alias is currently in use, but this is handled for plain unalias. Handle it for unalias -a as well. Notes: svn path=/head/; revision=317037
* sh: Reduce size of limits table.Jilles Tjoelker2017-04-121-1/+1
| | | | Notes: svn path=/head/; revision=316744
* sh: Add test for unaliasing an alias that is currently in use.Jilles Tjoelker2017-04-082-0/+8
| | | | | | | This already works correctly. Notes: svn path=/head/; revision=316646
* Fix indentation in dd(1)Eric van Gyzen2017-04-021-5/+5
| | | | | | | | | | | | | | Quoting http://mdocml.bsd.lv/mdoc/details/width.html Do not use macros in the argument specifying the width, since that's not portable. While GNU troff can handle it, mandoc cannot. MFC after: 3 days Sponsored by: Dell EMC Notes: svn path=/head/; revision=316430
* sh: Remove an XXX comment: it is normal for builtins to use argptr.Jilles Tjoelker2017-04-021-1/+1
| | | | Notes: svn path=/head/; revision=316421
* sh: Remove global state from collate_range_cmp().Jilles Tjoelker2017-04-021-1/+3
| | | | | | | The global state is not used across invocations of collate_range_cmp(). Notes: svn path=/head/; revision=316418
* sh: Don't scan word twice in ${param=word}.Jilles Tjoelker2017-04-021-12/+11
| | | | Notes: svn path=/head/; revision=316417
* sh: Don't scan word twice in ${param#%##%%word}.Jilles Tjoelker2017-04-021-11/+12
| | | | | | | | If word is expanded, use the found end instead of iterating over the data again. Notes: svn path=/head/; revision=316416
* sh: Don't scan word twice in ${param+-word}.Jilles Tjoelker2017-04-021-11/+7
| | | | | | | | There is no longer a case where argbackq has already been advanced but the string pointer needs to be advanced. Notes: svn path=/head/; revision=316414
* Update to tcsh 6.20.00Dmitry Chagin2017-03-251-0/+1
| | | | Notes: svn path=/head/; revision=315948
* sh: Fix build with -DDEBUG=2.Jilles Tjoelker2017-03-191-4/+1
| | | | | | | | | With the new expansion code (word splitting during instead of after other expansion processing), tracing the result of command substitution is no longer possible, so stop trying. Notes: svn path=/head/; revision=315585
* sh: Remove unused function declaration for arith_lex_reset().Jilles Tjoelker2017-03-181-1/+0
| | | | | | | Reported by: Robert Elz Notes: svn path=/head/; revision=315511
* sh: Remove unused return value of subevalvar_misc().Jilles Tjoelker2017-03-181-10/+8
| | | | Notes: svn path=/head/; revision=315487
* sh: Get rid of global variable argbackq.Jilles Tjoelker2017-03-161-32/+37
| | | | Notes: svn path=/head/; revision=315428
* sh: Fix executing wrong command with ${unsetvar#$(cmdsubst)}$(cmdsubst).Jilles Tjoelker2017-03-103-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 after: 1 week Notes: svn path=/head/; revision=315005
* Rename some tests to end in _test.Bryan Drewery2017-03-092-1/+1
| | | | | | | | | Requested by: ngie MFC after: 2 weeks X-MFC-With: r314886 Notes: svn path=/head/; revision=314944
* Remove unneeded -x from tests.Bryan Drewery2017-03-091-22/+22
| | | | | | | | | Reported by: ngie MFC after: 2 weeks X-MFC-With: r314886 Notes: svn path=/head/; revision=314943
* pwait: Add a -t flag to specify a timeout before exiting, and tests.Bryan Drewery2017-03-076-11/+347
| | | | | | | | | | | The exit status will be 124, as the timeout(1) utility uses. Reviewed by: jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D9697 Notes: svn path=/head/; revision=314886
* Convert absolute links to relative links.Rodney W. Grimes2017-03-071-2/+2
| | | | | | | | | | Style.Makefile(9) has been ignored to produce minimal diffs. Approved by: grehan (mentor) MFC after: 1 week Notes: svn path=/head/; revision=314833
* ps(1): Fix -w + UNLIMITED handlingConrad Meyer2017-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | A follow-up fix for r314685. Because the -w flag is parsed after ps(1) infers termwidth from COLUMNS and stdout, and UNLIMITED happens to be the zero value, the single -w flag in combination with a non-terminal stdout or COLUMNS=0 could result in output truncated at 131 characters. (Despite the output being unlimited without -w.) Obviously, adding more -w shouldn't truncate output lines. The committed patch is from bdrewery@, and I've reviewed and tested it. Submitted by: bdrewery@ Reported by: bdrewery@ Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314832
* Don't kill pid -1 on overflow from strtol(3).Bryan Drewery2017-03-051-3/+7
| | | | | | | | | | | | Store the result in a proper long and then compare to the proper pid_t for overflow, so that no MD assumptions are made. Reviewed by: jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D9887 Notes: svn path=/head/; revision=314714
* sh: Fix crash if a -T trap is taken during command substitution.Jilles Tjoelker2017-03-044-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 after: 1 week Notes: svn path=/head/; revision=314686
* ps(1): Only detect terminal width if stdout is a ttyConrad Meyer2017-03-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If stdout isn't a tty, use unlimited width output rather than truncating to 79 characters. This is helpful for shell scripts or e.g., 'ps | grep foo'. This hardcoded width has some history: In The Beginning of History[0], the width of ps was hardcoded as 80 bytes. In 1985, Bloom@ added detection using TIOCGWINSZ on stdin.[1] In 1986, Kirk merged a change to check stdout's window size instead. In 1990, the fallback checks to stderr and stdin's TIOCGWINSZ were added by Marc@, with the commit message "new version."[2] OS X Darwin has a very similar modification to ps(1), which simply sets UNLIMITED for all non-tty outputs.[3] I've chosen to respect COLUMNS instead of behaving identically to Darwin here, but I don't feel strongly about that. We could match OS X for parity if that is desired. [0]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?annotate=1065 [1]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=18105&r2=18106 [2]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=40675&r2=40674&pathrev=40675 [3]: https://opensource.apple.com/source/adv_cmds/adv_cmds-168/ps/ps.c.auto.html PR: 217159 Reported by: Deepak Nagaraj <n.deepak at gmail.com> Notes: svn path=/head/; revision=314685
* bin: normalize paths using SRCTOP-relative paths or :H when possibleEnji Cooper2017-03-045-7/+7
| | | | | | | | | | This simplifies make logic/output MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=314655
* sh: Add some already working tests that exercise new code paths.Jilles Tjoelker2017-03-034-0/+20
| | | | Notes: svn path=/head/; revision=314637
* Renumber copyright clause 4Warner Losh2017-02-28169-169/+169
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Use uintmax_t to print st_nlink.Konstantin Belousov2017-02-161-4/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=313798
* Remove empty LiBaptiste Daroussin2017-02-111-1/+1
| | | | | | | | Reported by: make manlint MFC after: 2 days Notes: svn path=/head/; revision=313660
* Remove space at and of lineBaptiste Daroussin2017-02-111-1/+1
| | | | | | | | Reported by: make manlint MFC after: 2 days Notes: svn path=/head/; revision=313659
* Remove bdes(1)Allan Jude2017-02-061-5/+1
| | | | | | | | | | | | | | | | | | The use of DES for anything is discouraged, especially with a static IV of 0 If you still need bdes(1) to decrypt Kirk's video lectures, see security/bdes in ports. This commit brought to you by the FOSDEM DevSummit and the "remove unneeded dependancies on openssl in base" working group Reviewed by: bapt, brnrd Relnotes: yes Sponsored by: FOSDEM DevSummit Differential Revision: https://reviews.freebsd.org/D9424 Notes: svn path=/head/; revision=313329
* Revert crap accidentally committedBaptiste Daroussin2017-01-281-1/+1
| | | | Notes: svn path=/head/; revision=312927
* Revert r312923 a better approach will be taken laterBaptiste Daroussin2017-01-281-1/+1
| | | | Notes: svn path=/head/; revision=312926
* chmod: Add SIGINFO handlerConrad Meyer2017-01-082-3/+26
| | | | | | | | | PR: 191884 Submitted by: Dan McGregor <dan.mcgregor at usask.ca> Reviewed by: mjg@ (earlier version) Notes: svn path=/head/; revision=311668
* Use type-independent formats for printing nlink_t and ino_t.Konstantin Belousov2017-01-061-1/+2
| | | | | | | | | | Extracted from: ino64 work by gleb, mckusick Discussed with: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=311522
* pax(1): Fix a bug with archives smaller than 512 bytes.Pedro F. Giffuni2016-12-211-1/+4
| | | | | | | | | | | | The problem here is that the archive is too short (< 512 bytes). The buffer routines, try to read at least 512 bytes, even when we try to determine what format file we have, which is wrong. Obtained from: NetBSD (CVS rev 1.26) MFC after: 5 days Notes: svn path=/head/; revision=310367
* Fix ls_tests:o_flag with ZFS TMPDIRAlan Somers2016-12-151-1/+1
| | | | | | | | | | | | | | Unlike UFS or TMPFS, ZFS sets uarch automatically whenever a file is updated. The test must explicitly clear uarch to be portable across filesystems. Also, it doesn't need to run as root. PR: 215179 MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8741 Notes: svn path=/head/; revision=310118
* Use nmount(2) rather than the obsolete mount(2).Brooks Davis2016-12-142-3/+29
| | | | | | | | | | Reviewed by: cem MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Notes: svn path=/head/; revision=310095
* ed(1): drop redundant parenthesis.Pedro F. Giffuni2016-12-141-2/+2
| | | | | | | These were Left-over from the cleanup in r309936. Notes: svn path=/head/; revision=310091
* Mount filesystems without executable permissions since they should neverBrooks Davis2016-12-141-1/+1
| | | | | | | | | | | | be used. Reviewed by: cem MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513 Notes: svn path=/head/; revision=310090