From patchwork Fri May 18 18:39:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 10411841 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6E3FE6031B for ; Fri, 18 May 2018 18:39:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58FF028707 for ; Fri, 18 May 2018 18:39:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DCD128A8D; Fri, 18 May 2018 18:39:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC77C28707 for ; Fri, 18 May 2018 18:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751452AbeERSjp (ORCPT ); Fri, 18 May 2018 14:39:45 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:48224 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbeERSjp (ORCPT ); Fri, 18 May 2018 14:39:45 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1fJkI3-0006AJ-Rv for ; Sat, 19 May 2018 02:39:43 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fJkI3-0005oV-FD; Sat, 19 May 2018 02:39:43 +0800 Subject: [v3 PATCH 6/17] var: Set IFS to fixed value at start time References: <20180518183844.zizl3xevlcm4gzsj@gondor.apana.org.au> To: DASH Mailing List Message-Id: From: Herbert Xu Date: Sat, 19 May 2018 02:39:43 +0800 Sender: dash-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 --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)