dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: dash@vger.kernel.org, Joey Hess <id@joeyh.name>, 858288@bugs.debian.org
Subject: [PATCH] eval: Check nflag in evaltree instead of cmdloop
Date: Thu, 4 Jun 2020 21:53:55 +1000	[thread overview]
Message-ID: <20200604115355.GA13954@gondor.apana.org.au> (raw)

This patch moves the nflag check from cmdloop into evaltree.  This
is so that nflag will be in force even if we enter the shell via a
path other than cmdloop, e.g., through sh -c.

Reported-by: Joey Hess <id@joeyh.name>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/src/eval.c b/src/eval.c
index d10be38..9476fbb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -213,6 +213,9 @@ evaltree(union node *n, int flags)
+	if (nflag)
+		goto out;
 	if (n == NULL) {
 		TRACE(("evaltree(NULL) called\n"));
 		goto out;
diff --git a/src/main.c b/src/main.c
index 7a28534..5c49fdc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -233,7 +233,7 @@ cmdloop(int top)
 				out2str("\nUse \"exit\" to leave shell.\n");
-		} else if (nflag == 0) {
+		} else {
 			int i;
 			job_warning = (job_warning == 2) ? 1 : 0;
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

                 reply	other threads:[~2020-06-04 11:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604115355.GA13954@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=858288@bugs.debian.org \
    --cc=dash@vger.kernel.org \
    --cc=id@joeyh.name \
    --subject='Re: [PATCH] eval: Check nflag in evaltree instead of cmdloop' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).