Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15823 > unrolled thread
| Started by | L A Walsh <bash@tlinx.org> |
|---|---|
| First post | 2020-01-21 13:15 -0800 |
| Last post | 2020-01-21 13:15 -0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: temp setting POSIXLY_CORRECT turns alias expansion off L A Walsh <bash@tlinx.org> - 2020-01-21 13:15 -0800
| From | L A Walsh <bash@tlinx.org> |
|---|---|
| Date | 2020-01-21 13:15 -0800 |
| Subject | Re: temp setting POSIXLY_CORRECT turns alias expansion off |
| Message-ID | <mailman.3170.1579641332.1979.bug-bash@gnu.org> |
On 2020/01/17 06:49, Chet Ramey wrote:
> On 1/16/20 2:05 PM, Martijn Dekker wrote:
>
>> Op 16-01-20 om 17:02 schreef Chet Ramey:
>>
>>> On 1/15/20 10:24 PM, Martijn Dekker wrote:
>>>
>>>> When alias expansion is enabled for a script in bash native mode,
>>>> prefixing POSIXLY_CORRECT=y to any command will turn alias expansion
>>>> globally off. This is a bug because the assignment should only have
>>>> effect on that command.
>>>>
>>> You're probably right, but it's an interesting question.
>>>
>>> The idea is that
>>>
>>> POSIXLY_CORRECT=y true
>>>
>>> is essentially equivalent (assuming POSIXLY_CORRECT is not already set) to
>>>
>>> POSIXLY_CORRECT=y ; true; unset POSIXLY_CORRECT
>>>
>>> and turning off posix mode resets a default environment.
>>>
That doesn't make sense. Why should it reset anything? There's no
requirement
to reset the environment when turning POSIX_CORRECTLY off.
>> I think it *should* be essentially equivalent to
>> (POSIXLY_CORRECT=y; true)
>> minus the actual forked subshell of course. But the state after the command
>> should be identical to the state before.
>>
>
> It gets into a larger question about variable setting and unsetting side
> effects. POSIXLY_CORRECT is not the only variable for which side effects
> occur.
>
----
Saying that this bug shouldn't be fixd because all such bugs aren't
not fixed at the same time, doesn't make sense.
Neither, really, does having the default shell settings disable
features that that
are standard in posix compatible shells. If someone turns on alias
expansion, having
it turned off with either Env vars being set (or unset), OR turning off
posix mode also
doesn't make sense. There is no standard requiring options explicitly
turned on to be
disabled when leaving POSIX mode. It seems the option explicitly
regulating a behavior
(in this case, alias expansion), should be given first attention if a
user has set or unset
that option.
By the same idea, if a user disables alias expansion, turning on
posix shouldn't override
the first setting. While it is true posix compatible shells should
support aliases, I don't
see that as not allowing them to be turned off.
Back to top | Article view | gnu.bash.bug
csiph-web