Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11856 > unrolled thread
| Started by | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| First post | 2015-11-10 00:36 -0800 |
| Last post | 2015-12-19 21:12 -0500 |
| Articles | 3 — 2 participants |
Back to article view | Back to gnu.bash.bug
SIGINT in a sourced script does not clean up some special variables Grisha Levit <grishalevit@gmail.com> - 2015-11-10 00:36 -0800
Re: SIGINT in a sourced script does not clean up some special variables Chet Ramey <chet.ramey@case.edu> - 2015-11-10 10:34 -0500
Re: SIGINT in a sourced script does not clean up some special variables Chet Ramey <chet.ramey@case.edu> - 2015-12-19 21:12 -0500
| From | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| Date | 2015-11-10 00:36 -0800 |
| Subject | SIGINT in a sourced script does not clean up some special variables |
| Message-ID | <5abcfcd2-65a0-454a-a7fb-400759114d40@googlegroups.com> |
Apologies if I'm missing something about the expected SIGINT behavior. I've read through the previous SIGINT discussions but this still seems unexpected:
$ declare -p BASH_ARGC BASH_ARGV BASH_SOURCE BASH_LINENO
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_SOURCE=()
declare -a BASH_LINENO=()
$ source <(echo 'kill -INT $$')
$ declare -p BASH_ARGC BASH_ARGV BASH_SOURCE BASH_LINENO
declare -a BASH_ARGC=([0]="1")
declare -a BASH_ARGV=([0]="/dev/fd/63")
declare -a BASH_SOURCE=([0]="/dev/fd/63")
declare -a BASH_LINENO=([0]="5")
Additionally, FUNCNAME is not cleared in some cases:
$ declare -p FUNCNAME
declare -a FUNCNAME
$ source <(echo 'die() { kill -INT $$; }; die')
$ declare -p FUNCNAME
declare -a FUNCNAME
$ source <(echo 'die() { : && kill -INT $$; }; die')
$ declare -p FUNCNAME
declare -a FUNCNAME=([0]="source")
If the sourced script is running a foreground command then these values are returned back to their initial state after the shell receives a SIGINT -- so I suspect it's possible to do the same in the cases above.
[toc] | [next] | [standalone]
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Date | 2015-11-10 10:34 -0500 |
| Message-ID | <mailman.2064.1447169703.7904.bug-bash@gnu.org> |
| In reply to | #11856 |
On 11/10/15 3:36 AM, Grisha Levit wrote: > Apologies if I'm missing something about the expected SIGINT behavior. I've read through the previous SIGINT discussions but this still seems unexpected: Thanks for the report. I'll take a look. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
[toc] | [prev] | [next] | [standalone]
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Date | 2015-12-19 21:12 -0500 |
| Message-ID | <mailman.238.1450577549.843.bug-bash@gnu.org> |
| In reply to | #11856 |
On 11/10/15 3:36 AM, Grisha Levit wrote: > Apologies if I'm missing something about the expected SIGINT behavior. I've read through the previous SIGINT discussions but this still seems unexpected: > > $ declare -p BASH_ARGC BASH_ARGV BASH_SOURCE BASH_LINENO > declare -a BASH_ARGC=() > declare -a BASH_ARGV=() > declare -a BASH_SOURCE=() > declare -a BASH_LINENO=() > > $ source <(echo 'kill -INT $$') > > $ declare -p BASH_ARGC BASH_ARGV BASH_SOURCE BASH_LINENO > declare -a BASH_ARGC=([0]="1") > declare -a BASH_ARGV=([0]="/dev/fd/63") > declare -a BASH_SOURCE=([0]="/dev/fd/63") > declare -a BASH_LINENO=([0]="5") > > Additionally, FUNCNAME is not cleared in some cases: Thanks for the report. This will be fixed in the next release of bash. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
[toc] | [prev] | [standalone]
Back to top | Article view | gnu.bash.bug
csiph-web