diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index 20a9dbf99521..de5481c5c0d0 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd May 30, 2016 +.Dd October 8, 2016 .Dt SH 1 .Os .Sh NAME @@ -1349,13 +1349,13 @@ used in tilde expansion and as a default directory for the built-in. .It Va IFS Input Field Separators. -The default value is +This is initialized at startup to .Aq space , .Aq tab , and .Aq newline in that order. -This default also applies if +This value also applies if .Va IFS is unset, but not if it is set to the empty string. See the diff --git a/bin/sh/tests/parameters/Makefile b/bin/sh/tests/parameters/Makefile index 28c503a1b1e7..939bd199a72b 100644 --- a/bin/sh/tests/parameters/Makefile +++ b/bin/sh/tests/parameters/Makefile @@ -9,6 +9,7 @@ ATF_TESTS_SH= functional_test ${PACKAGE}FILES+= env1.0 ${PACKAGE}FILES+= exitstatus1.0 +${PACKAGE}FILES+= ifs1.0 ${PACKAGE}FILES+= mail1.0 ${PACKAGE}FILES+= mail2.0 ${PACKAGE}FILES+= optind1.0 diff --git a/bin/sh/tests/parameters/ifs1.0 b/bin/sh/tests/parameters/ifs1.0 new file mode 100644 index 000000000000..b93d99a8a8c7 --- /dev/null +++ b/bin/sh/tests/parameters/ifs1.0 @@ -0,0 +1,10 @@ +# $FreeBSD$ + +env IFS=_ ${SH} -c ' +rc=2 +nosuchtool_function() { + rc=0 +} +v=nosuchtool_function +$v && exit "$rc" +' diff --git a/bin/sh/var.c b/bin/sh/var.c index 03d529b86fbc..c7834cd9d2c4 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -186,6 +186,7 @@ initvar(void) } } setvareq_const("OPTIND=1", 0); + setvareq_const("IFS= \t\n", 0); } /*