summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* MFC r207944: sh: Fix pathname expansion with quoted slashes like *\/.jilles2010-05-161-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are git commits 36f0fa8fcbc8c7b2b194addd29100fb40e73e4e9 and d6d06ff5c2ea0fa44becc5ef4340e5f2f15073e4 in dash. Because this is the first code I'm importing from dash to expand.c, add the Herbert Xu copyright notice which is in dash's expand.c. When pathname expanding *\/, the CTLESC representing the quoted state was erroneously taken as part of the * pathname component. This CTLESC was then seen by the pattern matching code as escaping the '\0' terminating the string. The code is slightly different because dash converts the CTLESC characters to backslashes and removes all the other CTL* characters to allow substituting glob(3). The effect of the bug was also slightly different from dash (where nothing matched at all). Because a CTLESC can escape a '\0' in some way, whether files were included despite the bug depended on memory that should not be read. In particular, on many machines /*\/ expanded to a strict subset of what /*/ expanded to. Example: echo /*"/null" This should print /dev/null, not /*/null. PR: bin/146378 Obtained from: dash
* Merge r199631: Handle current work directories of arbitrary length.stefanf2010-05-161-22/+29
|
* MFC r206548:kib2010-05-111-1/+2
| | | | Update the list of the process flags for P_WKILLED.
* MFC r207189: symlink(7): Add lpathconf(2) and *at system calls.jilles2010-05-021-2/+27
|
* MFC r207188: symlink(7): The ownership of symlinks is used by the system,jilles2010-05-021-3/+3
| | | | | | | in at least three ways, so do not say it is ignored: * who may delete/rename a symlink in a sticky directory * who may do lchflags(2)/lchown(2)/lchmod(2) * whose inode quota is charged
* MFC r207021: ln: Allow a trailing slash when creating a link to a directory.jilles2010-05-011-14/+13
| | | | | | | | | In the 'ln source... directory' synopsis, the basename of each source determines the name of the created link. Determine this using basename(3) instead of strrchr(..., '/') which is incorrect if the pathname ends in a slash. PR: 121568
* MFC r206773: ln: Do not delete a file by hardlinking it to itself.jilles2010-05-011-2/+59
| | | | | | | | | | | | Two pathnames refer to the same directory entry iff the directories match and the final components' names match. Example: (assuming file1 is an existing file) ln -f file1 file1 This now fails while leaving file1 intact. It used to delete file1 and then complain it cannot be linked because it is gone. With -i, this error is detected before the question is asked.
* MFC r197848: Clarify quoting of word in ${v=word} in sh(1).jilles2010-04-231-0/+3
|
* MFC r203576,r203677: sh: Don't stat() $MAIL/$MAILPATH if not interactive.jilles2010-04-202-1/+8
| | | | | These may be NFS mounted, and we should not touch them unless we are going to do something useful with the information.
* MFC r200943: sh: Remove setting variables from dotcmd/exportcmd.jilles2010-04-202-5/+0
| | | | | | | | | | | | It is already done by evalcommand(), unless special-ness has been removed, in which case variable assignments should not persist. (These are currently always special builtins, but this may change later: command builtin, command substitution.) This also fixes a memory leak when calling . with variable assignments. Example: valgrind --leak-check=full sh -c 'x=1 . /dev/null; x=2'
* MFC r199282: sh: Allow a newline before "in" in a for command,jilles2010-04-201-1/+3
| | | | as required by POSIX.
* MFC r204755:kib2010-03-191-3/+15
| | | | | Update the list of the process flags. Note that the lists of pending signals for process and its threads are distinct.
* MFC r204308:kib2010-03-041-1/+1
| | | | | | Do not restrict the allowed signals that can be specified by number to the list of signals that has symbolic name. It was impossible to send rt signals with kill(1) due to the check.
* MFC r204276:jh2010-03-031-1/+1
| | | | | | | Fix expansion of \W in prompt strings when the working directory is "/". The prompt string was truncated after \W when the working directory was "/". PR: bin/89410
* MFC r203665:jh2010-02-281-2/+6
| | | | | | | | | Make sure that FTS_COMFOLLOW is not set when the -P option is in effect. Otherwise the -i option will show the inode number of the referenced file for symbolic links given on the command line. Similarly, the file color was printed according to the link target in colorized output. PR: bin/102394
* MFC r202945:jh2010-02-243-21/+50
| | | | | | | | | | Fixes for ls(1) long format (-l) output: - Allow -h option to work if the listing contains at least one device file. - Align major and minor device numbers correctly to the size field. PR: bin/125678
* MFC r203688:brucec2010-02-182-2/+4
| | | | | | | | Initialize the execfile argument to NULL instead of _PATH_DEVNULL. This allows the -M option to be used without specifying -N. PR: bin/138146 Approved by: rrs (mentor)
* Merge r202461 from head:gavin2010-02-163-7/+12
| | | | | | | | | Implement an "-x" option to cp(1), for compatibility with Linux and feature parity with du(1) and similar: When set, cp(1) will not traverse mount points. PR: bin/88056 Initial patch by: Graham J Lee leeg teaching.physics.ox.ac.uk
* MFC r202944:jh2010-01-311-1/+1
| | | | | | | | | Print full path in the error message. It's possible that fts(3) provides an empty fts_name and reporting the full path is more appropriate especially with the -R option. PR: bin/107515 Approved by: trasz (mentor)
* MFC r201018:trasz2010-01-301-1/+1
| | | | Fix breakage introduced in last commit.
* MFC r201016:trasz2010-01-304-8/+32
| | | | | Improve ACL branding mismatch detection and reporting in some rare cases, such as "setfacl -m ''".
* MFC r196936:trasz2010-01-306-221/+539
| | | | Add NFSv4 support to setfacl(1).
* MFC r196841:trasz2010-01-301-12/+58
| | | | Add NFSv4 ACL support to mv(1).
* MFC r196827:trasz2010-01-302-17/+72
| | | | Add NFSv4 ACL support to getfacl(1).
* MFC r196754:trasz2010-01-301-30/+93
| | | | | | | | | | | Add NFSv4 ACL support to cp(1) and fix a few memory leaks. Note that this changes error reporting behaviour somewhat - before, no error was reported if ACL couldn't be copied because the target filesystem doesn't support ACLs. Now, it will be reported - of course, only if there actually is an ACL to copy. Reviewed by: rwatson
* MFC r196753:trasz2010-01-301-9/+6
| | | | | | | | | | | | | | | | - Don't include both <sys/types.h> and <sys/param.h> - Keep variables sorted - Fix logic error with -f and -v options - don't print the usual -v output if there was an error, whether or not we were passed -f - Don't call free(3) just before exit(2) - Whitespace fixes Submitted by: bde
* MFC r196712:trasz2010-01-301-48/+54
| | | | | | | | | | | Add NFSv4 ACL support to ls(1). MFC r196773: Fix regression introduced in r196712 - the 'name' string needs to be rewritten for each file we want to check ACL on. Without this change, ls(1) would check only the ACL on the first file to list.
* MFC r196711:trasz2010-01-301-13/+15
| | | | | Make the code more readable and fix chmod(1) on symlinks with NFSv4 enabled.
* MFC r201145 to stable/8:antoine2010-01-301-8/+8
| | | | | | | | | (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument. Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used. PR: 137213 Submitted by: Eygene Ryabinkin (initial version)
* MFC r201355: sh(1): document ulimit -w (swapuse rlimit).jilles2010-01-081-2/+5
|
* MFC r201354: sh(1): Correct two places where "$@" lacked necessary quotes.jilles2010-01-081-2/+2
|
* Plug a memory leak.delphij2010-01-041-0/+1
| | | | | PR: bin/141835 Submitted by: Henning Petersen <henning.petersen t-online.de>
* MFC r199458: Add pwait utility, which waits for any process to terminate.jilles2009-12-234-0/+229
| | | | | | | | | This is similar to the Solaris utility of the same name. Some use cases: * rc.subr's wait_for_pids * interactive use, e.g. to shut down the computer when some task is done even if the task is already running
* MFC r198173: sh: show more info about syntax errors in command substitution:jilles2009-12-201-0/+5
| | | | | | | the line number where the command substitution started. This applies to both the $() and `` forms but is most useful for `` because the other line number is relative to the enclosed text there. (For older versions, -v can be used as a workaround.)
* MFC r198963: sh: Fix memory leak when using a variable in arithmeticjilles2009-12-061-3/+23
| | | | like $((x)).
* MFC r199351:netchild2009-11-241-0/+1
| | | | | | Fix small resource leak (memory). Reviewed by: gad
* MFC r197371: Mention that NUL characters are not allowed in sh(1) input.jilles2009-10-291-0/+4
| | | | | | | I do not consider this a bug because POSIX permits it and argument strings and environment variables cannot contain '\0' anyway. PR: bin/25542
* MFC r198189: Check error of dlfunc(3).ume2009-10-201-0/+11
| | | | Approved by: re (kib)
* MFC r196483,r196634:jilles2009-10-115-18/+53
| | | | | | | | | | | sh: Fix crash when undefining or redefining a currently executing function Add a reference count to function definitions. Memory may leak if a SIGINT arrives in interactive mode at exactly the wrong time, this will be fixed later by changing SIGINT handling. PR: bin/137640 Approved by: re (kib)
* Add the -d switch to the usage message.brian2009-07-231-1/+1
| | | | | | Submitted by: Emil Mikulic - emil at dmr dot ath dot cx Approved by: re (kib) MFC after: 1 week
* Allow creating hard links to symlinks using ln(1).jilles2009-07-192-22/+41
| | | | | | | | This implements the POSIX.1-2008 -L and -P flags. The default remains to create hard links to the target of symlinks. Approved by: re (kib), ed (mentor)
* Add manual page links to advertise procstat(1) a little better.trasz2009-07-091-1/+2
| | | | Approved by: re (kib)
* With NFSv4 ACLs, it is possible that applying a mode to an ACL whichtrasz2009-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)
* Fix some weirdnesses in the NetBSD IFS code,jilles2009-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)
* Improve IFS expansion using code from NetBSD.jilles2009-06-251-61/+80
| | | | | | | | We now pass the ifs.sh testsuite. PR: standards/79067 Approved by: ed (mentor) (implicit) Obtained from: NetBSD
* Designate special builtins as such in command -V and type.jilles2009-06-242-3/+15
| | | | | | Also document various properties of special builtins that we implement. Approved by: ed (mentor) (implicit)
* Staticify internal routines.delphij2009-06-234-7/+7
|
* Quote -x tracing output so it is unambiguous.jilles2009-06-231-2/+17
| | | | | | It is usually but not always suitable for re-input to the shell. Approved by: ed (mentor) (implicit)
* Do not fork for a subshell if it is the last thing this shell is doingjilles2009-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)
* Usermode portion of the support for swap allocation accounting:kib2009-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)
OpenPOWER on IntegriCloud