aboutsummaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* Add manual page links to advertise procstat(1) a little better.Edward Tomasz Napierala2009-07-091-1/+2
| | | | | | | Approved by: re (kib) Notes: svn path=/head/; revision=195502
* With NFSv4 ACLs, it is possible that applying a mode to an ACL whichEdward Tomasz Napierala2009-07-011-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is identical to the mode computed from that ACL will modify the ACL. For example, mode computed from the following ACL is 0600: user:kamila:rwx--------C--:------:allow owner@:--x-----------:------:deny owner@:rw-p---A-W-Co-:------:allow group@:rwxp----------:------:deny group@:--------------:------:allow everyone@:rwxp---A-W-Co-:------:deny everyone@:------a-R-c--s:------:allow However, applying that mode (chmod 0600) changes the ACL into this: user:kamila:rwx-----------:------:deny user:kamila:rwx--------C--:------:allow owner@:--x-----------:------:deny owner@:rw-p---A-W-Co-:------:allow group@:rwxp----------:------:deny group@:--------------:------:allow everyone@:rwxp---A-W-Co-:------:deny everyone@:------a-R-c--s:------:allow In chmod(1) utility, there is an optimisation, which makes it not call chmod(2) if the mode of the file is the same as the new mode. Disable that optimisation for files which may have NFSv4 ACLs. Reviewed by: rwatson Approved by: re (kib) Notes: svn path=/head/; revision=195243
* Fix some weirdnesses in the NetBSD IFS code,Jilles Tjoelker2009-06-251-2/+3
| | | | | | | | | | | in particular "$@"$ifschar if the final positional parameter is empty. With the NetBSD code, adding the $ifschar removes a parameter. PR: standards/79067 Approved by: ed (mentor) (implicit) Notes: svn path=/head/; revision=194977
* Improve IFS expansion using code from NetBSD.Jilles Tjoelker2009-06-251-61/+80
| | | | | | | | | | | We now pass the ifs.sh testsuite. PR: standards/79067 Approved by: ed (mentor) (implicit) Obtained from: NetBSD Notes: svn path=/head/; revision=194975
* Designate special builtins as such in command -V and type.Jilles Tjoelker2009-06-242-3/+15
| | | | | | | | | Also document various properties of special builtins that we implement. Approved by: ed (mentor) (implicit) Notes: svn path=/head/; revision=194922
* Staticify internal routines.Xin LI2009-06-234-7/+7
| | | | Notes: svn path=/head/; revision=194795
* Quote -x tracing output so it is unambiguous.Jilles Tjoelker2009-06-231-2/+17
| | | | | | | | | It is usually but not always suitable for re-input to the shell. Approved by: ed (mentor) (implicit) Notes: svn path=/head/; revision=194786
* Do not fork for a subshell if it is the last thing this shell is doingJilles Tjoelker2009-06-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | (EV_EXIT). The fork is still done as normal if any traps are active. In many cases, the fork can be avoided even without this change by using {} instead of (), but in practice many scripts use (), likely because the syntax is simpler. Example: sh -c '(/bin/sleep 10)& sleep 1;ps -p $! -o comm=' Now prints "sleep" instead of "sh". $! is more useful this way. Most shells (dash, bash, pdksh, ksh93, zsh) seem to print "sleep" for this. Example: sh -c '( ( ( (ps jT))))' Now shows no waiting shell processes instead of four. Most shells (dash, bash, pdksh, ksh93, zsh) seem to show zero or one. PR: bin/74404 Approved by: ed (mentor) (implicit) Notes: svn path=/head/; revision=194774
* Usermode portion of the support for swap allocation accounting:Konstantin Belousov2009-06-231-1/+1
| | | | | | | | | | | | | | - update for getrlimit(2) manpage; - support for setting RLIMIT_SWAP in login class; - addition to the limits(1) and sh and csh limit-setting builtins; - tuning(7) documentation on the sysctls controlling overcommit. In collaboration with: pho Reviewed by: alc Approved by: re (kensmith) Notes: svn path=/head/; revision=194767
* sh: Improve handling of setjmp/longjmp volatile:Jilles Tjoelker2009-06-234-61/+18
| | | | | | | | | | | | | | - remove ineffective and unnecessary (void) &var; [1] - remove some unnecessary volatile keywords - add a necessary volatile keyword - save the old handler before doing something that could use the saved value Submitted by: Christoph Mallon [1] Approved by: ed (mentor) Notes: svn path=/head/; revision=194765
* Fix race condition in noclobber option.Jilles Tjoelker2009-06-201-7/+19
| | | | | | | | | | | | | Formerly, it was possible for the file to be created between the check if it existed and the open; the contents would then be lost. Because this must use O_EXCL, noclobber > will not create a file through a symlink anymore. This agrees with behaviour of other shells. Approved by: ed (mentor) (implicit) Notes: svn path=/head/; revision=194560
* Fix some issues with quoted output and shorten it in some cases.Jilles Tjoelker2009-06-191-9/+15
| | | | | | | | | | | | | | | | | Output quoted suitable for re-input to the shell occurs in various cases such as 'set', 'trap'. Bugfix: *, ? and [ must be quoted (except sole [) Bugfix: ~ and # must be quoted (really only sometimes, but keep it simple) Bugfix: space, tab and newline must always be quoted Shortening: other IFS characters do not need quoting Bugfix: send to correct output file, not hard-coded stdout Shortening: avoid unnecessary '' with \' Approved by: ed (mentor) Notes: svn path=/head/; revision=194516
* Properly flush input after an error in backquotes in interactive mode.Jilles Tjoelker2009-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | For parsing an old-style backquote substitution (`...`), a string "file" is used to store the contents of the substitution (with the special backslash processing done). If an error occurs, the shell cleans up all these files (returning to the top level) and flush the top level file. Erroneously, it first flushed the current file and then cleaned up all extra files, so that the top level file (i.e. the terminal) was not flushed. Example (in interactive mode): echo `for` echo This should not be printed Also noticeable in (in interactive mode): echo `(` The old version prints an extraneous prompt. Approved by: ed (mentor) Notes: svn path=/head/; revision=194406
* Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND.Jilles Tjoelker2009-06-135-9/+35
| | | | | | | | | | | | | | | | | | | | | | | | | This change only affects strings passed to -c, when the -s option is not used. The approach is to check if there may be additional data in the string after parsing each command. If there is none, use the EV_EXIT flag so that a fork may be omitted in specific cases. If there are empty lines after the command, the check will not see the end and forks will not be omitted. The same thing seems to happen in bash. Example: sh -c 'ps lT' No longer shows a shell process waiting for ps to finish. PR: bin/113860 Reviewed by: stefanf Approved by: ed (mentor) Notes: svn path=/head/; revision=194128
* Don't skip forking for an external command if any traps are active.Jilles Tjoelker2009-06-133-1/+17
| | | | | | | | | | | | | | | | | | | | Example: sh -c '(trap "echo trapped" EXIT; sleep 3)' now correctly prints "trapped". With this check, it is no longer necessary to check for -T explicitly in that case. This is a useful bugfix by itself and also important because I plan to skip forking more often. PR: bin/113860 (part of) PR: bin/74404 (part of) Reviewed by: stefanf Approved by: ed (mentor) Notes: svn path=/head/; revision=194127
* Mention the range for the exit status for the exit special builtin.Jilles Tjoelker2009-06-071-0/+1
| | | | | | | | | | | | | | The exit status may exceed 255 in some cases (return); even though it seems unwise to rely on this, it is also unwise to assume that $? is always between 0 and 255. This resolves bin/124748 by documenting that 'exit -1' is not valid. PR: bin/124748 Approved by: ed (mentor) Notes: svn path=/head/; revision=193636
* Make "human-readable" (-H/-h) output also "humanize" inode counts.Simon L. B. Nielsen2009-06-072-6/+37
| | | | | | | | | | | | Base 10 is always used for the inode counts as I could not think of any reason base 2 inode counts would be useful. Minor mdoc markup fix to df(1) while here anyway. MFC after: 3 weeks Notes: svn path=/head/; revision=193629
* use explicit 'unsigned int' instead of just the implicit-style 'unsigned' to ↵Ralf S. Engelschall2009-06-011-1/+1
| | | | | | | make linting tools (e.g. FlexeLint) happy, too Notes: svn path=/head/; revision=193225
* align coding style with style(9) to avoid misunderstandingsRalf S. Engelschall2009-06-011-1/+2
| | | | Notes: svn path=/head/; revision=193223
* correctly test for __GNUC__ macro (non-GCC compilers do not have it defined ↵Ralf S. Engelschall2009-06-013-4/+4
| | | | | | | at all) Notes: svn path=/head/; revision=193222
* be more type correct and align local ckmalloc() with its underlying ↵Ralf S. Engelschall2009-06-014-5/+7
| | | | | | | malloc(3) by using a "size_t" instead of an "int" argument Notes: svn path=/head/; revision=193221
* sh: Make read's timeout (-t) apply to the entire line, not only the firstJilles Tjoelker2009-05-312-19/+2
| | | | | | | | | | | | | | | | | | | character. This avoids using non-standard behaviour of the old (upto FreeBSD 7) TTY layer: it reprocesses the input queue when switching to canonical mode. The new TTY layer does not provide this functionality and so read -t worked very poorly (first character is not echoed, cannot be backspaced but is still read). This also agrees with what most other shells with read -t do. PR: bin/129566 Reviewed by: stefanf Approved by: ed (mentor) Notes: svn path=/head/; revision=193185
* Fix the eval command in combination with set -e. Before this change the shellStefan Farfeleder2009-05-315-9/+11
| | | | | | | | | | | | would always terminate if eval returned with a non-zero exit status regardless if the status was actually tested. Unfortunately a new file-scope variable is needed, the alternative would only be to add a new parameter to all built-ins. PR: 134881 Notes: svn path=/head/; revision=193169
* rm, find -delete: fix removing symlinks with uchg/uappnd set.Jilles Tjoelker2009-05-301-3/+3
| | | | | | | | | | | | | | | Formerly, this tried to clear the flags on the symlink's target instead of the symlink itself. As before, this only happens for root or for the unlink(1) variant of rm. PR: bin/111226 (part of) Submitted by: Martin Kammerhofer Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=193087
* Preserve file flags on symlinks in cp -Rp.Jilles Tjoelker2009-05-301-1/+1
| | | | | | | | | | | | This reported ENOSYS before. PR: bin/111226 (part of) Submitted by: Martin Kammerhofer Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=193086
* Fix various cases with 3 or 4 parameters in test(1) to be POSIX compliant.Jilles Tjoelker2009-05-262-9/+99
| | | | | | | | | | | | | | | | | | | | | More precisely, this gives precedence to an interpretation not using the '(', ')', '-a' and '-o' in their special meaning, if possible. For example, it is now safe to write [ "$a" = "$b" ] and assume it compares the two strings. The man page already says that test(1) works this way, so does not need to be changed. Interpretation of input with more parameters tries a bit harder to find a valid parse in some cases. Add various additional test cases to TEST.sh. PR: standards/133369 Approved by: ed (mentor) Notes: svn path=/head/; revision=192862
* Fix elapsed (etime) field for swapped out processes in ps:Jilles Tjoelker2009-05-241-0/+4
| | | | | | | | | | | | show '-' instead of time since the Epoch. PR: bin/123069 Submitted by: Vladimir Kozbin Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=192688
* Fix chflags -h in various cases: do not use link target's flags as original.Jilles Tjoelker2009-05-241-1/+1
| | | | | | | | | | | | Patch slightly changed to align more with chmod.c. PR: bin/131999 Submitted by: bde Approved by: ed (mentor) MFC after: 3 weeks Notes: svn path=/head/; revision=192687
* Make 'struct acl' larger, as required to support NFSv4 ACLs. ProvideEdward Tomasz Napierala2009-05-221-1/+1
| | | | | | | | | compatibility interfaces in both kernel and libc. Reviewed by: rwatson Notes: svn path=/head/; revision=192586
* Remove redundant whitespaceBrian Somers2009-05-181-3/+2
| | | | Notes: svn path=/head/; revision=192280
* When finding processes, ignore ourself and our ancestors. It is almostBrian Somers2009-05-172-5/+40
| | | | | | | | | | | | always surprising when you kill a 'sh -c ...' ancestor or when you kill yourself when using -f. Add a -a switch for backwards compatibility. MFC after: 3 weeks Notes: svn path=/head/; revision=192242
* Add a -d option to ps to display descendant info with the output.Brian Somers2009-05-174-15/+167
| | | | | | | | | This is similar to linux's -H (or -f) switch. MFC after: 3 weeks Notes: svn path=/head/; revision=192239
* Implement ^T support for rm: now it will report the next file itWarner Losh2009-04-291-0/+29
| | | | | | | | | removes when you hit ^T. This is similar to what's done for cp. The signal handler and type definitions for "info" were borrowed directly from cp. Notes: svn path=/head/; revision=191670
* Parse 'cmd1 && ! cmd2 | cmd3' correctly, the bang should apply to the entireStefan Farfeleder2009-04-131-0/+1
| | | | | | | | | | pipeline cmd2 | cmd3 and not just cmd2. PR: 130298 Submitted by: Jilles Tjoelker Notes: svn path=/head/; revision=191009
* Add reference to strmode(3).Edward Tomasz Napierala2009-04-131-0/+1
| | | | Notes: svn path=/head/; revision=191003
* Don't let trailing empty lines overwrite the result of the last command with 0.Stefan Farfeleder2009-04-041-1/+2
| | | | | | | | | | This affects the built-ins eval, fc, and trap and also the string passed to sh with the -c option. Submitted by: Jilles Tjoelker Notes: svn path=/head/; revision=190698
* Fix the behaviour of the read built-in when IFS is unset.Stefan Farfeleder2009-03-221-1/+1
| | | | | | | Obtained from: NetBSD Notes: svn path=/head/; revision=190298
* Improve the IFS handling of the read built-in.Stefan Farfeleder2009-03-221-10/+68
| | | | | | | | Obtained from: NetBSD Submitted by: Jilles Tjoelker Notes: svn path=/head/; revision=190295
* - Apply the r190270 changes to printing of single aliases too.Stefan Farfeleder2009-03-221-23/+48
| | | | | | | - Sort the aliases before printing them. Notes: svn path=/head/; revision=190284
* Make the output of the alias built-in POSIX-compliant: Drop the leading 'alias'Stefan Farfeleder2009-03-221-1/+6
| | | | | | | and suppress printing the trailing space which is added for internal purposes. Notes: svn path=/head/; revision=190270
* cat(1) compiles fine at WARNS level 6.Dag-Erling Smørgrav2009-03-161-0/+1
| | | | Notes: svn path=/head/; revision=189875
* Don't disable CR-to-NL translation when waiting for data to arrive.Ed Schouten2009-03-081-0/+1
| | | | | | | | | | | | | | | | | | | A difference between the old and the new TTY layer is that the new implementation does not perform any post-processing before returning data back to userspace when calling read(). sh(1)'s read turns the TTY into a raw mode before calling select(). This means that the first character will not receive any ICRNL processing. Inherit this flag from the original terminal attributes. Even though this issue is not present on RELENG_*, I'm MFCing it to make sh(1) in jails behave better. PR: bin/129566 MFC after: 2 weeks Notes: svn path=/head/; revision=189542
* [1] When showing threads, the thread name just appears if the commAttilio Rao2009-02-263-11/+37
| | | | | | | | | | | | | | | | | | | | | | label is choosen as last printout (ucomm suffers of this such bug too). That bug is caused by the fact that the fixed size of printout doesn't leave enough space for them to be printed out. Implement ucomm and comm commands with a dynamic size lenght for buffers. [2] On AMD64 architecture pointers don't have enough chars space to be shown (8 chars while they need 16). Fix them by providing a variadic space so that it fits well on both 64 and 32 bits architectures. [3] Check a return value of malloc() that wasn't checked before. PR: bin/128841, bin/128842 Reviewed by: jhb, emaste Sponsored by: Sandvine Incorporated Notes: svn path=/head/; revision=189078
* Before this fix, pax would stop the restore sequence forTim Kientzle2009-02-011-36/+4
| | | | | | | | | | | | | | | | symlinks after setting the owner. As a result, mode and timestamp were not restored. This patch corrects the problem by simply removing the short-circuit for symlinks and using lchown()/lchmod()/lutimes() always for restoring metadata. PR: bin/91316 Submitted by: Jaakko Heinonen Reviewed by: Joerg Sonnenberger MFC after: 14 days Notes: svn path=/head/; revision=187976
* Bump .Dd for r187609Giorgos Keramidas2009-01-301-1/+1
| | | | Notes: svn path=/head/; revision=187922
* Make the Monty Python quote more google friendly instead ofTom Rhodes2009-01-261-3/+2
| | | | | | | | | hacking it apart. Discussed with: Christoph Mallon <christoph.mallon@gmx.de> Notes: svn path=/head/; revision=187734
* Note the implication of setting the 'w' permission on directories,Tom Rhodes2009-01-231-2/+7
| | | | | | | | | | | while here, expand the 'naughty bits' comment in BUGS. PR: 84265 and 84268 Reviewed by: keramida Obtained from: hints from ceri, keramida Notes: svn path=/head/; revision=187627
* Add an example of using bs=2048 to duplicate data CD-ROMs.Giorgos Keramidas2009-01-231-0/+5
| | | | | | | | | | | | | | This should be a bit useful for users who look at the manpage and then try to copy data CD-ROM disks using dd. A lot of us know that bs=2048 is required, but it still manages to cause a bit of grief to those who haven't heard about it. PR: bin/130857 Submitted by: Tri Brotoharsono < mail at tribrotoharsono.net > MFC after: 3 days Notes: svn path=/head/; revision=187609
* o Fix a typo. Bump .Dd for the previous delta.Maxim Konovalov2009-01-131-2/+2
| | | | Notes: svn path=/head/; revision=187159
* Clean up a bit of confusing language and improve .Nd.Tom Rhodes2009-01-131-4/+9
| | | | | | | | PR: 47818 Reviewed by: keramida Notes: svn path=/head/; revision=187148