Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: L A Walsh Newsgroups: gnu.bash.bug Subject: Re: temp setting POSIXLY_CORRECT turns alias expansion off Date: Tue, 21 Jan 2020 13:15:16 -0800 Lines: 69 Approved: bug-bash@gnu.org Message-ID: References: <8661277e-ae6e-3d24-ef36-55f8e94bb482@case.edu> <5E2769E4.4030005@tlinx.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1579641332 27979 209.51.188.17 (21 Jan 2020 21:15:32 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Martijn Dekker , bug-bash@gnu.org To: chet.ramey@case.edu Envelope-to: bug-bash@gnu.org User-Agent: Thunderbird In-Reply-To: <8661277e-ae6e-3d24-ef36-55f8e94bb482@case.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 173.164.175.65 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <5E2769E4.4030005@tlinx.org> X-Mailman-Original-References: <8661277e-ae6e-3d24-ef36-55f8e94bb482@case.edu> Xref: csiph.com gnu.bash.bug:15823 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.