Ticket #38617

Reject orphan keywords in POSIX mode

Open Date: 2018-09-19 23:17 Last Update: 2018-10-06 15:22

Reporter:
Owner:
(None)
Type:
Status:
Closed
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
3
Resolution:
Fixed
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

This script is not POSIXly correct because the last } token does not follow another keyword and thus is not a keyword. It should be a syntax error (at least in the POSIXly correct mode).

  1. { { :; } >/dev/null }

Note: POSIX XCU 2.4 defines when a token should be recognized as a keyword.

Attachment File List

No attachments

Ticket History (3/4 Histories)

2018-09-19 23:17 Updated by: magicant
  • New Ticket "Reject orphan keywords in POSIX mode" created
2018-09-29 23:13 Updated by: magicant
  • Type Update from Feature Requests to Bugs
2018-09-30 23:43 Updated by: magicant
Comment

In { ( : ) }, the } token does not follow another reserved word, so } should not be recognized as a reserved word. However, no known shell actually reports this as a syntax error. Why should we reject { { :; } >/dev/null } then?

Currently, bash, dash and ksh rejects { { :; } >/dev/null } and mksh, zsh and yash accepts it.

2018-10-06 15:22 Updated by: magicant
  • Status Update from Open to Closed
  • Resolution Update from None to Fixed
Comment

Fixed in r3902, just imitating the behavior of ksh.

Edit

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