Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ["regression"] Stéphane= 1 zsh -c 'echo $Stéphane'
- X-seq: zsh-workers 36810
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: ["regression"] Stéphane= 1 zsh -c 'echo $Stéphane'
- Date: Wed, 7 Oct 2015 14:15:23 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=URWrUE1kdybba26DMhXephV8Be66MbXo72DVLRCYqBM=; b=rkH96PYA5cRt91B3U4s+WGdDRlKt6JL4rYZZRkrUUhVTlmLtjTWOAUa2PJ8J2u8G7u tJfoL6OUFjGVjYJDTJaxzXM+uFZkmWJLY+7fcX0MYct2JmlJp92PyQCW3irN64R+0EvL fhdPTAcivJU+AugSEgAL/+uVpcIU9bAmfTUdLjG5dmJDUaDhWvy2RLE+wrXKJUGAUeUJ UDk/QT5tcHWtvGqht4OkRf3u2z6BFQYVuEGlR0o+sESE/yu2HBLC4R6lieqYWfzq5C/f 152rYgbPw9nhW6KuIXj0/6j8GrAzrIoxyt3gVg/ScJJTxP0E3ikdMKGb0MwOd9Oj4y59 7YvA==
- In-reply-to: <151006084416.ZM5546@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20151006110401.GA9868@chaz.gmail.com> <151006084416.ZM5546@torch.brasslantern.com>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author