Dash Archive mirror
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	DASH shell mailing list <dash@vger.kernel.org>
Subject: set -i, -s do not make sense, bash does not accept them
Date: Wed, 6 Jan 2021 14:25:33 +0100	[thread overview]
Message-ID: <CAK1hOcPQzYeuMXViwVsfu27YYSBioWdK8hZQvin9Lxg_HJnw0w@mail.gmail.com> (raw)

Hello,

dash accepts "set -i" and "set -s", and their +OPT forms.

The -s/+s does not seem to do anything except affecting
the value of $-.

The -i/+i does have some effects. In interactive shell,
"set +i" makes prompt disappear. In non-interactive shell,
"set -i" makes it possible to ^C break the script and
land user into interactive input prompt (!):

$ PS1='T>' dash -c 'set -i; echo $-; sleep 5; echo $-'
i
^C
T> _

From code inspection, this seems to be caused by
's' and 'i' being present in optletters[] array,
and parsing code treating them as "set" options,
not special-cased.

IOW: it does not appear to be intentional.

bash does not treat them as "set" options.
They are only valid in startup command line, not in
"set" command. dash does the same with -c option.

bash adds "i", "s" and "c" into the value of $-,
despite them not being "set" options.

dash does not do so, resulting in discrepancy of not showing
"c" if e.g. "dash -c 'echo $-'" is run.

I propose to mimic bash behavior more closely:
do not accept "set -i" and "set -s", show "c" in $-.

                 reply	other threads:[~2021-01-06 13:26 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=CAK1hOcPQzYeuMXViwVsfu27YYSBioWdK8hZQvin9Lxg_HJnw0w@mail.gmail.com \
    --to=vda.linux@googlemail.com \
    --cc=dash@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).