summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
...
* Run the sh(1) and test(1) tests as unprivileged.jmmv2014-01-104-0/+26
| | | | | | | | | | | One of the tests for test(1) fails and some of the tests for sh(1) are silently bypassed when running as root. To fix these tests and ensure they all run, mark the test programs for sh(1) and test(1) as requiring an unprivileged user. (This should and will be the default in Kyua but isn't yet.) MFC after: 1 week
* sh(1): Discourage use of -e.jilles2014-01-031-2/+8
| | | | | Also, do not say that ! before a pipeline is an operator, because it is syntactically a keyword.
* Correct the description of the V state, which indicates that the process'markj2013-12-281-3/+4
| | | | | | parent is suspended, not the process itself. MFC after: 3 days
* sh: Don't check input for non-whitespace if history is disabled.jilles2013-12-271-8/+2
| | | | | | | | | | | preadbuffer() maintained a flag whether there was any non-whitespace character. This flag is only useful when history is enabled (in that case, lines containing only whitespace are not added to history). Instead, check using strspn() when history is enabled. There is an approximate 2% speedup when running sh -c '. /etc/rc.subr; . /etc/defaults/rc.conf; source_rc_confs' with hot cache.
* sh: Simplify code related to PPID variable.jilles2013-12-252-8/+2
|
* sh: Initialize OPTIND=1 even if it came from the environment.jilles2013-12-243-0/+5
|
* sh: Remove an unused variable.jilles2013-12-241-1/+0
|
* Document the lack of chflags support in pax(1)crees2013-12-211-1/+19
| | | | | | PR: docs/135516 Submitted by: arundel (based on) Approved by: gjb (mentor)
* Migrate tools/regression/bin/ tests to the new layout.jmmv2013-12-11420-2/+7331
| | | | | | | | | | | | | | | | | | | | This change is a proof of concept on how to easily integrate existing tests from the tools/regression/ hierarchy into the /usr/tests/ test suite and on how to adapt them to the new layout for src. To achieve these goals, this change: - Moves tests from tools/regression/bin/<tool>/ to bin/<tool>/tests/. - Renames the previous regress.sh files to legacy_test.sh. - Adds Makefiles to build and install the tests and all their supporting data files into /usr/tests/bin/. - Plugs the legacy_test test programs into the test suite using the new TAP backend for Kyua (appearing in 0.8) so that the code of the test programs does not have to change. - Registers the new directories in the BSD.test.dist mtree file. Reviewed by: freebsd-testing Approved by: rpaulo (mentor)
* sh: Split set -x output into a separate function.jilles2013-12-061-34/+41
|
* test: Avoid looking up again the type of a known binary operator.jilles2013-12-051-7/+6
|
* test: Simplify the code by unifying op_num and op_type.jilles2013-12-011-78/+75
| | | | The global variable t_wp_op is no longer needed.
* sh: Prefer memcpy() to strcpy() in most cases. Remove the scopy macro.jilles2013-11-308-27/+34
|
* sh: Make <&0 disable the </dev/null implicit in a background command.jilles2013-11-241-4/+5
| | | | | | Although <&0 does nothing, it is a redirection affecting standard input and should therefore disable the </dev/null redirection implicit in a background command.
* sh: Properly quote alias output from command -v.jilles2013-11-101-3/+5
| | | | | An alias should be printed by command -v as a command line; therefore, make the alias definition suitable for re-input to the shell.
* pkill - Optimize pgrep -Feadler2013-11-101-1/+4
| | | | | | | Ask for a specific process instead of pulling down all processes when -F <pidfile> is specified. This is much much faster. Obtained from: DragonflyBSD
* sh(1),limits(1): Document kqueues (-k) rlimit.jilles2013-11-011-2/+7
|
* sh: Reorder union node to reduce its size on 64-bit platforms.jilles2013-11-011-3/+3
|
* sh: Allow trapping SIGINT/SIGQUIT after ignore because of '&'.jilles2013-10-301-1/+3
| | | | | | | | | | | | | | If job control is not enabled, background jobs started with ... & ignore SIGINT and SIGQUIT so that they are not affected by such signals that are intended for the foreground job. However, this should not prevent reassigning a different action for these signals (as if the shell invocation inherited these signal actions from its parent). Austin group issue #751 Example: { trap - INT; exec sleep 10; } & wait A Ctrl+C should terminate the sleep command.
* Clean up a spurious "." in SEE ALSO.brueffer2013-10-281-1/+1
| | | | MFC after: 3 days
* Add a resource limit for the total number of kqueues available to thekib2013-10-211-1/+4
| | | | | | | | | | | | | | | | | | user. Kqueue now saves the ucred of the allocating thread, to correctly decrement the counter on close. Under some specific and not real-world use scenario for kqueue, it is possible for the kqueues to consume memory proportional to the square of the number of the filedescriptors available to the process. Limit allows administrator to prevent the abuse. This is kernel-mode side of the change, with the user-mode enabling commit following. Reported and tested by: pho Discussed with: jmg Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Don't test arrays for being NULL.trasz2013-10-211-7/+1
| | | | MFC after: 1 month
* sh: Remove one syscall when waiting for a foreground job.jilles2013-10-181-2/+1
| | | | | | The getpgrp() call is unnecessary: if there is no job control then the result was not used at all and if there is job control then we are not a subshell and our process group ID is equal to our process ID (rootpid).
* Remove extraneous \n.des2013-10-111-1/+1
| | | | | | Noticed by: Nikolai Lifanov <lifanov@mail.lifanov.com> Approved by: re (gjb)
* By popular demand, move freebsd-version(1) from /libexec to /bin.des2013-10-094-0/+271
| | | | Approved by: re (gjb)
* Remove useless check - ki_loginclass is an array; can't be NULL.trasz2013-10-041-1/+0
| | | | | | | CID: 1006559 Approved by: re (kib) MFC after: 2 weeks Sponsored by: FreeBSD Foundation
* Sweep man pages replacing ad -> ada.pluknet2013-10-011-3/+3
| | | | | | Approved by: re (blackend) MFC after: 1 week X-MFC note: stable/9 only
* sh: Make return return from the closest function or dot script.jilles2013-09-044-15/+10
| | | | | | | | | | | | | Formerly, return always returned from a function if it was called from a function, even if there was a closer dot script. This was for compatibility with the Bourne shell which only allowed returning from functions. Other modern shells and POSIX return from the function or the dot script, whichever is closest. Git 1.8.4's rebase --continue depends on the POSIX behaviour. Reported by: Christoph Mallon, avg
* sh: Fix race condition with signals and wait or set -T.jilles2013-09-024-31/+20
| | | | | | | | | | The change in r238888 was incomplete. It was still possible for a trapped signal to arrive before the shell went to sleep (sigsuspend()) because a check was missing or because the signal arrived before in_waitcmd was set. On SMP, this bug sometimes caused the builtins/wait4.0 test to take 1 second to execute; it then might or might not fail. On UP, the test almost always failed.
* sh: Simplify list() in the parser.jilles2013-08-301-21/+22
| | | | | | The erflag argument was only used by old-style (``) command substitutions. We can remove it and handle the special case in the command substitution code.
* sh: Separate out nbinary allocation into a function.jilles2013-08-301-21/+22
|
* sh: Use makename() where possible.jilles2013-08-301-22/+5
|
* sh: Add a function for the case where one token is required in the parse.jilles2013-08-301-31/+23
|
* sh: Recognize "--" as end of options in type builtin.jilles2013-08-301-0/+2
| | | | | This implementation makes minimal changes: command names starting with "-" (other than "--") can still be queried normally.
* sh: Cast -1 to pointer rather than pointer to variable of wrong type.jilles2013-08-302-5/+3
| | | | | | | | | | NEOF needs to be a non-null pointer distinct from valid union node pointers. It is not dereferenced. The new NEOF is much like SIG_ERR except that it is an object pointer instead of a function pointer. The variable tokpushback can now be static.
* Add the ability to display the default FIB number for a process to thewill2013-08-262-0/+4
| | | | | | | | | | | | | | | | | | ps(1) utility, e.g. "ps -O fib". bin/ps/keyword.c: Add the "fib" keyword and default its column name to "FIB". bin/ps/ps.1: Add "fib" as a supported keyword. sys/compat/freebsd32/freebsd32.h: sys/kern/kern_proc.c: sys/sys/user.h: Add the default fib number for a process (p->p_fibnum) to the user land accessible process data of struct kinfo_proc. Submitted by: Oliver Fromme <olli@fromme.com>, gibbs
* sh: Recognize "--" as end of options in alias builtin.jilles2013-08-251-3/+5
| | | | | Aliases starting with "-" (which are non-POSIX) will need to be preceded by an alias not starting with "-" or the newly added "--".
* sh: Disallow empty simple commands.jilles2013-08-251-8/+4
| | | | | | | | | | As per POSIX, a simple command must have at least one redirection, assignment word or command word. These occured in rare cases such as eval "f()" . The extension of allowing no commands inside { }, if, while, for, etc. remains.
* sh: Reject ++ and -- in arithmetic.jilles2013-08-241-0/+4
| | | | | | | | | | POSIX does not require ++ and -- in arithmetic. It is probably more useful to reject them than to treat ++x and --x as x silently. Note that the behaviour of increment and decrement can be obtained via (x+=1), ((x+=1)-1), (x-=1) and ((x-=1)+1). PR: bin/176444
* sh: Do not prematurely discard stopped jobs in a wait builtin.jilles2013-08-241-5/+1
| | | | | | | | | | | | | If a job is specified to 'wait', wait for it to complete. Formerly, in interactive mode, the job was deleted if it stopped. If no jobs are specified in interactive mode, 'wait' still waits for all jobs to complete or stop. In non-interactive mode, WUNTRACED is not passed to wait3() so stopped jobs are not detected. PR: bin/181435
* Expand the use of stat(2) flags to allow storing some Windows/DOSken2013-08-212-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and CIFS file attributes as BSD stat(2) flags. This work is intended to be compatible with ZFS, the Solaris CIFS server's interaction with ZFS, somewhat compatible with MacOS X, and of course compatible with Windows. The Windows attributes that are implemented were chosen based on the attributes that ZFS already supports. The summary of the flags is as follows: UF_SYSTEM: Command line name: "system" or "usystem" ZFS name: XAT_SYSTEM, ZFS_SYSTEM Windows: FILE_ATTRIBUTE_SYSTEM This flag means that the file is used by the operating system. FreeBSD does not enforce any special handling when this flag is set. UF_SPARSE: Command line name: "sparse" or "usparse" ZFS name: XAT_SPARSE, ZFS_SPARSE Windows: FILE_ATTRIBUTE_SPARSE_FILE This flag means that the file is sparse. Although ZFS may modify this in some situations, there is not generally any special handling for this flag. UF_OFFLINE: Command line name: "offline" or "uoffline" ZFS name: XAT_OFFLINE, ZFS_OFFLINE Windows: FILE_ATTRIBUTE_OFFLINE This flag means that the file has been moved to offline storage. FreeBSD does not have any special handling for this flag. UF_REPARSE: Command line name: "reparse" or "ureparse" ZFS name: XAT_REPARSE, ZFS_REPARSE Windows: FILE_ATTRIBUTE_REPARSE_POINT This flag means that the file is a Windows reparse point. ZFS has special handling code for reparse points, but we don't currently have the other supporting infrastructure for them. UF_HIDDEN: Command line name: "hidden" or "uhidden" ZFS name: XAT_HIDDEN, ZFS_HIDDEN Windows: FILE_ATTRIBUTE_HIDDEN This flag means that the file may be excluded from a directory listing if the application honors it. FreeBSD has no special handling for this flag. The name and bit definition for UF_HIDDEN are identical to the definition in MacOS X. UF_READONLY: Command line name: "urdonly", "rdonly", "readonly" ZFS name: XAT_READONLY, ZFS_READONLY Windows: FILE_ATTRIBUTE_READONLY This flag means that the file may not written or appended, but its attributes may be changed. ZFS currently enforces this flag, but Illumos developers have discussed disabling enforcement. The behavior of this flag is different than MacOS X. MacOS X uses UF_IMMUTABLE to represent the DOS readonly permission, but that flag has a stronger meaning than the semantics of DOS readonly permissions. UF_ARCHIVE: Command line name: "uarch", "uarchive" ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE Windows name: FILE_ATTRIBUTE_ARCHIVE The UF_ARCHIVED flag means that the file has changed and needs to be archived. The meaning is same as the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute. msdosfs and ZFS have special handling for this flag. i.e. they will set it when the file changes. sys/param.h: Bump __FreeBSD_version to 1000047 for the addition of new stat(2) flags. chflags.1: Document the new command line flag names (e.g. "system", "hidden") available to the user. ls.1: Reference chflags(1) for a list of file flags and their meanings. strtofflags.c: Implement the mapping between the new command line flag names and new stat(2) flags. chflags.2: Document all of the new stat(2) flags, and explain the intended behavior in a little more detail. Explain how they map to Windows file attributes. Different filesystems behave differently with respect to flags, so warn the application developer to take care when using them. zfs_vnops.c: Add support for getting and setting the UF_ARCHIVE, UF_READONLY, UF_SYSTEM, UF_HIDDEN, UF_REPARSE, UF_OFFLINE, and UF_SPARSE flags. All of these flags are implemented using attributes that ZFS already supports, so the on-disk format has not changed. ZFS currently doesn't allow setting the UF_REPARSE flag, and we don't really have the other infrastructure to support reparse points. msdosfs_denode.c, msdosfs_vnops.c: Add support for getting and setting UF_HIDDEN, UF_SYSTEM and UF_READONLY in MSDOSFS. It supported SF_ARCHIVED, but this has been changed to be UF_ARCHIVE, which has the same semantics as the DOS archive attribute instead of inverse semantics like SF_ARCHIVED. After discussion with Bruce Evans, change several things in the msdosfs behavior: Use UF_READONLY to indicate whether a file is writeable instead of file permissions, but don't actually enforce it. Refuse to change attributes on the root directory, because it is special in FAT filesystems, but allow most other attribute changes on directories. Don't set the archive attribute on a directory when its modification time is updated. Windows and DOS don't set the archive attribute in that scenario, so we are now bug-for-bug compatible. smbfs_node.c, smbfs_vnops.c: Add support for UF_HIDDEN, UF_SYSTEM, UF_READONLY and UF_ARCHIVE in SMBFS. This is similar to changes that Apple has made in their version of SMBFS (as of smb-583.8, posted on opensource.apple.com), but not quite the same. We map SMB_FA_READONLY to UF_READONLY, because UF_READONLY is intended to match the semantics of the DOS readonly flag. The MacOS X code maps both UF_IMMUTABLE and SF_IMMUTABLE to SMB_FA_READONLY, but the immutable flags have stronger meaning than the DOS readonly bit. stat.h: Add definitions for UF_SYSTEM, UF_SPARSE, UF_OFFLINE, UF_REPARSE, UF_ARCHIVE, UF_READONLY and UF_HIDDEN. The definition of UF_HIDDEN is the same as the MacOS X definition. Add commented-out definitions of UF_COMPRESSED and UF_TRACKED. They are defined in MacOS X (as of 10.8.2), but we do not implement them (yet). ufs_vnops.c: Add support for getting and setting UF_ARCHIVE, UF_HIDDEN, UF_OFFLINE, UF_READONLY, UF_REPARSE, UF_SPARSE, and UF_SYSTEM in UFS. Alphabetize the flags that are supported. These new flags are only stored, UFS does not take any action if the flag is set. Sponsored by: Spectra Logic Reviewed by: bde (earlier version)
* sh: Remove unnecessary reset functions.jilles2013-08-166-25/+1
| | | | These are already handled by exception handlers.
* sh: Recognize "--" as end of options in bg/fg/jobid builtins.jilles2013-08-161-6/+9
|
* sh: Recognize "--" as end of options in local builtin.jilles2013-08-141-0/+1
|
* sh: Allow a lone redirection before '|', ';;' or ';&'.jilles2013-08-141-0/+3
| | | | | | | Example: </dev/null | : PR: 181240 MFC after: 1 week
* Add -c flag to pgrep(1) and pkill(1), to match login classes.trasz2013-08-092-8/+42
| | | | MFC after: 1 month
* sh: Remove an incorrect comment.jilles2013-07-251-1/+1
|
* sh: Remove #define MKINIT.jilles2013-07-257-11/+9
| | | | MKINIT only served for the removed mkinit. Many variables can be static now.
* sh: Remove mkinit.jilles2013-07-2514-576/+32
| | | | | | | | | | | | | | Replace the RESET blocks with regular functions and a reset() function that calls them all. This code generation tool is unusual and does not appear to provide much benefit. I do not think isolating the knowledge about which modules need to be reset is worth an almost 500-line build tool and wider scope for variables used by the reset functions. Also, relying on reset functions is often wrong: the cleanup should be done in exception handlers so that no stale state remains after 'command eval' and the like.
* sh: Remove output.c's reset() handler.jilles2013-07-251-19/+0
| | | | | These cleanup operations are not needed because they are already performed after an optimized command substitution (whether there was an error or not).
OpenPOWER on IntegriCloud