From e753a1effbb2fb02b83b001dfd2d052aa1d8ea9c Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 30 Nov 2014 20:12:47 +0000 Subject: [PATCH] sh: Remove special case for '=' in set -x; always quote it in outqstr(). I plan to make set -x output always printable using $'...'; avoiding quoting words containing '=' is not worth the extra complexity. --- bin/sh/eval.c | 10 +--------- bin/sh/output.c | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/bin/sh/eval.c b/bin/sh/eval.c index c1a9cdbfcd93..d0460a024e3d 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -774,15 +774,7 @@ xtracecommand(struct arglist *varlist, struct arglist *arglist) for (sp = arglist->list ; sp ; sp = sp->next) { if (sep != 0) out2c(' '); - /* Disambiguate command looking like assignment. */ - if (sp == arglist->list && - strchr(sp->text, '=') != NULL && - strchr(sp->text, '\'') == NULL) { - out2c('\''); - out2str(sp->text); - out2c('\''); - } else - out2qstr(sp->text); + out2qstr(sp->text); sep = ' '; } out2c('\n'); diff --git a/bin/sh/output.c b/bin/sh/output.c index bf8e17d97ece..c6d118f11535 100644 --- a/bin/sh/output.c +++ b/bin/sh/output.c @@ -122,8 +122,7 @@ outqstr(const char *p, struct output *file) outstr("''", file); return; } - /* Caller will handle '=' if necessary */ - if (p[strcspn(p, "|&;<>()$`\\\"' \t\n*?[~#")] == '\0' || + if (p[strcspn(p, "|&;<>()$`\\\"' \t\n*?[~#=")] == '\0' || strcmp(p, "[") == 0) { outstr(p, file); return;