bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inconsistent readonly error behavior


From: Travis Everett
Subject: Re: inconsistent readonly error behavior
Date: Tue, 22 Dec 2020 11:21:38 -0600

I don't understand what distinction you're trying to make; any example you
can give?

I added an extra near-copy of the script to the gist replacing the
assignment with unset (
https://gist.github.com/abathur/8d18853e06f2a8cf3a97e45acda17f68#file-unset-sh-console),
and corresponding output where you can see that it hits all of the lines
skipped in the assignment example. (The behavior in this example is in line
with what I see by replacing the assignment with other errors like a
missing command, or a ${parameter:?word} expansion.)

On Mon, Dec 21, 2020 at 11:46 PM Oğuz <oguzismailuysal@gmail.com> wrote:

> On Tue, Dec 22, 2020 at 7:28 AM Travis Everett <travis.a.everett@gmail.com>
> wrote:
>
>> Configuration Information [Automatically generated, do not change]:
>> Machine: x86_64OS: darwin17.7.0
>> Compiler: clang
>> Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security
>> uname output: Darwin ecf1160e 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug
>> 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
>> Machine Type: x86_64-apple-darwin17.7.0
>> Bash Version: 5.
>> 0Patch Level: 18
>> Release Status: release
>>
>> Description:
>>     While trying to intentionally trap/ignore EXIT in a sourced script, I
>> noticed that I couldn't keep it from exiting when it tried to overwrite
>> PATH, which I had set to readonly. When I tried to minimize the repro
>> case,
>> I realized the behavior seems to differ between simple command and command
>> list contexts.
>>
>> Repeat-By:
>>
>>     readonly sigh=1
>>
>>     sigh=2
>>     : reached
>>
>>     sigh=2a; : skipped
>>     sigh=2b || : skipped
>>
>>     if true; then
>>         sigh=3
>>         : skipped
>>     fi
>
>
> I don't understand what is wrong here. Is there any shell that doesn't
> discard the current line or the lines that constitute a compound command
> when a shell error occurs?
>
>
>>     I also have a gist with a slightly longer example (and output from
>> bash, bash-sh, and osh:
>> https://gist.github.com/abathur/8d18853e06f2a8cf3a97e45acda17f68
>>
>> T
>>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]