[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: inconsistent readonly error behavior
From: |
Chet Ramey |
Subject: |
Re: inconsistent readonly error behavior |
Date: |
Wed, 23 Dec 2020 09:58:49 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 |
On 12/21/20 11:28 PM, Travis Everett wrote:
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
This is what POSIX calls a variable assignment error in
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01
A non-interactive POSIX shell is required to exit, and bash running in
posix mode does so. Just about every other shell claiming POSIX conformance
does the same thing, except yash (?).
In default mode, bash jumps back to the top level and reads a new command,
aborting whatever command is currently executing, even if it's a compound
command.
--
``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/
- inconsistent readonly error behavior, Travis Everett, 2020/12/21
- Re: inconsistent readonly error behavior, Oğuz, 2020/12/22
- Re: inconsistent readonly error behavior, Travis Everett, 2020/12/22
- Re: inconsistent readonly error behavior, Oğuz, 2020/12/22
- Re: inconsistent readonly error behavior, Chet Ramey, 2020/12/23
- Re: inconsistent readonly error behavior, Travis Everett, 2020/12/23
- Re: inconsistent readonly error behavior, Chet Ramey, 2020/12/23
- Re: inconsistent readonly error behavior, Travis Everett, 2020/12/23
Re: inconsistent readonly error behavior,
Chet Ramey <=