bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unset does not remove functions like a[b] unless -f is specified


From: Robert Elz
Subject: Re: unset does not remove functions like a[b] unless -f is specified
Date: Sat, 04 Feb 2023 17:05:58 +0700

    Date:        Sat, 4 Feb 2023 13:50:26 +0900
    From:        Koichi Murase <myoga.murase@gmail.com>
    Message-ID:  
<CAFLRLk8uhE31wyEhnrxJx0OzYwfBRo+HyOGYNUh-kBgaQ8EKsA@mail.gmail.com>

  | 2023年2月4日(土) 11:12 Chet Ramey <chet.ramey@case.edu>:
  | > Yep. I'll probably change that.
  |
  | I disagree with making the change to disallow the execution of
  | functions with a slash in their names.

I am fairly sure that Chet was speaking about when bash is in posix
mode, not the default mode behaviour.

  | The functions that have slashes in their names are Bash extensions.

When acting as a posix shell (when not, bash can largely do whatever
it likes) the question of executing functions with slashes in their
names never arises.   If the command word of a simple command contains
a '/' one is supposed to simply exec it.  The shell isn't even supposed
to look to see if it might be a function, or built-in command, or
anything else.

  | Is Bash required to strictly follow the POSIX
  | standard even for non-POSIX shell scripts that use Bash extensions?

If you don't turn on posix mode bash can do whatever Chet wants it to.

In that case there are all kinds of variations from what posix
requires of a conforming shell (like errors in special builtin
commands causing a non-interactive shell to exit).

But even when posix mode is enabled, there can be extensions, they
just cannot alter the behaviour of a correct conforming script.

  | For compatibility among shell implementations, Zsh also seems to
  | support the execution of functions with a slash in their names,

Yes, I think it does (until very recently I thought it was the only
kind-of-bourne shell which did).  zsh tends to be even less concerned
with posix compatability then bash is.

  | though Yash doesn't seem to attempt to run such functions.

Yash tends to try to conform to posix requirements everywhere (it
has extensions, but only the non-breaking kind).

  | I feel this is just an issue of the wording of the
  | standard and its interpretation. Is it impossible that this is
  | explicitly marked as `unspecified' in the standard?

No, this one is very clear.

kre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]