dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Anton Mitterer <calestyo@scientia.org>
To: Harald van Dijk <harald@gigawatt.nl>, dash@vger.kernel.org
Subject: Re: possible wrong behaviour when -s and -c are both used
Date: Fri, 11 Mar 2022 18:15:11 +0100	[thread overview]
Message-ID: <0e27baca7b331b12b1cc5dbc7764222abfd660ef.camel@scientia.org> (raw)
In-Reply-To: <fdfed8d3-d654-74de-67f5-85d21ae4c630@gigawatt.nl>

On Fri, 2022-03-11 at 10:12 +0000, Harald van Dijk wrote:
> This has -s and -c options. Contrary to your analysis below, as has
> been 
> answered on your Austin Group bug report, this has unspecified 
> behaviour. dash can do whatever it wants here.

Well with respect to that, I'd have also been fine if the standard
clearly says that this is unspecified.


> This only has a -c option. -s appears after 'echo foo', which is a 
> non-option, and is therefore also a non-option.

Stupid me, so obvious... *facepalm*


> The syntax to have both -s and -c options, but have -s appear after -
> c, is
> 
>    dash -c -s 'echo foo' script
> 
> which behaves the same as the -s -c case.

But still (even if POSIX leaves that open)... is this intended
behaviour by dash, that one can use -s and -c and it does actually
both?

It's not directly mentioned in the manpage (i.e. that both can be used
at the same time, and in which order these would then happen).
And the SYNOPSIS in the manpage would also rather imply that it's not
intended:
> SYNOPSIS
>     dash [-aCefnuvxIimqVEbp] [+aCefnuvxIimqVEbp] [-o option_name] [+o option_name] [command_file [argument ...]]
>     dash -c [-aCefnuvxIimqVEbp] [+aCefnuvxIimqVEbp] [-o option_name] [+o option_name] command_string [command_name [argument ...]]
>     dash -s [-aCefnuvxIimqVEbp] [+aCefnuvxIimqVEbp] [-o option_name] [+o option_name] [argument ...]

So I thought maybe it's just working by accident.


Cheers,
Chris.

      reply	other threads:[~2022-03-11 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-11  4:25 possible wrong behaviour when -s and -c are both used Christoph Anton Mitterer
2022-03-11 10:12 ` Harald van Dijk
2022-03-11 17:15   ` Christoph Anton Mitterer [this message]

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=0e27baca7b331b12b1cc5dbc7764222abfd660ef.camel@scientia.org \
    --to=calestyo@scientia.org \
    --cc=dash@vger.kernel.org \
    --cc=harald@gigawatt.nl \
    /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 NNTP newsgroup(s).