Op 30-12-18 om 23:43 schreef Philip Guenther:
This thread was never resolved/committed. Looking again at the diffs, I
still think I prefer that we_not_ touch print_value_quoted(), as the
other callers all use the 'key=value' format and don't need special
handling of empty values, [...]
Not actually true:
ksh -c 'alias foo=""; whence foo'
is expected to produce the shellquoted value of the alias only (so it
can be re-parsed by the shell), but prints nothing but an empty line
(should be a quoted empty). So that's another bug of the same type.
More importantly, I think your approach is conceptually wrong.
print_value_quoted() is a generic shellquoting function so its output
should work for all lexical contexts by default. Doing anything else is
asking for future bugs.
If you are really that bothered by quoted empties on key=value output
(as produced by *every* other shell including AT&T ksh and mksh), then
print_value_quoted() needs an extra flag parameter to disable quoting
empties and that flag should be set when printing key=value pairs.
- M.