History log of /freebsd-10.1-release/bin/sh/Makefile
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 262951 09-Mar-2014 jmmv

Sync sh(1) in stable/10 to head.

This is a MFC of all the commits listed below.

My original goal of this change was to only merge the move of the tests
from tools/regression/bin/ into the new layout (which include tests for
sh(1) and other tools as well). However, doing so is tricky due to the
ongoing work in sh(1) and, especially, the many changes to its tests
since stable/10 was first branched.

Merging everything is the simplest way to achieve this goal and, as a
bonus point, we get various fixes and miscellaneous improvements into
the branch.

Per jilles' suggestion, I'm avoiding the merge of a couple of changes
(r256850 and r257506) that required depending kernel changes. I'm also
avoiding very recent changes that have not had a long enough time to be
validated in current.

This is "make tinderbox" clean.

r256735 sh: Remove one syscall when waiting for a foreground job.
r257399 sh: Allow trapping SIGINT/SIGQUIT after ignore because of '&'.
r257504 sh: Reorder union node to reduce its size on 64-bit platforms.
r257920 sh: Add a test case for would-be assignments that are not due to quoting.
r257929 sh: Properly quote alias output from command -v.
r258489 sh: Add tests for the </dev/null implicit in a background command.
r258533 sh: Add more tests for the </dev/null implicit in a background command.
r258535 sh: Make <&0 disable the </dev/null implicit in a background command.
r258776 sh: Prefer memcpy() to strcpy() in most cases. Remove the scopy macro.
r259047 sh: Split set -x output into a separate function.
r259210 Migrate tools/regression/bin/ tests to the new layout.
r259844 sh: Remove an unused variable.
r259846 sh: Initialize OPTIND=1 even if it came from the environment.
r259874 sh: Simplify code related to PPID variable.
r259946 sh: Don't check input for non-whitespace if history is disabled.
r260246 sh(1): Discourage use of -e.
r260506 Run the sh(1) and test(1) tests as unprivileged.
r260586 Mark the bin/pax tests as requiring perl.
r260634 Use TAP_TESTS_PERL to register the legacy_test in bin/pax.
r260635 Replace hand-crafted Kyuafiles with automatic generation.
r260654 sh: Remove SIGWINCH handler and just check for resize before every read.
r261121 sh: Add test for nested alias.
r261125 sh: Solve the alias recursion problem in a less hackish way.
r261141 sh: Do not depend on parse/execute split in new alias test.
r261160 sh: Add tests for alias names after another alias.
r261192 sh: Allow aliases to force alias substitution on the following word.
r262533 sh: Make expari() static.
r262565 sh: Do not corrupt internal representation if LINENO inner expansion fails.
r262697 sh: Simplify expari().

Reviewed by: jilles


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 253650 25-Jul-2013 jilles

sh: Remove mkinit.

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.


# 235927 24-May-2012 marcel

Work better with how make/bmake works:
1. Avoid a cd back into ${.CURDIR} to run mkbuiltins when we know make
will first cd into ${.OBJDIR}. Keep the cwd to what make sets it to.
2. Don't tell mkbuiltins where to write to (= ${.OBJDIR}), but where to
get sources from (= ${.CURDIR}). This to compensate for point 1.

This fixes a problem with bmake's mk files that optimize ${.OBJDIR} to
expand to "." after changing cwd, not taking into account that the
target is pretty much undoing that and not getting the full path to the
object tree anymore.


# 218466 08-Feb-2011 jilles

sh: Import arithmetic expression code from dash.

New features:
* proper lazy evaluation of || and &&
* ?: ternary operator
* executable is considerably smaller (8K on i386) because lex and yacc are
no longer used

Differences from dash:
* arith_t instead of intmax_t
* imaxdiv() not used
* unset or null variables default to 0
* let/exp builtin (undocumented, will probably be removed later)

Obtained from: dash


# 216629 21-Dec-2010 jilles

sh: Add kill builtin.

This allows specifying a %job (which is equivalent to the corresponding
process group).

Additionally, it improves reliability of kill from sh in high-load
situations and ensures "kill" finds the correct utility regardless of PATH,
as required by POSIX (unless the undocumented %builtin mechanism is used).

Side effect: fatal errors (any error other than kill(2) failure) now return
exit status 2 instead of 1. (This is consistent with other sh builtins, but
not in NetBSD.)

Code size increases about 1K on i386.

Obtained from: NetBSD


# 215520 19-Nov-2010 jilles

sh: Add printf builtin.

This was removed in 2001 but I think it is appropriate to add it back:
* I do not want to encourage people to write fragile and non-portable echo
commands by making printf much slower than echo.
* Recent versions of Autoconf use it a lot.
* Almost no software still wants to support systems that do not have
printf(1) at all.
* In many other shells printf is already a builtin.

Side effect: printf is now always the builtin version (which behaves
identically to /usr/bin/printf) and cannot be overridden via PATH (except
via the undocumented %builtin mechanism).

Code size increases about 5K on i386. Embedded folks might want to replace
/usr/bin/printf with a hard link to /usr/bin/alias.


# 213815 13-Oct-2010 obrien

We only need to look as far as '..' to find 'test/'.


# 213811 13-Oct-2010 obrien

In the spirit of r90111, depend on c89 and remove the "STATIC" macro
and its usage.


# 213798 13-Oct-2010 obrien

If one wishes to set breakpoints of static the functions here, they
cannot be inlined.

Submitted by: jhb


# 213774 13-Oct-2010 jhb

Suggest that DEBUG_FLAGS be used to enable extra debugging rather than
frobbing CFLAGS directly. DEBUG_FLAGS is something that can be specified
on the make command line without having to edit the Makefile directly.

Submitted by: Garrett Cooper


# 213744 12-Oct-2010 obrien

If DEBUG is 3 or greater, disable STATICization of functions.
Also correct the documented location of the trace file.


# 213738 12-Oct-2010 obrien

Allow one to regression test 'sh' changes without having to install
a potentially bad /bin/sh first.


# 173718 17-Nov-2007 jb

Reduce the WARNS level to avoid a compiler warning about a variable
possibly being clobbered by a longjmp or a fork with gcc4.


# 157811 17-Apr-2006 schweikh

Whitespace nits.


# 149046 14-Aug-2005 stefanf

Recent cleanups made it possible to bump WARNS to 3.


# 127167 18-Mar-2004 ru

Install /bin/sh safely. This allows a shell script to be used
to strip binaries by specifying it in the STRIPBIN environment
variable honoured by install(1).

MFC after: 3 days


# 126173 23-Feb-2004 johan

style.Makefile:
Use WARNS?= instead of WARNS=


# 125503 05-Feb-2004 ru

Fixed style of DPADD and LDADD assignments as per style.Makefile(5).


# 124751 20-Jan-2004 ru

Removed duplicate y.tab.h from SRCS and CLEANFILES.


# 114502 02-May-2003 obrien

[Grrr, editor exited too early]
Rev 1.39 sets WARNS=WFORMAT=0 because of the explanation given.


# 114500 02-May-2003 obrien

The is_name and is_in_name macros are FUBAR'ed.
Due to the use of signed vs. unsigned chars on our various platforms, one gets
"warning: comparison is always true due to limited range of data type"
from GCC 3.3.


# 104284 01-Oct-2002 mux

It is now safe to remove WARNS=0 and WFORMAT=0.

Tested on: alpha, i386, sparc64


# 104276 01-Oct-2002 tjr

Add back WARNS=0 and WFORMAT=0; gcc is finding nonexistent format string
errors with %qd formats.


# 104273 01-Oct-2002 tjr

Remove WARNS=0 and WFORMAT=0. The shell compiles cleanly at WARNS=2
on at least i386. If there are warnings on other archs, I'd rather hear
about them than pretend they didn't exist.


# 90166 04-Feb-2002 kris

Lock down with WFORMAT=1 except those directories with unfixed warnings.
Tested on i386 and alpha.


# 87323 03-Dec-2001 obrien

Default to WARNS=2. Binary builds that cannot handle this must explicitly
set WARNS=0.

Reviewed by: mike


# 86693 20-Nov-2001 knu

(null commit to correct the previous log message)

Now that all the printf invocations from within the system startup
scripts *have been replaced with equivalent handmade functions*, we
can safely remove it.

Please steal the technique from src/etc/MAKEDEV when you want to use
printf(1) functionality from within the system rc scripts.


# 86692 20-Nov-2001 knu

Remove the printf builtin command from sh(1), which command is not
used so often that it's worth keeping it as a builtin.

Now that all the printf invocations from within the system startup
scripts, we can safely remove it.

Urged by: sheldonh :)

No MFC is planned so far because it may break compatibility and
violate POLA.


# 86505 17-Nov-2001 knu

Make test(1) a builtin command of our sh(1) for efficiency. The
binary size increase is 3,784 bytes (about 0.6%).

I don't drop the printf builtin while I'm here because some /etc/rc.*
scripts seem to use it before mounting /usr where printf(1) resides.

Reviewed by: arch (sheldonh)
Inspired by: NetBSD, ksh
Clued by: ume (on how the printf builtin is used)


# 51090 08-Sep-1999 sheldonh

Improve shell documentation:

* Consistently misspell built-in as builtin.

* Add a builtin(1) manpage and create builtin(1) MLINKS for all shell
builtin commands for which no standalone utility exists. These MLINKS
replace those that were created for csh(1).

* Add appropriate xrefs for builtin(1) to the csh(1) and sh(1) manpages,
as well as to the manpages of standalone utilities which are supported
as shell builtin commands in at least one of the shells. In such
manpages, explain that similar functionality may be provided as a
shell builtin command.

* Improve sh(1)'s description of the cd builtin command. Csh(1) already
describes it adequately. Replace the cd(1) manpage with a builtin(1)
MLINKS link.

* Clean up some mdoc problems: use Xr instead of literal "foo(n)"; use
Ic instead of Xr for shell builtin commands.

* Undo English contractions.

Reviewed by: mpp, rgrimes


# 50471 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 37456 06-Jul-1998 bde

Added a `build-tools' target for internal tools.

Removed explicit dependencies of foo.o on foo.c. These were mainly
placeholders for comments about missing dependencies of tools objects
on headers. This problem needs to be handled more generally.


# 35783 06-May-1998 bde

Backed out previous backout. Put y.tab.h back in SRCS.


# 35737 05-May-1998 bde

Backed out previous commit. It was tested, but not for the case where
a separate object tree doesn't exist. Crufty makefiles will have to
put y.tab.h in SRCS so that we know not to create foo.h from foo.y.


# 35708 04-May-1998 bde

Fixed races in `make -jN' using new yacc rules.


# 35465 26-Apr-1998 bde

Backed out most of rev.1.19 (explicit dependencies of object files
on generated headers). This is now handled generally in bsd.prog.mk.


# 30113 05-Oct-1997 jkh

Changes to support full make parallelism (-j<n>) in the world
target.
Reviewed by: <many different folks>
Submitted by: Nickolay N. Dudorov" <nnd@nnd.itfs.nsk.su>


# 28729 25-Aug-1997 bde

Restored clobbered parts of rev.1.15 (build intermediate object files
for tools).


# 25960 21-May-1997 steve

Remove y.tab.h from the beforedepend target. Also add a
rule that shows the dependency of arith_lex.[co] on y.tab.h.

Suggested by: Bruce Evans <bde@zeta.org.au>


# 25906 18-May-1997 steve

Add explicit y.tab.h rule so that 'make depend clean all' does
not fail with an "don't know how to make y.tab.h" error.


# 25903 18-May-1997 steve

Miscellaneous sorting and addition of rules for object files that
depend on generated headers.

Reviewed by: Bruce Evans <bde@zeta.org.au>


# 25221 28-Apr-1997 steve

Shamelessly pilfer most of NetBSD's Makefile so that the
problem with 'make -j n' and no .depend file goes away.
I think Bruce mentioned this somewhere on one of the
mailing lists.

Obtained from: NetBSD


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 19176 25-Oct-1996 bde

Build intermediate object files for mkinit, mknodes and mksyntax
so that simple regresssion tests based on `cmp' work. mkdep still
doesn't work right for these tools. They should probably be in
separate directories.

Sorted dependencies.


# 17988 01-Sep-1996 peter

oops, I didn't mean for the unconditional DEBUG code to go in, it's been
off in FreeBSD for some time. I realised this a few seconds after the
commit started..


# 17987 01-Sep-1996 peter

Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is a
merge of parallel duplicate work by Steve Price and myself. :-]

There are some changes to the build that are my fault... mkinit.c was
trying (poorly) to duplicate some of the work that make(1) is designed to
do. The Makefile hackery is my fault too, the depend list was incomplete
because of some explicit OBJS+= entries, so mkdep wasn't picking up their
source file #includes.

This closes a pile of /bin/sh PR's, but not all of them..

Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter


# 16663 24-Jun-1996 jkh

Bring in my changes for removing the pestilent obj links (unless you
really want them) from /usr/src. This is the final version of the
patches, incorporating the feedback I've received from -current.


# 16070 02-Jun-1996 phk

Backup yacc changes.


# 16013 30-May-1996 phk

Use new yacc rules. (I'm fixing the tree as fast as I can :-)


# 13882 03-Feb-1996 joerg

Fix the borokeness that crept in with rev 1.10 of parser.c, the sh
didn't correctly start background jobs anymore. Strange that nobody
was complaining...

Add a dummy target for `builtins' in the Makefile, to prevent it
from attempting to build this file by compiling builtins.c. :-/


# 10354 27-Aug-1995 joerg

Make the shell handle a null command in a &&/|| sequence correctly.
The && and || tokens do also terminate a command, not only the
newline.

While i was at it, disabled trace code by default, it served no good
purpose since it required the use of a debugger anyway to be turned
on. Instead, placed a hint in the Makefile on how to turn it on.

This makes the shell ~ 10 % faster and ~ 4 KB smaller. :)

Pointed out by: jan@physik.TU-Berlin.DE (Jan Riedinger)


# 3286 01-Oct-1994 ache

libcompat removed


# 3044 24-Sep-1994 dg

Added $Id$


# 2375 28-Aug-1994 bde

Add dependencies on libraries to DPADD. Someday this should be done
automagically. -lfoo has to be right to work, but ${LIBFO0} is too
easy to forget or misspell; nothing checks it and it should be
different for shared libraries.


# 2180 21-Aug-1994 bde

Touch init.c after making it in case mkinit refused to touch it after not
changing it. mkinit's attempted smartness about timestamps is mismatched
with the makefile. init.o is compiled _twice_ the first time it is made...


# 1633 30-May-1994 rgrimes

Need ${LDFLAGS} one more place.


# 1625 29-May-1994 rgrimes

Need to sue ${LDFLAGS} when building local binaries so they get built
static if ${NOSHARED}==YES. This makes it easier to bootstrap a system.


# 1557 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1556,
which included commits to RCS files with non-trunk default branches.


# 1556 26-May-1994 rgrimes

BSD 4.4 Lite bin Sources