klibc-bot for Herbert Xu
2020-Mar-28 21:49 UTC
[klibc] [klibc:update-dash] dash: var: Set IFS to fixed value at start time
Commit-ID: 6dc1db1bce863f0e0e0abda1b9a58d8cb22863ca Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=6dc1db1bce863f0e0e0abda1b9a58d8cb22863ca Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Sat, 19 May 2018 02:39:43 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: var: Set IFS to fixed value at start time [ dash commit 6458796c79e643503d14e18c611cfbf68c4a8cce ] 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 at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/var.c | 11 ++--------- usr/dash/var.h | 6 +----- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/usr/dash/var.c b/usr/dash/var.c index cc6f7f2a..604ab1f7 100644 --- a/usr/dash/var.c +++ b/usr/dash/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/usr/dash/var.h b/usr/dash/var.h index 11ce9b7d..52f559d1 100644 --- a/usr/dash/var.h +++ b/usr/dash/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)
Reasonably Related Threads
- [klibc:update-dash] [VAR] Use setvareq to set OPTIND initially
- [klibc:update-dash] dash: [VAR] Use setvareq to set OPTIND initially
- [klibc:master] [SHELL] Allow building without LINEO support
- [klibc:update-dash] dash: eval: Replace with listsetvar with mklocal/setvareq
- [klibc:update-dash] [BUILTIN] Set command -p path to /usr/sbin:/usr/bin:/sbin:/bin