DASH Shell discussions
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Harald van Dijk <harald@gigawatt.nl>,
	Jan Verbeek <ring@openmailbox.org>,
	dash@vger.kernel.org
Subject: Re: [BUG] Illegal function names are accepted after being used as aliases
Date: Tue, 23 Feb 2016 11:58:30 -0700	[thread overview]
Message-ID: <56CCABD6.40001@redhat.com> (raw)
In-Reply-To: <56CCA879.1070208@gigawatt.nl>

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

On 02/23/2016 11:44 AM, Harald van Dijk wrote:

> This matches bash's behaviour, aside from bash requiring -- to prevent
> detection of invalid flags to the alias command:
> 
> bash-4.3$ alias -- -=true

Then dash DOES have a bug:

# dash
$ alias -- -='echo hi'
alias: -- not found
$ echo $?
1
$ -
hi
$

POSIX XCU 1.4 is clear:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html

"Default Behavior: When this section is listed as "None.", it means that
the implementation need not support any options. Standard utilities that
do not accept options, but that do accept operands, shall recognize "--"
as a first argument to be discarded."

and alias takes operands, stating "OPTIONS: None.", which means POSIX
_requires_ 'alias -- -=name' to (attempt to) define only the single
alias '-', and NOT to also attempt to define '--' as an alias.

It's okay if dash allows 'alias -=blah' to define '-' as an alias as an
extension, but it MUST ignore '--' the way bash does.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-02-23 18:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23 18:18 [BUG] Illegal function names are accepted after being used as aliases Jan Verbeek
2016-02-23 18:40 ` Eric Blake
2016-02-23 18:44 ` Harald van Dijk
2016-02-23 18:58   ` Eric Blake [this message]
2016-02-23 19:21     ` Harald van Dijk
2016-02-23 19:33       ` Eric Blake
2016-02-23 21:00         ` Harald van Dijk
2016-02-23 21:49           ` Eric Blake

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=56CCABD6.40001@redhat.com \
    --to=eblake@redhat.com \
    --cc=dash@vger.kernel.org \
    --cc=harald@gigawatt.nl \
    --cc=ring@openmailbox.org \
    /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