Summary: | [patch] awk(1) assignment arguments do not accept values with a leading '=' | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | kd-dev | ||||
Component: | bin | Assignee: | Warner Losh <imp> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Some People | CC: | cem | ||||
Priority: | --- | Keywords: | patch | ||||
Version: | CURRENT | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Warner was interested in awk. The latest import of upstream nawk fixes this. |
Created attachment 180522 [details] Remove the second '=' check in `isclvar'. awk(1) explicitly disallows command-line assignments where the assignment value has a leading '='. This behavior is contrary to the standard, which places no such restriction on assignment values. From the standard: The characters following the <equals-sign> shall be interpreted as if they appeared in the awk program preceded and followed by a double-quote ('"') character, as a STRING token (see Grammar), except that if the last character is an unescaped <backslash>, it shall be interpreted as a literal <backslash> rather than as the first character of the sequence "\"". How to reproduce: $ awk 'END{print var}' var='=value=' < /dev/null awk: can't open file var==value= source line number 1 Expected output: =value= $ awk -v var='=value=' 'BEGIN{print var}' awk: invalid -v option argument: var== text Expected output: =value=