bug#79714: env: always adds __CF_USER_TEXT_ENCODING var on macOS since v9.8

Bruno Haible via GNU coreutils Bug Reports <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Organization GNU
Message-ID <2067113.kfQNDG1tbD@nimes>
Paul Eggert wrote:
> In addition to Pádraig's qualms, POSIX says[1] that if an environment 
> variable's name consists solely of uppercase ASCII letters, '_', and 
> non-initial digits, the variable might affect the behavior of standard 
> utilities like 'cat'. So if we document environment variable gotchas, we 
> should document that one too.
> 
> [1]: 
> https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html#tag_08_01

I don't think we should document this anywhere, because it would have a
silly effect.

The current, widely used conventions in shell scripts are that
  - uppercase variables are often environment variables,
  - lowercase variables are shell variables (not inherited),
  - mixed-case variables don't exist.

These conventions make it easy to read and understand shell scripts.

[1] is saying "The name space of environment variable names containing
  lowercase letters is reserved for applications. Applications can define
  any environment variables with names from this name space without
  modifying the behavior of the standard utilities."
and anyone following this advice makes their shell scripts harder to
understand.

This is a case of the standards body wanting to reserve a convention
for themselves, that is widely used. (Similar to the ISO C body, which
reserves all types ending in '_t' for themselves.)

Bruno
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.