* Re: ["regression"] Stéphane= 1 zsh -c 'echo $Stéphane'
2015-10-06 15:44 ` ["regression"] Stéphane= 1 " Bart Schaefer
@ 2015-10-06 18:59 ` ZyX
2015-10-06 19:29 ` Stephane Chazelas
2015-10-07 13:15 ` Stephane Chazelas
1 sibling, 1 reply; 5+ messages in thread
From: ZyX @ 2015-10-06 18:59 UTC (permalink / raw)
To: Bart Schaefer, Zsh hackers list
06.10.2015, 18:44, "Bart Schaefer" <schaefer@brasslantern.com>:
> This is discussed in the thread starting at workers/34004 and leading
> up to workers/34015.
>
> Nobody ever commented on whether the environment is allowed to contain
> names with the high-order bit set, but POSIX identifiers cannot, so it
> stands to reason you can't import something with that shape of name.
>From the list of shells I have ${Stéphane} with Stéphane=2 in environment accept only tcsh and ksh now (LANG=ru_RU.UTF-8).
Not accepting: mksh, rcsh*, posh, bash, dash, fish.
No shell accepts this with LANG=C.
glibc+tcc+getenv() call is fine with this name even with LANG=C.
Note: I do not know which standard describes environment variable names and what exactly it says about the issue.
* Plan 9 rc reimplementation, uses name `rcsh` due to name conflict with openrc.
>
> zsh -f -o posixidentifiers -c 'Stéphane=2; echo $Stéphane'
> zsh:1: command not found: Stéphane=2
> éphane
>
> In effect the environment is always treated as POSIX_IDENTIFIERS.
>
> POSIX_IDENTIFIERS <K> <S>
> When this option is set, only the ASCII characters a to z, A to Z,
> 0 to 9 and _ may be used in identifiers (names of shell parameters
> and modules).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ["regression"] Stéphane= 1 zsh -c 'echo $Stéphane'
2015-10-06 15:44 ` ["regression"] Stéphane= 1 " Bart Schaefer
2015-10-06 18:59 ` ZyX
@ 2015-10-07 13:15 ` Stephane Chazelas
1 sibling, 0 replies; 5+ messages in thread
From: Stephane Chazelas @ 2015-10-07 13:15 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh hackers list
2015-10-06 08:44:16 -0700, Bart Schaefer:
> This is discussed in the thread starting at workers/34004 and leading
> up to workers/34015.
>
> Nobody ever commented on whether the environment is allowed to contain
> names with the high-order bit set, but POSIX identifiers cannot, so it
> stands to reason you can't import something with that shape of name.
Note that it's not so much about the 8th bit (0-9 in EBCDIC have
the 8th bit set), but about being _, letters and digits in the
portable character set (0-9 a-z A-Z _).
POSIX doesn't forbid shells importing whatever they want from
the environment AFAICT. Only a POSIX application (script) must
not make use of those that are not valid POSIX identifiers.
IOW,
env Stéphane=1 sh -c 'echo "${Stéphane}"'
is an invalid inline-script, so it doesn't matter what sh does
with that Stéphane environment variable (as long as it's passed
along unmodified to the commands it executes, though not all
shells do it, and there was a discussion about it some time ago:
http://thread.gmane.org/gmane.comp.standards.posix.austin.general/690
)
> zsh -f -o posixidentifiers -c 'Stéphane=2; echo $Stéphane'
> zsh:1: command not found: Stéphane=2
> éphane
>
> In effect the environment is always treated as POSIX_IDENTIFIERS.
>
> POSIX_IDENTIFIERS <K> <S>
> When this option is set, only the ASCII characters a to z, A to Z,
> 0 to 9 and _ may be used in identifiers (names of shell parameters
> and modules).
[...]
Note that while POSIX (AFAICS) requires $Stéphane to be treated
as ${St}éphane, ksh93 and bash (in single-byte character
locales) don't.
The behaviour for ${Stéphane} would be unspecified, so
implementations may do whatever they want there.
Now, I won't be the one complaining if I can't use $Stéphane or
${Stéphane} as a variable name, I never liked the idea of the
syntax of a script being dependant on the locale.
--
Stephane
^ permalink raw reply [flat|nested] 5+ messages in thread