Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15811
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Chet Ramey <chet.ramey@case.edu> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: temp setting POSIXLY_CORRECT turns alias expansion off |
| Date | Fri, 17 Jan 2020 09:49:37 -0500 |
| Lines | 73 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.2802.1579272590.1979.bug-bash@gnu.org> (permalink) |
| References | <e9ec694f-aba2-1143-aa93-182ec2f85b8d@inlv.org> <eed07b24-b75a-fbd0-ed44-39ca6dd9b47e@case.edu> <d19fd75e-4bef-3ab7-70a4-5740a0d8d239@inlv.org> <8661277e-ae6e-3d24-ef36-55f8e94bb482@case.edu> |
| Reply-To | chet.ramey@case.edu |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | usenet.stanford.edu 1579272590 29888 209.51.188.17 (17 Jan 2020 14:49:50 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | chet.ramey@case.edu |
| To | Martijn Dekker <martijn@inlv.org>, bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1579272583; bh=2AkPcX1C7M7Jkn7msL0PkmVmYq2dceN3wIj5v9pKXv8=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=YMHjin6ZRgtKIegl+BbZfmQo7o22BHkvW2deWZwaCCpFd7SL1NMuOYMS1NrCurOyQj NOQJ8EYUQtbJ/LjBlJbRhdDzrf+BNvdIVj5uHtKP8g1VBB49R0y1TGaleiqA0sL0/4f Prz3eR3rSa3CP6hkAbbPs/kVhR3umWEd99N2HArDjN3/dy+DbzHWohk9h7DFAbHzluP cdAvFQwKBlNGcjB0oyqdQwK7D64rn49CEB/EXMiHDZNF4b0CN4kY6v451jcaXAxkQeY L/ug1/5h/sYZTYSE1k36GNJRWbr8uC+xsVnsvIciwEEbxWqM9vZAVwMBsFV8Uhtm6+w bjC0HThw== |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1579272578; bh=G2EdX5T0WDh3yrl7J3RjfkysvzxaJM1MvZECAAAjEDA=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=RkzjF08LiWAn4PslYSaJ6OhOgd74GbDS0ByLw8AX9HSmSqrOjMZuoDTG5e8qiqaryS Kqx5M9vK7K1eMTbCmDD13/mg/eN7VPN7X3E2JX37JbM7GMNuGKYMwvM/J/yMSD7xcdp fIwlK/TW+e1zdV/Xcd4GBNXO1wbZ6lmi2IhSeru0Yzh90CgXorDSLrG+lV6tdPo94r3 A02EDrSZMRKaPX62/+NquDlCvzZLlEsSDfUYqvuVYNxJ05bU/WIh94OUEABwZxXYknd dOC2gClIe4vWlsS7QvxH445gfSlnc1h6k2OsOgep94FE+iAzEGUV0GYLgejjNxec05h r7RXkz1w== |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
| In-Reply-To | <d19fd75e-4bef-3ab7-70a4-5740a0d8d239@inlv.org> |
| Content-Language | en-US |
| X-Junkmail-Status | score=7/90, host=mpv4-2015.case.edu |
| X-Junkmail-PrAS-Raw | score=7/90, refid=2.7.2:2020.1.17.141518:17:7.944, ip=, rules=DKIM_SIGNATURE, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_MAILTO, __URI_WITH_PATH, __URI_NO_WWW, __CP_NAME_BODY, __HIGHBITS, __CP_URI_IN_BODY, __INVOICE_MULTILINGUAL, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __MAIL_CHAIN, __FORWARDED_MSG, __BODY_NO_MAILTO, __NO_HTML_TAG_RAW, BODY_SIZE_3000_3999, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] |
| X-Received-From | 129.22.103.195 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <8661277e-ae6e-3d24-ef36-55f8e94bb482@case.edu> |
| X-Mailman-Original-References | <e9ec694f-aba2-1143-aa93-182ec2f85b8d@inlv.org> <eed07b24-b75a-fbd0-ed44-39ca6dd9b47e@case.edu> <d19fd75e-4bef-3ab7-70a4-5740a0d8d239@inlv.org> |
| Xref | csiph.com gnu.bash.bug:15811 |
Show key headers only | View raw
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.
>
> 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.
> Another odd behaviour: 'unset POSIXLY_CORRECT' resets a default environment
> even if the variable was already unset. This is in all versions of bash.
>
> If you'll forgive my frankness, I think the whole notion of coupling a
> shell variable (POSIXLY_CORRECT) to a shell option (-o posix) is broken,
> because:
Hindsight provides perspective. While `set -o posix' might be the more
shell-like way to do it, the GNU coding standards specified
POSIXLY_CORRECT, and still do, though in a weaker way. When I unified the
POSIXLY_CORRECT handling into posix mode in 1993, I had to support it
alongside `set -o posix'. The shell is a special beast because it allows
you to set variables, not just inherit them, so it had supported setting
POSIXLY_CORRECT as equivalent to inheriting it in the initial environment,
and I carried that behavior forward.
This was probably around the time I first ran bash through the POISIX
conformance test suite, so there were more places to check for posix
conformance. It quickly became unwieldy.
>
> (Also, 4. this kills process substitution. You never responded to my patch
> last month, did you forget about it?)
No, it's still there in the list of things to look at. It's not a high
priority right now.
> So I think bash should only check at init time if POSIXLY_CORRECT exists in
> the environment and set -o posix if so (the same way it checks if it was
> invoked as sh).
The existing code didn't do that, since there were
`getenv("POSIXLY_CORRECT")' calls scattered around the source, and I didn't
want to break backwards compatibility.
(On most systems -- the NeXT being a notable exception -- bash redefined
getenv to look in the environment it passed to its children, so it picked
up exports to POSIXLY_CORRECT.)
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar
Re: temp setting POSIXLY_CORRECT turns alias expansion off Chet Ramey <chet.ramey@case.edu> - 2020-01-17 09:49 -0500
csiph-web