diff mbox

[v3,6/17] var: Set IFS to fixed value at start time

Message ID E1fJkI3-0005oV-FD@gondobar (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Herbert Xu May 18, 2018, 6:39 p.m. UTC
This patch forces the IFS variable to always be set to its default
value, regardless of the environment.

It also removes the long unused IFS_BROKEN code.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---

 src/Makefile.am |    3 +--
 src/var.c       |   11 ++---------
 src/var.h       |    6 +-----
 3 files changed, 4 insertions(+), 16 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/Makefile.am b/src/Makefile.am
index 139355e..46399c7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,8 +3,7 @@  AM_YFLAGS = -d
 COMMON_CFLAGS = -Wall
 COMMON_CPPFLAGS = \
 	-include $(top_builddir)/config.h \
-	-DBSD=1 -DSHELL \
-	-DIFS_BROKEN
+	-DBSD=1 -DSHELL
 
 AM_CFLAGS = $(COMMON_CFLAGS)
 AM_CPPFLAGS = $(COMMON_CPPFLAGS)
diff --git a/src/var.c b/src/var.c
index cc6f7f2..604ab1f 100644
--- a/src/var.c
+++ b/src/var.c
@@ -75,11 +75,7 @@  MKINIT struct localvar_list *localvar_stack;
 
 const char defpathvar[] =
 	"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
-#ifdef IFS_BROKEN
-const char defifsvar[] = "IFS= \t\n";
-#else
-const char defifs[] = " \t\n";
-#endif
+char defifsvar[] = "IFS= \t\n";
 MKINIT char defoptindvar[] = "OPTIND=1";
 
 int lineno;
@@ -90,11 +86,7 @@  struct var varinit[] = {
 #if ATTY
 	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"ATTY\0",	0 },
 #endif
-#ifdef IFS_BROKEN
 	{ 0,	VSTRFIXED|VTEXTFIXED,		defifsvar,	0 },
-#else
-	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"IFS\0",	0 },
-#endif
 	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"MAIL\0",	changemail },
 	{ 0,	VSTRFIXED|VTEXTFIXED|VUNSET,	"MAILPATH\0",	changemail },
 	{ 0,	VSTRFIXED|VTEXTFIXED,		defpathvar,	changepath },
@@ -143,6 +135,7 @@  INIT {
 		}
 	}
 
+	setvareq(defifsvar, VTEXTFIXED);
 	setvareq(defoptindvar, VTEXTFIXED);
 
 	fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid());
diff --git a/src/var.h b/src/var.h
index 872e2db..55fed1b 100644
--- a/src/var.h
+++ b/src/var.h
@@ -100,12 +100,8 @@  extern struct var varinit[];
 #define vhistsize (&vterm)[1]
 #endif
 
-#ifdef IFS_BROKEN
-extern const char defifsvar[];
+extern char defifsvar[];
 #define defifs (defifsvar + 4)
-#else
-extern const char defifs[];
-#endif
 extern const char defpathvar[];
 #define defpath (defpathvar + 36)