yash-rs
yash-rs copied to clipboard
Disposition of ill-named variables
trafficstars
Currently, VariableSet allows creating variables with any name, including an empty name and names containing the = sign. Such non-portable names may cause unexpected issues.
- Variable names containing the
=sign should not be exported as is, but the current implementation naively tries to export them. - The
typeset,readonly, andexportbuilt-ins currently allow creating a variable with an empty name. - The
getoptsandreadbuilt-ins currently allow creating a variable with an arbitrary name, but a variable name containing the=sign results in the wrong environment variable if the all-export option is enabled. - The
setbuilt-in should not print variables with an invalid name. For example,export =; setprints=''in the current implementation, but this is not a valid assignment.