summaryrefslogtreecommitdiffstats
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* The NetBSD Foundation has granted permission to remove clause 3 and 4 fromjoel2010-03-022-14/+0
| | | | | | | their software. Approved by: pjd Obtained from: NetBSD
* Do not restrict the allowed signals that can be specified by numberkib2010-02-251-1/+1
| | | | | | | to the list of signals that has symbolic name. It was impossible to send rt signals with kill(1) due to the check. MFC after: 1 week
* Fix expansion of \W in prompt strings when the working directory is "/".jh2010-02-241-1/+1
| | | | | | | | The prompt string was truncated after \W when the working directory was "/". PR: bin/89410 Submitted by: Dr Balwinder Singh Dheeman MFC after: 1 week
* Bump WARNS where possible.uqs2010-02-151-1/+1
| | | | | Checked by: make universe Approved by: ed (co-mentor)
* - Implement -q option for pgrep(1).pjd2010-02-122-5/+20
| | | | - Add regression test to test -q option.
* Initialize the execfile argument to NULL instead of _PATH_DEVNULL. This ↵brucec2010-02-082-2/+4
| | | | | | | | allows the -M option to be used without specifying -N. PR: bin/138146 Approved by: rrs (mentor) MFC after: 3 days
* Make sure that FTS_COMFOLLOW is not set when the -P option is in effect.jh2010-02-081-2/+6
| | | | | | | | | | 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 Reviewed by: jilles MFC after: 2 weeks
* Tell the compiler these structures are aligned to a byte boundary.imp2010-02-073-7/+5
| | | | | | | | | | All the elements of these structs are char anyway, so it won't hurt performance. Bump warns back up to the default. # we likely should have CTASSERTS to make sure they are the right size. # but with libarchive based tar maybe we shouldn't bother.
* sh: Do not stat() $MAIL/$MAILPATH in non-interactive shells.jilles2010-02-062-1/+8
| | | | | These may be NFS mounted, and we should not touch them unless we are going to do something useful with the information.
* Arm doesn't seem to need such kit gloves. Bump the warnings to 3 hereimp2010-02-041-2/+0
| | | | as well.
* Fixes for ls(1) long format (-l) output:jh2010-01-243-21/+50
| | | | | | | | | | - 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 Approved by: trasz (mentor) MFC after: 1 month
* Print full path in the error message. It's possible that fts(3)jh2010-01-241-1/+1
| | | | | | | | | | provides an empty fts_name and reporting the full path is more appropriate especially with the -R option. PR: bin/107515 Submitted by: bde Approved by: trasz (mentor) MFC after: 1 week
* Remove stale references to utmp(5) and its corresponding filenames.ed2010-01-211-2/+2
| | | | I removed utmp and its manpage, but not other manpages referring to it.
* Raise WARNS for various tools where possible.ed2010-01-171-1/+0
| | | | Submitted by: Marius Nünnerich <marius@nuenneri.ch>
* Implement an "-x" option to cp(1), for compatibility with Linux andgavin2010-01-173-7/+12
| | | | | | | | | | | | feature parity with du(1) and similar: When set, cp(1) will not traverse mount points. Initial patch by: Graham J Lee leeg teaching.physics.ox.ac.uk PR: bin/88056 Initial patch by: Graham J Lee leeg teaching.physics.ox.ac.uk Approved by: ed (mentor) MFC after: 1 month
* Port everything in bin/ from utmp to utmpx.ed2010-01-133-12/+3
| | | | | date: use libc utmpx routines instead of the ones provided by libulog. pax: don't depend on <utmp.h>
* Let csh(1) use utmpx instead of utmp.ed2010-01-132-5/+6
| | | | | | | | | csh allows you to monitor the utmp(x) file to monitor certain user logins. Unfortunately it needs to directly stat() this file. I don't want to break this module , but eventually it shouldn't do that. The idea of the getutxent(3) API is to hide file access. Approved by: mp
* Committed the wrong version in r201484. This time really fix the "-t"obrien2010-01-041-4/+14
| | | | | | functionality. Per the regression tests (pgrep-t.t & pkill-t.t), "-t" should accept "v1", which means a plain number should be accepted for UNIX98-style PTY's.
* Fix the "-t" functionality. Per the regression tests (pgrep-t.t & pkill-t.t),obrien2010-01-041-3/+4
| | | | | "-t" should accept "v1", which means a plain number should be accepted for UNIX98-style PTY's.
* sh: Send the "not found" message for builtin <cmd> to redirected fd 2.jilles2010-01-031-5/+11
|
* sh: Fix some bugs with backquoted builtins:jilles2010-01-016-21/+23
| | | | | | | | | | | | - correctly handle error output in $(builtin 2>&1), clarify out1/out2 vs output/errout in the code - treat all builtins as regular builtins so errors do not abort the shell and variable assignments do not persist - respect the caller's INTOFF Some bugs still exist: - expansion errors may still abort the shell - some side effects of expansions and builtins persist
* sh(1): document ulimit -w (swapuse rlimit).jilles2009-12-311-2/+5
| | | | MFC after: 1 week
* sh(1): Correct two places where "$@" lacked necessary quotes.jilles2009-12-311-2/+2
| | | | MFC after: 1 week
* sh: Use PATH= assignment in type.jilles2009-12-311-1/+1
| | | | | Example: PATH=/var/empty; PATH=/bin type ls
* sh: Allow command -pv and command -pV (lookup using _PATH_STDPATH).jilles2009-12-313-7/+14
|
* sh: Ensure funcnest is decremented if there was an error in the function.jilles2009-12-301-2/+3
| | | | | | This will be important when things like 'command eval f' will be possible. Currently, the funcnest = 0 assignment in RESET (called when returning to the top level after an error in interactive mode) is really sufficient.
* Fix memory leak when parsing backticks (``).jilles2009-12-301-13/+23
|
* sh: arith: Return only 0 and 1 from && and ||.jilles2009-12-301-2/+2
| | | | This agrees with C, POSIX and other shells.
* Add missing `void' for function without arguments.ed2009-12-291-1/+1
|
* Add missing `void' for function without arguments.ed2009-12-291-1/+1
|
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.antoine2009-12-281-8/+8
| | | | | | | | | 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 after: 1 month
* sh: Change varinit to use const better.jilles2009-12-271-13/+13
|
* sh: Various warning fixes (from WARNS=6 NO_WERROR=1):jilles2009-12-2721-100/+98
| | | | | | | - const - initializations to silence -Wuninitialized (it was safe anyway) - remove nested extern declarations - rename "index" locals to "idx"
* Remove declaration of function that no longer exists.jilles2009-12-261-1/+0
|
* Fix breakage introduced in last commit.trasz2009-12-261-1/+1
|
* Improve ACL branding mismatch detection and reporting in some rare cases,trasz2009-12-264-8/+32
| | | | such as "setfacl -m ''".
* sh: Do not run callers' exception handlers in subshells.jilles2009-12-253-3/+5
| | | | | | | Reset the exception handler in the child to main's. This avoids inappropriate double cleanups or shell duplication when the exception is caught, such as 'fc' and future 'command eval' and 'command .'.
* sh: Do not consider a tilde-prefix with expansions in it.jilles2009-12-251-2/+7
| | | | | | | | | | That is, do not do tilde expansion if any of the CTL* bytes (\201-\210), not only CTLESC and CTLQUOTEMARK, are encountered. Such an expansion would look up a user name with sh's internal representation. The parser does not currently distinguish between backslashed and unbackslashed \201-\210, so tilde expansion of user names with these bytes in them is not so easy to fix.
* sh: Add some __dead2 to indicate functions that do not return.jilles2009-12-244-6/+6
|
* sh: Constify various strings.jilles2009-12-2428-90/+92
| | | | | Most of this is adding const keywords, but setvar() in var.c had to be changed somewhat more.
* sh: Remove setting variables from dotcmd/exportcmd.jilles2009-12-242-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 will 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'
* Plug a memory leak.delphij2009-12-211-0/+1
| | | | | | PR: bin/141835 Submitted by: Henning Petersen <henning.petersen t-online.de> MFC after: 2 weeks
* Let date(1) use utmpx instead of logwtmp().ed2009-12-052-5/+11
| | | | | utmpx also has OLD_TIME/NEW_TIME messages, which seem to be intended for the same purpose as how we call logwtmp() here.
* Fix some cases where file descriptors from redirections leak to programs.jilles2009-11-292-16/+7
| | | | | | | | | | | | | | | | - Redirecting fds that were not open before kept two copies of the redirected file. sh -c '{ :; } 7>/dev/null; fstat -p $$; true' (both fd 7 and 10 remained open) - File descriptors used to restore things after redirection were not set close-on-exec, instead they were explicitly closed before executing a program normally and before executing a shell procedure. The latter must remain but the former is replaced by close-on-exec. sh -c 'exec 7</; { exec fstat -p $$; } 7>/dev/null; true' (fd 10 remained open) The examples above are simpler than the testsuite because I do not want to use fstat or procstat in the testsuite.
* Fix various things about SIGINT handling:jilles2009-11-226-6/+25
| | | | | | | | | | | | | | | | | | * exception handlers are now run with interrupts disabled, which avoids many race conditions * fix some cases where SIGINT only aborts one command and continues the script, in particular if a SIGINT causes an EINTR error which trumped the interrupt. Example: sh -c 'echo < /some/fifo; echo This should not be printed' The fifo should not have writers. When pressing ctrl+c to abort the open, the shell used to continue with the next command. Example: sh -c '/bin/echo < /some/fifo; echo This should not be printed' Similar. Note, however, that this particular case did not and does not work in interactive mode with job control enabled.
* sh: Ensure the same command input file is on top after executing a builtin.jilles2009-11-223-0/+33
| | | | | | | | | | | | | This avoids weirdness when 'fc -e vi' or the like is done and there is a syntax error in the file. Formerly an interactive shell tried to execute stuff after the syntax error and exited. This should also avoid similar issues with 'command eval' and 'command .' when 'command' is implemented properly as in NetBSD sh. Special builtins did not have this problem since errors in them cause the shell to exit or to reset various state such as the current command input file.
* trap: do not consider a bad signal name a fatal error.jilles2009-11-211-3/+6
| | | | | POSIX explicitly prescribes this. Continue processing any other signals and return status 1.
* Handle current work directories of arbitrary length. The argument to cdstefanf2009-11-211-22/+29
| | | | | | | continues to be limited by PATH_MAX (1024). Obtained from: NetBSD PR: 104456
* sh: Some changes to stderr flushing:jilles2009-11-217-14/+16
| | | | | | | | | * increase buffer size from 100 to 256 bytes * remove implied flush from out2str(), in particular this avoids unnecessary flushing in the middle of a -x tracing line * rename dprintf() to out2fmt_flush(), make it flush out2 and use this function in various places where flushing is desired after an error message
* Add pwait utility, which waits for any process to terminate.jilles2009-11-174-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 Discussed on: hackers@
OpenPOWER on IntegriCloud