待辦事項 #38229

assignments preceding special builtins persist as exported

啟用日期: 2018-04-26 10:49 最後更新: 2018-10-06 18:05

回報者:
(匿名)
負責人:
類型:
狀態:
開啟 [Owner assigned]
元件:
里程碑:
(無)
優先權:
3
嚴重程度:
5 - 中
處理結果:
Postponed
檔案:
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

細節

$ yash -c 'v=foo :; env | grep ^v='
foo

The assignment should persist as : is a special builtin, but I don't think it should be exported.

Ticket History (3/4 Histories)

2018-04-26 10:49 Updated by: None
  • New Ticket "assignments preceding special builtins persist as exported" created
2018-04-26 10:50 Updated by: mcdutchie
評語

Forgot to log in again. I am the reporter.

2018-04-27 00:38 Updated by: magicant
  • 元件 Update from (無) to shell-main
  • 負責人 Update from (無) to magicant
評語

The current behavior is explicitly allowed in the POSIX standard.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01

If the command name is a special built-in utility, variable assignments shall affect the current execution environment. Unless the set -a option is on (see set), it is unspecified: (1) Whether or not the variables gain the export attribute during the execution of the special built-in utility (2) Whether or not export attributes gained as a result of the variable assignments persist after the completion of the special built-in utility

It is surprising to me, though, that many other shells behave differently than yash.

2018-10-06 18:05 Updated by: magicant
  • 優先權 Update from 5 - 中 to 3
  • 處理結果 Update from to Postponed

Attachment File List

No attachments

編輯

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » 登入