zsh-workers
 help / color / mirror / code / Atom feed
* ["regression"] Stéphane=1 zsh -c 'echo $Stéphane'
@ 2015-10-06 11:04 Stephane Chazelas
  2015-10-06 15:44 ` ["regression"] Stéphane= 1 " Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Stephane Chazelas @ 2015-10-06 11:04 UTC (permalink / raw)
  To: Zsh hackers list

$ zsh --version
zsh 5.0.2 (x86_64-pc-linux-gnu)
$ locale charmap
UTF-8
$ env Stéphane=1 zsh -c 'echo $Stéphane'
1

Now:

$ zsh --version
zsh 5.1.1 (x86_64-debian-linux-gnu)
$ env Stéphane=1 zsh -c 'echo $Stéphane'

$ env Stéphane=1 zsh -c 'Stéphane=2; export Stéphane; printenv Stéphane'
1


The change may have been intentional, but then why allow:

$ zsh -c 'Stéphane=2; echo $Stéphane'
2

(it looks like 5.0.2 had similar problems with a Stéphane env var in iso8859-1
locales).

-- 
Stephane


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ["regression"] Stéphane= 1 zsh -c 'echo $Stéphane'
  2015-10-06 11:04 ["regression"] Stéphane=1 zsh -c 'echo $Stéphane' Stephane Chazelas
@ 2015-10-06 15:44 ` Bart Schaefer
  2015-10-06 18:59   ` ZyX
  2015-10-07 13:15   ` Stephane Chazelas
  0 siblings, 2 replies; 5+ messages in thread
From: Bart Schaefer @ 2015-10-06 15:44 UTC (permalink / raw)
  To: Zsh hackers list

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.

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-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 18:59   ` ZyX
@ 2015-10-06 19:29     ` Stephane Chazelas
  0 siblings, 0 replies; 5+ messages in thread
From: Stephane Chazelas @ 2015-10-06 19:29 UTC (permalink / raw)
  To: ZyX; +Cc: Bart Schaefer, Zsh hackers list

2015-10-06 21:59:01 +0300, ZyX:
> 
> 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).
[...]

Also bash, but not for multi-byte characters.

-- 
Stephane


^ 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

end of thread, other threads:[~2015-10-07 13:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 11:04 ["regression"] Stéphane=1 zsh -c 'echo $Stéphane' Stephane Chazelas
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

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).