[Bug 251770] /bin/sh: false expansion
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Tue Jan 5 19:10:48 UTC 2021
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251770
--- Comment #4 from Steffen (Daode) Nurpmeso <steffen at sdaoden.eu> ---
Sorry for being so late, i wanted to reread the standard text, maybe to open an
issue. But i think your last statement pretty much describes the situation.
(Whereas my initial report was only "from gut".)
3385 4.23 Variable Assignment
3386 In the shell command language, a word consisting of the
following parts:
3387 varname=value
3388 When used in a context where assignment is defined to occur
and at no other time, the value
3389 (representing a word or field) shall be assigned as the
value of the variable denoted by varname.
3390 Note: For further information, see XCU Section
2.9.1 (on page 2365).
---
75482 2.9.1 Simple Command
75495 4. Each variable assignment shall be expanded for
tilde expansion, parameter expansion,
75496 command substitution, arithmetic expansion, and
quote removal prior to assigning the
75497 value.
---
75501 Variable assignments shall be performed as follows:
75502 • If no command name results, variable assignments shall
affect the current execution
75503 environment.
---
So everything should be handled sequentially, making it a bug.
---
75504 • If the command name is not a special built-in utility or
function, the variable assignments
[.]
75507 4. In this case it is unspecified:
75508 — Whether or not the assignments are visible for
subsequent expansions in step 4
75509 — Whether variable assignments made as side-effects of
these expansions are visible for
75510 subsequent expansions in step 4, or in the current
shell execution environment, or
75511 both
---
So it allows to setup the "execution environment of the command" entirely from
the current environment, which is effectively read-only. As you say.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list