yash-rs icon indicating copy to clipboard operation
yash-rs copied to clipboard

Disposition of ill-named variables

Open magicant opened this issue 9 months ago • 0 comments
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, and export built-ins currently allow creating a variable with an empty name.
  • The getopts and read built-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 set built-in should not print variables with an invalid name. For example, export =; set prints ='' in the current implementation, but this is not a valid assignment.

magicant avatar Jan 27 '25 15:01 magicant