summary refs log tree commit diff
path: root/src/dash.1
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-04-04 17:54:01 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-04-19 18:19:59 +0800
commit3cd57b6ed933c299e4d7c3c1e8390194635bbab8 (patch)
tree4b1ea08ad050cdd12392653c4d4fc05f89f8f5e2 /src/dash.1
parentparser: Fix parameter expansion inside inner double quotes (diff)
downloaddash-3cd57b6ed933c299e4d7c3c1e8390194635bbab8.tar.gz
dash-3cd57b6ed933c299e4d7c3c1e8390194635bbab8.zip
eval: Variable assignments on functions are no longer persistent
Dirk Fieldhouse <fieldhouse@gmx.net> wrote:
>
> In POSIX.1-2017 ("simultaneously IEEE Std 1003.1™-2017 and The Open
> Group Technical Standard Base Specifications, Issue 7")
> <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09>,
> we read under '2.9.1 Simple Commands'
>
> "Variable assignments shall be performed as follows:
> ...
> -    If the command name is a standard utility implemented as a function
> (see XBD Utility), the effect of variable assignments shall be as if the
> utility was not implemented as a function.
> ...
> -    If the command name is a function that is not a standard utility
> implemented as a function, variable assignments shall affect the current
> execution environment during the execution of the function. It is
> unspecified:
>
>     *   Whether or not the variable assignments persist after the
> completion of the function
>
>     *   Whether or not the variables gain the export attribute during
> the execution of the function
>
>     *   Whether or not export attributes gained as a result of the
> variable assignments persist after the completion of the function (if
> variable assignments persist after the completion of the function)"

POSIX used to require the current dash behaviour.  However, you're
right that this is no longer the case.

This patch will remove the persistence of the variable assignment.

I have considered the exporting the variables during the function
execution but have decided against it because:

1) It makes the code bigger.
2) dash has never done this in the past.
3) You cannot use this portably anyway.

Reported-by: Dirk Fieldhouse <fieldhouse@gmx.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/dash.1')
0 files changed, 0 insertions, 0 deletions
n>Switch to my own fork of base16-vimJune McEnroe 2013-05-24Indent compojure correctlyJune McEnroe 2013-05-23Remove vim-clojure-staticJune McEnroe 2013-05-23Replace VimClojure with vim-clojure-staticJune McEnroe 2013-05-18Do not run gitgutter eagerlyJune McEnroe 2013-05-15Remove tabularJune McEnroe 2013-05-15Use long names for all settingsJune McEnroe 2013-05-15Add vim-gitgutterJune McEnroe 2013-04-23Remove unused pluginsJune McEnroe 2013-04-23Switch to base16-default colorschemeJune McEnroe 2013-03-26Replace nerdcommenter with vim-commentaryJune McEnroe 2013-03-24Add paredit.vimJune McEnroe 2013-03-14Update base16-vimJune McEnroe It's still crap 2013-03-12Hide mode from below statuslineJune McEnroe 2013-03-12Switch to powerlineJune McEnroe Which I'm not going to bother configuring because it thinks it's all fancy and for other things that aren't Vim so it stores its config file in ~/.config which I keep in a different repo and I only want to use it for Vim so fuck you, Powerline. </rant> 2013-03-12Remove vim-powerlineJune McEnroe 2013-02-03Update base16 and refheapJune McEnroe 2013-02-03Ignore plugin/private.vimJune McEnroe 2012-09-29Disable GUI dialogsJune McEnroe